From d906ec3b77847db08b7ef01139c024b407c05471 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sat, 20 Sep 2025 12:30:52 +0200 Subject: refactor: merge two nix-instantiate commands --- nixos/rebuild | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'nixos') diff --git a/nixos/rebuild b/nixos/rebuild index 3dfbf71..7fa750a 100755 --- a/nixos/rebuild +++ b/nixos/rebuild @@ -11,20 +11,17 @@ if [ ! -f $configPath ]; then exit 1 fi -nix-eval() { - nix-instantiate --eval --raw --read-write-mode "$@" -} - -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' + nix-instantiate --eval --raw \ + --argstr host "$HOSTNAME" \ + --expr ' + { host }: + let + toml = builtins.readFile ./hosts/${host}/metadata.toml; + channel = (builtins.fromTOML toml).channel; + in + (import ./npins).${channel}.outPath + ' ) # nixos-rebuild always reads Nixpkgs from the NIX_PATH, -- cgit v1.2.3