summaryrefslogtreecommitdiff
path: root/nixos/rebuild
diff options
context:
space:
mode:
authorSilvan Mosberger <silvan.mosberger@tweag.io>2023-11-16 07:30:27 +0100
committerMartin Fischer <martin@push-f.com>2024-11-29 05:49:48 +0100
commit2ae50cc68e42b9d790dfba26a8c42219e7ae8f6a (patch)
treed6330dd49c89fe94f0ecd4fc0900f747aa341865 /nixos/rebuild
import https://github.com/infinisil/sanix
I (Martin) squashed the commits up to the currently latest (37b7f370e36f1a1e90f746e0a4f80582058f7d55).
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"