From 94e7b5667ca7b4c38b73f1dcce20c714cfe8981d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 13 Mar 2025 14:48:48 +0100 Subject: colmena: support running arbitrary commands before updating --- system/settings/colmena-auto-upgrade.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'system/settings') diff --git a/system/settings/colmena-auto-upgrade.nix b/system/settings/colmena-auto-upgrade.nix index 98168401..b9b84e88 100644 --- a/system/settings/colmena-auto-upgrade.nix +++ b/system/settings/colmena-auto-upgrade.nix @@ -77,6 +77,15 @@ in }; }; + preUpgradeHook = lib.mkOption { + type = lib.types.str; + default = ""; + description = "Commands to run before upgrade"; + example = lib.literalExpression '' + $${pkgs.npins}/bin/npins update + ''; + }; + useNixShell = lib.mkOption { default = false; type = lib.types.bool; @@ -221,6 +230,9 @@ in ${git} checkout ${cfg.git.branch} '' } + + ${cfg.preUpgradeHook} + ${if cfg.useNixShell then '' ${nix-shell} --run "${pkgs.writeShellScript "colmena-auto-upgrade" mainScript}" '' -- cgit 1.4.1