Some weeks ago, I installed Monotone on my main machine to act as a dedicated server for Vigipac's source code. During the process, I had to write a rc.d script and configure multiple things to get everything working safely. The overall process is not difficult once you know how Monotone works, but it is quite time consuming and error prone (due to concrete file permissions, for example). So I thought I could share my work to make this process easier to other people and love pkgsrc even more ;-)
A simple way to achieve this could have been to include the rc.d script in the Monotone package, alongside a user and a group, using the marvelous bsd.pkg.install.mk framework. However, if I had gone this route, users of Monotone who only want it as a client would have an extra, useless user/group pair in their system. This is wrong, IMHO.
So the other possible approach was to create a new package that provided all the needed bits to make the configuration of a dedicated server as painless as possible. And this is what I've done. The package is named, for obvious reasons, monotone-server, and is found in pkgsrc's devel category.
Basically, all it does is install a rc.d script, register a user/group pair (monotone:monotone) to run the server as and provide a home-grown script (monotone-server-init) to initialize the database. Furthermore, it installs a template file containing the required hooks to authenticate clients against branches and also provides a mechanism to easily define the set of branches (collections) to share (through an "invented" branches.conf file).
What does the monotone-server-init script do, you say? Well, it asks you where the database should be created (which defaults to /var/monotone/monotone.db), creates it, generates a key pair to access the server and tells you what to do to end the configuration. All in an interactive and self-explanatory process.
Hope it's useful to someone :-)