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)
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 "Running the script with no parameters performs the following operations:"
echo " 1. Pull the latest version of the config"
echo " 2. Update your flake.lock file"
echo " 3. Commit any changes back to the repository"
echo " 4. Run 'nixos-rebuild switch'."
echo " 1. Pull the latest version of your Nix config repository"
echo " 2. Run 'nixos-rebuild switch'."
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 " -h, --help Show this help screen."
echo " -o, --operation The nixos-rebuild operation to perform."

View file

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

View file

@ -54,7 +54,7 @@ in
];
# Deploy update script
aux.system.nixos-upgrade-script.enable = true;
aux.system.nixos-operations-script.enable = true;
# Pull and apply updates.
systemd = {
@ -66,7 +66,7 @@ in
path = config.aux.system.corePackages;
unitConfig.RequiresMountsFor = cfg.configDir;
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.user != "") "--user ${cfg.user} ").content
(lib.mkIf (cfg.pushUpdates) "--update ").content

View file

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

View file

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

View file

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