summaryrefslogtreecommitdiff
path: root/nixos/rebuild
blob: 2ee7d76dc8fbb8c7aa3cacd3528b648965b98231 (plain)
1
2
3
4
5
6
7
8
9
10
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"