Commit Graph

43 Commits

Author SHA1 Message Date
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
Nicolas B. Pierron
5783f66bc8 Internalize the recursion over the set of all packages. 2016-03-20 18:17:35 +00:00
Nicolas B. Pierron
f8dedbb101 Build aliases based on the previous set including all-packages, instead of only using all-packages. 2016-03-20 18:02:28 +00:00
Nicolas B. Pierron
01693ac154 Move stdenvAdapaters attribute from all-packages.nix into the stdenvAdapters of the top-level. 2016-03-20 17:50:06 +00:00
Nicolas B. Pierron
ff72cf185e Split helperFunctions to simplify the identification with the extend function. 2016-03-20 17:37:40 +00:00
Nicolas B. Pierron
5cdaa7b907 Remove all-packages.nix helperFunctions dependency. 2016-03-20 16:41:20 +00:00
Nicolas B. Pierron
ae0471b737 Split consecutive merge operators to simplify the identification of extend functions. 2016-03-20 16:40:36 +00:00
Nicolas B. Pierron
335a969d45 Inline pkgsFun in pkgsWithOverrides. 2016-03-20 16:33:46 +00:00
Nicolas B. Pierron
ad31783405 Extract the top-level logic out of all-packages.nix into pkgs/top-level/default.nix 2016-03-20 16:28:18 +00:00