Add branch name option to nixos-upgrade with defaults to main
This commit is contained in:
parent
cc4ae56ea3
commit
ca40bc1151
|
@ -31,6 +31,15 @@ in
|
|||
type = lib.types.bool;
|
||||
description = "Enables automatic system updates.";
|
||||
};
|
||||
branches = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
description = "Which local and remote branches to compare.";
|
||||
default = {
|
||||
local = "main";
|
||||
remote = "main";
|
||||
remoteName = "origin";
|
||||
};
|
||||
};
|
||||
configDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Path where your NixOS configuration files are stored.";
|
||||
|
@ -70,7 +79,7 @@ in
|
|||
# Check if there are changes from Git.
|
||||
echo "Pulling latest version..."
|
||||
sudo -u ${cfg.user} git fetch
|
||||
sudo -u ${cfg.user} git diff --quiet --exit-code || true
|
||||
sudo -u ${cfg.user} git diff --quiet --exit-code ${cfg.branches.local} ${cfg.branches.remoteName}/${cfg.branches.remote} || true
|
||||
# If we have changes (git diff returns 1), pull changes and run the update
|
||||
if [ $? -eq 1 ]; then
|
||||
echo "Updates found, running nixos-rebuild..."
|
||||
|
|
|
@ -8,7 +8,7 @@ in
|
|||
host.services.ssh = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "Enables SSH server.");
|
||||
ports = lib.mkOption {
|
||||
default = [ ];
|
||||
default = [ 22 ];
|
||||
type = lib.types.listOf lib.types.int;
|
||||
description = "Ports for SSH to listen on.";
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue