summaryrefslogtreecommitdiff
path: root/nixos/rebuild
blob: 98101c1d352bd939295eb29445e1a41539469170 (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 ./configuration.nix relative to this script
configPath=$(realpath -- "$(dirname -- "${BASH_SOURCE[0]}")/configuration.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"