Nix : Add switch function.

This commit is contained in:
Dmitry Voronin 2024-02-03 00:04:38 +03:00
parent 3a389c0c75
commit 278ddca61c
2 changed files with 13 additions and 0 deletions

View file

@ -46,6 +46,18 @@ function nix_rebuild() {
cd -
}
# Rebuild and switch system.
# Optionally force the hostname.
# Usage: nix_switch [HOSTNAME]
function nix_switch() {
local target="${1}"
[[ "${target}" = "" ]] && target="${HOSTNAME}"
cd ${HOME}/.config/linux/system
nixos-rebuild switch --flake .#${target}
cd -
}
# Update system.
# Optionally force the hostname.
# Usage: nix_update [HOSTNAME]

View file

@ -270,6 +270,7 @@ Command|Description
`nix_unstable`|Switch to Unstable branch.
`nix_channel`|Display current channel.
`nix_rebuild [HOSTNAME]`|Rebuild system. Optionally force the hostname.
`nix_switch [HOSTNAME]`|Rebuild and switch system. Optionally force the hostname.
`nix_update [HOSTNAME]`|Update system. Optionally force the hostname.
`nix_clean`|Free up root space.
`nix_shell [NAME]`|Spawn shell with specified nix environment. `Main` is default.