From 2ae50cc68e42b9d790dfba26a8c42219e7ae8f6a Mon Sep 17 00:00:00 2001
From: Silvan Mosberger <silvan.mosberger@tweag.io>
Date: Thu, 16 Nov 2023 07:30:27 +0100
Subject: import https://github.com/infinisil/sanix

I (Martin) squashed the commits up to the currently latest
(37b7f370e36f1a1e90f746e0a4f80582058f7d55).
---
 nixos/rebuild | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100755 nixos/rebuild

(limited to 'nixos/rebuild')

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"
-- 
cgit v1.2.3