1# SVN server
2{
3 config,
4 lib,
5 pkgs,
6 ...
7}:
8let
9
10 cfg = config.services.svnserve;
11
12in
13
14{
15
16 ###### interface
17
18 options = {
19
20 services.svnserve = {
21
22 enable = lib.mkOption {
23 type = lib.types.bool;
24 default = false;
25 description = "Whether to enable svnserve to serve Subversion repositories through the SVN protocol.";
26 };
27
28 svnBaseDir = lib.mkOption {
29 type = lib.types.str;
30 default = "/repos";
31 description = "Base directory from which Subversion repositories are accessed.";
32 };
33 };
34
35 };
36
37 ###### implementation
38
39 config = lib.mkIf cfg.enable {
40 systemd.services.svnserve = {
41 after = [ "network.target" ];
42 wantedBy = [ "multi-user.target" ];
43 preStart = "mkdir -p ${cfg.svnBaseDir}";
44 script = "${pkgs.subversion.out}/bin/svnserve -r ${cfg.svnBaseDir} -d --foreground --pid-file=/run/svnserve.pid";
45 };
46 };
47}