Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haskell infra: Make sure packages get custom stdenv #28478

Merged
merged 1 commit into from Sep 5, 2017

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Aug 22, 2017

Motivation for this change

The big question is whether stdenv should just be part of self, just as it is included in all-packages.

N.B. @shlevy this is needed for sierra so I can fish stdenv out (worst case with callPackages ({ stdenv }: stdenv) {}) for the -pgml flag.

Things done

No hashes ought to be changed, though I didn't exhaustively check.

  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what problem this change tries to solve.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Aug 22, 2017

@peti one of the goals of 74f5fe5 was to allow passing in a custom stdenv, which would be used for genericBuilder's mkDerivation call. That does work, but if packages take stdenv as an parameter for any reason, they'll get the default one instead. This change remedies it.

I use custom stdenvs to fix the sierra issue without rebuilding GHC to hard-code a different C toolchain.

One of the goals of 74f5fe5 was to allow passing in a custom stdenv,
which would be used for genericBuilder's `mkDerivation` call. That does
work, but if packages takes `stdenv` as an parameter for any reason,
they'll get the default one instead. This change remedies it.
@peti
Copy link
Member

peti commented Aug 22, 2017

@Ericson2314, I am sorry, but I still don't understand. Where exactly would you like to override stdenv and why is that not possible today?

@peti
Copy link
Member

peti commented Aug 22, 2017

Are you aware that hackage-packages.nix binds stdenv as an argument? Haskell packages in Nixpkgs never need stdenv as an argument -- it's always in scope. No lookup in self takes place.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Aug 22, 2017

@peti

Where exactly would you like to override stdenv

Since 74f5fe5,

callPackage makePackageSet { stdenv = ...; }

Are you aware that hackage-packages.nix binds stdenv as an argument?

What about stand-alone cabal2nix? stdenv would be unbound unless it is a set-pattern parameter.

@peti
Copy link
Member

peti commented Aug 22, 2017

Yes, expressions generated by cabal2nix need a stdenv argument, but the only place they ever use it is to access stdenv.lib.licenses. Arguably, we could change that code of take lib as an argument rather than stdenv, but in any case it should make no difference for your use case, no?

@Ericson2314
Copy link
Member Author

@peti What I've done is master...obsidiansystems:more-sierra-hack#diff-209cb9d64e0f91ce90d31759e43bba01R48 That could be rewritten, but I'd think that if callPackage provides self, which it will because of the pkgs in mkScope's definition, it might as well provide the right one.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Aug 22, 2017

@peti Also consider

  1. People do still write Haskell packages by hand

  2. We could perhaps get rid of those 3 outer arguments in haskell-packages.nix, making there more obviously be one source of truth.

@peti peti merged commit 1357268 into NixOS:master Sep 5, 2017
@Ericson2314 Ericson2314 deleted the haskell-custom-stdenv branch September 5, 2017 19:35
@Ericson2314
Copy link
Member Author

@peti Thanks!

@Ericson2314 Ericson2314 added the 9.needs: port to stable A PR needs a backport to the stable release. label Sep 5, 2017
@samueldr samueldr removed the 9.needs: port to stable A PR needs a backport to the stable release. label Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants