diff options
Diffstat (limited to 'colmena/cobalt/services/gitolite.nix')
-rw-r--r-- | colmena/cobalt/services/gitolite.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/colmena/cobalt/services/gitolite.nix b/colmena/cobalt/services/gitolite.nix index 459a80e..af4c88a 100644 --- a/colmena/cobalt/services/gitolite.nix +++ b/colmena/cobalt/services/gitolite.nix @@ -1,5 +1,19 @@ { pkgs, ... }: +let + # https://groups.google.com/g/gitolite/c/NwZ1-hq9-9E/m/mDbiKyAvDwAJ + fixRefsTrigger = pkgs.writeText "fix-refs" '' + [[ $4 == W ]] || exit 0 + + cd $GL_REPO_BASE/$2.git + + head=`git symbolic-ref HEAD` + [[ -f $head ]] || { + set -- refs/heads/* + git symbolic-ref HEAD $1 + } + ''; +in { services.gitolite = { enable = true; @@ -11,7 +25,12 @@ $RC{GIT_CONFIG_KEYS} = '.*'; $RC{ROLES}{OWNERS} = 1; $RC{OWNER_ROLENAME} = 'OWNERS'; + # For some unknown reason, $ENV{HOME} doesn't get resolved to the correct + # directory. + # $RC{LOCAL_CODE} = '$ENV{HOME}/local'; + $RC{LOCAL_CODE} = '/var/lib/gitolite/local'; push(@{$RC{ENABLE}}, 'D'); + push(@{$RC{POST_GIT}}, 'fix-refs'); # push(@{$RC{ENABLE}}, 'set-default-roles'); # push(@{$RC{ENABLE}}, 'create'); # push(@{$RC{ENABLE}}, 'fork'); @@ -23,6 +42,10 @@ "/var/lib/gitolite" ]; + systemd.tmpfiles.rules = [ + "C /var/lib/gitolite/local/triggers/fix-refs 755 git git - ${fixRefsTrigger}" + ]; + systemd.timers."gitolite-trash-cleanup" = { wantedBy = [ "timers.target" ]; |