aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-09-20 12:30:52 +0200
committerMartin Fischer <martin@push-f.com>2025-09-20 14:40:47 +0200
commitd906ec3b77847db08b7ef01139c024b407c05471 (patch)
treecc06d0d1c4349548147bbed1bda1f74df016c425
parent13b041e800549de30380c637cb1ba4c1494ae5c2 (diff)
refactor: merge two nix-instantiate commands
-rwxr-xr-xnixos/rebuild23
1 files changed, 10 insertions, 13 deletions
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,