diff options
author | Martin Fischer <martin@push-f.com> | 2025-04-26 08:26:08 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-04-26 08:39:32 +0200 |
commit | 940fb56e7e450b7da56cc333d17ab0edb4cd1d0f (patch) | |
tree | 4ffd3e20cbd4de5b8d25827e294f7b7b3ba22dd4 /nixos/rebuild | |
parent | c329be48e687e3152e1362a71b76035bfda7215e (diff) |
Diffstat (limited to 'nixos/rebuild')
-rwxr-xr-x | nixos/rebuild | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/nixos/rebuild b/nixos/rebuild index 80a52cd..cfc14cf 100755 --- a/nixos/rebuild +++ b/nixos/rebuild @@ -11,19 +11,18 @@ if [ ! -f $configPath ]; then exit 1 fi -firstLine=$(head -n1 "$configPath") - -if ! echo "$firstLine" | grep -E ^"# channel *=" > /dev/null; then - echo "aborting: $configPath doesn't start with \`# channel=\"...\"\`, where ... is a pin from sources.json" - exit 1 -fi - nix-eval() { + # FUTURE: use --raw when upgrading to NixOS 25.05 nix-instantiate --eval --read-write-mode "$@" \ | tr -d \" # nix-instantiate has no raw output yet (like the experimental nix eval) } -channel=$(nix-eval --argstr line "$(echo $firstLine | tr -d \#)" --expr '{line}: (builtins.fromTOML line).channel') +channel=$(nix-eval --argstr host "$HOSTNAME" --expr '{host}: +let + toml = builtins.readFile ./hosts/${host}/metadata.toml; +in + (builtins.fromTOML toml).channel +') nixpkgsPath=$(nix-eval --argstr channel "$channel" --expr '{channel}: (import ./npins).${channel}.outPath') # nixos-rebuild always reads Nixpkgs from the NIX_PATH, |