diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000000..14bee08e3811
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,16 @@
+**/deps.nix linguist-generated
+**/node-packages.nix linguist-generated
+
+pkgs/applications/editors/emacs-modes/*-generated.nix linguist-generated
+pkgs/development/r-modules/*-packages.nix linguist-generated
+pkgs/development/haskell-modules/hackage-packages.nix linguist-generated
+pkgs/development/beam-modules/hex-packages.nix linguist-generated
+
+doc/** linguist-documentation
+doc/default.nix linguist-documentation=false
+
+nixos/doc/** linguist-documentation
+nixos/doc/default.nix linguist-documentation=false
+
+nixos/modules/module-list.nix merge=union
+pkgs/top-level/all-packages.nix merge=union
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 9e89cc78954f..dde31a2c0c01 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -10,18 +10,19 @@
# This file
/.github/CODEOWNERS @edolstra
-# Boostraping and core infra
-/pkgs/stdenv @edolstra
-/pkgs/build-support/cc-wrapper @edolstra
-
# Libraries
/lib @edolstra @nbp
+/lib/systems @nbp @ericson2314
# Nixpkgs Internals
-/default.nix @nbp
-/pkgs/top-level/default.nix @nbp
-/pkgs/top-level/impure.nix @nbp
-/pkgs/top-level/stage.nix @nbp
+/default.nix @nbp
+/pkgs/top-level/default.nix @nbp @Ericson2314
+/pkgs/top-level/impure.nix @nbp @Ericson2314
+/pkgs/top-level/stage.nix @nbp @Ericson2314
+/pkgs/stdenv
+/pkgs/build-support/cc-wrapper @Ericson2314 @orivej
+/pkgs/build-support/bintools-wrapper @Ericson2314 @orivej
+/pkgs/build-support/setup-hooks @Ericson2314
# NixOS Internals
/nixos/default.nix @nbp
@@ -82,4 +83,10 @@
/pkgs/applications/editors/eclipse @rycee
# https://github.com/NixOS/nixpkgs/issues/31401
-/lib/maintainers.nix @ghost
+/lib/licenses.nix @ghost
+
+# Qt / KDE
+/pkgs/applications/kde @ttuegel
+/pkgs/desktops/plasma-5 @ttuegel
+/pkgs/development/libraries/kde-frameworks @ttuegel
+/pkgs/development/libraries/qt-5 @ttuegel
diff --git a/.version b/.version
index a88d2ca32319..770bde1f44b3 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-18.03
+18.09
diff --git a/COPYING b/COPYING
index afc460fff5cb..198597a1b410 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2017 Eelco Dolstra and the Nixpkgs/NixOS contributors
+Copyright (c) 2003-2018 Eelco Dolstra and the Nixpkgs/NixOS contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/README.md b/README.md
index 64cfb25eac34..3f2ff48dd92a 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,9 @@
-[](https://nixos.org/nixos)
+[](https://nixos.org/nixos)
-[](https://travis-ci.org/NixOS/nixpkgs)
[](https://www.codetriage.com/nixos/nixpkgs)
Nixpkgs is a collection of packages for the [Nix](https://nixos.org/nix/) package
-manager. It is periodically built and tested by the [hydra](http://hydra.nixos.org/)
+manager. It is periodically built and tested by the [Hydra](https://hydra.nixos.org/)
build daemon as so-called channels. To get channel information via git, add
[nixpkgs-channels](https://github.com/NixOS/nixpkgs-channels.git) as a remote:
@@ -23,7 +22,7 @@ release and `nixos-unstable` for the latest successful build of master:
For pull-requests, please rebase onto nixpkgs `master`.
-[NixOS](https://nixos.org/nixos/) linux distribution source code is located inside
+[NixOS](https://nixos.org/nixos/) Linux distribution source code is located inside
`nixos/` folder.
* [NixOS installation instructions](https://nixos.org/nixos/manual/#ch-installation)
diff --git a/doc/coding-conventions.xml b/doc/coding-conventions.xml
index 765fc56c3bb3..d556c7ebe1ed 100644
--- a/doc/coding-conventions.xml
+++ b/doc/coding-conventions.xml
@@ -18,9 +18,9 @@
tab settings so it’s asking for trouble.
Use lowerCamelCase for variable
- names, not UpperCamelCase. TODO: naming of
- attributes in
- all-packages.nix?
+ names, not UpperCamelCase. Note, this rule does
+ not apply to package attribute names, which instead follow the rules
+ in .
Function calls with attribute set arguments are
written as
@@ -220,9 +220,10 @@ args.stdenv.mkDerivation (args // {
The variable name used for the instantiated package
in all-packages.nix, and when passing it as a
- dependency to other functions. This is what Nix expression authors
- see. It can also be used when installing using nix-env
- -iA.
+ dependency to other functions. Typically this is called the
+ package attribute name. This is what Nix
+ expression authors see. It can also be used when installing using
+ nix-env -iA.The filename for (the directory containing) the Nix
expression.
@@ -259,12 +260,12 @@ bound to the variable name e2fsprogs in
Also append "unstable" to the name - e.g.,
"pkgname-unstable-2014-09-23".
- Dashes in the package name should be preserved
- in new variable names, rather than converted to underscores
- (which was convention up to around 2013 and most names
- still have underscores instead of dashes) — e.g.,
- http-parser instead of
- http_parser.
+ Dashes in the package name should be preserved in
+ new variable names, rather than converted to underscores or camel
+ cased — e.g., http-parser instead of
+ http_parser or httpParser. The
+ hyphenated style is preferred in all three package
+ names.If there are multiple versions of a package, this
should be reflected in the variable names in
diff --git a/doc/cross-compilation.xml b/doc/cross-compilation.xml
index 4b35b72feae0..10e4706b0590 100644
--- a/doc/cross-compilation.xml
+++ b/doc/cross-compilation.xml
@@ -61,7 +61,7 @@
The "target platform" attribute is, unlike the other two attributes, not actually fundamental to the process of building software.
- Instead, it is only relevant for compatability with building certain specific compilers and build tools.
+ Instead, it is only relevant for compatibility with building certain specific compilers and build tools.
It can be safely ignored for all other packages.
@@ -162,7 +162,7 @@
A runtime dependency between 2 packages implies that between them both the host and target platforms match.
This is directly implied by the meaning of "host platform" and "runtime dependency":
- The package dependency exists while both packages are runnign on a single host platform.
+ The package dependency exists while both packages are running on a single host platform.
A build time dependency, however, implies a shift in platforms between the depending package and the depended-on package.
@@ -187,7 +187,7 @@
How does this work in practice? Nixpkgs is now structured so that build-time dependencies are taken from buildPackages, whereas run-time dependencies are taken from the top level attribute set.
For example, buildPackages.gcc should be used at build time, while gcc should be used at run time.
Now, for most of Nixpkgs's history, there was no buildPackages, and most packages have not been refactored to use it explicitly.
- Instead, one can use the four attributes used for specifying dependencies as documented in .
+ Instead, one can use the six (gasp) attributes used for specifying dependencies as documented in .
We "splice" together the run-time and build-time package sets with callPackage, and then mkDerivation for each of four attributes pulls the right derivation out.
This splicing can be skipped when not cross compiling as the package sets are the same, but is a bit slow for cross compiling.
Because of this, a best-of-both-worlds solution is in the works with no splicing or explicit access of buildPackages needed.
@@ -200,6 +200,45 @@
+
+ Cross packagaing cookbook
+
+ Some frequently problems when packaging for cross compilation are good to just spell and answer.
+ Ideally the information above is exhaustive, so this section cannot provide any new information,
+ but its ludicrous and cruel to expect everyone to spend effort working through the interaction of many features just to figure out the same answer to the same common problem.
+ Feel free to add to this list!
+
+
+
+
+ What if my package's build system needs to build a C program to be run under the build environment?
+
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ Add it to your mkDerivation invocation.
+
+
+
+
+ My package fails to find ar.
+
+
+ Many packages assume that an unprefixed ar is available, but Nix doesn't provide one.
+ It only provides a prefixed one, just as it only does for all the other binutils programs.
+ It may be necessary to patch the package to fix the build system to use a prefixed `ar`.
+
+
+
+
+ My package's testsuite needs to run host platform code.
+
+
+ doCheck = stdenv.hostPlatform != stdenv.buildPlatfrom;
+ Add it to your mkDerivation invocation.
+
+
+
+
@@ -214,8 +253,19 @@
or also with crossSystem, in which case packages run on the latter, but all building happens on the former.
Both parameters take the same schema as the 3 (build, host, and target) platforms defined in the previous section.
As mentioned above, lib.systems.examples has some platforms which are used as arguments for these parameters in practice.
- You can use them programmatically, or on the command line like nix-build <nixpkgs> --arg crossSystem '(import <nixpkgs/lib>).systems.examples.fooBarBaz'.
+ You can use them programmatically, or on the command line:
+nix-build <nixpkgs> --arg crossSystem '(import <nixpkgs/lib>).systems.examples.fooBarBaz' -A whatever
+
+
+ Eventually we would like to make these platform examples an unnecessary convenience so that
+nix-build <nixpkgs> --arg crossSystem.config '<arch>-<os>-<vendor>-<abi>' -A whatever
+ works in the vast majority of cases.
+ The problem today is dependencies on other sorts of configuration which aren't given proper defaults.
+ We rely on the examples to crudely to set those configuration parameters in some vaguely sane manner on the users behalf.
+ Issue #34274 tracks this inconvenience along with its root cause in crufty configuration options.
+
+
While one is free to pass both parameters in full, there's a lot of logic to fill in missing fields.
As discussed in the previous section, only one of system, config, and parsed is needed to infer the other two.
diff --git a/doc/default.nix b/doc/default.nix
index cfd51fba257e..ec458634a42c 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -23,11 +23,12 @@ pkgs.stdenv.mkDerivation {
buildCommand = let toDocbook = { useChapters ? false, inputFile, outputFile }:
let
- extraHeader = ''xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" '';
+ extraHeader = lib.optionalString (!useChapters)
+ ''xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" '';
in ''
{
- pandoc '${inputFile}' -w docbook ${lib.optionalString useChapters "--top-level-division=chapter"} \
- --smart \
+ pandoc '${inputFile}' -w docbook+smart ${lib.optionalString useChapters "--top-level-division=chapter"} \
+ -f markdown+smart \
| sed -e 's|||' \
-e 's| .version
diff --git a/doc/languages-frameworks/coq.xml b/doc/languages-frameworks/coq.xml
index d16c9f3dc87f..0ce1abd6194c 100644
--- a/doc/languages-frameworks/coq.xml
+++ b/doc/languages-frameworks/coq.xml
@@ -11,31 +11,53 @@
in the Coq derivation.
- Some libraries require OCaml and sometimes also Camlp5. The exact
- versions that were used to build Coq are saved in the
+ Some libraries require OCaml and sometimes also Camlp5 or findlib.
+ The exact versions that were used to build Coq are saved in the
coq.ocaml and coq.camlp5
- attributes.
+ and coq.findlib attributes.
+
+
+ Coq libraries may be compatible with some specific versions of Coq only.
+ The compatibleCoqVersions attribute is used to
+ precisely select those versions of Coq that are compatible with this
+ derivation.
Here is a simple package example. It is a pure Coq library, thus it
- only depends on Coq. Its makefile has been
- generated using coq_makefile so we only have to
+ depends on Coq. It builds on the Mathematical Components library, thus it
+ also takes mathcomp as buildInputs.
+ Its Makefile has been generated using
+ coq_makefile so we only have to
set the $COQLIB variable at install time.
-{stdenv, fetchurl, coq}:
-stdenv.mkDerivation {
- src = fetchurl {
- url = http://coq.inria.fr/pylons/contribs/files/Karatsuba/v8.4/Karatsuba.tar.gz;
- sha256 = "0ymfpv4v49k4fm63nq6gcl1hbnnxrvjjp7yzc4973n49b853c5b1";
+{ stdenv, fetchFromGitHub, coq, mathcomp }:
+
+stdenv.mkDerivation rec {
+ name = "coq${coq.coq-version}-multinomials-${version}";
+ version = "1.0";
+ src = fetchFromGitHub {
+ owner = "math-comp";
+ repo = "multinomials";
+ rev = version;
+ sha256 = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m";
};
- name = "coq-karatsuba";
-
buildInputs = [ coq ];
+ propagatedBuildInputs = [ mathcomp ];
installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/";
+
+ meta = {
+ description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials";
+ inherit (src.meta) homepage;
+ license = stdenv.lib.licenses.cecill-b;
+ inherit (coq.meta) platforms;
+ };
+
+ passthru = {
+ compatibleCoqVersions = v: builtins.elem v [ "8.5" "8.6" "8.7" ];
+ };
}
-
diff --git a/doc/languages-frameworks/emscripten.md b/doc/languages-frameworks/emscripten.md
new file mode 100644
index 000000000000..24c49ec1409c
--- /dev/null
+++ b/doc/languages-frameworks/emscripten.md
@@ -0,0 +1,185 @@
+# User's Guide to Emscripten in Nixpkgs
+
+[Emscripten](https://github.com/kripken/emscripten): An LLVM-to-JavaScript Compiler
+
+This section of the manual covers how to use `emscripten` in nixpkgs.
+
+Minimal requirements:
+
+* nix
+* nixpkgs
+
+Modes of use of `emscripten`:
+
+* **Imperative usage** (on the command line):
+
+ If you want to work with `emcc`, `emconfigure` and `emmake` as you are used to from Ubuntu and similar distributions you can use these commands:
+
+ * `nix-env -i emscripten`
+ * `nix-shell -p emscripten`
+
+* **Declarative usage**:
+
+ This mode is far more power full since this makes use of `nix` for dependency management of emscripten libraries and targets by using the `mkDerivation` which is implemented by `pkgs.emscriptenStdenv` and `pkgs.buildEmscriptenPackage`. The source for the packages is in `pkgs/top-level/emscripten-packages.nix` and the abstraction behind it in `pkgs/development/em-modules/generic/default.nix`.
+ * build and install all packages:
+ * `nix-env -iA emscriptenPackages`
+
+ * dev-shell for zlib implementation hacking:
+ * `nix-shell -A emscriptenPackages.zlib`
+
+
+## Imperative usage
+
+A few things to note:
+
+* `export EMCC_DEBUG=2` is nice for debugging
+* `~/.emscripten`, the build artifact cache sometimes creates issues and needs to be removed from time to time
+
+
+## Declarative usage
+
+Let's see two different examples from `pkgs/top-level/emscripten-packages.nix`:
+
+* `pkgs.zlib.override`
+* `pkgs.buildEmscriptenPackage`
+
+Both are interesting concepts.
+
+A special requirement of the `pkgs.buildEmscriptenPackage` is the `doCheck = true` is a default meaning that each emscriptenPackage requires a `checkPhase` implemented.
+
+* Use `export EMCC_DEBUG=2` from within a emscriptenPackage's `phase` to get more detailed debug output what is going wrong.
+* ~/.emscripten cache is requiring us to set `HOME=$TMPDIR` in individual phases. This makes compilation slower but also makes it more deterministic.
+
+### Usage 1: pkgs.zlib.override
+
+This example uses `zlib` from nixpkgs but instead of compiling **C** to **ELF** it compiles **C** to **JS** since we were using `pkgs.zlib.override` and changed stdenv to `pkgs.emscriptenStdenv`. A few adaptions and hacks were set in place to make it working. One advantage is that when `pkgs.zlib` is updated, it will automatically update this package as well. However, this can also be the downside...
+
+See the `zlib` example:
+
+ zlib = (pkgs.zlib.override {
+ stdenv = pkgs.emscriptenStdenv;
+ }).overrideDerivation
+ (old: rec {
+ buildInputs = old.buildInputs ++ [ pkgconfig ];
+ # we need to reset this setting!
+ NIX_CFLAGS_COMPILE="";
+ configurePhase = ''
+ # FIXME: Some tests require writing at $HOME
+ HOME=$TMPDIR
+ runHook preConfigure
+
+ #export EMCC_DEBUG=2
+ emconfigure ./configure --prefix=$out --shared
+
+ runHook postConfigure
+ '';
+ dontStrip = true;
+ outputs = [ "out" ];
+ buildPhase = ''
+ emmake make
+ '';
+ installPhase = ''
+ emmake make install
+ '';
+ checkPhase = ''
+ echo "================= testing zlib using node ================="
+
+ echo "Compiling a custom test"
+ set -x
+ emcc -O2 -s EMULATE_FUNCTION_POINTER_CASTS=1 test/example.c -DZ_SOLO \
+ libz.so.${old.version} -I . -o example.js
+
+ echo "Using node to execute the test"
+ ${pkgs.nodejs}/bin/node ./example.js
+
+ set +x
+ if [ $? -ne 0 ]; then
+ echo "test failed for some reason"
+ exit 1;
+ else
+ echo "it seems to work! very good."
+ fi
+ echo "================= /testing zlib using node ================="
+ '';
+
+ postPatch = pkgs.stdenv.lib.optionalString pkgs.stdenv.isDarwin ''
+ substituteInPlace configure \
+ --replace '/usr/bin/libtool' 'ar' \
+ --replace 'AR="libtool"' 'AR="ar"' \
+ --replace 'ARFLAGS="-o"' 'ARFLAGS="-r"'
+ '';
+ });
+
+### Usage 2: pkgs.buildEmscriptenPackage
+
+This `xmlmirror` example features a emscriptenPackage which is defined completely from this context and no `pkgs.zlib.override` is used.
+
+ xmlmirror = pkgs.buildEmscriptenPackage rec {
+ name = "xmlmirror";
+
+ buildInputs = [ pkgconfig autoconf automake libtool gnumake libxml2 nodejs openjdk json_c ];
+ nativeBuildInputs = [ pkgconfig zlib ];
+
+ src = pkgs.fetchgit {
+ url = "https://gitlab.com/odfplugfest/xmlmirror.git";
+ rev = "4fd7e86f7c9526b8f4c1733e5c8b45175860a8fd";
+ sha256 = "1jasdqnbdnb83wbcnyrp32f36w3xwhwp0wq8lwwmhqagxrij1r4b";
+ };
+
+ configurePhase = ''
+ rm -f fastXmlLint.js*
+ # a fix for ERROR:root:For asm.js, TOTAL_MEMORY must be a multiple of 16MB, was 234217728
+ # https://gitlab.com/odfplugfest/xmlmirror/issues/8
+ sed -e "s/TOTAL_MEMORY=234217728/TOTAL_MEMORY=268435456/g" -i Makefile.emEnv
+ # https://github.com/kripken/emscripten/issues/6344
+ # https://gitlab.com/odfplugfest/xmlmirror/issues/9
+ sed -e "s/\$(JSONC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(LIBXML20_LDFLAGS)/\$(JSONC_LDFLAGS) \$(LIBXML20_LDFLAGS) \$(ZLIB_LDFLAGS) /g" -i Makefile.emEnv
+ # https://gitlab.com/odfplugfest/xmlmirror/issues/11
+ sed -e "s/-o fastXmlLint.js/-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -o fastXmlLint.js/g" -i Makefile.emEnv
+ '';
+
+ buildPhase = ''
+ HOME=$TMPDIR
+ make -f Makefile.emEnv
+ '';
+
+ outputs = [ "out" "doc" ];
+
+ installPhase = ''
+ mkdir -p $out/share
+ mkdir -p $doc/share/${name}
+
+ cp Demo* $out/share
+ cp -R codemirror-5.12 $out/share
+ cp fastXmlLint.js* $out/share
+ cp *.xsd $out/share
+ cp *.js $out/share
+ cp *.xhtml $out/share
+ cp *.html $out/share
+ cp *.json $out/share
+ cp *.rng $out/share
+ cp README.md $doc/share/${name}
+ '';
+ checkPhase = ''
+
+ '';
+ };
+
+### Declarative debugging
+
+Use `nix-shell -I nixpkgs=/some/dir/nixpkgs -A emscriptenPackages.libz` and from there you can go trough the individual steps. This makes it easy to build a good `unit test` or list the files of the project.
+
+1. `nix-shell -I nixpkgs=/some/dir/nixpkgs -A emscriptenPackages.libz`
+2. `cd /tmp/`
+3. `unpackPhase`
+4. cd libz-1.2.3
+5. `configurePhase`
+6. `buildPhase`
+7. ... happy hacking...
+
+## Summary
+
+Using this toolchain makes it easy to leverage `nix` from NixOS, MacOSX or even Windows (WSL+ubuntu+nix). This toolchain is reproducible, behaves like the rest of the packages from nixpkgs and contains a set of well working examples to learn and adapt from.
+
+If in trouble, ask the maintainers.
+
diff --git a/doc/languages-frameworks/haskell.md b/doc/languages-frameworks/haskell.md
index da3fd770ce72..1623e0d276f2 100644
--- a/doc/languages-frameworks/haskell.md
+++ b/doc/languages-frameworks/haskell.md
@@ -48,7 +48,7 @@ trouble with packages like `3dmodels` and `4Blocks`, because these names are
invalid identifiers in the Nix language. The issue of how to deal with these
rare corner cases is currently unresolved.)
-Haskell packages who's Nix name (second column) begins with a `haskell-` prefix
+Haskell packages whose Nix name (second column) begins with a `haskell-` prefix
are packages that provide a library whereas packages without that prefix
provide just executables. Libraries may provide executables too, though: the
package `haskell-pandoc`, for example, installs both a library and an
@@ -334,14 +334,10 @@ navigate there.
Finally, you can run
```shell
-hoogle server -p 8080
+hoogle server -p 8080 --local
```
and navigate to http://localhost:8080/ for your own local
-[Hoogle](https://www.haskell.org/hoogle/). Note, however, that Firefox and
-possibly other browsers disallow navigation from `http:` to `file:` URIs for
-security reasons, which might be quite an inconvenience. See [this
-page](http://kb.mozillazine.org/Links_to_local_pages_do_not_work) for
-workarounds.
+[Hoogle](https://www.haskell.org/hoogle/).
### How to build a Haskell project using Stack
@@ -581,8 +577,8 @@ nix-shell "" -A haskellPackages.bar.env
Every Haskell package set takes a function called `overrides` that you can use
to manipulate the package as much as you please. One useful application of this
feature is to replace the default `mkDerivation` function with one that enables
-library profiling for all packages. To accomplish that, add configure the
-following snippet in your `~/.config/nixpkgs/config.nix` file:
+library profiling for all packages. To accomplish that add the following
+snippet to your `~/.config/nixpkgs/config.nix` file:
```nix
{
packageOverrides = super: let self = super.pkgs; in
@@ -693,9 +689,7 @@ might be necessary to purge the local caches that store data from those
machines to disable these binary channels for the duration of the previous
command, i.e. by running:
```shell
-rm /nix/var/nix/binary-cache-v3.sqlite
-rm /nix/var/nix/manifests/*
-rm /nix/var/nix/channel-cache/*
+rm ~/.cache/nix/binary-cache*.sqlite
```
### Builds on Darwin fail with `math.h` not found
@@ -777,14 +771,14 @@ to find out the store path of the system's zlib library. Now, you can
stack --extra-lib-dirs=/nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib build
```
- Typically, you'll need `--extra-include-dirs` as well. It's possible
- to add those flag to the project's `stack.yaml` or your user's
- global `~/.stack/global/stack.yaml` file so that you don't have to
- specify them manually every time. But again, you're likely better off
- using Stack's Nix support instead.
+Typically, you'll need `--extra-include-dirs` as well. It's possible
+to add those flag to the project's `stack.yaml` or your user's
+global `~/.stack/global/stack.yaml` file so that you don't have to
+specify them manually every time. But again, you're likely better off
+using Stack's Nix support instead.
- The same thing applies to `cabal configure`, of course, if you're
- building with `cabal-install` instead of Stack.
+The same thing applies to `cabal configure`, of course, if you're
+building with `cabal-install` instead of Stack.
### Creating statically linked binaries
diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml
index fc15d847d15f..6743c131201f 100644
--- a/doc/languages-frameworks/index.xml
+++ b/doc/languages-frameworks/index.xml
@@ -30,6 +30,7 @@ such as Perl or Haskell. These are described in this chapter.
+
diff --git a/doc/languages-frameworks/perl.xml b/doc/languages-frameworks/perl.xml
index dfb463b99912..149fcb275a09 100644
--- a/doc/languages-frameworks/perl.xml
+++ b/doc/languages-frameworks/perl.xml
@@ -177,5 +177,19 @@ you need it.
+Cross-compiling modules
+
+Nixpkgs has experimental support for cross-compiling Perl
+modules. In many cases, it will just work out of the box, even for
+modules with native extensions. Sometimes, however, the Makefile.PL
+for a module may (indirectly) import a native module. In that case,
+you will need to make a stub for that module that will satisfy the
+Makefile.PL and install it into
+lib/perl5/site_perl/cross_perl/${perl.version}.
+See the postInstall for DBI for
+an example.
+
+
+
diff --git a/doc/languages-frameworks/python.md b/doc/languages-frameworks/python.md
index 9172d7122139..0f871395854c 100644
--- a/doc/languages-frameworks/python.md
+++ b/doc/languages-frameworks/python.md
@@ -134,7 +134,7 @@ with
```nix
with import {};
-python35.withPackages (ps: [ps.numpy ps.toolz])
+(python35.withPackages (ps: [ps.numpy ps.toolz])).env
```
Executing `nix-shell` gives you again a Nix shell from which you can run Python.
@@ -191,7 +191,6 @@ building Python libraries is `buildPythonPackage`. Let's see how we can build th
toolz = buildPythonPackage rec {
pname = "toolz";
version = "0.7.4";
- name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
@@ -237,7 +236,6 @@ with import {};
my_toolz = python35.pkgs.buildPythonPackage rec {
pname = "toolz";
version = "0.7.4";
- name = "${pname}-${version}";
src = python35.pkgs.fetchPypi {
inherit pname version;
@@ -283,15 +281,15 @@ order to build [`datashape`](https://github.com/blaze/datashape).
{ # ...
datashape = buildPythonPackage rec {
- name = "datashape-${version}";
+ pname = "datashape";
version = "0.4.7";
- src = pkgs.fetchurl {
- url = "mirror://pypi/D/DataShape/${name}.tar.gz";
+ src = fetchPypi {
+ inherit pname version;
sha256 = "14b2ef766d4c9652ab813182e866f493475e65e558bed0822e38bf07bba1a278";
};
- buildInputs = with self; [ pytest ];
+ checkInputs = with self; [ pytest ];
propagatedBuildInputs = with self; [ numpy multipledispatch dateutil ];
meta = {
@@ -318,10 +316,11 @@ when building the bindings and are therefore added as `buildInputs`.
{ # ...
lxml = buildPythonPackage rec {
- name = "lxml-3.4.4";
+ pname = "lxml";
+ version = "3.4.4";
- src = pkgs.fetchurl {
- url = "mirror://pypi/l/lxml/${name}.tar.gz";
+ src = fetchPypi {
+ inherit pname version;
sha256 = "16a0fa97hym9ysdk3rmqz32xdjqmy4w34ld3rm3jf5viqjx65lxk";
};
@@ -351,11 +350,11 @@ and `CFLAGS`.
{ # ...
pyfftw = buildPythonPackage rec {
- name = "pyfftw-${version}";
+ pname = "pyFFTW";
version = "0.9.2";
- src = pkgs.fetchurl {
- url = "mirror://pypi/p/pyFFTW/pyFFTW-${version}.tar.gz";
+ src = fetchPypi {
+ inherit pname version;
sha256 = "f6bbb6afa93085409ab24885a1a3cdb8909f095a142f4d49e346f2bd1b789074";
};
@@ -440,11 +439,11 @@ We first create a function that builds `toolz` in `~/path/to/toolz/release.nix`
{ pkgs, buildPythonPackage }:
buildPythonPackage rec {
- name = "toolz-${version}";
+ pname = "toolz";
version = "0.7.4";
- src = pkgs.fetchurl {
- url = "mirror://pypi/t/toolz/toolz-${version}.tar.gz";
+ src = fetchPypi {
+ inherit pname version;
sha256 = "43c2c9e5e7a16b6c88ba3088a9bfc82f7db8e13378be7c78d6c14a5f8ed05afd";
};
@@ -549,25 +548,31 @@ The `buildPythonPackage` function is implemented in
The following is an example:
```nix
-{ # ...
- twisted = buildPythonPackage {
- name = "twisted-8.1.0";
+buildPythonPackage rec {
+ version = "3.3.1";
+ pname = "pytest";
- src = pkgs.fetchurl {
- url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2;
- sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl";
- };
+ preCheck = ''
+ # don't test bash builtins
+ rm testing/test_argcomplete.py
+ '';
- propagatedBuildInputs = [ self.ZopeInterface ];
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "cf8436dc59d8695346fcd3ab296de46425ecab00d64096cebe79fb51ecb2eb93";
+ };
- meta = {
- homepage = http://twistedmatrix.com/;
- description = "Twisted, an event-driven networking engine written in Python";
- license = stdenv.lib.licenses.mit;
- };
+ checkInputs = [ hypothesis ];
+ buildInputs = [ setuptools_scm ];
+ propagatedBuildInputs = [ attrs py setuptools six pluggy ];
+
+ meta = with stdenv.lib; {
+ maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
+ description = "Framework for writing tests";
};
}
+
```
The `buildPythonPackage` mainly does four things:
@@ -623,7 +628,6 @@ with import {};
packageOverrides = self: super: {
pandas = super.pandas.overridePythonAttrs(old: rec {
version = "0.19.1";
- name = "pandas-${version}";
src = super.fetchPypi {
pname = "pandas";
inherit version;
@@ -867,8 +871,10 @@ Executing `python setup.py bdist_wheel` in a `nix-shell `fails with
```
ValueError: ZIP does not support timestamps before 1980
```
-This is because files are included that depend on items in the Nix store which have a timestamp of, that is, it corresponds to January the 1st, 1970 at 00:00:00. And as the error informs you, ZIP does not support that.
-The command `bdist_wheel` takes into account `SOURCE_DATE_EPOCH`, and `nix-shell` sets this to 1. By setting it to a value corresponding to 1980 or later, or by unsetting it, it is possible to build wheels.
+
+This is because files from the Nix store (which have a timestamp of the UNIX epoch of January 1, 1970) are included in the .ZIP, but .ZIP archives follow the DOS convention of counting timestamps from 1980.
+
+The command `bdist_wheel` reads the `SOURCE_DATE_EPOCH` environment variable, which `nix-shell` sets to 1. Unsetting this variable or giving it a value corresponding to 1980 or later enables building wheels.
Use 1980 as timestamp:
```shell
@@ -878,7 +884,7 @@ or the current time:
```shell
nix-shell --run "SOURCE_DATE_EPOCH=$(date +%s) python3 setup.py bdist_wheel"
```
-or unset:
+or unset `SOURCE_DATE_EPOCH`:
```shell
nix-shell --run "unset SOURCE_DATE_EPOCH; python3 setup.py bdist_wheel"
```
diff --git a/doc/languages-frameworks/rust.md b/doc/languages-frameworks/rust.md
index 7c6955af812b..f0498eac5b19 100644
--- a/doc/languages-frameworks/rust.md
+++ b/doc/languages-frameworks/rust.md
@@ -9,17 +9,18 @@ date: 2017-03-05
To install the rust compiler and cargo put
```
-rust
+rustc
+cargo
```
into the `environment.systemPackages` or bring them into
-scope with `nix-shell -p rust`.
+scope with `nix-shell -p rustc cargo`.
For daily builds (beta and nightly) use either rustup from
nixpkgs or use the [Rust nightlies
overlay](#using-the-rust-nightlies-overlay).
-## Packaging Rust applications
+## Compiling Rust applications with Cargo
Rust applications are packaged by using the `buildRustPackage` helper from `rustPlatform`:
@@ -55,6 +56,226 @@ checksum can be then take from the failed build.
To install crates with nix there is also an experimental project called
[nixcrates](https://github.com/fractalide/nixcrates).
+## Compiling Rust crates using Nix instead of Cargo
+
+### Simple operation
+
+When run, `cargo build` produces a file called `Cargo.lock`,
+containing pinned versions of all dependencies. Nixpkgs contains a
+tool called `carnix` (`nix-env -iA nixos.carnix`), which can be used
+to turn a `Cargo.lock` into a Nix expression.
+
+That Nix expression calls `rustc` directly (hence bypassing Cargo),
+and can be used to compile a crate and all its dependencies. Here is
+an example for a minimal `hello` crate:
+
+
+ $ cargo new hello
+ $ cd hello
+ $ cargo build
+ Compiling hello v0.1.0 (file:///tmp/hello)
+ Finished dev [unoptimized + debuginfo] target(s) in 0.20 secs
+ $ carnix -o hello.nix --src ./. Cargo.lock --standalone
+ $ nix-build hello.nix
+
+Now, the file produced by the call to `carnix`, called `hello.nix`, looks like:
+
+```
+# Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone
+{ lib, buildPlatform, buildRustCrate, fetchgit }:
+let kernel = buildPlatform.parsed.kernel.name;
+ # ... (content skipped)
+in
+rec {
+ hello = f: hello_0_1_0 { features = hello_0_1_0_features { hello_0_1_0 = f; }; };
+ hello_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
+ crateName = "hello";
+ version = "0.1.0";
+ authors = [ "pe@pijul.org " ];
+ src = ./.;
+ inherit dependencies buildDependencies features;
+ };
+ hello_0_1_0 = { features?(hello_0_1_0_features {}) }: hello_0_1_0_ {};
+ hello_0_1_0_features = f: updateFeatures f (rec {
+ hello_0_1_0.default = (f.hello_0_1_0.default or true);
+ }) [ ];
+}
+```
+
+In particular, note that the argument given as `--src` is copied
+verbatim to the source. If we look at a more complicated
+dependencies, for instance by adding a single line `libc="*"` to our
+`Cargo.toml`, we first need to run `cargo build` to update the
+`Cargo.lock`. Then, `carnix` needs to be run again, and produces the
+following nix file:
+
+```
+# Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone
+{ lib, buildPlatform, buildRustCrate, fetchgit }:
+let kernel = buildPlatform.parsed.kernel.name;
+ # ... (content skipped)
+in
+rec {
+ hello = f: hello_0_1_0 { features = hello_0_1_0_features { hello_0_1_0 = f; }; };
+ hello_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
+ crateName = "hello";
+ version = "0.1.0";
+ authors = [ "pe@pijul.org " ];
+ src = ./.;
+ inherit dependencies buildDependencies features;
+ };
+ libc_0_2_36_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
+ crateName = "libc";
+ version = "0.2.36";
+ authors = [ "The Rust Project Developers" ];
+ sha256 = "01633h4yfqm0s302fm0dlba469bx8y6cs4nqc8bqrmjqxfxn515l";
+ inherit dependencies buildDependencies features;
+ };
+ hello_0_1_0 = { features?(hello_0_1_0_features {}) }: hello_0_1_0_ {
+ dependencies = mapFeatures features ([ libc_0_2_36 ]);
+ };
+ hello_0_1_0_features = f: updateFeatures f (rec {
+ hello_0_1_0.default = (f.hello_0_1_0.default or true);
+ libc_0_2_36.default = true;
+ }) [ libc_0_2_36_features ];
+ libc_0_2_36 = { features?(libc_0_2_36_features {}) }: libc_0_2_36_ {
+ features = mkFeatures (features.libc_0_2_36 or {});
+ };
+ libc_0_2_36_features = f: updateFeatures f (rec {
+ libc_0_2_36.default = (f.libc_0_2_36.default or true);
+ libc_0_2_36.use_std =
+ (f.libc_0_2_36.use_std or false) ||
+ (f.libc_0_2_36.default or false) ||
+ (libc_0_2_36.default or false);
+ }) [];
+}
+```
+
+Here, the `libc` crate has no `src` attribute, so `buildRustCrate`
+will fetch it from [crates.io](https://crates.io). A `sha256`
+attribute is still needed for Nix purity.
+
+### Handling external dependencies
+
+Some crates require external libraries. For crates from
+[crates.io](https://crates.io), such libraries can be specified in
+`defaultCrateOverrides` package in nixpkgs itself.
+
+Starting from that file, one can add more overrides, to add features
+or build inputs by overriding the hello crate in a seperate file.
+
+```
+with import {};
+((import ./hello.nix).hello {}).override {
+ crateOverrides = defaultCrateOverrides // {
+ hello = attrs: { buildInputs = [ openssl ]; };
+ };
+}
+```
+
+Here, `crateOverrides` is expected to be a attribute set, where the
+key is the crate name without version number and the value a function.
+The function gets all attributes passed to `buildRustCrate` as first
+argument and returns a set that contains all attribute that should be
+overwritten.
+
+For more complicated cases, such as when parts of the crate's
+derivation depend on the the crate's version, the `attrs` argument of
+the override above can be read, as in the following example, which
+patches the derivation:
+
+```
+with import {};
+((import ./hello.nix).hello {}).override {
+ crateOverrides = defaultCrateOverrides // {
+ hello = attrs: lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") {
+ postPatch = ''
+ substituteInPlace lib/zoneinfo.rs \
+ --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
+ '';
+ };
+ };
+}
+```
+
+Another situation is when we want to override a nested
+dependency. This actually works in the exact same way, since the
+`crateOverrides` parameter is forwarded to the crate's
+dependencies. For instance, to override the build inputs for crate
+`libc` in the example above, where `libc` is a dependency of the main
+crate, we could do:
+
+```
+with import {};
+((import hello.nix).hello {}).override {
+ crateOverrides = defaultCrateOverrides // {
+ libc = attrs: { buildInputs = []; };
+ };
+}
+```
+
+### Options and phases configuration
+
+Actually, the overrides introduced in the previous section are more
+general. A number of other parameters can be overridden:
+
+- The version of rustc used to compile the crate:
+
+ ```
+ (hello {}).override { rust = pkgs.rust; };
+ ```
+
+- Whether to build in release mode or debug mode (release mode by
+ default):
+
+ ```
+ (hello {}).override { release = false; };
+ ```
+
+- Whether to print the commands sent to rustc when building
+ (equivalent to `--verbose` in cargo:
+
+ ```
+ (hello {}).override { verbose = false; };
+ ```
+
+- Extra arguments to be passed to `rustc`:
+
+ ```
+ (hello {}).override { extraRustcOpts = "-Z debuginfo=2"; };
+ ```
+
+- Phases, just like in any other derivation, can be specified using
+ the following attributes: `preUnpack`, `postUnpack`, `prePatch`,
+ `patches`, `postPatch`, `preConfigure` (in the case of a Rust crate,
+ this is run before calling the "build" script), `postConfigure`
+ (after the "build" script),`preBuild`, `postBuild`, `preInstall` and
+ `postInstall`. As an example, here is how to create a new module
+ before running the build script:
+
+ ```
+ (hello {}).override {
+ preConfigure = ''
+ echo "pub const PATH=\"${hi.out}\";" >> src/path.rs"
+ '';
+ };
+ ```
+
+### Features
+
+One can also supply features switches. For example, if we want to
+compile `diesel_cli` only with the `postgres` feature, and no default
+features, we would write:
+
+```
+(callPackage ./diesel.nix {}).diesel {
+ default = false;
+ postgres = true;
+}
+```
+
+Where `diesel.nix` is the file generated by Carnix, as explained above.
+
## Using the Rust nightlies overlay
Mozilla provides an overlay for nixpkgs to bring a nightly version of Rust into scope.
diff --git a/doc/languages-frameworks/texlive.xml b/doc/languages-frameworks/texlive.xml
index fdee1e405ecc..4515e17ec09e 100644
--- a/doc/languages-frameworks/texlive.xml
+++ b/doc/languages-frameworks/texlive.xml
@@ -39,6 +39,9 @@ nix-repl> :l <nixpkgs>
nix-repl> texlive.collection-<TAB>
+
+ Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example scheme-basic, into the combination.
+
diff --git a/doc/meta.xml b/doc/meta.xml
index 0f9dccfb91b5..5dbe810810d1 100644
--- a/doc/meta.xml
+++ b/doc/meta.xml
@@ -53,7 +53,7 @@ $ nix-env -qa hello --json
"x86_64-linux",
"armv5tel-linux",
"armv7l-linux",
- "mips64el-linux",
+ "mips32-linux",
"x86_64-darwin",
"i686-cygwin",
"i686-freebsd",
@@ -174,7 +174,7 @@ meta-attributes
maintainers of this Nix expression. If
you would like to be a maintainer of a package, you may want to add
yourself to nixpkgs/lib/maintainers.nix
+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix">nixpkgs/maintainers/maintainer-list.nix
and write something like [ stdenv.lib.maintainers.alice
stdenv.lib.maintainers.bob ].
diff --git a/doc/multiple-output.xml b/doc/multiple-output.xml
index a2acc91e55a2..2f23da8df01e 100644
--- a/doc/multiple-output.xml
+++ b/doc/multiple-output.xml
@@ -68,7 +68,7 @@
$outputDevdoc
- is for developer documentation. Currently we count gtk-doc in there. It goes to devdoc or is removed (!) by default. This is because e.g. gtk-doc tends to be rather large and completely unused by nixpkgs users.
+ is for developer documentation. Currently we count gtk-doc and devhelp books in there. It goes to devdoc or is removed (!) by default. This is because e.g. gtk-doc tends to be rather large and completely unused by nixpkgs users.
diff --git a/doc/package-notes.xml b/doc/package-notes.xml
index 184bee089ae3..2d6c87c3d07a 100644
--- a/doc/package-notes.xml
+++ b/doc/package-notes.xml
@@ -660,6 +660,32 @@ cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
passing -q to the Emacs command.
+
+ Sometimes emacsWithPackages is not enough, as
+ this package set has some priorities imposed on packages (with
+ the lowest priority assigned to Melpa Unstable, and the highest for
+ packages manually defined in
+ pkgs/top-level/emacs-packages.nix). But you
+ can't control this priorities when some package is installed as a
+ dependency. You can override it on per-package-basis, providing all
+ the required dependencies manually - but it's tedious and there is
+ always a possibility that an unwanted dependency will sneak in
+ through some other package. To completely override such a package
+ you can use overrideScope.
+
+
+
+overrides = super: self: rec {
+ haskell-mode = self.melpaPackages.haskell-mode;
+ ...
+};
+((emacsPackagesNgGen emacs).overrideScope overrides).emacsWithPackages (p: with p; [
+ # here both these package will use haskell-mode of our own choice
+ ghc-mod
+ dante
+])
+
+
@@ -667,11 +693,13 @@ cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
Weechat
-Weechat can currently be configured to include your choice of plugins.
-To make use of this functionality, install an expression that overrides its configuration such as
+Weechat can be configured to include your choice of plugins, reducing its
+closure size from the default configuration which includes all available
+plugins. To make use of this functionality, install an expression that
+overrides its configuration such as
weechat.override {configure = {availablePlugins, ...}: {
- plugins = with availablePlugins; [ python perl ];
- }
+ plugins = with availablePlugins; [ python perl ];
+ }
}
diff --git a/doc/reviewing-contributions.xml b/doc/reviewing-contributions.xml
index 0813e0968e86..c4bd6c57ffdb 100644
--- a/doc/reviewing-contributions.xml
+++ b/doc/reviewing-contributions.xml
@@ -7,123 +7,123 @@
Reviewing contributions
- The following section is a draft and reviewing policy is still being
+ The following section is a draft and reviewing policy is still being
discussed.
-The nixpkgs projects receives a fairly high number of contributions via
- GitHub pull-requests. Reviewing and approving these is an important task and a
+The nixpkgs projects receives a fairly high number of contributions via
+ GitHub pull-requests. Reviewing and approving these is an important task and a
way to contribute to the project.
-The high change rate of nixpkgs make any pull request that is open for
- long enough subject to conflicts that will require extra work from the
- submitter or the merger. Reviewing pull requests in a timely manner and being
- responsive to the comments is the key to avoid these. GitHub provides sort
- filters that can be used to see the most
- recently and the least
+The high change rate of nixpkgs make any pull request that is open for
+ long enough subject to conflicts that will require extra work from the
+ submitter or the merger. Reviewing pull requests in a timely manner and being
+ responsive to the comments is the key to avoid these. GitHub provides sort
+ filters that can be used to see the most
+ recently and the least
recently updated pull-requests.
-When reviewing a pull request, please always be nice and polite.
- Controversial changes can lead to controversial opinions, but it is important
+When reviewing a pull request, please always be nice and polite.
+ Controversial changes can lead to controversial opinions, but it is important
to respect every community members and their work.
-GitHub provides reactions, they are a simple and quick way to provide
- feedback to pull-requests or any comments. The thumb-down reaction should be
- used with care and if possible accompanied with some explanations so the
+GitHub provides reactions, they are a simple and quick way to provide
+ feedback to pull-requests or any comments. The thumb-down reaction should be
+ used with care and if possible accompanied with some explanations so the
submitter has directions to improve his contribution.
-Pull-requests reviews should include a list of what has been reviewed in a
- comment, so other reviewers and mergers can know the state of the
+Pull-requests reviews should include a list of what has been reviewed in a
+ comment, so other reviewers and mergers can know the state of the
review.
-All the review template samples provided in this section are generic and
- meant as examples. Their usage is optional and the reviewer is free to adapt
+All the review template samples provided in this section are generic and
+ meant as examples. Their usage is optional and the reviewer is free to adapt
them to his liking.Package updates
-A package update is the most trivial and common type of pull-request.
- These pull-requests mainly consist in updating the version part of the package
+A package update is the most trivial and common type of pull-request.
+ These pull-requests mainly consist in updating the version part of the package
name and the source hash.
-It can happen that non trivial updates include patches or more complex
+It can happen that non trivial updates include patches or more complex
changes.Reviewing process:
- Add labels to the pull-request. (Requires commit
+ Add labels to the pull-request. (Requires commit
rights)
- 8.has: package (update) and any topic
+ 8.has: package (update) and any topic
label that fit the updated package.
- Ensure that the package versioning is fitting the
+ Ensure that the package versioning is fitting the
guidelines.
- Ensure that the commit text is fitting the
+ Ensure that the commit text is fitting the
guidelines.Ensure that the package maintainers are notified.
- mention-bot usually notify GitHub users based on the
- submitted changes, but it can happen that it misses some of the
+ mention-bot usually notify GitHub users based on the
+ submitted changes, but it can happen that it misses some of the
package maintainers.
- Ensure that the meta field contains correct
+ Ensure that the meta field contains correct
information.
- License can change with version updates, so it should be
+ License can change with version updates, so it should be
checked to be fitting upstream license.
- If the package has no maintainer, a maintainer must be
- set. This can be the update submitter or a community member that
+ If the package has no maintainer, a maintainer must be
+ set. This can be the update submitter or a community member that
accepts to take maintainership of the package.Ensure that the code contains no typos.Building the package locally.
- Pull-requests are often targeted to the master or staging
- branch so building the pull-request locally as it is submitted can
+ Pull-requests are often targeted to the master or staging
+ branch so building the pull-request locally as it is submitted can
trigger a large amount of source builds.
- It is possible to rebase the changes on nixos-unstable or
- nixpkgs-unstable for easier review by running the following commands
+ It is possible to rebase the changes on nixos-unstable or
+ nixpkgs-unstable for easier review by running the following commands
from a nixpkgs clone.
-$ git remote add channels https://github.com/NixOS/nixpkgs-channels.git
$ git fetch channels nixos-unstable
$ git fetch origin pull/PRNUMBER/head
-$ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD
- This should be done only once to be able to fetch channel
+ This should be done only once to be able to fetch channel
branches from the nixpkgs-channels repository.Fetching the nixos-unstable branch.
- Fetching the pull-request changes, PRNUMBER
- is the number at the end of the pull-request title and
- BASEBRANCH the base branch of the
+ Fetching the pull-request changes, PRNUMBER
+ is the number at the end of the pull-request title and
+ BASEBRANCH the base branch of the
pull-request.
- Rebasing the pull-request changes to the nixos-unstable
+ Rebasing the pull-request changes to the nixos-unstable
branch.
- The nox
- tool can be used to review a pull-request content in a single command.
- It doesn't rebase on a channel branch so it might trigger multiple
- source builds. PRNUMBER should be replaced by the
+ The nox
+ tool can be used to review a pull-request content in a single command.
+ It doesn't rebase on a channel branch so it might trigger multiple
+ source builds. PRNUMBER should be replaced by the
number at the end of the pull-request title.
$ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
@@ -153,42 +153,42 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
New packages
-New packages are a common type of pull-requests. These pull requests
+New packages are a common type of pull-requests. These pull requests
consists in adding a new nix-expression for a package.Reviewing process:
- Add labels to the pull-request. (Requires commit
+ Add labels to the pull-request. (Requires commit
rights)
- 8.has: package (new) and any topic
+ 8.has: package (new) and any topic
label that fit the new package.
- Ensure that the package versioning is fitting the
+ Ensure that the package versioning is fitting the
guidelines.
- Ensure that the commit name is fitting the
+ Ensure that the commit name is fitting the
guidelines.
- Ensure that the meta field contains correct
+ Ensure that the meta field contains correct
information.
- License must be checked to be fitting upstream
+ License must be checked to be fitting upstream
license.
- Platforms should be set or the package will not get binary
+ Platforms should be set or the package will not get binary
substitutes.
- A maintainer must be set, this can be the package
- submitter or a community member that accepts to take maintainership of
+ A maintainer must be set, this can be the package
+ submitter or a community member that accepts to take maintainership of
the package.Ensure that the code contains no typos.Ensure the package source.
- Mirrors urls should be used when
+ Mirrors urls should be used when
available.
- The most appropriate function should be used (e.g.
- packages from GitHub should use
+ The most appropriate function should be used (e.g.
+ packages from GitHub should use
fetchFromGitHub).
@@ -223,49 +223,49 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
Module updates
-Module updates are submissions changing modules in some ways. These often
+Module updates are submissions changing modules in some ways. These often
contains changes to the options or introduce new options.Reviewing process
- Add labels to the pull-request. (Requires commit
+ Add labels to the pull-request. (Requires commit
rights)
- 8.has: module (update) and any topic
+ 8.has: module (update) and any topic
label that fit the module.Ensure that the module maintainers are notified.
- Mention-bot notify GitHub users based on the submitted
- changes, but it can happen that it miss some of the package
+ Mention-bot notify GitHub users based on the submitted
+ changes, but it can happen that it miss some of the package
maintainers.
- Ensure that the module tests, if any, are
+ Ensure that the module tests, if any, are
succeeding.Ensure that the introduced options are correct.
- Type should be appropriate (string related types differs
- in their merging capabilities, optionSet and
+ Type should be appropriate (string related types differs
+ in their merging capabilities, optionSet and
string types are deprecated).
- Description, default and example should be
+ Description, default and example should be
provided.Ensure that option changes are backward compatible.
- mkRenamedOptionModule and
- mkAliasOptionModule functions provide way to make
+ mkRenamedOptionModule and
+ mkAliasOptionModule functions provide way to make
option changes backward compatible.
- Ensure that removed options are declared with
+ Ensure that removed options are declared with
mkRemovedOptionModule
- Ensure that changes that are not backward compatible are
+ Ensure that changes that are not backward compatible are
mentioned in release notes.
- Ensure that documentations affected by the change is
+ Ensure that documentations affected by the change is
updated.
@@ -294,37 +294,37 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
New modules submissions introduce a new module to NixOS.
- Add labels to the pull-request. (Requires commit
+ Add labels to the pull-request. (Requires commit
rights)
- 8.has: module (new) and any topic label
+ 8.has: module (new) and any topic label
that fit the module.
- Ensure that the module tests, if any, are
+ Ensure that the module tests, if any, are
succeeding.Ensure that the introduced options are correct.
- Type should be appropriate (string related types differs
- in their merging capabilities, optionSet and
+ Type should be appropriate (string related types differs
+ in their merging capabilities, optionSet and
string types are deprecated).
- Description, default and example should be
+ Description, default and example should be
provided.
- Ensure that module meta field is
+ Ensure that module meta field is
present
- Maintainers should be declared in
+ Maintainers should be declared in
meta.maintainers.
- Module documentation should be declared with
+ Module documentation should be declared with
meta.doc.
- Ensure that the module respect other modules
+ Ensure that the module respect other modules
functionality.
- For example, enabling a module should not open firewall
+ For example, enabling a module should not open firewall
ports by default.
@@ -340,7 +340,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
- [ ] options have default
- [ ] options have example
- [ ] options have descriptions
-- [ ] No unneeded package is added to system.environmentPackages
+- [ ] No unneeded package is added to environment.systemPackages
- [ ] meta.maintainers is set
- [ ] module documentation is declared in meta.doc
@@ -355,22 +355,22 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
Other type of submissions requires different reviewing steps.
-If you consider having enough knowledge and experience in a topic and
- would like to be a long-term reviewer for related submissions, please contact
- the current reviewers for that topic. They will give you information about the
+If you consider having enough knowledge and experience in a topic and
+ would like to be a long-term reviewer for related submissions, please contact
+ the current reviewers for that topic. They will give you information about the
reviewing process.
-The main reviewers for a topic can be hard to find as there is no list, but
-checking past pull-requests to see who reviewed or git-blaming the code to see
+The main reviewers for a topic can be hard to find as there is no list, but
+checking past pull-requests to see who reviewed or git-blaming the code to see
who committed to that topic can give some hints.
-Container system, boot system and library changes are some examples of the
+Container system, boot system and library changes are some examples of the
pull requests fitting this category.Merging pull-requests
-It is possible for community members that have enough knowledge and
+It is possible for community members that have enough knowledge and
experience on a special topic to contribute by merging pull requests.TODO: add the procedure to request merging rights.
@@ -380,13 +380,13 @@ The following paragraph about how to deal with unactive contributors is just a
proposition and should be modified to what the community agrees to be the right
policy.
-Please note that contributors with commit rights unactive for more than
+Please note that contributors with commit rights unactive for more than
three months will have their commit rights revoked.
-->
-In a case a contributor leaves definitively the Nix community, he should
- create an issue or notify the mailing list with references of packages and
- modules he maintains so the maintainership can be taken over by other
+In a case a contributor leaves definitively the Nix community, he should
+ create an issue or notify the mailing list with references of packages and
+ modules he maintains so the maintainership can be taken over by other
contributors.
diff --git a/doc/shell.md b/doc/shell.md
new file mode 100644
index 000000000000..079574d4ae86
--- /dev/null
+++ b/doc/shell.md
@@ -0,0 +1,20 @@
+---
+title: pkgs.mkShell
+author: zimbatm
+date: 2017-10-30
+---
+
+pkgs.mkShell is a special kind of derivation that is only useful when using
+it combined with nix-shell. It will in fact fail to instantiate when invoked
+with nix-build.
+
+## Usage
+
+```nix
+{ pkgs ? import {} }:
+pkgs.mkShell {
+ # this will make all the build inputs from hello and gnutar available to the shell environment
+ inputsFrom = with pkgs; [ hello gnutar ];
+ buildInputs = [ pkgs.gnumake ];
+}
+```
diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index 46b562a794f0..2a3316b8d018 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -179,6 +179,269 @@ genericBuild
+Specifying dependencies
+
+
+ As described in the Nix manual, almost any *.drv store path in a derivation's attribute set will induce a dependency on that derivation.
+ mkDerivation, however, takes a few attributes intended to, between them, include all the dependencies of a package.
+ This is done both for structure and consistency, but also so that certain other setup can take place.
+ For example, certain dependencies need their bin directories added to the PATH.
+ That is built-in, but other setup is done via a pluggable mechanism that works in conjunction with these dependency attributes.
+ See for details.
+
+
+ Dependencies can be broken down along three axes: their host and target platforms relative to the new derivation's, and whether they are propagated.
+ The platform distinctions are motivated by cross compilation; see for exactly what each platform means.
+
+ The build platform is ignored because it is a mere implementation detail of the package satisfying the dependency:
+ As a general programming principle, dependencies are always specified as interfaces, not concrete implementation.
+
+ But even if one is not cross compiling, the platforms imply whether or not the dependency is needed at run-time or build-time, a concept that makes perfect sense outside of cross compilation.
+ For now, the run-time/build-time distinction is just a hint for mental clarity, but in the future it perhaps could be enforced.
+
+
+ The extension of PATH with dependencies, alluded to above, proceeds according to the relative platforms alone.
+ The process is carried out only for dependencies whose host platform matches the new derivation's build platform–i.e. which run on the platform where the new derivation will be built.
+
+ Currently, that means for native builds all dependencies are put on the PATH.
+ But in the future that may not be the case for sake of matching cross:
+ the platforms would be assumed to be unique for native and cross builds alike, so only the depsBuild* and nativeBuildDependencies dependencies would affect the PATH.
+
+ For each dependency dep of those dependencies, dep/bin, if present, is added to the PATH environment variable.
+
+
+ The dependency is propagated when it forces some of its other-transitive (non-immediate) downstream dependencies to also take it on as an immediate dependency.
+ Nix itself already takes a package's transitive dependencies into account, but this propagation ensures nixpkgs-specific infrastructure like setup hooks (mentioned above) also are run as if the propagated dependency.
+
+
+ It is important to note dependencies are not necessary propagated as the same sort of dependency that they were before, but rather as the corresponding sort so that the platform rules still line up.
+ The exact rules for dependency propagation can be given by assigning each sort of dependency two integers based one how it's host and target platforms are offset from the depending derivation's platforms.
+ Those offsets are given are given below in the descriptions of each dependency list attribute.
+ Algorithmically, we traverse propagated inputs, accumulating every propagated dep's propagated deps and adjusting them to account for the "shift in perspective" described by the current dep's platform offsets.
+ This results in sort a transitive closure of the dependency relation, with the offsets being approximately summed when two dependency links are combined.
+ We also prune transitive deps whose combined offsets go out-of-bounds, which can be viewed as a filter over that transitive closure removing dependencies that are blatantly absurd.
+
+
+ We can define the process precisely with Natural Deduction using the inference rules.
+ This probably seems a bit obtuse, but so is the bash code that actually implements it!
+
+ The findInputs function, currently residing in pkgs/stdenv/generic/setup.sh, implements the propagation logic.
+
+ They're confusing in very different ways so...hopefully if something doesn't make sense in one presentation, it does in the other!
+
+let mapOffset(h, t, i) = i + (if i <= 0 then h else t - 1)
+
+propagated-dep(h0, t0, A, B)
+propagated-dep(h1, t1, B, C)
+h0 + h1 in {-1, 0, 1}
+h0 + t1 in {-1, 0, 1}
+-------------------------------------- Transitive property
+propagated-dep(mapOffset(h0, t0, h1),
+ mapOffset(h0, t0, t1),
+ A, C)
+
+let mapOffset(h, t, i) = i + (if i <= 0 then h else t - 1)
+
+dep(h0, _, A, B)
+propagated-dep(h1, t1, B, C)
+h0 + h1 in {-1, 0, 1}
+h0 + t1 in {-1, 0, -1}
+-------------------------------------- Take immediate deps' propagated deps
+propagated-dep(mapOffset(h0, t0, h1),
+ mapOffset(h0, t0, t1),
+ A, C)
+
+propagated-dep(h, t, A, B)
+-------------------------------------- Propagated deps count as deps
+dep(h, t, A, B)
+ Some explanation of this monstrosity is in order.
+ In the common case, the target offset of a dependency is the successor to the target offset: t = h + 1.
+ That means that:
+
+let f(h, t, i) = i + (if i <= 0 then h else t - 1)
+let f(h, h + 1, i) = i + (if i <= 0 then h else (h + 1) - 1)
+let f(h, h + 1, i) = i + (if i <= 0 then h else h)
+let f(h, h + 1, i) = i + h
+
+ This is where the "sum-like" comes from above:
+ We can just sum all the host offset to get the host offset of the transitive dependency.
+ The target offset is the transitive dep is simply the host offset + 1, just as it was with the dependencies composed to make this transitive one;
+ it can be ignored as it doesn't add any new information.
+
+
+ Because of the bounds checks, the uncommon cases are h = t and h + 2 = t.
+ In the former case, the motivation for mapOffset is that since its host and target platforms are the same, no transitive dep of it should be able to "discover" an offset greater than its reduced target offsets.
+ mapOffset effectively "squashes" all its transitive dependencies' offsets so that none will ever be greater than the target offset of the original h = t package.
+ In the other case, h + 1 is skipped over between the host and target offsets.
+ Instead of squashing the offsets, we need to "rip" them apart so no transitive dependencies' offset is that one.
+
+
+Overall, the unifying theme here is that propagation shouldn't be introducing transitive dependencies involving platforms the needing package is unaware of.
+The offset bounds checking and definition of mapOffset together ensure that this is the case.
+Discovering a new offset is discovering a new platform, and since those platforms weren't in the derivation "spec" of the needing package, they cannot be relevant.
+From a capability perspective, we can imagine that the host and target platforms of a package are the capabilities a package requires, and the depending package must provide the capability to the dependency.
+
+
+
+ Variables specifying dependencies
+
+
+ depsBuildBuild
+
+
+ A list of dependencies whose host and target platforms are the new derivation's build platform.
+ This means a -1 host and -1 target offset from the new derivation's platforms.
+ They are programs/libraries used at build time that furthermore produce programs/libraries also used at build time.
+ If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it in nativeBuildInputsinstead.
+ The most common use for this buildPackages.stdenv.cc, the default C compiler for this role.
+ That example crops up more than one might think in old commonly used C libraries.
+
+
+ Since these packages are able to be run at build time, that are always added to the PATH, as described above.
+ But since these packages are only guaranteed to be able to run then, they shouldn't persist as run-time dependencies.
+ This isn't currently enforced, but could be in the future.
+
+
+
+
+
+ nativeBuildInputs
+
+
+ A list of dependencies whose host platform is the new derivation's build platform, and target platform is the new derivation's host platform.
+ This means a -1 host offset and 0 target offset from the new derivation's platforms.
+ They are programs/libraries used at build time that, if they are a compiler or similar tool, produce code to run at run time—i.e. tools used to build the new derivation.
+ If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it here, rather than in depsBuildBuild or depsBuildTarget.
+ This would be called depsBuildHost but for historical continuity.
+
+
+ Since these packages are able to be run at build time, that are added to the PATH, as described above.
+ But since these packages only are guaranteed to be able to run then, they shouldn't persist as run-time dependencies.
+ This isn't currently enforced, but could be in the future.
+
+
+
+
+
+ depsBuildTarget
+
+
+ A list of dependencies whose host platform is the new derivation's build platform, and target platform is the new derivation's target platform.
+ This means a -1 host offset and 1 target offset from the new derivation's platforms.
+ They are programs used at build time that produce code to run at run with code produced by the depending package.
+ Most commonly, these would tools used to build the runtime or standard library the currently-being-built compiler will inject into any code it compiles.
+ In many cases, the currently-being built compiler is itself employed for that task, but when that compiler won't run (i.e. its build and host platform differ) this is not possible.
+ Other times, the compiler relies on some other tool, like binutils, that is always built separately so the dependency is unconditional.
+
+
+ This is a somewhat confusing dependency to wrap ones head around, and for good reason.
+ As the only one where the platform offsets are not adjacent integers, it requires thinking of a bootstrapping stage two away from the current one.
+ It and it's use-case go hand in hand and are both considered poor form:
+ try not to need this sort dependency, and try not avoid building standard libraries / runtimes in the same derivation as the compiler produces code using them.
+ Instead strive to build those like a normal library, using the newly-built compiler just as a normal library would.
+ In short, do not use this attribute unless you are packaging a compiler and are sure it is needed.
+
+
+ Since these packages are able to be run at build time, that are added to the PATH, as described above.
+ But since these packages only are guaranteed to be able to run then, they shouldn't persist as run-time dependencies.
+ This isn't currently enforced, but could be in the future.
+
+
+
+
+
+ depsHostHost
+
+ A list of dependencies whose host and target platforms match the new derivation's host platform.
+ This means a both 0 host offset and 0 target offset from the new derivation's host platform.
+ These are packages used at run-time to generate code also used at run-time.
+ In practice, that would usually be tools used by compilers for metaprogramming/macro systems, or libraries used by the macros/metaprogramming code itself.
+ It's always preferable to use a depsBuildBuild dependency in the derivation being built than a depsHostHost on the tool doing the building for this purpose.
+
+
+
+
+ buildInputs
+
+
+ A list of dependencies whose host platform and target platform match the new derivation's.
+ This means a 0 host offset and 1 target offset from the new derivation's host platform.
+ This would be called depsHostTarget but for historical continuity.
+ If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it here, rather than in depsBuildBuild.
+
+
+ These often are programs/libraries used by the new derivation at run-time, but that isn't always the case.
+ For example, the machine code in a statically linked library is only used at run time, but the derivation containing the library is only needed at build time.
+ Even in the dynamic case, the library may also be needed at build time to appease the linker.
+
+
+
+
+
+ depsTargetTarget
+
+ A list of dependencies whose host platform matches the new derivation's target platform.
+ This means a 1 offset from the new derivation's platforms.
+ These are packages that run on the target platform, e.g. the standard library or run-time deps of standard library that a compiler insists on knowing about.
+ It's poor form in almost all cases for a package to depend on another from a future stage [future stage corresponding to positive offset].
+ Do not use this attribute unless you are packaging a compiler and are sure it is needed.
+
+
+
+
+ depsBuildBuildPropagated
+
+ The propagated equivalent of depsBuildBuild.
+ This perhaps never ought to be used, but it is included for consistency [see below for the others].
+
+
+
+
+ propagatedNativeBuildInputs
+
+ The propagated equivalent of nativeBuildInputs.
+ This would be called depsBuildHostPropagated but for historical continuity.
+ For example, if package Y has propagatedNativeBuildInputs = [X], and package Z has buildInputs = [Y], then package Z will be built as if it included package X in its nativeBuildInputs.
+ If instead, package Z has nativeBuildInputs = [Y], then Z will be built as if it included X in the depsBuildBuild of package Z, because of the sum of the two -1 host offsets.
+
+
+
+
+ depsBuildTargetPropagated
+
+ The propagated equivalent of depsBuildTarget.
+ This is prefixed for the same reason of alerting potential users.
+
+
+
+
+ depsHostHostPropagated
+
+ The propagated equivalent of depsHostHost.
+
+
+
+
+ propagatedBuildInputs
+
+ The propagated equivalent of buildInputs.
+ This would be called depsHostTargetPropagated but for historical continuity.
+
+
+
+
+ depsTargetTarget
+
+ The propagated equivalent of depsTargetTarget.
+ This is prefixed for the same reason of alerting potential users.
+
+
+
+
+
+
+
+
Attributes
@@ -198,63 +461,22 @@ genericBuild
-
- Variables specifying dependencies
-
-
- nativeBuildInputs
-
- A list of dependencies used by the new derivation at build-time.
- I.e. these dependencies should not make it into the package's runtime-closure, though this is currently not checked.
- For each dependency dir, the directory dir/bin, if it exists, is added to the PATH environment variable.
- Other environment variables are also set up via a pluggable mechanism.
- For instance, if buildInputs contains Perl, then the lib/site_perl subdirectory of each input is added to the PERL5LIB environment variable.
- See for details.
-
-
-
-
- buildInputs
-
- A list of dependencies used by the new derivation at run-time.
- Currently, the build-time environment is modified in the exact same way as with nativeBuildInputs.
- This is problematic in that when cross-compiling, foreign executables can clobber native ones on the PATH.
- Even more confusing is static-linking.
- A statically-linked library should be listed here because ultimately that generated machine code will be used at run-time, even though a derivation containing the object files or static archives will only be used at build-time.
- A less confusing solution to this would be nice.
-
-
-
-
-
- propagatedNativeBuildInputs
-
- Like nativeBuildInputs, but these dependencies are propagated:
- that is, the dependencies listed here are added to the nativeBuildInputs of any package that uses this package as a dependency.
- So if package Y has propagatedNativeBuildInputs = [X], and package Z has nativeBuildInputs = [Y],
- then package X will appear in Z’s build environment automatically.
-
-
-
-
- propagatedBuildInputs
-
- Like buildInputs, but propagated just like propagatedNativeBuildInputs.
- This inherits buildInputs's flaws of clobbering native executables when cross-compiling and being confusing for static linking.
-
-
-
-
-
Variables affecting build propertiesenableParallelBuilding
- If set, stdenv will pass specific
- flags to make and other build tools to enable
- parallel building with up to build-cores
- workers.
+
+ If set to true, stdenv will
+ pass specific flags to make and other build tools to
+ enable parallel building with up to build-cores
+ workers.
+
+ Unless set to false, some build systems with good
+ support for parallel building including cmake,
+ meson, and qmake will set it to
+ true.
+
@@ -649,7 +871,7 @@ script) if it exists.
By default, when cross compiling, the configure script has and passed.
Packages can instead pass [ "build" "host" "target" ] or a subset to control exactly which platform flags are passed.
Compilers and other tools should use this to also pass the target platform, for example.
- Note eventually these will be passed when in native builds too, to improve determinism: build-time guessing, as is done today, is a risk of impurity.
+ Eventually these will be passed when in native builds too, to improve determinism: build-time guessing, as is done today, is a risk of impurity.
@@ -773,13 +995,14 @@ but only if the doCheck variable is enabled.
doCheck
- If set to a non-empty string, the check phase is
- executed, otherwise it is skipped (default). Thus you should set
-
-
-doCheck = true;
-
- in the derivation to enable checks.
+
+ Controls whether the check phase is executed.
+ By default it is skipped, but if doCheck is set to true, the check phase is usually executed.
+ Thus you should set doCheck = true; in the derivation to enable checks.
+ The exception is cross compilation.
+ Cross compiled builds never run tests, no matter how doCheck is set,
+ as the newly-built program won't run on the platform used to build it.
+
@@ -916,6 +1139,20 @@ following:
If set, libraries and executables are not
stripped. By default, they are.
+
+ dontStripHost
+
+ Like dontStripHost, but only affects the strip command targetting the package's host platform.
+ Useful when supporting cross compilation, but otherwise feel free to ignore.
+
+
+
+ dontStripTarget
+
+ Like dontStripHost, but only affects the strip command targetting the packages' target platform.
+ Useful when supporting cross compilation, but otherwise feel free to ignore.
+
+ dontMoveSbin
@@ -1044,12 +1281,14 @@ installcheck.
doInstallCheck
- If set to a non-empty string, the installCheck phase is
- executed, otherwise it is skipped (default). Thus you should set
-
- doInstallCheck = true;
-
- in the derivation to enable install checks.
+
+ Controls whether the installCheck phase is executed.
+ By default it is skipped, but if doInstallCheck is set to true, the installCheck phase is usually executed.
+ Thus you should set doInstallCheck = true; in the derivation to enable install checks.
+ The exception is cross compilation.
+ Cross compiled builds never run tests, no matter how doInstallCheck is set,
+ as the newly-built program won't run on the platform used to build it.
+
@@ -1346,46 +1585,127 @@ someVar=$(stripHash $name)
Package setup hooks
-The following packages provide a setup hook:
-
+
+ Nix itself considers a build-time dependency merely something that should previously be built and accessible at build time—packages themselves are on their own to perform any additional setup.
+ In most cases, that is fine, and the downstream derivation can deal with it's own dependencies.
+ But for a few common tasks, that would result in almost every package doing the same sort of setup work---depending not on the package itself, but entirely on which dependencies were used.
+
+
+ In order to alleviate this burden, the setup hook>mechanism was written, where any package can include a shell script that [by convention rather than enforcement by Nix], any downstream reverse-dependency will source as part of its build process.
+ That allows the downstream dependency to merely specify its dependencies, and lets those dependencies effectively initialize themselves.
+ No boilerplate mirroring the list of dependencies is needed.
+
+
+ The Setup hook mechanism is a bit of a sledgehammer though: a powerful feature with a broad and indiscriminate area of effect.
+ The combination of its power and implicit use may be expedient, but isn't without costs.
+ Nix itself is unchanged, but the spirit of adding dependencies being effect-free is violated even if the letter isn't.
+ For example, if a derivation path is mentioned more than once, Nix itself doesn't care and simply makes sure the dependency derivation is already built just the same—depending is just needing something to exist, and needing is idempotent.
+ However, a dependency specified twice will have its setup hook run twice, and that could easily change the build environment (though a well-written setup hook will therefore strive to be idempotent so this is in fact not observable).
+ More broadly, setup hooks are anti-modular in that multiple dependencies, whether the same or different, should not interfere and yet their setup hooks may well do so.
+
+
+ The most typical use of the setup hook is actually to add other hooks which are then run (i.e. after all the setup hooks) on each dependency.
+ For example, the C compiler wrapper's setup hook feeds itself flags for each dependency that contains relevant libaries and headers.
+ This is done by defining a bash function, and appending its name to one of
+ envBuildBuildHooks`,
+ envBuildHostHooks`,
+ envBuildTargetHooks`,
+ envHostHostHooks`,
+ envHostTargetHooks`, or
+ envTargetTargetHooks`.
+ These 6 bash variables correspond to the 6 sorts of dependencies by platform (there's 12 total but we ignore the propagated/non-propagated axis).
+
+
+ Packages adding a hook should not hard code a specific hook, but rather choose a variable relative to how they are included.
+ Returning to the C compiler wrapper example, if it itself is an n dependency, then it only wants to accumulate flags from n + 1 dependencies, as only those ones match the compiler's target platform.
+ The hostOffset variable is defined with the current dependency's host offset targetOffset with its target offset, before it's setup hook is sourced.
+ Additionally, since most environment hooks don't care about the target platform,
+ That means the setup hook can append to the right bash array by doing something like
+
+addEnvHooks "$hostOffset" myBashFunction
+
+
+
+ The existence of setups hooks has long been documented and packages inside Nixpkgs are free to use these mechanism.
+ Other packages, however, should not rely on these mechanisms not changing between Nixpkgs versions.
+ Because of the existing issues with this system, there's little benefit from mandating it be stable for any period of time.
+
+
+ Here are some packages that provide a setup hook.
+ Since the mechanism is modular, this probably isn't an exhaustive list.
+ Then again, since the mechanism is only to be used as a last resort, it might be.
- CC Wrapper
+ Bintools Wrapper
- CC Wrapper wraps a C toolchain for a bunch of miscellaneous purposes.
- Specifically, a C compiler (GCC or Clang), Binutils (or the CCTools + binutils mashup when targetting Darwin), and a C standard library (glibc or Darwin's libSystem) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by CC Wrapper.
- Packages typically depend on only CC Wrapper, instead of those 3 inputs directly.
+ Bintools Wrapper wraps the binary utilities for a bunch of miscellaneous purposes.
+ These are GNU Binutils when targetting Linux, and a mix of cctools and GNU binutils for Darwin.
+ [The "Bintools" name is supposed to be a compromise between "Binutils" and "cctools" not denoting any specific implementation.]
+ Specifically, the underlying bintools package, and a C standard library (glibc or Darwin's libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by Bintools Wrapper.
+ Packages typically depend on CC Wrapper, which in turn (at run time) depends on Bintools Wrapper.
- Dependency finding is undoubtedly the main task of CC wrapper.
+ Bintools Wrapper was only just recently split off from CC Wrapper, so the division of labor is still being worked out.
+ For example, it shouldn't care about about the C standard library, but just take a derivation with the dynamic loader (which happens to be the glibc on linux).
+ Dependency finding however is a task both wrappers will continue to need to share, and probably the most important to understand.
It is currently accomplished by collecting directories of host-platform dependencies (i.e. buildInputs and nativeBuildInputs) in environment variables.
- CC wrapper's setup hook causes any include subdirectory of such a dependency to be added to NIX_CFLAGS_COMPILE, and any lib and lib64 subdirectories to NIX_LDFLAGS.
- The setup hook itself contains some lengthy comments describing the exact convoluted mechanism by which this is accomplished.
+ Bintools Wrapper's setup hook causes any lib and lib64 subdirectories to be added to NIX_LDFLAGS.
+ Since CC Wrapper and Bintools Wrapper use the same strategy, most of the Bintools Wrapper code is sparsely commented and refers to CC Wrapper.
+ But CC Wrapper's code, by contrast, has quite lengthy comments.
+ Bintools Wrapper merely cites those, rather than repeating them, to avoid falling out of sync.
A final task of the setup hook is defining a number of standard environment variables to tell build systems which executables full-fill which purpose.
- They are defined to just be the base name of the tools, under the assumption that CC Wrapper's binaries will be on the path.
+ They are defined to just be the base name of the tools, under the assumption that Bintools Wrapper's binaries will be on the path.
Firstly, this helps poorly-written packages, e.g. ones that look for just gcc when CC isn't defined yet clang is to be used.
- Secondly, this helps packages not get confused when cross-compiling, in which case multiple CC wrappers may be simultaneous in use (targeting different platforms).
- BUILD_- and TARGET_-prefixed versions of the normal environment variable are defined for the additional CC Wrappers, properly disambiguating them.
+ Secondly, this helps packages not get confused when cross-compiling, in which case multiple Bintools Wrappers may simultaneously be in use.
+
+ Each wrapper targets a single platform, so if binaries for multiple platforms are needed, the underlying binaries must be wrapped multiple times.
+ As this is a property of the wrapper itself, the multiple wrappings are needed whether or not the same underlying binaries can target multiple platforms.
+
+ BUILD_- and TARGET_-prefixed versions of the normal environment variable are defined for the additional Bintools Wrappers, properly disambiguating them.
- A problem with this final task is that CC Wrapper is honest and defines LD as ld.
+ A problem with this final task is that Bintools Wrapper is honest and defines LD as ld.
Most packages, however, firstly use the C compiler for linking, secondly use LD anyways, defining it as the C compiler, and thirdly, only so define LD when it is undefined as a fallback.
- This triple-threat means CC Wrapper will break those packages, as LD is already defined as the actually linker which the package won't override yet doesn't want to use.
+ This triple-threat means Bintools Wrapper will break those packages, as LD is already defined as the actual linker which the package won't override yet doesn't want to use.
The workaround is to define, just for the problematic package, LD as the C compiler.
A good way to do this would be preConfigure = "LD=$CC".
+
+ CC Wrapper
+
+
+ CC Wrapper wraps a C toolchain for a bunch of miscellaneous purposes.
+ Specifically, a C compiler (GCC or Clang), wrapped binary tools, and a C standard library (glibc or Darwin's libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by CC Wrapper.
+ Packages typically depend on CC Wrapper, which in turn (at run time) depends on Bintools Wrapper.
+
+
+ Dependency finding is undoubtedly the main task of CC Wrapper.
+ This works just like Bintools Wrapper, except that any include subdirectory of any relevant dependency is added to NIX_CFLAGS_COMPILE.
+ The setup hook itself contains some lengthy comments describing the exact convoluted mechanism by which this is accomplished.
+
+
+ CC Wrapper also like Bintools Wrapper defines standard environment variables with the names of the tools it wraps, for the same reasons described above.
+ Importantly, while it includes a cc symlink to the c compiler for portability, the CC will be defined using the compiler's "real name" (i.e. gcc or clang).
+ This helps lousy build systems that inspect on the name of the compiler rather than run it.
+
+
+
+
Perl
- Adds the lib/site_perl subdirectory
- of each build input to the PERL5LIB
- environment variable.
+
+
+ Adds the lib/site_perl subdirectory of each build input to the PERL5LIB environment variable.
+ For instance, if buildInputs contains Perl, then the lib/site_perl subdirectory of each input is added to the PERL5LIB environment variable.
+
+
@@ -1482,6 +1802,20 @@ someVar=$(stripHash $name)
disabled or patched to work with PaX.
+
+ autoPatchelfHook
+ This is a special setup hook which helps in packaging
+ proprietary software in that it automatically tries to find missing shared
+ library dependencies of ELF files. All packages within the
+ runtimeDependencies environment variable are unconditionally
+ added to executables, which is useful for programs that use
+
+ dlopen
+ 3
+
+ to load libraries at runtime.
+
+
diff --git a/lib/customisation.nix b/lib/customisation.nix
index 483ef6fd4866..d942f54ee798 100644
--- a/lib/customisation.nix
+++ b/lib/customisation.nix
@@ -1,7 +1,7 @@
{ lib }:
let
- inherit (builtins) attrNames isFunction;
+ inherit (builtins) attrNames;
in
@@ -36,7 +36,7 @@ rec {
overrideDerivation = drv: f:
let
newDrv = derivation (drv.drvAttrs // (f drv));
- in addPassthru newDrv (
+ in lib.flip (extendDerivation true) newDrv (
{ meta = drv.meta or {};
passthru = if drv ? passthru then drv.passthru else {};
}
@@ -72,7 +72,7 @@ rec {
makeOverridable = f: origArgs:
let
ff = f origArgs;
- overrideWith = newArgs: origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs);
+ overrideWith = newArgs: origArgs // (if lib.isFunction newArgs then newArgs origArgs else newArgs);
in
if builtins.isAttrs ff then (ff // {
override = newArgs: makeOverridable f (overrideWith newArgs);
@@ -81,7 +81,7 @@ rec {
${if ff ? overrideAttrs then "overrideAttrs" else null} = fdrv:
makeOverridable (args: (f args).overrideAttrs fdrv) origArgs;
})
- else if builtins.isFunction ff then {
+ else if lib.isFunction ff then {
override = newArgs: makeOverridable f (overrideWith newArgs);
__functor = self: ff;
overrideDerivation = throw "overrideDerivation not yet supported for functors";
@@ -112,8 +112,8 @@ rec {
*/
callPackageWith = autoArgs: fn: args:
let
- f = if builtins.isFunction fn then fn else import fn;
- auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
+ f = if lib.isFunction fn then fn else import fn;
+ auto = builtins.intersectAttrs (lib.functionArgs f) autoArgs;
in makeOverridable f (auto // args);
@@ -122,8 +122,8 @@ rec {
individual attributes. */
callPackagesWith = autoArgs: fn: args:
let
- f = if builtins.isFunction fn then fn else import fn;
- auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
+ f = if lib.isFunction fn then fn else import fn;
+ auto = builtins.intersectAttrs (lib.functionArgs f) autoArgs;
origArgs = auto // args;
pkgs = f origArgs;
mkAttrOverridable = name: pkg: makeOverridable (newArgs: (f newArgs).${name}) origArgs;
@@ -131,8 +131,8 @@ rec {
/* Add attributes to each output of a derivation without changing
- the derivation itself. */
- addPassthru = drv: passthru:
+ the derivation itself and check a given condition when evaluating. */
+ extendDerivation = condition: passthru: drv:
let
outputs = drv.outputs or [ "out" ];
@@ -142,13 +142,18 @@ rec {
outputToAttrListElement = outputName:
{ name = outputName;
value = commonAttrs // {
- inherit (drv.${outputName}) outPath drvPath type outputName;
+ inherit (drv.${outputName}) type outputName;
+ drvPath = assert condition; drv.${outputName}.drvPath;
+ outPath = assert condition; drv.${outputName}.outPath;
};
};
outputsList = map outputToAttrListElement outputs;
- in commonAttrs // { outputUnspecified = true; };
-
+ in commonAttrs // {
+ outputUnspecified = true;
+ drvPath = assert condition; drv.drvPath;
+ outPath = assert condition; drv.outPath;
+ };
/* Strip a derivation of all non-essential attributes, returning
only those needed by hydra-eval-jobs. Also strictly evaluate the
diff --git a/lib/debug.nix b/lib/debug.nix
index 646ef220ad0a..d163e60b6957 100644
--- a/lib/debug.nix
+++ b/lib/debug.nix
@@ -2,10 +2,10 @@
let
-inherit (builtins) trace attrNamesToStr isAttrs isFunction isList isInt
+inherit (builtins) trace attrNamesToStr isAttrs isList isInt
isString isBool head substring attrNames;
-inherit (lib) all id mapAttrsFlatten elem;
+inherit (lib) all id mapAttrsFlatten elem isFunction;
in
diff --git a/lib/default.nix b/lib/default.nix
index 3e30ec515fcb..cbe0a0ba21b5 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -21,10 +21,10 @@ let
# packaging
customisation = callLibs ./customisation.nix;
- maintainers = callLibs ./maintainers.nix;
+ maintainers = import ../maintainers/maintainer-list.nix;
meta = callLibs ./meta.nix;
sources = callLibs ./sources.nix;
-
+ versions = callLibs ./versions.nix;
# module system
modules = callLibs ./modules.nix;
@@ -41,23 +41,23 @@ let
generators = callLibs ./generators.nix;
misc = callLibs ./deprecated.nix;
# domain-specific
- sandbox = callLibs ./sandbox.nix;
fetchers = callLibs ./fetchers.nix;
# Eval-time filesystem handling
filesystem = callLibs ./filesystem.nix;
# back-compat aliases
- platforms = systems.doubles;
+ platforms = systems.forMeta;
inherit (builtins) add addErrorContext attrNames
concatLists deepSeq elem elemAt filter genericClosure genList
- getAttr hasAttr head isAttrs isBool isFunction isInt isList
+ getAttr hasAttr head isAttrs isBool isInt isList
isString length lessThan listToAttrs pathExists readFile
replaceStrings seq stringLength sub substring tail;
inherit (trivial) id const concat or and boolToString mergeAttrs
flip mapNullable inNixShell min max importJSON warn info
- nixpkgsVersion mod;
+ nixpkgsVersion mod compare splitByAndCompare
+ functionArgs setFunctionArgs isFunction;
inherit (fixedPoints) fix fix' extends composeExtensions
makeExtensible makeExtensibleWithCustomName;
@@ -72,8 +72,8 @@ let
inherit (lists) singleton foldr fold foldl foldl' imap0 imap1
concatMap flatten remove findSingle findFirst any all count
optional optionals toList range partition zipListsWith zipLists
- reverseList listDfs toposort sort take drop sublist last init
- crossLists unique intersectLists subtractLists
+ reverseList listDfs toposort sort compareLists take drop sublist
+ last init crossLists unique intersectLists subtractLists
mutuallyExclusive;
inherit (strings) concatStrings concatMapStrings concatImapStrings
intersperse concatStringsSep concatMapStringsSep
@@ -88,13 +88,14 @@ let
inherit (stringsWithDeps) textClosureList textClosureMap
noDepEntry fullDepEntry packEntry stringAfter;
inherit (customisation) overrideDerivation makeOverridable
- callPackageWith callPackagesWith addPassthru hydraJob makeScope;
+ callPackageWith callPackagesWith extendDerivation
+ hydraJob makeScope;
inherit (meta) addMetaAttrs dontDistribute setName updateName
appendToName mapDerivationAttrset lowPrio lowPrioSet hiPrio
hiPrioSet;
inherit (sources) pathType pathIsDirectory cleanSourceFilter
cleanSource sourceByRegex sourceFilesBySuffices
- commitIdFromGitRepo;
+ commitIdFromGitRepo cleanSourceWith pathHasContext canCleanSource;
inherit (modules) evalModules closeModules unifyModuleSyntax
applyIfFunction unpackSubmodule packSubmodule mergeModules
mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions
diff --git a/lib/deprecated.nix b/lib/deprecated.nix
index 2a0f5a55bf14..34cf336d1f42 100644
--- a/lib/deprecated.nix
+++ b/lib/deprecated.nix
@@ -1,6 +1,6 @@
{ lib }:
let
- inherit (builtins) isFunction head tail isList isAttrs isInt attrNames;
+ inherit (builtins) head tail isList isAttrs isInt attrNames;
in
@@ -53,7 +53,7 @@ rec {
f: # the function applied to the arguments
initial: # you pass attrs, the functions below are passing a function taking the fix argument
let
- takeFixed = if isFunction initial then initial else (fixed : initial); # transform initial to an expression always taking the fixed argument
+ takeFixed = if lib.isFunction initial then initial else (fixed : initial); # transform initial to an expression always taking the fixed argument
tidy = args:
let # apply all functions given in "applyPreTidy" in sequence
applyPreTidyFun = fold ( n: a: x: n ( a x ) ) lib.id (maybeAttr "applyPreTidy" [] args);
@@ -63,7 +63,7 @@ rec {
let args = takeFixed fixed;
mergeFun = args.${n};
in if isAttrs x then (mergeFun args x)
- else assert isFunction x;
+ else assert lib.isFunction x;
mergeFun args (x ( args // { inherit fixed; }));
in overridableDelayableArgs f newArgs;
in
@@ -374,7 +374,7 @@ rec {
if isAttrs x then
if x ? outPath then "derivation"
else "attrs"
- else if isFunction x then "function"
+ else if lib.isFunction x then "function"
else if isList x then "list"
else if x == true then "bool"
else if x == false then "bool"
diff --git a/lib/generators.nix b/lib/generators.nix
index 5f9da234f447..73017f2c6796 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -14,6 +14,8 @@ let
libAttr = lib.attrsets;
flipMapAttrs = flip libAttr.mapAttrs;
+
+ inherit (lib) isFunction;
in
rec {
@@ -22,11 +24,15 @@ rec {
* character sep. If sep appears in k, it is escaped.
* Helper for synaxes with different separators.
*
- * mkKeyValueDefault ":" "f:oo" "bar"
+ * mkValueString specifies how values should be formatted.
+ *
+ * mkKeyValueDefault {} ":" "f:oo" "bar"
* > "f\:oo:bar"
*/
- mkKeyValueDefault = sep: k: v:
- "${libStr.escape [sep] k}${sep}${toString v}";
+ mkKeyValueDefault = {
+ mkValueString ? toString
+ }: sep: k: v:
+ "${libStr.escape [sep] k}${sep}${mkValueString v}";
/* Generate a key-value-style config file from an attrset.
@@ -34,7 +40,7 @@ rec {
* mkKeyValue is the same as in toINI.
*/
toKeyValue = {
- mkKeyValue ? mkKeyValueDefault "="
+ mkKeyValue ? mkKeyValueDefault {} "="
}: attrs:
let mkLine = k: v: mkKeyValue k v + "\n";
in libStr.concatStrings (libAttr.mapAttrsToList mkLine attrs);
@@ -64,7 +70,7 @@ rec {
# apply transformations (e.g. escapes) to section names
mkSectionName ? (name: libStr.escape [ "[" "]" ] name),
# format a setting line from key and value
- mkKeyValue ? mkKeyValueDefault "="
+ mkKeyValue ? mkKeyValueDefault {} "="
}: attrsOfAttrs:
let
# map function to string for each key val
@@ -106,7 +112,7 @@ rec {
else if isString v then "\"" + v + "\""
else if null == v then "null"
else if isFunction v then
- let fna = functionArgs v;
+ let fna = lib.functionArgs v;
showFnas = concatStringsSep "," (libAttr.mapAttrsToList
(name: hasDefVal: if hasDefVal then "(${name})" else name)
fna);
@@ -126,6 +132,6 @@ rec {
(name: value:
"${toPretty args name} = ${toPretty args value};") v)
+ " }"
- else "toPretty: should never happen (v = ${v})";
+ else abort "toPretty: should never happen (v = ${v})";
}
diff --git a/lib/licenses.nix b/lib/licenses.nix
index cbd737dc57f1..ba575c27052d 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -2,7 +2,7 @@
let
spdx = lic: lic // {
- url = "http://spdx.org/licenses/${lic.spdxId}";
+ url = "http://spdx.org/licenses/${lic.spdxId}.html";
};
in
@@ -15,7 +15,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
afl21 = spdx {
spdxId = "AFL-2.1";
- fullName = "Academic Free License";
+ fullName = "Academic Free License v2.1";
+ };
+
+ afl3 = spdx {
+ spdxId = "AFL-3.0";
+ fullName = "Academic Free License v3.0";
};
agpl3 = spdx {
@@ -74,6 +79,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = ''Beerware License'';
};
+ bsd0 = spdx {
+ spdxId = "0BSD";
+ fullName = "BSD Zero Clause License";
+ };
+
bsd2 = spdx {
spdxId = "BSD-2-Clause";
fullName = ''BSD 2-clause "Simplified" License'';
@@ -89,6 +99,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = ''BSD 4-clause "Original" or "Old" License'';
};
+ clArtistic = spdx {
+ spdxId = "ClArtistic";
+ fullName = "Clarified Artistic License";
+ };
+
cc0 = spdx {
spdxId = "CC0-1.0";
fullName = "Creative Commons Zero v1.0 Universal";
@@ -164,6 +179,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "CeCILL-C Free Software License Agreement";
};
+ cpal10 = spdx {
+ spdxId = "CPAL-1.0";
+ fullName = "Common Public Attribution License 1.0";
+ };
+
cpl10 = spdx {
spdxId = "CPL-1.0";
fullName = "Common Public License 1.0";
@@ -195,6 +215,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Eclipse Public License 1.0";
};
+ epl20 = spdx {
+ spdxId = "EPL-2.0";
+ fullName = "Eclipse Public License 2.0";
+ };
+
epson = {
fullName = "Seiko Epson Corporation Software License Agreement for Linux";
url = https://download.ebz.epson.net/dsc/du/02/eula/global/LINUX_EN.html;
@@ -304,6 +329,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
free = false;
};
+ inria-icesl = {
+ fullName = "INRIA Non-Commercial License Agreement for IceSL";
+ url = "http://shapeforge.loria.fr/icesl/EULA_IceSL_binary.pdf";
+ free = false;
+ };
+
ipa = spdx {
spdxId = "IPA";
fullName = "IPA Font License";
@@ -426,6 +457,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Notion modified LGPL";
};
+ nposl3 = spdx {
+ spdxId = "NPOSL-3.0";
+ fullName = "Non-Profit Open Software License 3.0";
+ };
+
ofl = spdx {
spdxId = "OFL-1.1";
fullName = "SIL Open Font License 1.1";
@@ -441,6 +477,16 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "OpenSSL License";
};
+ osl21 = spdx {
+ spdxId = "OSL-2.1";
+ fullName = "Open Software License 2.1";
+ };
+
+ osl3 = spdx {
+ spdxId = "OSL-3.0";
+ fullName = "Open Software License 3.0";
+ };
+
php301 = spdx {
spdxId = "PHP-3.01";
fullName = "PHP License v3.01";
@@ -451,6 +497,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "PostgreSQL License";
};
+ postman = {
+ fullName = "Postman EULA";
+ url = https://www.getpostman.com/licenses/postman_base_app;
+ free = false;
+ };
+
psfl = spdx {
spdxId = "Python-2.0";
fullName = "Python Software Foundation License version 2";
@@ -538,6 +590,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Vovida Software License v1.0";
};
+ watcom = spdx {
+ spdxId = "Watcom-1.0";
+ fullName = "Sybase Open Watcom Public License 1.0";
+ };
+
w3c = spdx {
spdxId = "W3C";
fullName = "W3C Software Notice and License";
@@ -572,5 +629,4 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
spdxId = "ZPL-2.1";
fullName = "Zope Public License 2.1";
};
-
}
diff --git a/lib/lists.nix b/lib/lists.nix
index 8f67c6bb0ca3..424d2c57f556 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -385,6 +385,30 @@ rec {
if len < 2 then list
else (sort strictLess pivot.left) ++ [ first ] ++ (sort strictLess pivot.right));
+ /* Compare two lists element-by-element.
+
+ Example:
+ compareLists compare [] []
+ => 0
+ compareLists compare [] [ "a" ]
+ => -1
+ compareLists compare [ "a" ] []
+ => 1
+ compareLists compare [ "a" "b" ] [ "a" "c" ]
+ => 1
+ */
+ compareLists = cmp: a: b:
+ if a == []
+ then if b == []
+ then 0
+ else -1
+ else if b == []
+ then 1
+ else let rel = cmp (head a) (head b); in
+ if rel == 0
+ then compareLists cmp (tail a) (tail b)
+ else rel;
+
/* Return the first (at most) N elements of a list.
Example:
@@ -440,8 +464,12 @@ rec {
init = list: assert list != []; take (length list - 1) list;
- /* FIXME(zimbatm) Not used anywhere
- */
+ /* return the image of the cross product of some lists by a function
+
+ Example:
+ crossLists (x:y: "${toString x}${toString y}") [[1 2] [3 4]]
+ => [ "13" "14" "23" "24" ]
+ */
crossLists = f: foldl (fs: args: concatMap (f: map f args) fs) [f];
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
deleted file mode 100644
index f050904896fc..000000000000
--- a/lib/maintainers.nix
+++ /dev/null
@@ -1,723 +0,0 @@
-{ ...}:
-/* List of NixOS maintainers. The format is:
-
- handle = "Real Name ";
-
- where is preferred to be your GitHub username (so it's easy
- to ping a package @), and is your real name, not
- a pseudonym. Please keep the list alphabetically sorted. */
-{
- a1russell = "Adam Russell ";
- aaronschif = "Aaron Schif ";
- abaldeau = "Andreas Baldeau ";
- abbradar = "Nikolay Amiantov ";
- abigailbuccaneer = "Abigail Bunyan ";
- aboseley = "Adam Boseley ";
- abuibrahim = "Ruslan Babayev ";
- acowley = "Anthony Cowley ";
- adelbertc = "Adelbert Chang ";
- adev = "Adrien Devresse ";
- adisbladis = "Adam Hose ";
- Adjective-Object = "Maxwell Huang-Hobbs ";
- adnelson = "Allen Nelson ";
- adolfogc = "Adolfo E. García Castro ";
- aespinosa = "Allan Espinosa ";
- aflatter = "Alexander Flatter ";
- afldcr = "James Alexander Feldman-Crough ";
- aforemny = "Alexander Foremny ";
- afranchuk = "Alex Franchuk ";
- aherrmann = "Andreas Herrmann ";
- ahmedtd = "Taahir Ahmed ";
- ak = "Alexander Kjeldaas ";
- akaWolf = "Artjom Vejsel ";
- akc = "Anders Claesson ";
- alexvorobiev = "Alex Vorobiev ";
- dezgeg = "Tuomas Tynkkynen ";
- dfordivam = "Divam ";
- dfoxfranke = "Daniel Fox Franke ";
- dgonyeo = "Derek Gonyeo ";
- dipinhora = "Dipin Hora ";
- disassembler = "Samuel Leathers ";
- dizfer = "David Izquierdo ";
- dmalikov = "Dmitry Malikov ";
- DmitryTsygankov = "Dmitry Tsygankov ";
- dmjio = "David Johnson ";
- dochang = "Desmond O. Chang ";
- domenkozar = "Domen Kozar ";
- dotlambda = "Robert Schütz ";
- doublec = "Chris Double ";
- dpaetzel = "David Pätzel ";
- dpflug = "David Pflug ";
- drets = "Dmytro Rets ";
- drewkett = "Andrew Burkett ";
- dsferruzza = "David Sferruzza ";
- dtzWill = "Will Dietz ";
- dupgit = "Olivier Delhomme ";
- dywedir = "Vladyslav M. ";
- e-user = "Alexander Kahl ";
- earldouglas = "James Earl Douglas ";
- ebzzry = "Rommel Martinez ";
- edanaher = "Evan Danaher ";
- edef = "edef ";
- ederoyd46 = "Matthew Brown ";
- eduarrrd = "Eduard Bachmakov ";
- edwtjo = "Edward Tjörnhammar ";
- eelco = "Eelco Dolstra ";
- ehegnes = "Eric Hegnes ";
- ehmry = "Emery Hemingway ";
- eikek = "Eike Kettner ";
- ekleog = "Leo Gaspard ";
- elasticdog = "Aaron Bull Schaefer ";
- eleanor = "Dejan Lukan ";
- elijahcaine = "Elijah Caine ";
- elitak = "Eric Litak ";
- ellis = "Ellis Whitehead ";
- eperuffo = "Emanuele Peruffo ";
- epitrochoid = "Mabry Cervin ";
- eqyiel = "Ruben Maher ";
- ericbmerritt = "Eric Merritt ";
- ericsagnes = "Eric Sagnes ";
- erictapen = "Justin Humm ";
- erikryb = "Erik Rybakken ";
- ertes = "Ertugrul Söylemez ";
- ethercrow = "Dmitry Ivanov ";
- etu = "Elis Hirwing ";
- exi = "Reno Reckling ";
- exlevan = "Alexey Levan ";
- expipiplus1 = "Joe Hermaszewski ";
- fadenb = "Tristan Helmich ";
- falsifian = "James Cook ";
- fare = "Francois-Rene Rideau ";
- fgaz = "Francesco Gazzetta ";
- FireyFly = "Jonas Höglund ";
- flokli = "Florian Klink ";
- florianjacob = "Florian Jacob ";
- flosse = "Markus Kohlhase ";
- fluffynukeit = "Daniel Austin ";
- fmthoma = "Franz Thoma ";
- forkk = "Andrew Okin ";
- fornever = "Friedrich von Never ";
- fpletz = "Franz Pletz ";
- fps = "Florian Paul Schmidt ";
- fridh = "Frederik Rietdijk ";
- frlan = "Frank Lanitz ";
- fro_ozen = "fro_ozen ";
- ftrvxmtrx = "Siarhei Zirukin ";
- funfunctor = "Edward O'Callaghan ";
- fuuzetsu = "Mateusz Kowalczyk ";
- fuzzy-id = "Thomas Bach ";
- fxfactorial = "Edgar Aroutiounian ";
- gabesoft = "Gabriel Adomnicai ";
- gal_bolle = "Florent Becker ";
- garbas = "Rok Garbas ";
- garrison = "Jim Garrison ";
- gavin = "Gavin Rogers ";
- gebner = "Gabriel Ebner ";
- geistesk = "Alvar Penning ";
- georgewhewell = "George Whewell ";
- gilligan = "Tobias Pflug ";
- giogadi = "Luis G. Torres ";
- gleber = "Gleb Peregud ";
- glenns = "Glenn Searby ";
- globin = "Robin Gloster ";
- gnidorah = "Alex Ivanov ";
- goibhniu = "Cillian de Róiste ";
- Gonzih = "Max Gonzih ";
- goodrone = "Andrew Trachenko ";
- gpyh = "Yacine Hmito ";
- grahamc = "Graham Christensen ";
- grburst = "Julius Elias ";
- gridaphobe = "Eric Seidel ";
- guibert = "David Guibert ";
- guibou = "Guillaume Bouchard ";
- guillaumekoenig = "Guillaume Koenig ";
- guyonvarch = "Joris Guyonvarch ";
- hakuch = "Jesse Haber-Kucharsky ";
- hamhut1066 = "Hamish Hutchings ";
- havvy = "Ryan Scheel ";
- hbunke = "Hendrik Bunke ";
- hce = "Hans-Christian Esperer ";
- hectorj = "Hector Jusforgues ";
- hedning = "Tor Hedin Brønner ";
- heel = "Sergii Paryzhskyi ";
- henrytill = "Henry Till ";
- hhm = "hhm ";
- hinton = "Tom Hinton ";
- hodapp = "Chris Hodapp ";
- hrdinka = "Christoph Hrdinka ";
- htr = "Hugo Tavares Reis ";
- iand675 = "Ian Duncan ";
- ianwookim = "Ian-Woo Kim ";
- iblech = "Ingo Blechschmidt ";
- igsha = "Igor Sharonov ";
- ikervagyok = "Balázs Lengyel ";
- infinisil = "Silvan Mosberger ";
- ironpinguin = "Michele Catalano ";
- ivan-tkatchev = "Ivan Tkatchev ";
- ixmatus = "Parnell Springmeyer ";
- j-keck = "Jürgen Keck ";
- jagajaga = "Arseniy Seroka ";
- jammerful = "jammerful ";
- jansol = "Jan Solanti ";
- javaguirre = "Javier Aguirre ";
- jb55 = "William Casarin ";
- jbedo = "Justin Bedő ";
- jcumming = "Jack Cummings ";
- jdagilliland = "Jason Gilliland ";
- jefdaj = "Jeffrey David Johnson ";
- jensbin = "Jens Binkert ";
- jerith666 = "Matt McHenry ";
- jfb = "James Felix Black ";
- jfrankenau = "Johannes Frankenau ";
- jgeerds = "Jascha Geerds ";
- jgertm = "Tim Jaeger ";
- jgillich = "Jakob Gillich ";
- jhhuh = "Ji-Haeng Huh ";
- jirkamarsik = "Jirka Marsik ";
- jlesquembre = "José Luis Lafuente ";
- jluttine = "Jaakko Luttinen ";
- joachifm = "Joachim Fasting ";
- joamaki = "Jussi Maki ";
- joelmo = "Joel Moberg ";
- joelteon = "Joel Taylor ";
- johbo = "Johannes Bornhold ";
- johnmh = "John M. Harris, Jr. ";
- johnramsden = "John Ramsden ";
- joko = "Ioannis Koutras ";
- jonafato = "Jon Banafato ";
- joncojonathan = "Jonathan Haddock ";
- jpierre03 = "Jean-Pierre PRUNARET ";
- jpotier = "Martin Potier ";
- jraygauthier = "Raymond Gauthier ";
- jtojnar = "Jan Tojnar ";
- juliendehos = "Julien Dehos ";
- jwiegley = "John Wiegley ";
- jwilberding = "Jordan Wilberding ";
- jyp = "Jean-Philippe Bernardy ";
- jzellner = "Jeff Zellner ";
- kaiha = "Kai Harries ";
- kamilchm = "Kamil Chmielewski ";
- kampfschlaefer = "Arnold Krille ";
- karolchmist = "karolchmist ";
- kentjames = "James Kent "; inactive since 2012
- uwap = "uwap ";
- vaibhavsagar = "Vaibhav Sagar ";
- valeriangalliat = "Valérian Galliat ";
- vandenoever = "Jos van den Oever ";
- vanschelven = "Klaas van Schelven ";
- vanzef = "Ivan Solyankin ";
- vbgl = "Vincent Laporte ";
- vbmithr = "Vincent Bernardoff ";
- vcunat = "Vladimír Čunát ";
- vdemeester = "Vincent Demeester ";
- veprbl = "Dmitry Kalinkin ";
- vifino = "Adrian Pistol ";
- vinymeuh = "VinyMeuh ";
- viric = "Lluís Batlle i Rossell ";
- vizanto = "Danny Wilson ";
- vklquevs = "vklquevs ";
- vlstill = "Vladimír Štill ";
- vmandela = "Venkateswara Rao Mandela ";
- vmchale = "Vanessa McHale ";
- volhovm = "Mikhail Volkhov ";
- volth = "Jaroslavas Pocepko ";
- vozz = "Oliver Hunt ";
- vrthra = "Rahul Gopinath ";
- vyp = "vyp ";
- wedens = "wedens ";
- willibutz = "Willi Butz ";
- willtim = "Tim Philip Williams ";
- winden = "Antonio Vargas Gonzalez ";
- wizeman = "Ricardo M. Correia ";
- wjlroe = "William Roe ";
- wkennington = "William A. Kennington III ";
- wmertens = "Wout Mertens ";
- woffs = "Frank Doepper ";
- womfoo = "Kranium Gikos Mendoza ";
- wscott = "Wayne Scott ";
- wyvie = "Elijah Rum ";
- xnwdd = "Guillermo NWDD ";
- xvapx = "Marti Serra ";
- xwvvvvwx = "David Terry ";
- xzfc = "Albert Safin ";
- yarr = "Dmitry V. ";
- yegortimoshenko = "Yegor Timoshenko ";
- ylwghst = "Burim Augustin Berisa ";
- yochai = "Yochai ";
- yorickvp = "Yorick van Pelt ";
- yuriaisaka = "Yuri Aisaka ";
- yurrriq = "Eric Bailey ";
- z77z = "Marco Maggesi ";
- zagy = "Christian Zagrodnick ";
- zalakain = "Unai Zalakain ";
- zarelit = "David Costa ";
- zauberpony = "Elmar Athmer ";
- zef = "Zef Hemel ";
- zimbatm = "zimbatm ";
- Zimmi48 = "Théo Zimmermann ";
- zohl = "Al Zohali ";
- zoomulator = "Kim Simmons