From a495240129e549f1672d1ff5f65ece69a5999d17 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Fri, 8 Mar 2024 22:12:45 +0300 Subject: [PATCH] Nix : Update some function names. --- module/common/bash/module/Nix.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/module/common/bash/module/Nix.sh b/module/common/bash/module/Nix.sh index e36500f5..2930eb8b 100644 --- a/module/common/bash/module/Nix.sh +++ b/module/common/bash/module/Nix.sh @@ -2,8 +2,8 @@ export _nix_system_config="git+https://git.voronind.com/voronind/nixos.git" # Rebuild system. # Optionally force the hostname. -# Usage: nix_rebuild [HOSTNAME] -function nix_rebuild() { +# Usage: nixos_rebuild [HOSTNAME] +function nixos_rebuild() { local target="${1}" [[ "${target}" = "" ]] && target="${HOSTNAME}" @@ -12,20 +12,14 @@ function nix_rebuild() { # Rebuild and switch system. # Optionally force the hostname. -# Usage: nix_switch [HOSTNAME] -function nix_switch() { +# Usage: nixos_switch [HOSTNAME] +function nixos_switch() { local target="${1}" [[ "${target}" = "" ]] && target="${HOSTNAME}" nixos-rebuild switch --flake "${_nix_system_config}#${target}" --refresh } -# Update system versions. -# Usage: nix_update -function nix_update() { - nix flake update -} - # Spawn shell with specified nix environment. # Uses flake.nix in current dir by default. # Usage: nix_shell [NAME] @@ -33,12 +27,14 @@ function nix_shell() { local target="${1}" [[ "${target}" = "" ]] && target="default" + # Create Nix GC root in .NixRoot{NAME}. nix build ".#devShells.${NIX_CURRENT_SYSTEM}.${target}" -o ".NixRoot${target^}" + NIX_SHELL="${target}" nix develop ".#devShells.${NIX_CURRENT_SYSTEM}.${target}" } alias shell="nix_shell" -# Spawn nix-shell with specified packages. +# Spawn temporary nix-shell with specified packages. # Usage: nix_tmpshell function nix_tmpshell() { local IFS=$'\n' @@ -62,12 +58,12 @@ function nix_tmpshell() { alias tmpshell="nix_tmpshell" # Build live image. -function nix_live() { +function nixos_live() { nix build "${_nix_system_config}#nixosConfigurations.live.config.system.build.isoImage" } # List nixos generations. -function nix_generations() { +function nixos_generations() { nix-env -p /nix/var/nix/profiles/system --list-generations }