From e88d6a462154abcfb35d6a62e496dfd2eb772556 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Sat, 22 Aug 2026 01:56:06 +0800 Subject: [PATCH] feat(zshrc): nor use nh if available Signed-off-by: Dict Xiong --- .zshrc2 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.zshrc2 b/.zshrc2 index 8de6c99..d5e1c17 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -149,7 +149,14 @@ bnd() { } nor() { test -n "$1" || { echo fatal: no verb given; return 1; } - nixos-rebuild "$1" --flake .${2:+#}$2 + local verb="$1" + local flake=".${2:+#$2}" + + if command -v nh >/dev/null 2>&1 && [[ "$verb" != dry-build && "$verb" != dry-activate ]]; then + nh os "$verb" --bypass-root-check "$flake" + else + nixos-rebuild "$verb" --flake "$flake" + fi } alias 'nors'='nor switch' alias 'norbt'='nor boot'