aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-16 23:47:16 +0000
committertv <tv@krebsco.de>2026-11-16 23:47:16 +0000
commitfb7a621f580caf6d31e0b807d070a7231416538d (patch)
tree79365d0c5c08e7833f9166e15c8894668ba96958 /pkgs
parente3fea8300d452b64dfc0bdd7e662193a1c92010c (diff)
don't hash nixpkgs on every evaluation
"${pkgs.path}" copies nixpkgs to the store, which means hashing all of it, on every evaluation, even when it's a store path already. That took no-op builds from ~3s to ~25s. Use builtins.storePath when it's a store path; only a nixpkgs outside the store still gets copied.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/run-firecracker-vm/default.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgs/run-firecracker-vm/default.nix b/pkgs/run-firecracker-vm/default.nix
index 44e9e7c..3ff3d0f 100644
--- a/pkgs/run-firecracker-vm/default.nix
+++ b/pkgs/run-firecracker-vm/default.nix
@@ -240,9 +240,13 @@ let
inherit (nixos.config.system.build) toplevel kernel initialRamdisk;
- # The host's nixpkgs, for the guest's NIX_PATH (copied to the store, if
- # it's not a store path already).
- nixpkgs = "${pkgs.path}";
+ # The host's nixpkgs, for the guest's NIX_PATH. builtins.storePath if
+ # it's in the store already, as "${pkgs.path}" would copy it to the
+ # store anyway, hashing all of nixpkgs on every evaluation (~20s).
+ nixpkgs =
+ if lib.isStorePath (toString pkgs.path)
+ then builtins.storePath (toString pkgs.path)
+ else "${pkgs.path}";
# The guest's closure, as erofs image. (Without nixpkgs, which made it
# 7 GiB, and comes from the host's store instead.)