nixos/gitea: use gitea to refresh hooks and keys

Gitea now provides this functionality as an admin command.
Is significantly faster, especially on slow disks.

(cherry picked from commit c854b8570285ac4c14282a5efa0f8334a520ac8d)
This commit is contained in:
Zane van Iperen 2021-07-11 12:48:10 +10:00 committed by Raphael Megzari
parent 84b0bedef2
commit 9d0618433a

View File

@ -523,19 +523,12 @@ in
''} ''}
# update all hooks' binary paths # update all hooks' binary paths
HOOKS=$(find ${cfg.repositoryRoot} -mindepth 4 -maxdepth 6 -type f -wholename "*git/hooks/*") ${gitea}/bin/gitea admin regenerate hooks
if [ "$HOOKS" ]
then
sed -ri 's,/nix/store/[a-z0-9.-]+/bin/gitea,${gitea}/bin/gitea,g' $HOOKS
sed -ri 's,/nix/store/[a-z0-9.-]+/bin/env,${pkgs.coreutils}/bin/env,g' $HOOKS
sed -ri 's,/nix/store/[a-z0-9.-]+/bin/bash,${pkgs.bash}/bin/bash,g' $HOOKS
sed -ri 's,/nix/store/[a-z0-9.-]+/bin/perl,${pkgs.perl}/bin/perl,g' $HOOKS
fi
# update command option in authorized_keys # update command option in authorized_keys
if [ -r ${cfg.stateDir}/.ssh/authorized_keys ] if [ -r ${cfg.stateDir}/.ssh/authorized_keys ]
then then
sed -ri 's,/nix/store/[a-z0-9.-]+/bin/gitea,${gitea}/bin/gitea,g' ${cfg.stateDir}/.ssh/authorized_keys ${gitea}/bin/gitea admin regenerate keys
fi fi
''; '';