From 53ab5716aac5e2a0d40c4c412e6105730942940f Mon Sep 17 00:00:00 2001 From: sterni Date: Sat, 13 Nov 2021 13:43:43 +0100 Subject: fix(web/static): avoid drvHash unnecessarily inflating closures The string context of drvPath apparently causes a derivation to _directly_ reference the whole dependency closure of the derivation drvPath belongs to. This not only is unnecessary in this case (since we are using drvHash to construct HTTP URLs which are primarily contigent on the deployed configuration and not the shape of the nix store), but also creates a very confusing derivation (e. g. web.tvl's index.html would *directly* reference pandoc). Change-Id: I6e9900e9e35fbd639061e53322e4ccb3fbb7e7ec Reviewed-on: https://cl.tvl.fyi/c/depot/+/3862 Tested-by: BuildkiteCI Reviewed-by: tazjin --- web/static/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'web') diff --git a/web/static/default.nix b/web/static/default.nix index 7a17dec36279..ea498057f9de 100644 --- a/web/static/default.nix +++ b/web/static/default.nix @@ -7,7 +7,12 @@ let logo = depot.web.tvl.logo; in lib.fix(self: pkgs.runCommand "tvl-static" { passthru = { - drvHash = lib.substring storeDirLength 32 self.drvPath; + # Preserving the string context here makes little sense: While we are + # referencing this derivation, we are not doing so via the nix store, + # so it makes little sense for Nix to police the references. + drvHash = builtins.unsafeDiscardStringContext ( + lib.substring storeDirLength 32 self.drvPath + ); }; } '' mkdir $out -- cgit 1.4.1