aboutsummaryrefslogtreecommitdiffstats
path: root/home/root
diff options
context:
space:
mode:
authorMark Nipper <nipsy@bitgnome.net>2024-05-07 19:18:37 -0700
committerMark Nipper <nipsy@bitgnome.net>2024-05-07 19:18:37 -0700
commitb9262b04e8626dc68db2d65945bd3df4872ffd8d (patch)
tree09afd0c774b296b3a36a37e1836ed2bd3962ba3f /home/root
parentd526747d3904253c63e872b520ce6c220836b83d (diff)
downloadnix-b9262b04e8626dc68db2d65945bd3df4872ffd8d.tar
nix-b9262b04e8626dc68db2d65945bd3df4872ffd8d.tar.gz
nix-b9262b04e8626dc68db2d65945bd3df4872ffd8d.tar.bz2
nix-b9262b04e8626dc68db2d65945bd3df4872ffd8d.tar.lz
nix-b9262b04e8626dc68db2d65945bd3df4872ffd8d.tar.xz
nix-b9262b04e8626dc68db2d65945bd3df4872ffd8d.tar.zst
nix-b9262b04e8626dc68db2d65945bd3df4872ffd8d.zip
Add NixOS helpers
Diffstat (limited to 'home/root')
-rw-r--r--home/root/common/core/zsh/default.nix1
-rw-r--r--home/root/common/core/zsh/zshrc15
2 files changed, 16 insertions, 0 deletions
diff --git a/home/root/common/core/zsh/default.nix b/home/root/common/core/zsh/default.nix
index 8c1d93c..7829d80 100644
--- a/home/root/common/core/zsh/default.nix
+++ b/home/root/common/core/zsh/default.nix
@@ -24,6 +24,7 @@ export COLORFGBG="green;blue"
ip = "ip -c=auto";
la = "ls -aF --color=auto";
ll = "ls -alFhs --color=auto";
+ nix-list-generations = "nixos-rebuild list-generations | cat; echo; nix-env --list-generations --profile /nix/var/nix/profiles/system";
zgrep = "zgrep --color=auto";
};
};
diff --git a/home/root/common/core/zsh/zshrc b/home/root/common/core/zsh/zshrc
index 890d1f6..5338c6c 100644
--- a/home/root/common/core/zsh/zshrc
+++ b/home/root/common/core/zsh/zshrc
@@ -29,6 +29,21 @@ bindkey -M vicmd v edit-command-line
#[[ -z "$TMUX" ]] && (tmux -2 new-session -t default \; new-window || tmux -2 new-session -s default)
[[ -z "$TMUX" ]] && (tmux -2 attach -t default || tmux -2 new-session -s default)
+# Nix helper
+function nix-switch-generation {
+
+ local gen=${1}
+
+ if [[ -z "${gen}" ]]; then
+ echo 'you must specify a generation ID!' >&2
+ return 1
+ fi
+
+ nix-env --switch-generation ${gen} -p /nix/var/nix/profiles/system
+ /nix/var/nix/profiles/system/bin/switch-to-configuration switch
+
+}
+
# prompt/theme shit
function precmd {