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