Commit graph

21 commits

Author SHA1 Message Date
John Ericson 0828e2d8c3 treewide: Remove usage of remaining redundant platform compatability stuff
Want to get this out of here for 18.09, so it can be deprecated
thereafter.
2018-08-30 17:20:32 -04:00
John Ericson 740cfffcb2 haskell infra: Fix built-time overrides
These should all come from `buildHaskellPackages`
2018-07-09 18:09:17 -04:00
John Ericson f27f491784 Haskell infra: Do callPackage splicing 2018-07-09 16:39:37 -04:00
John Ericson 0eb142cd46 top-level: Expose splicePackages for newScope users
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.
2018-07-09 12:33:43 -04:00
Will Dietz 218d4dc154 make-derivation: Don't add host-suffix to fixed-output derivations names
Not only does the suffix unnecessarily reduce sharing, but it also breaks
unpacker setup hooks (e.g. that of `unzip`) which identify interesting tarballs
using the file extension.

This also means we can get rid of the splicing hacks for fetchers.
2018-07-09 11:07:10 -04:00
John Ericson bb18a3b573 top-level: Splice in more package sets for new types of deps
This is done in preparation for the next commit where, among other
changes, I add support for the new `dep*` attributes.
2017-12-30 22:04:20 -05:00
John Ericson 6c36d3c9e0 top-level: Fix splicing, again 2017-12-10 17:01:23 -05:00
John Ericson 965cc5da57 top-level: Fix splicing in the presence of evaluation errors
- No more `or {}`, this was misleading at best since those values
   wouldn't be used unless the attr they are defined from was present
   anyways.

 - `tryEval` for get outputs. This ensures that if some derivations fail, they
   won't take out the others. This benefited from the `or {}` before, but that
   was never good enough. `tryEval` is strictly better.
2017-12-09 20:02:45 -05:00
John Ericson 5ae8f18f4d Rename __targetPackages to targetPackages 2017-11-05 17:10:53 -05:00
Shea Levy 1a1ad1a17d Revert "Merge branch 'improved-make-overridable' of git://github.com/ElvishJerricco/nixpkgs"
This reverts commit c3af1210b4, reversing
changes made to 49f175cd0c.
2017-09-29 09:11:26 -04:00
Shea Levy d96da5af87 Revert "Avoid polluting lib namespace unncessarily"
Reverting #27319

This reverts commit 01a3f0b8aa.
2017-09-29 09:09:53 -04:00
Shea Levy 01a3f0b8aa Avoid polluting lib namespace unncessarily 2017-09-28 18:51:20 -04:00
Shea Levy c3af1210b4 Merge branch 'improved-make-overridable' of git://github.com/ElvishJerricco/nixpkgs 2017-09-28 18:10:50 -04:00
John Ericson 64aebc7679 stdenv: Also splice unlisted default "out" output
Otherwise, some cross builds will use the wrong type of dep.

This won't affect native builds, and perhaps no extant cross buids
either.
2017-09-19 14:48:23 -04:00
Will Fancher 05f9db601a Added self views of the interface in makeExtensibleWithInterface
Fixing the `overrideScope` in `haskellpackages`.
2017-07-14 06:43:33 -04:00
Will Fancher af479c182f Added callPackageWithSelfWith and callPackageWithSelf 2017-07-12 18:35:23 -04:00
John Ericson 863d79b364 top-level: Introduce targetPackages and a "double link fold"
Each bootstrapping stage ought to just depend on the previous stage, but
poorly-written compilers break this elegence. This provides an easy-enough
way to depend on the next stage: targetPackages. PLEASE DO NOT USE IT
UNLESS YOU MUST!

I'm hoping someday in a pleasant future I can revert this commit :)
2017-04-23 14:01:12 -04:00
John Ericson af8f87a3a1 top-level: Do not splice pkgs, buildPackages or *Platform
- `pkgs` is self-similar, and thus already spliced
 - `buildPackages` is an ingredient of splicing and should be kept as is
 - The platforms are not packages or package sets and couldn't be spliced

There's probably other things that shouldn't be spliced too. The best long-
term solution is simply to stop splicing altogether.
2017-04-23 13:54:42 -04:00
John Ericson c869fe022e top-level: no more need to expose splicedPackages
This was just done temporarily on the last cross-overhauling PR for
testing purposes.
2017-01-25 09:24:55 -05:00
John Ericson bfb147b6a8 top-level: Only splice as needed for performance 2017-01-24 11:37:56 -05:00
John Ericson bf17d6dacf top-level: Introduce buildPackages for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]

In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.

To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.

Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.

--------

Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:

Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.

This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".

Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.

Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.

--------

Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.

 1. GCC when doing a `build = host = target = foreign` build (maximally
    cross), still defines environment variables like `CPATH`[1] with
    packages.  This seems assuredly wrong because whether gcc dynamically
    links those, or the programs built by gcc dynamically link those---I
    have no idea which case is reality---they should be foreign. Therefore,
    in all likelihood, I just made the gcc less broken.

 2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
    a native version of itself. When coreutils was overwritten to be built
    with fewer features, the native version it used would also be
    overwritten because the binding was tight. Now it uses the much looser
    `BuildPackages.coreutils` which is just fine as a richer build dep
    doesn't cause any problems and avoids a rebuild.

So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!

[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2017-01-24 11:37:56 -05:00