on iko/ghcjs-patch-master help sign in
Don't duplicate the configureFlags when not on Windows (#1420)

When not on Windows, the `configureFlags` attr of `libmpc` is set to `(drv.configureFlags or [])`. Since `drv.configureFlags` seems to be equal to `["--enable-static" "--disable-shared"]` (at least on my machine), `configureFlags` appears to be merged with itself and in the end, it is equal to: `["--enable-static" "--disable-shared" "--enable-static" "--disable-shared"]`. You can verify this by comparing the derivations of `libmpc` with and without this patch. This changes the derivation of `libmpc` as well the derivation of all dependent packages, like `gcc`, causing cache misses from https://cache.nixos.org/. Because these packages are built and stored in the IOHK cache, users don't notice this, until they use a different version of `nixpkgs` than the one pinned by `haskell.nix`, e.g., one with a different version of `glibc` so that the IOHK cache cannot be used. This results in `gcc` and other packages being built from scratch instead of being downloaded from https://cache.nixos.org/. Fix this by hoisting the conditional one level higher so that `overrideAttrs` isn't even called on non-Windows OSes. Do the same for `mpfr` for consistency. I haven't tested this on Windows. I'm not sure whether I have hoisted the conditional too high, see the first comment in the file.

commit0c9142a7532cf45164ad10c4d8605df0ff0f31d2 authorThomas Winant <dewinant@gmail.com> dateThu 7 Apr 2022, 11:59 (5 years ago) parentb0fed19
1 file changed+4−4
overlays/windows.nix+4−4
overlays/windows.nix+4−4
@@ -16,12 +16,12 @@ final: prev:
1616 # postFixup = "";
1717 # });
1818} // prev.lib.optionalAttrs (prev ? mfpr) {
19− mfpr = prev.mfpr.overrideAttrs (drv: {
20− configureFlags = (drv.configureFlags or []) ++ prev.lib.optional prev.stdenv.hostPlatform.isWindows "--enable-static --disable-shared" ;
19+ mfpr = if !prev.stdenv.hostPlatform.isWindows then prev.mpfr else prev.mfpr.overrideAttrs (drv: {
20+ configureFlags = (drv.configureFlags or []) ++ [ "--enable-static --disable-shared" ];
2121 });
2222} // {
23− libmpc = prev.libmpc.overrideAttrs (drv: {
24− configureFlags = (drv.configureFlags or []) ++ prev.lib.optional prev.stdenv.hostPlatform.isWindows "--enable-static --disable-shared" ;
23+ libmpc = if !prev.stdenv.hostPlatform.isWindows then prev.libmpc else prev.libmpc.overrideAttrs (drv: {
24+ configureFlags = (drv.configureFlags or []) ++ [ "--enable-static --disable-shared" ];
2525 });
2626
2727 binutils-unwrapped = prev.binutils-unwrapped.overrideAttrs (attrs: {