1 { pkgs, lib, config, ... }:
3 inherit (builtins) readFile;
4 inherit (builtins.extraBuiltins) pass;
6 inherit (config) networking;
7 inherit (config.services) gitolite;
8 inherit (config.users) users groups;
9 gitolite-admin = "julm";
12 # Make confortable to call gitolite from a shell
13 # (but mind to prefix it by sudo -u git)
14 environment.systemPackages = [ pkgs.gitolite ];
20 group = users."git-daemon".name;
21 adminPubkey = (readFile ../../../sec/ssh/julm.pub);
23 $RC{UMASK} = 0027; # NOTE: no quote around in Perl, so it's octal
24 $RC{LOG_DEST} = 'repo-log,syslog';
25 $RC{LOG_FACILITY} = 'local0';
26 #$RC{GIT_CONFIG_KEYS} = 'hooks.* gitweb.*';
27 $RC{GIT_CONFIG_KEYS} = '.*';
28 #$RC{LOCAL_CODE} = "$rc{GL_ADMIN_BASE}/local"
29 # if -d "$rc{GL_ADMIN_BASE}/local";
30 $RC{LOCAL_CODE} = "$ENV{HOME}/local";
31 push(@{$RC{ENABLE}}, ( 'Alias'
33 # NOTE: without this "cgit" option,
34 # the repositories' "description" files are not modified
36 , 'Shell ${gitolite-admin}'
38 , 'expand-deny-messages'
40 , 'keysubdirs-as-groups'
42 , (-d "$ENV{HOME}/local" ? 'repo-specific-hooks' : ())
43 , 'ssh-authkeys-split'
48 systemd.services.gitolite-init = {
50 # Allow git-daemon to enter ~git
51 chmod g+x "${gitolite.dataDir}"
52 install -D -d -o ${gitolite.user} -g ${gitolite.group} -m 750 \
53 ${gitolite.dataDir}/local \
54 ${gitolite.dataDir}/local/hooks \
55 ${gitolite.dataDir}/local/hooks/common \
56 ${gitolite.dataDir}/local/hooks/repo-specific
59 systemd.services.git-daemon = {
60 # NOTE: not using nixpkgs' gitDaemon, to avoid running it as root.
61 after = [ "network.target" ];
62 wantedBy = [ "multi-user.target" ];
64 User = users."git-daemon".name;
65 Group = groups."git-daemon".name;
69 script = "${pkgs.git}/bin/git daemon --verbose --reuseaddr"
70 + " --base-path=${gitolite.dataDir}/repositories"
71 #+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
72 #+ "--port=${toString cfg.port} "
75 users.users."git-daemon" = {
76 uid = config.ids.uids.git;
77 description = "Git daemon user";