Add extraCommands option in autoUpgrade, add example for enable and ntfyUrlFile

This commit is contained in:
batteredbunny 2024-05-23 20:03:49 +03:00
parent 251fbfd070
commit 9f86e0d942

View file

@ -15,26 +15,35 @@
cd ${cfg.flake} cd ${cfg.flake}
git pull git pull
nix flake update --commit-lock-file nix flake update --commit-lock-file
${cfg.extraCommands}
git push git push
''; '';
}; };
in { in {
options.system.autoUpgrade = { options.system.autoUpgrade = {
# TODO: make sure flake is a local folder # TODO: make sure system.autoUpgrade.flake is a local folder
updateFlake = lib.mkOption { updateFlake = lib.mkOption {
default = false; default = false;
description = "Update lockfile of the flake."; 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 = { failureNotification = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
description = "Enable ntfy notification on upgrade failure."; description = "Enable ntfy notification on upgrade failure.";
example = true;
}; };
ntfyUrlFile = lib.mkOption { ntfyUrlFile = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
description = "Environment file containing NTFY_URL"; description = "Environment file containing NTFY_URL";
example = "/etc/secrets/failureNotification.env";
}; };
}; };
}; };