3
0
Fork 0
forked from mirrors/nixpkgs
Commit graph

76 commits

Author SHA1 Message Date
Robert Hensing 200175a701 config.allowAliases: Define as option
This simplifies usages and makes the default value consistent.

In a few cases, the default value was interpreted to be `false`,
but this is useless, because virtually nobody will explicitly
set `allowAliases = true;`.
2022-04-01 11:33:10 +02:00
Adam Joseph 8a1235f775 https://github.com/NixOS/nixpkgs/pull/161158#pullrequestreview-903824138 2022-03-10 20:30:17 -08:00
Adam Joseph 5b63b25d68 s/makeStaticParsedPlatform/makeMuslParsedPlatform/g 2022-03-10 20:30:17 -08:00
Adam Joseph 3cf831874e Update pkgs/top-level/stage.nix
Co-authored-by: John Ericson <git@JohnEricson.me>
2022-03-10 20:30:17 -08:00
Adam Joseph 12371a51e6 lib/systems: add mips64el definitions
MIPS has a large space of {architecture,abi,endianness}; this commit
adds all of them to lib/systems/platforms.nix so we can be done with
it.

Currently lib/systems/inspect.nix has a single "isMips" predicate,
which is a bit ambiguous now that we will have both mips32 and mips64
support, with the latter having two ABIs.  Let's add four new
predicates (isMips32, isMips64, isMips64n32, and isMips64n64) and
treat the now-ambiguous isMips as deprecated in favor of the
more-specific predicates.  These predicates are used mainly for
enabling/disabling target-specific workarounds, and it is extremely
rare that a platform-specific workaround is needed, and both mips32
and mips64 need exactly the same workaround.

The separate predicates (isMips64n32 and isMips64n64) for ABI
distinctions are, unfortunately, useful.  Boost's user-scheduled
threading (used by nix) does does not currently supports mips64n32,
which is a very desirable ABI on routers since they rarely have
more than 2**32 bytes of DRAM.
2022-03-10 20:30:16 -08:00
Bernardo Meurer d13430a8da
pkgs/top-level/stage: format trivialBuilders import 2021-11-08 09:33:34 -08:00
Bernardo Meurer 21c299f077
writeShellApplication: get shellcheck from pkgsBuildHost 2021-11-08 09:33:34 -08:00
Ryan Burns 4246d6ce21 aliases: add pkgs.system
This is an old compat definition for stdenv.hostPlatform.system
2021-10-27 09:36:27 -07:00
Alyssa Ross c13cf1e76f
Merge remote-tracking branch 'nixpkgs/master' into staging-next 2021-09-01 07:47:01 +00:00
Robert Hensing eb8e943493 Fix interaction between appendOverlays and otherPackageSets
The comment

    a dirty hack that should be removed

has led me to believe that nixpkgsFun isn't the right solution,
but bypassing it is worse, because it creates a second, inner
overriding mechanism that doesn't pass its changes to the old,
outer overriding mechanism.

Before this change:

    nix-repl> ((import <nixpkgs> {}).appendOverlays([(f: s: { foobarbaz = "ok"; })])).foobarbaz
    "ok"

    nix-repl> ((import <nixpkgs> {}).appendOverlays([(f: s: { foobarbaz = "ok"; })])).pkgsCross.aarch64-multiplatform.foobarbaz
    error: attribute 'foobarbaz' missing

           at «string»:1:1:

                1| ((import <nixpkgs> {}).appendOverlays([(f: s: { foobarbaz = "ok"; })])).pkgsCross.aarch64-multiplatform.foobarbaz
                 | ^
                2|

After this change:

    nix-repl> ((import ./. {}).appendOverlays([(f: s: { foobarbaz = "ok"; })])).pkgsCross.aarch64-multiplatform.foobarbaz
    "ok"

Thanks to samueldr for discovering this problem.
2021-08-31 09:18:08 +02:00
John Ericson 3edba5edfc pkgsStatic: Finally obviate overlay! 2021-08-20 06:09:48 +00:00
John Ericson f110a182a6 stdenv: Fix overriding + overrideAttrs
The old stdenv adapters were subtly wrong in two ways:

 - `overrideAttrs` leaked the original, unoverridden `mkDerivation`.

 - `stdenv.override` would throw away any manually-set `mkDerivation`
   from a stdenv reverting to the original.

Now, `mkDerivation` is controlled (nearly directly) via an argument, and
always correctly closes over the final ("self") stdenv. This means the
adapters can work entirely via `.override` without any manual `stdenv //
...`, and both those issues are fixed.

Note hashes are changed, because stdenvs no previously overridden like
`stdenvNoCC` and `crossLibcStdenv` now are. I had to add some
`dontDisableStatic = true` accordingly. The flip side however is that
since the overrides compose, we no longer need to override anything but
the default `stdenv` from which all the others are created.
2021-08-18 17:22:50 +00:00
Ryan Burns 565db30876 pkgsStatic: fix musleabi* adapter
Fixes pkgsCross.muslpi.nix (depends on
pkgsCross.muslpi.busybox-sandbox-shell, which depends on
pkgsCross.muslpi.pkgsStatic.stdenv)

Currently, the ABI adapter in pkgsStatic does not
recognize musleabi/musleabihf and falls back to "musl".

```
> nix eval -f . pkgsCross.muslpi.stdenv.hostPlatform.config
"armv6l-unknown-linux-musleabihf"
> nix eval -f . pkgsCross.muslpi.pkgsStatic.stdenv.hostPlatform.config
"armv6l-unknown-linux-musl"
```

This results in an invalid config passed to GCC configuration, which
fails with `Configuration armv6l-unknown-linux-musl not supported`.
2021-08-16 18:52:22 -07:00
sternenseemann 148d73fc74 pkgsLLVM.stdenv: use lld again
PR #122778 allowed the linker being chosen independently from useLLVM
which also affected pkgsLLVM where we were relying on this behavior.
For platform sets assembled from scratch useLLVM still implies
linker == "lld", however in the case of pkgsLLVM we update the current
platform via the set update operator which means that `linker` won't
be re-evaluated. Using ld.bfd with pkgsLLVM is okay to a certain extent,
but with C++ things begin to break.

We fix this by setting linker explicitly.
2021-08-03 22:39:29 +02:00
Sandro Jäckel 6708061975
top-level: fix typo 2021-06-17 11:16:37 +02:00
sternenseemann a13b1a7086 pkgsLLVM: cross compiled package set using llvm compilers
Provide a version of nixpkgs which is built using the LLVM toolchain.
This is achieved by reusing the useLLVM attribute usable in the cross
toolchain bootstrapping which is a) perfectly acceptable and b) the only
way to bootstrap a LLVM stdenv across platforms without unreasonable
amounts of work.

This is mostly working now since we fixed some issues with
llvmPackages_7.lldClang in #119717 and compile glibc with gcc at all
times as of #119786 (since clang can't compile our glibc at the moment).
There are seemingly some issues left to be ironed out, for example the
C++ library of ncurses fails to build with a linking issue. I have
attempted to alleviate that problem with #120790, but to no avail so
far.

Nonetheless, having a working pkgsLLVM.hello is a good start.

A currently present issue is that there is no way to change the libc
since there is some issue with lldClang actually picking up on the set
libc. This will need investigation and fixing.
2021-05-10 12:45:33 +02:00
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