Commit Graph

58 Commits

Author SHA1 Message Date
Robert Hensing
f2c5c706f4 lib.throwIfNot: init 2021-12-22 13:13:50 +01:00
Robert Hensing
cf73196411 nixpkgs: Check overlays types
This seems to be a common mistake and is worth checking so we can
provide a better error message.
2021-12-22 13:13:16 +01:00
John Ericson
2dde58903e top-level: Simplify impure and pure fallback
This is now possible, since the `platform` attribute has been removed in
PR #107214. I've been waiting to do a cleanup like this for a long time!
2021-01-23 10:01:38 -05:00
Cole Helbling
11eddd61bc
top-level: ignore unexpected args
This fixes both `nix-shell` failing to eval with `nixUnstable`, as well
as ofborg's failure to eval on aarch64 due to passing an "unexpected
arg" (1112e3a8c8/ofborg/src/nix.rs (L334-L340)).
2020-10-01 11:21:32 -07:00
Matthew Bauer
635b762569 systems: allow passing in string for cross/localSystem
This makes things a little bit more convenient. Just pass in like:

$ nix-build ’<nixpkgs>’ -A hello --argstr localSystem x86_64-linux --argstr crossSystem aarch64-linux
2019-06-04 11:17:25 -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
Jan Malakhovski
4a647dd225 pkgs/top-level: check types of nixpkgs.config
This patch simply introduces a plain simple NixOS module and passes
`nixpkgs.config` through it via `evalModules` (with some temporary hackery to
passthru undefined options).
2019-03-08 11:19:38 +02:00
Jan Malakhovski
849b10a419 top-level: fix a typo 2019-02-03 15:30:13 +00:00
Matthew Bauer
a3a6ad7a01 stdenv: implement crossOverlays
crossOverlays only apply to the packages being built, not the build
packages. It is useful when you don’t care what is used to build your
packages, just what is being built. The idea relies heavily on the
cross compiling infrastructure. Using this implies that we need to
create a cross stdenv.
2018-12-04 21:06:46 -06:00
John Ericson
abf27609c6 top-level: Move comma for stylistic consistency 2018-03-20 15:37:34 -04:00
Shea Levy
943592f698
Add setFunctionArgs lib function.
Among other things, this will allow *2nix tools to output plain data
while still being composable with the traditional
callPackage/.override interfaces.
2018-01-31 14:02:19 -05:00
Bjørn Forsman
ff252c799d Fix typo in comment 2017-04-19 20:30:44 +02:00
John Ericson
3efc661a1d Elaborate localSystem and crossSystem in a consistent manner 2017-04-17 17:13:01 -04:00
John Ericson
2227789392 lib: Collect system/platform related files
Previously, platforms was a random thing in top-level
2017-04-17 17:13:01 -04:00
John Ericson
8cd4c31d6b top-level: Allow nixpkgs to take localSystem directly
This is instead of both system and platform, which is kind of ugly.
2017-02-08 22:06:57 -05:00
John Ericson
4c17cd555f top-level: Document the {local,cross}System, contrasting with *Platform`
This is an implementation detail of how the bootstrapping chain is chosen,
and thus need not be in the manual.
2017-01-24 11:37:56 -05:00
John Ericson
92edcb7ebb top-level: Lay the groundwork for {build,host,target}Platform
The long term goal is a big replace:
  { inherit system platform; } => buildPlatform
  crossSystem => hostPlatform
  stdenv.cross => targetPlatform
And additionally making sure each is defined even when not cross compiling.

This commit refactors the bootstrapping code along that vision, but leaves
the old identifiers with their null semantics in place so packages can be
modernized incrementally.
2017-01-24 11:37:56 -05:00
Nicolas B. Pierron
f5dfe78a1e Add overlays mechanism to Nixpkgs.
This patch add a new argument to Nixpkgs default expression named "overlays".

By default, the value of the argument is either taken from the environment variable `NIXPKGS_OVERLAYS`,
or from the directory `~/.nixpkgs/overlays/`.  If the environment variable does not name a valid directory
then this mechanism would fallback on the home directory.  If the home directory does not exists it will
fallback on an empty list of overlays.

The overlays directory should contain the list of extra Nixpkgs stages which would be used to extend the
content of Nixpkgs, with additional set of packages.  The overlays, i-e directory, files, symbolic links
are used in alphabetical order.

The simplest overlay which extends Nixpkgs with nothing looks like:

```nix
self: super: {
}
```

More refined overlays can use `super` as the basis for building new packages, and `self` as a way to query
the final result of the fix-point.

An example of overlay which extends Nixpkgs with a small set of packages can be found at:
  https://github.com/nbp/nixpkgs-mozilla/blob/nixpkgs-overlay/moz-overlay.nix

To use this file, checkout the repository and add a symbolic link to
the `moz-overlay.nix` file in `~/.nixpkgs/overlays` directory.
2017-01-16 01:17:33 +01:00
John Ericson
3e197f7d81 top-level: Normalize stdenv booting
Introduce new abstraction, `stdenv/booter.nix` for composing bootstraping
stages, and use it everywhere for consistency. See that file for more doc.

Stdenvs besides Linux and Darwin are completely refactored to utilize this.
Those two, due to their size and complexity, are minimally edited for
easier reviewing.

No hashes should be changed.
2017-01-13 13:23:23 -05:00
Eric Litak
489ba1744c top-level: missing parentheses 2016-12-20 16:27:04 -08:00
John Ericson
19fbe80c3d top-level: avoid another assert false while we're at it 2016-12-15 17:09:46 -05:00
John Ericson
5c6234a7d3 top-level: Allow manually specifying a stdenv, and fix stdenv tests
- The darwin test can now force the use of the freshly-booted darwin stdenv
 - The linux test now passes enough dummy arguments

This may make debugging harder, if so, check out #20889
2016-12-03 17:21:07 -08:00
John Ericson
a55d1ecc90 top-level: Document why nixpkgsFun doesn't close over inferred default arguments 2016-12-01 11:24:33 -05:00
John Ericson
05c12f147e top-level: Move default-choosing logic to top-level/platforms.nix
This mirrors stdenv/default.nix
2016-12-01 11:24:32 -05:00
John Ericson
39753f5360 top-level: Close over fewer arguments for stdenv stages
This makes the flow of data easier to understand. There's little downside
because the args in question are already inspected by the stdenvs.

cross-compiling in particular is simpler because we don't need to worry
about overriding the config closed over by `allPackages`.
2016-11-30 19:11:03 -05:00
John Ericson
d240a0da1a top-level: Remove cycles: stdenv calls in top-level but not vice versa
This commit changes the dependencies of stdenv, and clean-up the stdenv
story by removing the `defaultStdenv` attribute as well as the `bootStdenv`
parameter.

Before, the final bootstrapping stage's stdenv was provided by
all-packages, which was iterating multiple times over the
top-level/default.nix expression, and non-final bootstrapping stages'
stdenvs were explicitly specified with the `bootStdenv` parameter.

Now, all stages' stdenvs are specified with the `stdenv` parameter.
For non-final bootstrapping stages, this is a small change---basically just
rename the parameter.
For the final stage, top-level/default.nix takes the chosen stdenv and
makes the final stage with it.

`allPackages` is used to make all bootstrapping stages, final and
non-final alike. It's basically the expression of `stage.nix` (along with a
few partially-applied default arguments)

Note, the make-bootstrap-tools scripts are temporarily broken
2016-11-30 19:10:59 -05:00
John Ericson
07a2b17cbf top-level: Split some of pkgs/top-level/default.nix to pkgs/top-level/stage.nix
This is preparation for the latter just building a single stage, and the
former building a package set with the bootstrapped stdenv.
2016-11-30 19:04:22 -05:00
John Ericson
ea7bf02268 top-level: top-level/stdenv.nix no longer needs pkg argument 2016-11-06 21:28:38 -08:00
John Ericson
e22346c35e top-level: Make stdenvCross which appears at first glance normal...
...but actually is weird just like the original
2016-11-06 21:27:38 -08:00
John Ericson
eed34bd214 top-level: Remove redundant arguments from top-level/{all-package,stdenv}.nix 2016-11-02 18:36:02 -04:00
John Ericson
68a04c1195 top-level: Inline topLevelArugments, and make pkg named arg for stdenv
[Trying my best to indent properly while avoiding excessive drift]
2016-11-02 18:35:03 -04:00
John Ericson
05977b236b top-level: Remove redundant parentheses 2016-11-02 17:38:16 -04:00
John Ericson
a113382f2c top-level: Use nixpkgsFun to avoid import ../.. 2016-11-02 21:50:24 +01:00
John Ericson
3ca3b145ea top-level: Use foldl' to make the list of package functions top to bottom 2016-10-13 11:15:52 -04:00
John Ericson
e4cd45a30c top-level: Make overridePackages extend rather than replace existing overrides 2016-10-13 11:14:11 -04:00
Eelco Dolstra
97bfc2fac9 runCommand: Use stdenvNoCC
This ensures that most "trivial" derivations used to build NixOS
configurations no longer depend on GCC. For commands that do invoke
gcc, there is runCommandCC.
2016-09-29 13:06:43 +02:00
John Ericson
4af2bf6663 Separate fix-point from config importing hacks and other impurities 2016-07-14 14:33:23 -07:00
John Ericson
29de9cedad Make default config an argument default instead of using null check
Thanks @Mathnerd314 for this idea
2016-07-09 13:06:19 -07:00
John Ericson
351352f68d Remove gccWith* arguments which are unused 2016-06-22 00:45:05 -07:00
John Ericson
98b9403a22 top-level: builtins.toPath no longer needed 2016-06-21 00:19:00 -07:00
zimbatm
bec28d748c Remove unecessary branching on old nix versions
All these builtins are available since 1.10 or earlier (1.10 being the
lib/minver.nix)
2016-06-17 11:06:48 +01:00
Nicolas B. Pierron
87ad35e336 Fix comments typos. 2016-03-24 19:40:12 +00:00
Nicolas B. Pierron
aa7f0fc214 Move stdenvOverrides under pkgsWithOverrides. 2016-03-20 19:26:57 +00:00
Nicolas B. Pierron
5ae7356d42 Replace the merge operators by the fix' and extends functions. 2016-03-20 19:23:08 +00:00
Nicolas B. Pierron
1bcefcdf5c Under pkgsWithOverrides, replace the last uses of pkgs by the corresponding argument. 2016-03-20 19:18:33 +00:00
Nicolas B. Pierron
800766fb0b Change the customOverrides to use the stdenvOverrides instead of the original package set. 2016-03-20 19:10:48 +00:00
Nicolas B. Pierron
21b8007bcf Move the customOverrides after the stdenvOverrides.
This change is not backward compatible, in the sense that this allow you to
override the packages which used to be overriden by the last stage of
stdenv.  Note, this does not mean that these packages would be used by
stdenv.
2016-03-20 19:04:15 +00:00
Nicolas B. Pierron
9e8c5208a1 Add bootStdenv condition around the overrider.
This condition used to be implicit in the sense that the stdenvOverrides
uses pkgs_6, instead of pkgs_7 as its super set, and also that each stage of
the compiler is build again the bootstrap packages of the previous stage,
thus overriden by the stdenv.override function.
2016-03-20 19:03:37 +00:00
Nicolas B. Pierron
598ed874df Add extra argument to better identity with the extend function later. 2016-03-20 18:23:29 +00:00
Nicolas B. Pierron
a190baa479 In top-level/default.nix, rename self to allPackages. 2016-03-20 18:18:39 +00:00