summaryrefslogtreecommitdiff
path: root/nixos/rebuild
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/rebuild')
-rwxr-xr-xnixos/rebuild11
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/rebuild b/nixos/rebuild
new file mode 100755
index 0000000..2ee7d76
--- /dev/null
+++ b/nixos/rebuild
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# nix-instantiate --eval has no raw mode yet
+nixpkgsPath=$(nix-instantiate --eval --read-write-mode nixpkgs/path.nix | tr -d \")
+# Get the ./root.nix relative to this script
+configPath=$(realpath -- "$(dirname -- "${BASH_SOURCE[0]}")/root.nix")
+
+# nixos-rebuild always reads Nixpkgs from the NIX_PATH,
+# so we need to set it explicitly to our pinned version
+exec nixos-rebuild "$@" -I nixpkgs="$nixpkgsPath" -I nixos-config="$configPath"