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: Use splicing like normal callPackage #43264

Merged
merged 4 commits into from
Jul 9, 2018

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Jul 9, 2018

Motivation for this change

This ensures all tools and setup-depends are drawn from buildHaskellPackages, the equivalent of buildPackages, so that they run on the build system as intended.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • 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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

CC @kirelagin

Otherwise extra packages in scope can't be made to work for cross. As
much as I think splicing is an evil trick, I think it's best to do this
and at least have it work consistently for now.

It would seems simpler to expose a `newScopeWithSplicing`, but there's a
few attrs (like `buildPackages` or `buildHaskellPackages`) that
shouldn't be spliced. Users should instead splice, override the splicing
on those packages, and apply `newScope` to that.
pkgsHostHost = {};
pkgsHostTarget = scope;
pkgsTargetTarget = {};
} // {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a parenthesis around pkgs.splicePackages {...} to make it more clear. I think that's how the precedence works but it is sometimes unclear whether this is (pkgs.splicePackages {...}) // {...} or pkgs.splicePackages ({...} // {...})

Copy link
Member Author

@Ericson2314 Ericson2314 Jul 9, 2018

Choose a reason for hiding this comment

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

Maybe it's just all the Haskell, but I find function application before operators one of the few precedence rules I do remember 😁.

These should all come from `buildHaskellPackages`
@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jul 9, 2018
@Ericson2314
Copy link
Member Author

And because of all the problems with max args lately, let me say this preserves hashes in the native case and thus is fine.

@Ericson2314 Ericson2314 merged commit 547ef77 into NixOS:master Jul 9, 2018
@Ericson2314 Ericson2314 deleted the splice-more branch July 9, 2018 22:34
@kirelagin
Copy link
Member

Cool!

So, does it mean that my concerns about nativeGhc being shifted by -3 instead of -2 become valid? :) (There is no real difference, of course, because in both cases all the platforms are the original build platform, bu conceptually.)

@Ericson2314
Copy link
Member Author

Ericson2314 commented Jul 11, 2018

@kirelagin hehe not quite! https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/make-package-set.nix#L111 prevents splicing on ghc and buildHaskellPackages, just as we do for buildPackages in https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/splice.nix#L117 (and ..err..um.. also should do for stdenv there too!). [It hasn't yes been a problem for stdenv because stdenv.cc becomes a dep purely on the bash level.]

@kirelagin
Copy link
Member

Errr and what is the purpose of preventing splicing on ghc?

@Ericson2314
Copy link
Member Author

Because it already functions as the _compiler meta-package and indeed needs the rename bad.

If every package used the actual ghc from the previous stage, there'd be only one possible bootstrapping chain. But we bootstrap many: e.g. many GHCs from the same binary GHC, or GHCJS vs cross GHC from the same native GHC. The compiler may be drawn from the previous stage, but the choice of compiler is made in the current stage and thus _compiler should be bound there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: work-in-progress This PR isn't done 6.topic: haskell 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants