hydra: improve updater

This commit is contained in:
Astro 2022-01-10 02:35:49 +01:00
parent f6ea1f0332
commit d678c69d23

View File

@ -13,23 +13,22 @@
"d ${config.users.users.updater.home} 0700 updater ${config.users.users.updater.group} -" "d ${config.users.users.updater.home} 0700 updater ${config.users.users.updater.group} -"
]; ];
# Build script # Timer-triggered service that updates flake.lock and pushes to a
# branch to be picked up by Hydra.
systemd.services.updater = { systemd.services.updater = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = with pkgs; [ git nixFlakes curl ]; path = with pkgs; [ git nixFlakes curl ];
script = '' script = ''
git config --global user.email "astro@spaceboyz.net"
git config --global user.name "Astrobot"
TEMP=$(mktemp -d) TEMP=$(mktemp -d)
cd $TEMP cd $TEMP
git clone --depth=1 --single-branch gitea@gitea.c3d2.de:C3D2/nix-config.git git clone --depth=1 --single-branch gitea@gitea.c3d2.de:C3D2/nix-config.git
cd nix-config cd nix-config
nix flake update nix flake update --commit-lock-file
git config user.email "astro@spaceboyz.net"
git config user.name "Astrobot"
git add flake.lock
git commit -m "flake.lock: update"
git push -f origin HEAD:flake-update git push -f origin HEAD:flake-update
''; '';
serviceConfig = { serviceConfig = {