Skip to content

Commit

Permalink
get NAR by nix flake prefetch over getFlake, fixes unlocked flake…
Browse files Browse the repository at this point in the history
… reference
  • Loading branch information
KiaraGrouwstra committed Nov 8, 2024
1 parent b306b3e commit 367ebc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion terraform/nix-build/nix-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ else
flake_rel="$(echo "${attribute}" | cut -d "#" -f 1)"
# e.g. flake_rel="."
flake_dir="$(readlink -f "${flake_rel}")"
flake_nar="$(nix build --expr "builtins.getFlake ''git+file://${flake_dir}?narHash=sha256-0000000000000000000000000000000000000000000=''" 2>&1 | grep -Po "(?<=got ')sha256-[^']*(?=')")"
flake_nar="$(nix flake prefetch "${flake_dir}" --json | jq -r '.hash')"
# substitute variables into the template
nix_expr="(builtins.getFlake ''file://${flake_dir}/flake.nix?narHash=${flake_nar}'').${config_path}.extendModules { specialArgs = builtins.fromJSON ''${special_args}''; }"
# inject `special_args` into nixos config's `specialArgs`
Expand Down

0 comments on commit 367ebc0

Please sign in to comment.