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 = ''
58 tcp dport git counter accept comment "git-daemon: Git"
62 systemd.services.git-daemon = {
63 # NOTE: not using nixpkgs' gitDaemon, to avoid running it as root.
64 after = [ "network.target" ];
65 wantedBy = [ "multi-user.target" ];
67 User = users."git-daemon".name;
68 Group = groups."git-daemon".name;
72 script = "${pkgs.git}/bin/git daemon --verbose --reuseaddr"
73 + " --base-path=${gitolite.dataDir}/repositories"
74 #+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
75 #+ "--port=${toString cfg.port} "
78 users.users."git-daemon" = {
79 uid = config.ids.uids.git;
80 description = "Git daemon user";
81 group = groups."git-daemon".name;
83 fileSystems."/var/lib/gitolite" = {
84 device = "rpool/var/git";
87 services.sanoid.datasets."rpool/var/git" = {
88 use_template = [ "snap" ];