From ded3ac5dff9c51fff90c5dffb111894e318ea3e3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 13 Mar 2025 14:39:12 +0100 Subject: linde/colmena: enable configuration of checked out branch --- system/settings/colmena-auto-upgrade.nix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'system/settings/colmena-auto-upgrade.nix') diff --git a/system/settings/colmena-auto-upgrade.nix b/system/settings/colmena-auto-upgrade.nix index add141b6..98168401 100644 --- a/system/settings/colmena-auto-upgrade.nix +++ b/system/settings/colmena-auto-upgrade.nix @@ -63,12 +63,18 @@ in description = "Enable automatic upgrades for Colmena"; }; - pullGit = lib.mkOption { - default = false; - type = lib.types.bool; - description = '' - Whether to pull the latest changes from the Git repository before upgrading. - ''; + git = lib.mkOption { + type = lib.types.submodule { + options = { + enable = lib.mkEnableOption "Whether to pull the latest changes from the Git repository before upgrading."; + + branch = lib.mkOption { + type = lib.types.str; + default = "origin/main"; + description = "Git branch to checkout after fetching"; + }; + }; + }; }; useNixShell = lib.mkOption { @@ -209,10 +215,10 @@ in nix-shell = "${pkgs.nix}/bin/nix-shell"; in '' - ${lib.optionalString cfg.pullGit + ${lib.optionalString cfg.git.enable '' - ${git} fetch --all --prune - ${git} checkout FETCH_HEAD + ${git} fetch --prune + ${git} checkout ${cfg.git.branch} '' } ${if cfg.useNixShell then '' -- cgit 1.4.1