Commit Graph

60 Commits

Author SHA1 Message Date
Ryan Burns
7b9c1dbd28 pkgs/top-level/stage: force elfv2 on static powerpc64-linux
The staging logic reconstructs the target platform, discarding
powerpc64's custom gcc.abi = elfv2 setup. Musl requires ELFv2 ABI so
this should be set unconditionally here.
2021-03-15 19:27:41 -07:00
zimbatm
bbc9af1f0a
tree-wide: do not use pkgs.extend in nixpkgs
Each invocation of pkgs.extends adds 130MB of allocation to the hydra
evaluator. We are already struggling with the amount of memory nixpkgs
requires.

`pkgs.extend` is a useful escape-hatch, but should be not be used inside
of nixpkgs directly.
2020-11-30 14:24:40 +01:00
Dmitry Bogatov
55195119d5 Distinguish pkgsStatic from pkgsMusl via stdenv.targetPlatform
This change allows derivations to distinguish dynamic musl build and
static musl build in cases where upstream build system can't detect it
by itself.
2020-08-27 18:36:34 -04:00
Alyssa Ross
59dbb00555
symlinkJoin: fix cross 2019-10-28 15:12:35 +00:00
volth
35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
John Ericson
aa0cf64422
Merge pull request #57611 from Ericson2314/stage-braid-not-chain
top-level: Create `pkgs{Build,Host,Target}{Build,Host,Target}`
2019-03-25 21:56:59 -04:00
danbst
f72903864d pkgsMusl, pkgsi686Linux, pkgsStatic: fix infinite recursion with overlays
Consider example:

$ nix-instantiate ./nixos -A system --arg configuration '
    {
      boot.isContainer = true;
      nixpkgs.overlays = [ (self: super: {
        nix = self.pkgsStatic.nix;
      }) ];
    }'

When resolving package through overlays, we figure out that

  nix == self.pkgsStatic.nix
  =>
  nix == (import <nixpkgs> { inherit overlays; }).nix
  =>
  nix == (import <nixpkgs> { overlays = [(self: super: { nix = self.pkgsStatic.nix; })];}).nix

and we enter infinite recursion of nixpkgs evaluations.

The proper fix should terminate recursion by assigning self fixpoint
to inner custom package set. But I get infinite recursion somehow, so
I use `super`. It is less correct modulo deep custom overrides, but behaves
correctly for simple cases and doesn't OOM evaluator.

Fixes https://github.com/NixOS/nixpkgs/issues/57984
2019-03-25 10:58:46 +02:00
John Ericson
70d71bbbe4 top-level: Create pkgs{Build,Host,Target}{Build,Host,Target}
This is needed to avoid confusing and repeated boilerplate for
`fooForTarget`.  The vast majority of use-cases can still use
`buildPackages or `targetPackages`, which are now defined in terms of
these.
2019-03-24 22:12:15 -04:00
Jan Malakhovski
83ae1ffed4 pkgs/top-level/stage.nix: don't override overlays and config in nixpkgsFun
`nixpkgsFun` already sets them via `args`. Doing this also introduces unexpected
hard to debug errors, see the patch.
2019-03-08 11:37:20 +02:00
Danylo Hlynskyi
b421183b34
Merge pull request #56237 from LnL7/expose-overlays
pkgs/top-level: expose current overlays in pkgs
2019-03-05 03:06:21 +02:00
Jörg Thalheim
dadc7eb329
treewide: use runtimeShell instead of stdenv.shell whenever possible
Whenever we create scripts that are installed to $out, we must use runtimeShell
in order to get the shell that can be executed on the machine we create the
package for. This is relevant for cross-compiling. The only use case for
stdenv.shell are scripts that are executed as part of the build system.
Usages in checkPhase are borderline however to decrease the likelyhood
of people copying the wrong examples, I decided to use runtimeShell as well.
2019-02-26 14:10:49 +00:00
Daiderd Jordan
135f263b39
pkgs/top-level: expose current overlays in pkgs
This enables inspection of the currently used overlays. Useful for
usecases where nixpkgs is imported multiple times.
eg. different channels

	self: super:
	let
	  latest = import <nixpkgs-trunk> {
	    inherit (super) config overlays;
	  };
	in
	{
	  hello-custom-latest = latest.hello-custom;
	}
2019-02-23 11:09:45 +01:00
Robert Hensing
055ac8e495 Partially revert 755e824
Reinstates the error message that helps migration of forks.
Same should be done for super *if* it is to be removed.
2019-02-03 18:22:22 +07:00
John Ericson
755e824291 all-packages: Just refer to self, not super, or res
This ends a years-long process to removoe pointless fixed points in this
file!
2019-02-02 16:14:58 -05:00
Matthew Bauer
6d90a8b894 top-level/stage.nix: add static overlay
Adds the static overlay that can be used to build Nixpkgs statically.
Can be used like:

  nix build pkgsStatic.hello

Not all packages build, as some rely on dynamic linking.
2018-12-04 21:56:03 -06:00
Robert Hensing
22aac3b921 all-packages.nix: Alias self to res, deprecating self
For historical reasons, self was ill-named. This removes its usages
from all-packages.nix and provides a deprecation message for those
who use a patched Nixpkgs.

Some packages seem to depend on the peculiarities of res, as can
be seen by making res into an alias of pkgs (normally "self").
The super variable doesn't have all that is needed.

Therefore the simple fix is not guaranteed to work and as such,
usages of res need to be changed to pkgs or super, case by case.
2018-12-02 19:24:49 +01:00
Robert Hensing
51c6f51390 Merge remote-tracking branch 'upstream/master' into nixos-nixpkgs-pkgs-use-overlays 2018-11-04 21:33:16 +01:00
Matthew Bauer
370ce8fcd3 stage.nix: throw error on incorrect pkgsi686Linux usage
pkgsi686Linux now throws an error with a message as opposed to the
previous assertion.
2018-11-03 00:58:58 -05:00
Matthew Bauer
b3ab4d1f8e Revert "Revert "stage.nix: pkgsi686Linux only works on x86 family""
This reverts commit 08b5cffe87.
2018-11-03 00:52:14 -05:00
Matthew Bauer
08b5cffe87 Revert "stage.nix: pkgsi686Linux only works on x86 family"
This reverts commit 78ca6d885f.

Broke eval on aarch64
2018-11-03 00:47:39 -05:00
Matthew Bauer
78ca6d885f stage.nix: pkgsi686Linux only works on x86 family
aarch64 cpus are going to break on pkgsi686Linux packages.

See this error:

https://hydra.nixos.org/build/82962379/
2018-11-02 21:24:55 -05:00
Robert Hensing
889a5c3512 pkgs.appendOverlays: Avoid unnecessary nixpkgs evaluation 2018-10-27 14:00:19 +02:00
Robert Hensing
ba8b54fa4a Add Nixpkgs functions for adding overlays ad-hoc
This is something that I have found useful in tests. In practice
I recommend that people call Nixpkgs once for performance and
simplicity. The inline documentation mentions this too.
2018-10-18 10:48:43 +02:00
Matthew Bauer
01dfe3f560 stage.nix: fix cross compiling with pkgsMusl
Fixes #48265
2018-10-15 12:59:07 -05:00
John Ericson
359d00f8b0 top-level: system should still come from the host platform
2a6e4ae49a and
e51f736076 reverted a bit too much, and I
initially missed this when reviewing. The release notes already still
mention this change, too.
2018-09-23 13:24:44 -04:00
Sarah Brofeldt
2a6e4ae49a Revert "top-level: Deprecate top-level {build,host,target}Platform"
This reverts commit e51f736076.
2018-09-11 13:25:50 +02:00
John Ericson
773233ca77 top-level, stdenv: Make system and stdenv.system describe the hostPlatform.
Intuitively, one cares mainly about the host platform: Platforms differ
in meaningful ways but compilation is morally a pure process and
probably doesn't care, or those difference are already abstracted away.
@Dezgeg also empirically confirmed that > 95% of checks are indeed of
the host platform.

Yet these attributes in the old cross infrastructure were defined to be
the build platform, for expediency. And this was never before changed.
(For native builds build and host coincide, so it isn't clear what the
intention was.)

Fixing this doesn't affect native builds, since again they coincide. It
also doesn't affect cross builds of anything in Nixpkgs, as these are no
longer used. It could affect external cross builds, but I deem that
unlikely as anyone thinking about cross would use more explicit
attributes for clarity, all the more so because the rarity of inspecting
the build platform.
2018-09-06 08:33:51 -04:00
John Ericson
e51f736076 top-level: Deprecate top-level {build,host,target}Platform
I don't know when we can/should remove them, but this at least gets
people to stop using them. The preferred alternatives also date back to
17.09 so writing forward-compatable code without extra conditions is
easy.

Beginning with these as they are the least controversial.
2018-09-05 11:53:51 -04:00
John Ericson
7d85ade0cc treewide: Purge stdenv.platform and top-level platform
Progress towards #27069
2018-08-20 15:22:46 -04:00
volth
101df126bb config.skipAliases -> config.allowAliases 2018-07-17 14:46:21 +00:00
Matthew Bauer
ad20a4a1c3 stage: add Linux checks
This prevent us evaluation on macOS systems where pkgsMusl &
pkgsi686Linux is unsupported.
2018-07-05 17:32:54 -04:00
John Ericson
f795ed79d0 stage: Make pkgsMusl and pkgsi686linux respect the original localSystem more
For example:

nix-repl> pkgsi686Linux.pkgsMusl.hostPlatform.config
"i686-unknown-linux-musl"

nix-repl> pkgsMusl.pkgsi686Linux.hostPlatform.config
"i686-unknown-linux-musl"
2018-07-05 16:17:54 -04:00
Matthew Bauer
69f1045001 treewide: remove forceSystem 2018-07-05 15:47:10 -04:00
Matthew Bauer
c491a99362 treewide: remove callPackage_i686
This has been replaced with pkgsi686Linux.callPackage
2018-07-05 14:04:52 -04:00
Matthew Bauer
5b357d9037 stage: refactor extraPkgs
I have renamed the overlay to “otherPackageSets” because I think that
is more descriptive.

pkgsLocal has been removed because there were concerns that it would
be confusing. None of the other names seemed very useful so I think it
is best to avoid it altogether. pkgsCross is still included,
hopefully, that will not have as much confusion.

pkgsMusl is now available for building Musl packages. It will give you
packages bulit with the Musl libc.

Also added more documentation.

/cc @dezgeg @Ericson2314 @dtzWill
2018-07-05 13:59:03 -04:00
Matthew Bauer
18af089de7 stage: remove nixpkgsFun
also inherit forceSystem for some GNU Hurd stuff
2018-07-02 11:20:34 -04:00
Matthew Bauer
d1bd9faf61 stage: move old stuff to stage.nix 2018-07-02 11:07:53 -04:00
Matthew Bauer
b6b1950594 top-level: add extraPkgs to stage.nix 2018-07-02 11:07:53 -04:00
Matthew Bauer
d665e80450 top-level: move cross pkgs to overlay 2018-07-02 11:07:53 -04:00
Will Fancher
9555fd700d aliases: fix using the wrong self refs 2018-06-12 18:05:42 +00:00
Matthew Bauer
ffe4b64205 aliases: add skip aliases config
You can turn on this config option if you want to find references to
aliases in Nixpkgs. Ideally these can be removed from Nixpkgs and
eventually we can remove the alias altogether.
2018-05-01 13:54:08 -05:00
Tyson Whitehead
fefa9ef756 top-level: Duplicate overlaying unless stdenvOverrides comes last
The stdenvOverrides overlay is used to bring packages forward during
bootstrapping via stdenv.overrides.  These packages have already had
the overlays applied to them in the previous boostrapping stage.  If
stdenvOverrides is not last in the overlays stack, all remaining
overlays will windup being applied again to these packages.

closes #34086
2018-01-31 00:16:27 -05:00
John Ericson
5ae8f18f4d Rename __targetPackages to targetPackages 2017-11-05 17:10:53 -05:00
John Ericson
a302d7360f top-level: {build,host,target}Platform are defined in the stdenv instead
See #27069 for a discussion of this
2017-07-07 12:55:02 -04:00
hsloan
9f156f4a8a top-level: stdenv.cross vanquished 2017-06-28 21:29:08 -04:00
John Ericson
a7d89139ea top-level: stdenv.cross is now only defined with host != build
In practice, this is a strictly stronger condition than target != build
as we never have build = target != host. Really, the attribute should
be removed altogether, but for now we make it work for plain libraries,
which do not care about the target platform. In the few cases where the
compilers use this and actually care about the target platform, I'll
manually change them to use `targetPlatform` instead.
2017-04-24 16:12:26 -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
d59e4fbb75 stage.nix: Better explain why buildPackages as null is valid arg 2017-04-23 14:01:12 -04:00
John Ericson
bfb147b6a8 top-level: Only splice as needed for performance 2017-01-24 11:37:56 -05:00
John Ericson
a1a798f017 top-level: crossSystem is no longer exposed to packages. Use *Platform. 2017-01-24 11:37:56 -05:00