1 { flakes, 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 ];
18 group = users."git-daemon".name;
19 adminPubkey = builtins.readFile (flakes.secrets + "/members/ssh/julm.pub");
21 $RC{UMASK} = 0027; # NOTE: no quote around in Perl, so it's octal
22 $RC{LOG_DEST} = 'repo-log,syslog';
23 $RC{LOG_FACILITY} = 'local0';
24 #$RC{GIT_CONFIG_KEYS} = 'hooks.* gitweb.*';
25 $RC{GIT_CONFIG_KEYS} = '.*';
26 #$RC{LOCAL_CODE} = "$rc{GL_ADMIN_BASE}/local"
27 # if -d "$rc{GL_ADMIN_BASE}/local";
28 $RC{LOCAL_CODE} = "$ENV{HOME}/local";
29 push(@{$RC{ENABLE}}, ( 'Alias'
31 # NOTE: without this "cgit" option,
32 # the repositories' "description" files are not modified
34 , 'Shell ${gitolite-admin}'
36 , 'expand-deny-messages'
38 , 'keysubdirs-as-groups'
40 , (-d "$ENV{HOME}/local" ? 'repo-specific-hooks' : ())
41 , 'ssh-authkeys-split'
46 systemd.services.gitolite-init = {
48 # Allow git-daemon to enter ~git
49 chmod g+x "${gitolite.dataDir}"
50 install -D -d -o ${gitolite.user} -g ${gitolite.group} -m 750 \
51 ${gitolite.dataDir}/local \
52 ${gitolite.dataDir}/local/hooks \
53 ${gitolite.dataDir}/local/hooks/common \
54 ${gitolite.dataDir}/local/hooks/repo-specific
57 networking.nftables.ruleset = ''
58 add rule inet filter net2fw tcp dport 9418 counter accept comment "Git"
60 systemd.services.git-daemon = {
61 # NOTE: not using nixpkgs' gitDaemon, to avoid running it as root.
62 after = [ "network.target" ];
63 wantedBy = [ "multi-user.target" ];
65 User = users."git-daemon".name;
66 Group = groups."git-daemon".name;
70 script = "${pkgs.git}/bin/git daemon --verbose --reuseaddr"
71 + " --base-path=${gitolite.dataDir}/repositories"
72 #+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
73 #+ "--port=${toString cfg.port} "
76 users.users."git-daemon" = {
77 uid = config.ids.uids.git;
78 description = "Git daemon user";