1 {pkgs, lib, config, system, ...}:
2 let inherit (builtins.extraBuiltins) pass;
4 inherit (config) networking;
5 inherit (config.services) gitolite;
6 inherit (config.users) users groups;
7 gitolite-admin = "julm";
11 environment.systemPackages = [ pkgs.gitolite ];
12 # NOTE: make confortable to call gitolite from a shell
13 # (but mind the sudo -u git).
19 group = users."git-daemon".name;
20 adminPubkey = pass "${networking.domainBase}/ssh/pub/${gitolite-admin}";
22 $RC{UMASK} = 0027; # NOTE: no quote around in Perl, so it's octal
23 $RC{LOG_DEST} = 'repo-log,syslog';
24 $RC{LOG_FACILITY} = 'local0';
25 #$RC{GIT_CONFIG_KEYS} = 'hooks.* gitweb.*';
26 $RC{GIT_CONFIG_KEYS} = '.*';
27 #$RC{LOCAL_CODE} = "$rc{GL_ADMIN_BASE}/local"
28 # if -d "$rc{GL_ADMIN_BASE}/local";
29 $RC{LOCAL_CODE} = "$ENV{HOME}/local";
30 push(@{$RC{ENABLE}}, ( 'Alias'
33 , 'Shell ${gitolite-admin}'
35 , 'expand-deny-messages'
37 , 'keysubdirs-as-groups'
39 , (-d "$ENV{HOME}/local" ? 'repo-specific-hooks' : ())
40 , 'ssh-authkeys-split'
45 systemd.services.gitolite-init = {
47 chmod g+x "${gitolite.dataDir}"
48 # NOTE: allow git-daemon to enter ~git
49 install -D -d -o ${gitolite.user} -g ${gitolite.group} -m 750 \
50 ${gitolite.dataDir}/local \
51 ${gitolite.dataDir}/local/hooks \
52 ${gitolite.dataDir}/local/hooks/common \
53 ${gitolite.dataDir}/local/hooks/repo-specific
56 systemd.services.git-daemon = {
57 # NOTE: not using nixpkgs' gitDaemon, to avoid running it as root.
58 after = [ "network.target" ];
59 wantedBy = [ "multi-user.target" ];
61 User = users."git-daemon".name;
62 Group = groups."git-daemon".name;
66 script = "${pkgs.git}/bin/git daemon --verbose --reuseaddr"
67 + " --base-path=${gitolite.dataDir}/repositories"
68 #+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
69 #+ "--port=${toString cfg.port} "
72 users.users = lib.singleton
73 { name = "git-daemon";
74 uid = config.ids.uids.git;
75 description = "Git daemon user";