Commit Graph

18 Commits

Author SHA1 Message Date
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
Matthew Bauer
97a3c7f5a3 top-level/impure.nix: expose crossOverlays 2019-04-19 12:03:56 -04:00
Jan Malakhovski
107f0fc9e7 top-level: cleanup whitespace 2019-02-03 15:30:14 +00:00
Matthew Bauer
31eac6fd00 impure.nix: fix handling of localSystem
If we passed a localSystem in, we don’t want the current system to
override it. Now we check for localSystem first to avoid getting
"mixed" localSystem values from commands like this:

  nix-build --arg localSystem '{config="x86_64-unknown-linux-musl";}' -A hello

Which would eventually evaluate localSystem to this:

{
  config = "x86_64-unknown-linux-musl";
  system = "x86_64-darwin";
}

& Nix would not be able to run it correctly.

Fixes #41599

/cc @Ericson2314
2018-06-25 17:13:02 -04:00
Yorick
20bb5fb0d9
impure.nix: stringify path from NIX_PATH
If impure.nix gets the path from NIX_PATH, the type is `path`, and `path+"/."` is a no-op. Stringify it first so `isDir` will return false if it's not, in fact, a dir. This way, single files can be specified with nixpkgs-overlays in the NIX_PATH.
2018-05-04 13:12:09 +02:00
Tuomas Tynkkynen
0c368ef02f treewide: Escape backslash in strings properly
"\." is apparently the same as "." wheras the correct one is "\\."
2017-09-14 01:03:39 +03:00
Michael Peyton Jones
9235ff1259 Overlays: allow overlays to be specified in a file 2017-08-17 22:13:39 +00:00
Matthew Bauer
5c7815a388
impure.nix: add crossSystem as arg 2017-04-29 15:22:33 -05:00
Tom Hunger
4a524cf662 Allow directories with a default.nix to be imported as an overlay. Closes #23016.
Note that ${} substitution doesn't work because of the "cannot refer
to other paths" constraint. The paranthesis are needed to enforce
right-first evaluation.
2017-02-25 02:32:04 +01:00
John Ericson
d680f541bf top-level: Hack around Nix's --arg logic not handling unnamed params 2017-02-09 11:54:17 -05: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
Eelco Dolstra
b70a979c69
Remove unnecessary "sort" call
attrNames already returns names in sorted order.
2017-02-01 20:29:34 +01:00
Eelco Dolstra
9d6a55aefd
~/.nixpkgs -> ~/.config/nixpkgs
The former is still respected as a fallback for config.nix for
backwards compatibility (but not for overlays because they're a new
feature).
2017-02-01 16:07:55 +01:00
Eelco Dolstra
7dacca324d
$NIXPKGS_OVERLAYS -> <nixpkgs-overlays>
The Nix search path is the established mechanism for specifying the
location of Nix expressions, so let's use it instead of adding another
environment variable.
2017-02-01 16:07:54 +01:00
Eelco Dolstra
86fe7a40ac
Only read overlays ending in .nix
For example, this prevents Nix from barfing on editor backup files in
~/.nixpkgs/overlays.
2017-02-01 16:07:54 +01:00
Nicolas B. Pierron
f9da1fa957 Throw an error if NIXPKGS_OVERLAYS is invalid and improve documentation. 2017-01-16 01:17:33 +01: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
4af2bf6663 Separate fix-point from config importing hacks and other impurities 2016-07-14 14:33:23 -07:00