1 { inputs, pkgs, lib, config, ... }:
4 inherit (config) networking;
5 inherit (config.services) gitolite;
6 inherit (config.users) users groups;
7 gitolite-admin = "julm";
10 # Make confortable to call gitolite from a shell
11 # (but mind to prefix it by sudo -u git)
12 environment.systemPackages = [ pkgs.gitolite ];
17 group = users."git-daemon".name;
18 adminPubkey = builtins.readFile (inputs.secrets + "/members/ssh/julm.pub");
20 $RC{UMASK} = 0027; # NOTE: no quote around in Perl, so it's octal
21 $RC{LOG_DEST} = 'repo-log,syslog';
22 $RC{LOG_FACILITY} = 'local0';
23 #$RC{GIT_CONFIG_KEYS} = 'hooks.* gitweb.*';
24 $RC{GIT_CONFIG_KEYS} = '.*';
25 #$RC{LOCAL_CODE} = "$rc{GL_ADMIN_BASE}/local"
26 # if -d "$rc{GL_ADMIN_BASE}/local";
27 $RC{LOCAL_CODE} = "$ENV{HOME}/local";
28 push(@{$RC{ENABLE}}, ( 'Alias'
30 # NOTE: without this "cgit" option,
31 # the repositories' "description" files are not modified
33 , 'Shell ${gitolite-admin}'
35 , 'expand-deny-messages'
37 , 'keysubdirs-as-groups'
39 , (-d "$ENV{HOME}/local" ? 'repo-specific-hooks' : ())
40 , 'ssh-authkeys-split'
44 systemd.services.gitolite-init = {
46 # Allow git-daemon to enter ~git
47 chmod g+x "${gitolite.dataDir}"
48 install -D -d -o ${gitolite.user} -g ${gitolite.group} -m 750 \
49 ${gitolite.dataDir}/local \
50 ${gitolite.dataDir}/local/hooks \
51 ${gitolite.dataDir}/local/hooks/common \
52 ${gitolite.dataDir}/local/hooks/repo-specific
55 networking.nftables.ruleset = ''
56 add rule inet filter net2fw tcp dport 9418 counter accept comment "Git"
58 systemd.services.git-daemon = {
59 # NOTE: not using nixpkgs' gitDaemon, to avoid running it as root.
60 after = [ "network.target" ];
61 wantedBy = [ "multi-user.target" ];
63 User = users."git-daemon".name;
64 Group = groups."git-daemon".name;
68 script = "${pkgs.git}/bin/git daemon --verbose --reuseaddr"
69 + " --base-path=${gitolite.dataDir}/repositories"
70 #+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
71 #+ "--port=${toString cfg.port} "
74 users.users."git-daemon" = {
75 uid = config.ids.uids.git;
76 description = "Git daemon user";
78 fileSystems."/var/lib/gitolite" = {
79 device = "rpool/var/git";