diff options
author | sefidel <contact@sefidel.net> | 2023-02-05 12:40:52 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2023-02-05 12:40:52 +0900 |
commit | 1c471fc1847e0da278f0aa4957867f75f40cb1a9 (patch) | |
tree | c2c141878a5e931b7fd490428ed192990a862fbf /colmena/cobalt/services | |
parent | 4a2af09922ca67b0c0b4691cb8b407c017aa97a9 (diff) | |
download | nixrc-1c471fc1847e0da278f0aa4957867f75f40cb1a9.tar.gz nixrc-1c471fc1847e0da278f0aa4957867f75f40cb1a9.zip |
feat(colmena/services): gitolite: add POST_GIT - fix-refs trigger
https://groups.google.com/g/gitolite/c/NwZ1-hq9-9E
Diffstat (limited to 'colmena/cobalt/services')
-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" ]; |