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;
|
type = lib.types.bool;
|
||||||
description = "Enables automatic system updates.";
|
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 {
|
configDir = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Path where your NixOS configuration files are stored.";
|
description = "Path where your NixOS configuration files are stored.";
|
||||||
|
@ -70,7 +79,7 @@ in
|
||||||
# Check if there are changes from Git.
|
# Check if there are changes from Git.
|
||||||
echo "Pulling latest version..."
|
echo "Pulling latest version..."
|
||||||
sudo -u ${cfg.user} git fetch
|
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 we have changes (git diff returns 1), pull changes and run the update
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
echo "Updates found, running nixos-rebuild..."
|
echo "Updates found, running nixos-rebuild..."
|
||||||
|
|
|
@ -8,7 +8,7 @@ in
|
||||||
host.services.ssh = {
|
host.services.ssh = {
|
||||||
enable = lib.mkEnableOption (lib.mdDoc "Enables SSH server.");
|
enable = lib.mkEnableOption (lib.mdDoc "Enables SSH server.");
|
||||||
ports = lib.mkOption {
|
ports = lib.mkOption {
|
||||||
default = [ ];
|
default = [ 22 ];
|
||||||
type = lib.types.listOf lib.types.int;
|
type = lib.types.listOf lib.types.int;
|
||||||
description = "Ports for SSH to listen on.";
|
description = "Ports for SSH to listen on.";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue