summary refs log tree commit diff
path: root/pkgs/top-level/default.nix
diff options
context:
space:
mode:
authorNicolas B. Pierron <nicolas.b.pierron@nbp.name>2016-12-17 18:05:21 +0000
committerNicolas B. Pierron <nicolas.b.pierron@gmail.com>2017-01-16 01:17:33 +0100
commitf5dfe78a1eb5ff8dfcc7ab37cfc132c5f31d3cef (patch)
treed7422aa64c2735316fb2bdd2022f90d7a15a453c /pkgs/top-level/default.nix
parent7c8d3aa21d420f5e1546d0021c2e950ac1ebf4c6 (diff)
downloadnixpkgs-f5dfe78a1eb5ff8dfcc7ab37cfc132c5f31d3cef.tar
nixpkgs-f5dfe78a1eb5ff8dfcc7ab37cfc132c5f31d3cef.tar.gz
nixpkgs-f5dfe78a1eb5ff8dfcc7ab37cfc132c5f31d3cef.tar.bz2
nixpkgs-f5dfe78a1eb5ff8dfcc7ab37cfc132c5f31d3cef.tar.lz
nixpkgs-f5dfe78a1eb5ff8dfcc7ab37cfc132c5f31d3cef.tar.xz
nixpkgs-f5dfe78a1eb5ff8dfcc7ab37cfc132c5f31d3cef.tar.zst
nixpkgs-f5dfe78a1eb5ff8dfcc7ab37cfc132c5f31d3cef.zip
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.
Diffstat (limited to 'pkgs/top-level/default.nix')
-rw-r--r--pkgs/top-level/default.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix
index 04daf9778ff..a146dad63bc 100644
--- a/pkgs/top-level/default.nix
+++ b/pkgs/top-level/default.nix
@@ -23,6 +23,9 @@
 , # Allow a configuration attribute set to be passed in as an argument.
   config ? {}
 
+, # List of overlays layers used to extend Nixpkgs.
+  overlays ? []
+
 , # A function booting the final package set for a specific standard
   # environment. See below for the arguments given to that function,
   # the type of list it returns.
@@ -80,7 +83,7 @@ in let
   boot = import ../stdenv/booter.nix { inherit lib allPackages; };
 
   stages = stdenvStages {
-    inherit lib system platform crossSystem config;
+    inherit lib system platform crossSystem config overlays;
   };
 
   pkgs = boot stages;