1
0
Fork 0

General: rename nixos-upgrade-script to nixos-operations-script

This commit is contained in:
Aires 2024-10-06 12:13:36 -04:00
parent d829d8b67e
commit e59a0c1735
6 changed files with 19 additions and 17 deletions

View file

@ -10,15 +10,13 @@ user=$(/run/current-system/sw/bin/whoami) # Which user account to use for
remainingArgs="" # All remaining arguments that haven't yet been processed (will be passed to nixos-rebuild) remainingArgs="" # All remaining arguments that haven't yet been processed (will be passed to nixos-rebuild)
function usage() { function usage() {
echo "nixos-rebuild Operations Script (NOS) updates your system and your flake.lock file by pulling the latest versions." echo "The NixOS Operations Script (NOS) is a nixos-rebuild wrapper for system maintenance."
echo "" echo ""
echo "Running the script with no parameters performs the following operations:" echo "Running the script with no parameters performs the following operations:"
echo " 1. Pull the latest version of the config" echo " 1. Pull the latest version of your Nix config repository"
echo " 2. Update your flake.lock file" echo " 2. Run 'nixos-rebuild switch'."
echo " 3. Commit any changes back to the repository"
echo " 4. Run 'nixos-rebuild switch'."
echo "" echo ""
echo "Advanced usage: nixos-upgrade-script.sh [-o|--operation operation] [-f|--flake path-to-flake] [extra nixos-rebuild parameters]" echo "Advanced usage: nixos-operations-script.sh [-o|--operation operation] [-f|--flake path-to-flake] [extra nixos-rebuild parameters]"
echo "Options:" echo "Options:"
echo " -h, --help Show this help screen." echo " -h, --help Show this help screen."
echo " -o, --operation The nixos-rebuild operation to perform." echo " -o, --operation The nixos-rebuild operation to perform."

View file

@ -18,7 +18,7 @@
]; ];
# Install the nos helper script # Install the nos helper script
aux.system.nixos-upgrade-script.enable = true; aux.system.nixos-operations-script.enable = true;
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: _prev: { (final: _prev: {

View file

@ -54,7 +54,7 @@ in
]; ];
# Deploy update script # Deploy update script
aux.system.nixos-upgrade-script.enable = true; aux.system.nixos-operations-script.enable = true;
# Pull and apply updates. # Pull and apply updates.
systemd = { systemd = {
@ -66,7 +66,7 @@ in
path = config.aux.system.corePackages; path = config.aux.system.corePackages;
unitConfig.RequiresMountsFor = cfg.configDir; unitConfig.RequiresMountsFor = cfg.configDir;
script = lib.strings.concatStrings [ script = lib.strings.concatStrings [
"/run/current-system/sw/bin/nixos-upgrade-script --operation ${cfg.operation} " "/run/current-system/sw/bin/nixos-operations-script --operation ${cfg.operation} "
(lib.mkIf (cfg.configDir != "") "--flake ${cfg.configDir} ").content (lib.mkIf (cfg.configDir != "") "--flake ${cfg.configDir} ").content
(lib.mkIf (cfg.user != "") "--user ${cfg.user} ").content (lib.mkIf (cfg.user != "") "--user ${cfg.user} ").content
(lib.mkIf (cfg.pushUpdates) "--update ").content (lib.mkIf (cfg.pushUpdates) "--update ").content

View file

@ -10,8 +10,8 @@
let let
cfg = config.aux.system; cfg = config.aux.system;
nixos-upgrade-script = pkgs.writeShellScriptBin "nixos-upgrade-script" ( nixos-operations-script = pkgs.writeShellScriptBin "nixos-operations-script" (
builtins.readFile ../../bin/nixos-upgrade-script.sh builtins.readFile ../../bin/nixos-operations-script.sh
); );
in in
{ {
@ -23,7 +23,7 @@ in
type = lib.types.str; type = lib.types.str;
default = "monthly"; default = "monthly";
}; };
nixos-upgrade-script.enable = lib.mkEnableOption "Installs the nos (nixos-upgrade-script) helper script."; nixos-operations-script.enable = lib.mkEnableOption "Installs the nos (nixos-operations-script) helper script.";
}; };
}; };
config = lib.mkMerge [ config = lib.mkMerge [
@ -79,9 +79,9 @@ in
# Support for standard, dynamically-linked executables # Support for standard, dynamically-linked executables
programs.nix-ld.enable = true; programs.nix-ld.enable = true;
} }
(lib.mkIf cfg.nixos-upgrade-script.enable { (lib.mkIf cfg.nixos-operations-script.enable {
# Enable and configure NOS # Enable and configure NOS
aux.system.packages = [ nixos-upgrade-script ]; aux.system.packages = [ nixos-operations-script ];
environment.variables."FLAKE_DIR" = config.secrets.nixConfigFolder; environment.variables."FLAKE_DIR" = config.secrets.nixConfigFolder;
}) })
]; ];

View file

@ -94,7 +94,7 @@ in
theme = "gentoo"; theme = "gentoo";
}; };
shellAliases = { shellAliases = {
nos = "nixos-upgrade-script"; nos = "nixos-operations-script";
z = "zellij"; z = "zellij";
update = "upgrade"; update = "upgrade";
upgrade = "nos"; upgrade = "nos";

View file

@ -5,12 +5,16 @@
imports = [ ../common/home-manager/git-crypt.nix ]; imports = [ ../common/home-manager/git-crypt.nix ];
home.stateVersion = "24.05"; home.stateVersion = "24.05";
programs = { programs = {
git.extraConfig = {
safe.directory = "${config.secrets.nixConfigFolder}/.git";
};
ssh = { ssh = {
enable = true; enable = true;
matchBlocks = config.secrets.users.root.sshConfig; matchBlocks = config.secrets.users.root.sshConfig;
}; };
git.extraConfig = { zsh = {
safe.directory = "${config.secrets.nixConfigFolder}/.git"; oh-my-zsh.theme = "kardan";
shellAliases.nos = "nixos-operations-script";
}; };
}; };
}; };