From: Scott Worley Date: Sat, 30 May 2020 18:34:38 +0000 (-0700) Subject: Separate pull-updates snippet X-Git-Url: http://git.scottworley.com/auto-upgrade-with-pinch/commitdiff_plain/9dbfef330f23b81081a08f0c2f52c31393943340?ds=sidebyside Separate pull-updates snippet --- diff --git a/modules/auto-upgrade.nix b/modules/auto-upgrade.nix index aabb0e2..d30a624 100644 --- a/modules/auto-upgrade.nix +++ b/modules/auto-upgrade.nix @@ -2,6 +2,15 @@ with lib; let cfg = config.system.autoUpgradeWithPinch; + pull-repo-snippet = '' + ( + cd /etc/nixos + ${pkgs.git}/bin/git fetch + PATH="${pkgs.keyedgit cfg.keys}/bin:$PATH" \ + ${pkgs.polite-merge}/bin/polite-merge --ff-only --verify-signatures + ) + ''; + auto-upgrade-script = pkgs.writeShellScript "auto-upgrade" '' ${pkgs.utillinux}/bin/flock /run/auto-upgrade-with-pinch ${ pkgs.writeShellScript "auto-upgrade-with-lock-held" '' @@ -25,12 +34,8 @@ let } } - # Fetch updates - ( - cd /etc/nixos - ${pkgs.git}/bin/git fetch - PATH="${pkgs.keyedgit cfg.keys}/bin:$PATH" ${pkgs.polite-merge}/bin/polite-merge --ff-only --verify-signatures - ) + # Pull updates + ${pull-repo-snippet} # Update channels ${pkgs.pinch}/bin/pinch update /etc/nixos/channels