From 9dbfef330f23b81081a08f0c2f52c31393943340 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Sat, 30 May 2020 11:34:38 -0700 Subject: [PATCH] Separate pull-updates snippet --- modules/auto-upgrade.nix | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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 -- 2.44.1