Skip to content

Commit 4b7364b

Browse files
committed
Improve remote store eval time
This code used to put the .drv path into the string context for each package. That meant we had to query the store each time one of these was evaluated for the out path. This is pretty quick when using a non-remote store. But the latency with the remote store really slows us down. We should just calculate the outPath once instead, and use that throughout.
1 parent 4cb78ba commit 4b7364b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/load-cabal-plan.nix

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ let
7575
buildable = true;
7676
} // lookupDependencies hsPkgs.pkgsBuildBuild (components.setup.depends or []) (components.setup.exe-depends or []);
7777
};
78-
nixFilesDir = callProjectResults.projectNix + callProjectResults.src.origSubDir or "";
78+
# We use unsafeDiscardStringContext to ensure that we don't query this derivation when importing
79+
# each package. The cost can be very high when using a remote store, as we need to do a network call.
80+
nixFilesDir = builtins.unsafeDiscardStringContext callProjectResults.projectNix.outPath + callProjectResults.src.origSubDir or "";
7981
in {
8082
# This replaces the `plan-nix/default.nix`
8183
pkgs = (hackage: {

0 commit comments

Comments
 (0)