From 9f86e0d942775cd97976c57bce39d41e56964837 Mon Sep 17 00:00:00 2001 From: batteredbunny Date: Thu, 23 May 2024 20:03:49 +0300 Subject: [PATCH] Add extraCommands option in autoUpgrade, add example for enable and ntfyUrlFile --- modules/nixos-upgrade.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/nixos-upgrade.nix b/modules/nixos-upgrade.nix index 4a8f5db..79c8a40 100644 --- a/modules/nixos-upgrade.nix +++ b/modules/nixos-upgrade.nix @@ -15,26 +15,35 @@ cd ${cfg.flake} git pull nix flake update --commit-lock-file + ${cfg.extraCommands} git push ''; }; in { options.system.autoUpgrade = { - # TODO: make sure flake is a local folder + # TODO: make sure system.autoUpgrade.flake is a local folder updateFlake = lib.mkOption { default = false; description = "Update lockfile of the flake."; + example = true; + }; + + extraCommands = lib.mkOption { + type = lib.types.nullOr lib.types.str; + description = "Extra commands to run during upgrade"; }; failureNotification = { enable = lib.mkOption { default = false; description = "Enable ntfy notification on upgrade failure."; + example = true; }; ntfyUrlFile = lib.mkOption { type = lib.types.nullOr lib.types.path; description = "Environment file containing NTFY_URL"; + example = "/etc/secrets/failureNotification.env"; }; }; };