diff options
author | sterni <sternenseemann@systemli.org> | 2021-11-13T12·43+0100 |
---|---|---|
committer | sterni <sternenseemann@systemli.org> | 2021-11-13T13·27+0000 |
commit | 53ab5716aac5e2a0d40c4c412e6105730942940f (patch) | |
tree | efb6730ff27241da104699608893d8583dcd2acc /web/static/default.nix | |
parent | e2fbc10ebdb5d85813fd15c5dd371ee8e1e87a22 (diff) |
fix(web/static): avoid drvHash unnecessarily inflating closures r/3054
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 <mail@tazj.in>
Diffstat (limited to '')
-rw-r--r-- | web/static/default.nix | 7 |
1 files changed, 6 insertions, 1 deletions
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 |