nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

survey: Fix returned haskellPackages not being overridable #74

Closed nh2 closed 4 years ago

nh2 commented 4 years ago

So far, staticHaskellBinariesOverlay just did mapAttrs over haskellPackages directly.

That is wrong.

It should do a proper haskellPackages.override, just like haskellLibsReadyForStaticLinkingOverlay does, and so its mapAttrs over super instead.

This commit does that.

Because of this bug, it was until now impossible to further override the returned haskellPackages. For example, using

static_haskellPackages_with_fixes =
  static-stack2nix-builder.haskell-static-nix_output.haskellPackages.override (old: {
    # composeExtensions boilerplate here ...
     {
       # Haskell overrides here
     }
});

(as is sometimes necessary for the static-stack2nix-builder to override one's own packages) would not work; as soon as .override was used, all packages inside would lose their static overrides, e.g. configureFlags would be reset to "".

nh2 commented 4 years ago

CI build turned up a couple unrelated problems:

nh2 commented 4 years ago

CI green, merging.