From fb7a621f580caf6d31e0b807d070a7231416538d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 23:47:16 +0000 Subject: 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. --- pkgs/run-firecracker-vm/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'pkgs/run-firecracker-vm') 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.) -- cgit v1.3.1