Merge remote-tracking branch 'upstream/master' into sage-8.4

This commit is contained in:
Timo Kaufmann 2018-09-07 20:54:09 +02:00
commit 4ab832d6e7
2407 changed files with 90340 additions and 88212 deletions

View File

@ -43,7 +43,7 @@ See the nixpkgs manual for more details on [standard meta-attributes](https://ni
## Writing good commit messages ## Writing good commit messages
In addition to writing properly formatted commit messages, it's important to include relevant information so other developers can later understand *why* a change was made. While this information usually can be found by digging code, mailing list archives, pull request discussions or upstream changes, it may require a lot of work. In addition to writing properly formatted commit messages, it's important to include relevant information so other developers can later understand *why* a change was made. While this information usually can be found by digging code, mailing list/Discourse archives, pull request discussions or upstream changes, it may require a lot of work.
For package version upgrades and such a one-line commit message is usually sufficient. For package version upgrades and such a one-line commit message is usually sufficient.

View File

@ -1 +1 @@
18.09 19.03

View File

@ -38,5 +38,4 @@ For pull-requests, please rebase onto nixpkgs `master`.
Communication: Communication:
* [Discourse Forum](https://discourse.nixos.org/) * [Discourse Forum](https://discourse.nixos.org/)
* [Mailing list](https://groups.google.com/forum/#!forum/nix-devel)
* [IRC - #nixos on freenode.net](irc://irc.freenode.net/#nixos) * [IRC - #nixos on freenode.net](irc://irc.freenode.net/#nixos)

View File

@ -15,6 +15,12 @@ if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.
it is safe to upgrade by running it again: it is safe to upgrade by running it again:
curl https://nixos.org/nix/install | sh curl https://nixos.org/nix/install | sh
For more information, please see the NixOS release notes at
https://nixos.org/nixos/manual or locally at
${toString ./doc/manual/release-notes}.
If you need further help, see https://nixos.org/nixos/support.html
'' ''
else else

View File

@ -325,7 +325,7 @@
}; };
}; };
} }
</screen> </screen>
<para> <para>
To install it into our environment, you can just run <literal>nix-env -iA To install it into our environment, you can just run <literal>nix-env -iA
@ -347,7 +347,7 @@
}; };
}; };
} }
</screen> </screen>
<para> <para>
<literal>pathsToLink</literal> tells Nixpkgs to only link the paths listed <literal>pathsToLink</literal> tells Nixpkgs to only link the paths listed
@ -383,7 +383,7 @@
}; };
}; };
} }
</screen> </screen>
<para> <para>
This provides us with some useful documentation for using our packages. This provides us with some useful documentation for using our packages.
@ -395,15 +395,15 @@
{ {
packageOverrides = pkgs: with pkgs; rec { packageOverrides = pkgs: with pkgs; rec {
myProfile = writeText "my-profile" '' myProfile = writeText "my-profile" ''
export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
''; '';
myPackages = pkgs.buildEnv { myPackages = pkgs.buildEnv {
name = "my-packages"; name = "my-packages";
paths = [ paths = [
(runCommand "profile" {} '' (runCommand "profile" {} ''
mkdir -p $out/etc/profile.d mkdir -p $out/etc/profile.d
cp ${myProfile} $out/etc/profile.d/my-profile.sh cp ${myProfile} $out/etc/profile.d/my-profile.sh
'') '')
aspell aspell
bc bc
@ -421,7 +421,7 @@ cp ${myProfile} $out/etc/profile.d/my-profile.sh
}; };
}; };
} }
</screen> </screen>
<para> <para>
For this to work fully, you must also have this script sourced when you are For this to work fully, you must also have this script sourced when you are
@ -438,7 +438,7 @@ if [ -d $HOME/.nix-profile/etc/profile.d ]; then
fi fi
done done
fi fi
</screen> </screen>
<para> <para>
Now just run <literal>source $HOME/.profile</literal> and you can starting Now just run <literal>source $HOME/.profile</literal> and you can starting
@ -459,16 +459,16 @@ fi
{ {
packageOverrides = pkgs: with pkgs; rec { packageOverrides = pkgs: with pkgs; rec {
myProfile = writeText "my-profile" '' myProfile = writeText "my-profile" ''
export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
export INFOPATH=$HOME/.nix-profile/share/info:/nix/var/nix/profiles/default/share/info:/usr/share/info export INFOPATH=$HOME/.nix-profile/share/info:/nix/var/nix/profiles/default/share/info:/usr/share/info
''; '';
myPackages = pkgs.buildEnv { myPackages = pkgs.buildEnv {
name = "my-packages"; name = "my-packages";
paths = [ paths = [
(runCommand "profile" {} '' (runCommand "profile" {} ''
mkdir -p $out/etc/profile.d mkdir -p $out/etc/profile.d
cp ${myProfile} $out/etc/profile.d/my-profile.sh cp ${myProfile} $out/etc/profile.d/my-profile.sh
'') '')
aspell aspell
bc bc
@ -485,17 +485,17 @@ cp ${myProfile} $out/etc/profile.d/my-profile.sh
pathsToLink = [ "/share/man" "/share/doc" "/share/info" "/bin" "/etc" ]; pathsToLink = [ "/share/man" "/share/doc" "/share/info" "/bin" "/etc" ];
extraOutputsToInstall = [ "man" "doc" "info" ]; extraOutputsToInstall = [ "man" "doc" "info" ];
postBuild = '' postBuild = ''
if [ -x $out/bin/install-info -a -w $out/share/info ]; then if [ -x $out/bin/install-info -a -w $out/share/info ]; then
shopt -s nullglob shopt -s nullglob
for i in $out/share/info/*.info $out/share/info/*.info.gz; do for i in $out/share/info/*.info $out/share/info/*.info.gz; do
$out/bin/install-info $i $out/share/info/dir $out/bin/install-info $i $out/share/info/dir
done done
fi fi
''; '';
}; };
}; };
} }
</screen> </screen>
<para> <para>
<literal>postBuild</literal> tells Nixpkgs to run a command after building <literal>postBuild</literal> tells Nixpkgs to run a command after building

View File

@ -30,7 +30,7 @@
<section xml:id="sec-cross-packaging"> <section xml:id="sec-cross-packaging">
<title>Packaging in a cross-friendly manner</title> <title>Packaging in a cross-friendly manner</title>
<section> <section xml:id="sec-cross-platform-parameters">
<title>Platform parameters</title> <title>Platform parameters</title>
<para> <para>
@ -47,13 +47,9 @@
<para> <para>
In Nixpkgs, these three platforms are defined as attribute sets under the In Nixpkgs, these three platforms are defined as attribute sets under the
names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and
and <literal>targetPlatform</literal>. All three are always defined as <literal>targetPlatform</literal>. They are always defined as attributes in
attributes in the standard environment, and at the top level. That means the standard environment. That means one can access them like:
one can get at them just like a dependency in a function that is imported
with <literal>callPackage</literal>:
<programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...buildPlatform...</programlisting>
, or just off <varname>stdenv</varname>:
<programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting> <programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>
. .
</para> </para>
@ -219,7 +215,7 @@
</variablelist> </variablelist>
</section> </section>
<section> <section xml:id="sec-cross-specifying-dependencies">
<title>Specifying Dependencies</title> <title>Specifying Dependencies</title>
<para> <para>
@ -304,7 +300,7 @@
</note> </note>
</section> </section>
<section> <section xml:id="sec-cross-cookbook">
<title>Cross packaging cookbook</title> <title>Cross packaging cookbook</title>
<para> <para>
@ -317,7 +313,7 @@
</para> </para>
<qandaset> <qandaset>
<qandaentry> <qandaentry xml:id="cross-qa-build-c-program-in-build-environment">
<question> <question>
<para> <para>
What if my package's build system needs to build a C program to be run What if my package's build system needs to build a C program to be run
@ -331,7 +327,7 @@
</para> </para>
</answer> </answer>
</qandaentry> </qandaentry>
<qandaentry> <qandaentry xml:id="cross-qa-fails-to-find-ar">
<question> <question>
<para> <para>
My package fails to find <command>ar</command>. My package fails to find <command>ar</command>.
@ -347,7 +343,7 @@
</para> </para>
</answer> </answer>
</qandaentry> </qandaentry>
<qandaentry> <qandaentry xml:id="cross-testsuite-runs-host-code">
<question> <question>
<para> <para>
My package's testsuite needs to run host platform code. My package's testsuite needs to run host platform code.

View File

@ -1,6 +1,7 @@
<chapter xmlns="http://docbook.org/ns/docbook" <chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="chap-functions"> xmlns:xi="http://www.w3.org/2001/XInclude"
xml:id="chap-functions">
<title>Functions reference</title> <title>Functions reference</title>
<para> <para>
The nixpkgs repository has several utility functions to manipulate Nix The nixpkgs repository has several utility functions to manipulate Nix
@ -30,12 +31,16 @@
<para> <para>
Example usages: Example usages:
<programlisting>pkgs.foo.override { arg1 = val1; arg2 = val2; ... }</programlisting> <programlisting>pkgs.foo.override { arg1 = val1; arg2 = val2; ... }</programlisting>
<programlisting>import pkgs.path { overlays = [ (self: super: { <programlisting>
foo = super.foo.override { barSupport = true ; }; import pkgs.path { overlays = [ (self: super: {
})]};</programlisting> foo = super.foo.override { barSupport = true ; };
<programlisting>mypkg = pkgs.callPackage ./mypkg.nix { })]};
mydep = pkgs.mydep.override { ... }; </programlisting>
}</programlisting> <programlisting>
mypkg = pkgs.callPackage ./mypkg.nix {
mydep = pkgs.mydep.override { ... };
}
</programlisting>
</para> </para>
<para> <para>
@ -60,9 +65,11 @@
<para> <para>
Example usage: Example usage:
<programlisting>helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec { <programlisting>
separateDebugInfo = true; helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec {
});</programlisting> separateDebugInfo = true;
});
</programlisting>
</para> </para>
<para> <para>
@ -133,14 +140,16 @@
<para> <para>
Example usage: Example usage:
<programlisting>mySed = pkgs.gnused.overrideDerivation (oldAttrs: { <programlisting>
name = "sed-4.2.2-pre"; mySed = pkgs.gnused.overrideDerivation (oldAttrs: {
src = fetchurl { name = "sed-4.2.2-pre";
url = ftp://alpha.gnu.org/gnu/sed/sed-4.2.2-pre.tar.bz2; src = fetchurl {
sha256 = "11nq06d131y4wmf3drm0yk502d2xc6n5qy82cg88rb9nqd2lj41k"; url = ftp://alpha.gnu.org/gnu/sed/sed-4.2.2-pre.tar.bz2;
}; sha256 = "11nq06d131y4wmf3drm0yk502d2xc6n5qy82cg88rb9nqd2lj41k";
patches = []; };
});</programlisting> patches = [];
});
</programlisting>
</para> </para>
<para> <para>
@ -180,8 +189,10 @@
<para> <para>
Example usage: Example usage:
<programlisting>f = { a, b }: { result = a+b; } <programlisting>
c = lib.makeOverridable f { a = 1; b = 2; }</programlisting> f = { a, b }: { result = a+b; };
c = lib.makeOverridable f { a = 1; b = 2; };
</programlisting>
</para> </para>
<para> <para>
@ -444,6 +455,7 @@ merge:"diff3"
<filename>./bin/start.sh</filename> -- relative paths are supported. <filename>./bin/start.sh</filename> -- relative paths are supported.
</para> </para>
</section> </section>
<xi:include href="shell.section.xml" />
<section xml:id="sec-pkgs-dockerTools"> <section xml:id="sec-pkgs-dockerTools">
<title>pkgs.dockerTools</title> <title>pkgs.dockerTools</title>
@ -480,29 +492,29 @@ merge:"diff3"
<example xml:id='ex-dockerTools-buildImage'> <example xml:id='ex-dockerTools-buildImage'>
<title>Docker build</title> <title>Docker build</title>
<programlisting> <programlisting>
buildImage { buildImage {
name = "redis"; <co xml:id='ex-dockerTools-buildImage-1' /> name = "redis"; <co xml:id='ex-dockerTools-buildImage-1' />
tag = "latest"; <co xml:id='ex-dockerTools-buildImage-2' /> tag = "latest"; <co xml:id='ex-dockerTools-buildImage-2' />
fromImage = someBaseImage; <co xml:id='ex-dockerTools-buildImage-3' /> fromImage = someBaseImage; <co xml:id='ex-dockerTools-buildImage-3' />
fromImageName = null; <co xml:id='ex-dockerTools-buildImage-4' /> fromImageName = null; <co xml:id='ex-dockerTools-buildImage-4' />
fromImageTag = "latest"; <co xml:id='ex-dockerTools-buildImage-5' /> fromImageTag = "latest"; <co xml:id='ex-dockerTools-buildImage-5' />
contents = pkgs.redis; <co xml:id='ex-dockerTools-buildImage-6' /> contents = pkgs.redis; <co xml:id='ex-dockerTools-buildImage-6' />
runAsRoot = '' <co xml:id='ex-dockerTools-buildImage-runAsRoot' /> runAsRoot = '' <co xml:id='ex-dockerTools-buildImage-runAsRoot' />
#!${stdenv.shell} #!${stdenv.shell}
mkdir -p /data mkdir -p /data
''; '';
config = { <co xml:id='ex-dockerTools-buildImage-8' /> config = { <co xml:id='ex-dockerTools-buildImage-8' />
Cmd = [ "/bin/redis-server" ]; Cmd = [ "/bin/redis-server" ];
WorkingDir = "/data"; WorkingDir = "/data";
Volumes = { Volumes = {
"/data" = {}; "/data" = {};
};
}; };
} };
</programlisting> }
</programlisting>
</example> </example>
<para> <para>
@ -521,7 +533,8 @@ merge:"diff3"
<callout arearefs='ex-dockerTools-buildImage-2'> <callout arearefs='ex-dockerTools-buildImage-2'>
<para> <para>
<varname>tag</varname> specifies the tag of the resulting image. By <varname>tag</varname> specifies the tag of the resulting image. By
default it's <literal>null</literal>, which indicates that the nix output hash will be used as tag. default it's <literal>null</literal>, which indicates that the nix output
hash will be used as tag.
</para> </para>
</callout> </callout>
<callout arearefs='ex-dockerTools-buildImage-3'> <callout arearefs='ex-dockerTools-buildImage-3'>
@ -644,15 +657,15 @@ merge:"diff3"
<example xml:id='ex-dockerTools-pullImage'> <example xml:id='ex-dockerTools-pullImage'>
<title>Docker pull</title> <title>Docker pull</title>
<programlisting> <programlisting>
pullImage { pullImage {
imageName = "nixos/nix"; <co xml:id='ex-dockerTools-pullImage-1' /> imageName = "nixos/nix"; <co xml:id='ex-dockerTools-pullImage-1' />
imageDigest = "sha256:20d9485b25ecfd89204e843a962c1bd70e9cc6858d65d7f5fadc340246e2116b"; <co xml:id='ex-dockerTools-pullImage-2' /> imageDigest = "sha256:20d9485b25ecfd89204e843a962c1bd70e9cc6858d65d7f5fadc340246e2116b"; <co xml:id='ex-dockerTools-pullImage-2' />
finalImageTag = "1.11"; <co xml:id='ex-dockerTools-pullImage-3' /> finalImageTag = "1.11"; <co xml:id='ex-dockerTools-pullImage-3' />
sha256 = "0mqjy3zq2v6rrhizgb9nvhczl87lcfphq9601wcprdika2jz7qh8"; <co xml:id='ex-dockerTools-pullImage-4' /> sha256 = "0mqjy3zq2v6rrhizgb9nvhczl87lcfphq9601wcprdika2jz7qh8"; <co xml:id='ex-dockerTools-pullImage-4' />
os = "linux"; <co xml:id='ex-dockerTools-pullImage-5' /> os = "linux"; <co xml:id='ex-dockerTools-pullImage-5' />
arch = "x86_64"; <co xml:id='ex-dockerTools-pullImage-6' /> arch = "x86_64"; <co xml:id='ex-dockerTools-pullImage-6' />
} }
</programlisting> </programlisting>
</example> </example>
<calloutlist> <calloutlist>
@ -667,16 +680,16 @@ merge:"diff3"
<para> <para>
<varname>imageDigest</varname> specifies the digest of the image to be <varname>imageDigest</varname> specifies the digest of the image to be
downloaded. Skopeo can be used to get the digest of an image, with its downloaded. Skopeo can be used to get the digest of an image, with its
<varname>inspect</varname> subcommand. Since a given <varname>imageName</varname> <varname>inspect</varname> subcommand. Since a given
may transparently refer to a manifest list of images which support <varname>imageName</varname> may transparently refer to a manifest list
multiple architectures and/or operating systems, supply the `--override-os` of images which support multiple architectures and/or operating systems,
and `--override-arch` arguments to specify exactly which image you supply the `--override-os` and `--override-arch` arguments to specify
want. By default it will match the OS and architecture of the host the exactly which image you want. By default it will match the OS and
command is run on. architecture of the host the command is run on.
<programlisting> <programlisting>
$ nix-shell --packages skopeo jq --command "skopeo --override-os linux --override-arch x86_64 inspect docker://docker.io/nixos/nix:1.11 | jq -r '.Digest'" $ nix-shell --packages skopeo jq --command "skopeo --override-os linux --override-arch x86_64 inspect docker://docker.io/nixos/nix:1.11 | jq -r '.Digest'"
sha256:20d9485b25ecfd89204e843a962c1bd70e9cc6858d65d7f5fadc340246e2116b sha256:20d9485b25ecfd89204e843a962c1bd70e9cc6858d65d7f5fadc340246e2116b
</programlisting> </programlisting>
This argument is required. This argument is required.
</para> </para>
</callout> </callout>
@ -695,16 +708,16 @@ merge:"diff3"
</para> </para>
</callout> </callout>
<callout arearefs='ex-dockerTools-pullImage-5'> <callout arearefs='ex-dockerTools-pullImage-5'>
<para> <para>
<varname>os</varname>, if specified, is the operating system of the fetched image. <varname>os</varname>, if specified, is the operating system of the
By default it's <literal>linux</literal>. fetched image. By default it's <literal>linux</literal>.
</para> </para>
</callout> </callout>
<callout arearefs='ex-dockerTools-pullImage-6'> <callout arearefs='ex-dockerTools-pullImage-6'>
<para> <para>
<varname>arch</varname>, if specified, is the cpu architecture of the fetched image. <varname>arch</varname>, if specified, is the cpu architecture of the
By default it's <literal>x86_64</literal>. fetched image. By default it's <literal>x86_64</literal>.
</para> </para>
</callout> </callout>
</calloutlist> </calloutlist>
</section> </section>
@ -734,13 +747,13 @@ merge:"diff3"
<example xml:id='ex-dockerTools-exportImage'> <example xml:id='ex-dockerTools-exportImage'>
<title>Docker export</title> <title>Docker export</title>
<programlisting> <programlisting>
exportImage { exportImage {
fromImage = someLayeredImage; fromImage = someLayeredImage;
fromImageName = null; fromImageName = null;
fromImageTag = null; fromImageTag = null;
name = someLayeredImage.name; name = someLayeredImage.name;
} }
</programlisting> </programlisting>
</example> </example>
@ -771,19 +784,19 @@ merge:"diff3"
<example xml:id='ex-dockerTools-shadowSetup'> <example xml:id='ex-dockerTools-shadowSetup'>
<title>Shadow base files</title> <title>Shadow base files</title>
<programlisting> <programlisting>
buildImage { buildImage {
name = "shadow-basic"; name = "shadow-basic";
runAsRoot = '' runAsRoot = ''
#!${stdenv.shell} #!${stdenv.shell}
${shadowSetup} ${shadowSetup}
groupadd -r redis groupadd -r redis
useradd -r -g redis redis useradd -r -g redis redis
mkdir /data mkdir /data
chown redis:redis /data chown redis:redis /data
''; '';
} }
</programlisting> </programlisting>
</example> </example>
<para> <para>

View File

@ -15,15 +15,18 @@ stdenv.mkDerivation {
buildPhase = "ant"; buildPhase = "ant";
} }
</programlisting> </programlisting>
Note that <varname>jdk</varname> is an alias for the OpenJDK. Note that <varname>jdk</varname> is an alias for the OpenJDK (self-built
where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in
Nixpkgs (<literal>Aarch32</literal>, <literal>Aarch64</literal>) point to the
(unfree) <literal>oraclejdk</literal>.
</para> </para>
<para> <para>
JAR files that are intended to be used by other packages should be installed JAR files that are intended to be used by other packages should be installed
in <filename>$out/share/java</filename>. The OpenJDK has a stdenv setup hook in <filename>$out/share/java</filename>. JDKs have a stdenv setup hook that
that adds any JARs in the <filename>share/java</filename> directories of the add any JARs in the <filename>share/java</filename> directories of the build
build inputs to the <envar>CLASSPATH</envar> environment variable. For inputs to the <envar>CLASSPATH</envar> environment variable. For instance, if
instance, if the package <literal>libfoo</literal> installs a JAR named the package <literal>libfoo</literal> installs a JAR named
<filename>foo.jar</filename> in its <filename>share/java</filename> <filename>foo.jar</filename> in its <filename>share/java</filename>
directory, and another package declares the attribute directory, and another package declares the attribute
<programlisting> <programlisting>
@ -59,6 +62,16 @@ installPhase =
on the JDK at runtime. on the JDK at runtime.
</para> </para>
<para>
Note all JDKs passthru <literal>home</literal>, so if your application
requires environment variables like <envar>JAVA_HOME</envar> being set, that
can be done in a generic fashion with the <literal>--set</literal> argument
of <literal>makeWrapper</literal>:
<programlisting>
--set JAVA_HOME ${jdk.home}
</programlisting>
</para>
<para> <para>
It is possible to use a different Java compiler than <command>javac</command> It is possible to use a different Java compiler than <command>javac</command>
from the OpenJDK. For instance, to use the GNU Java Compiler: from the OpenJDK. For instance, to use the GNU Java Compiler:

View File

@ -14,7 +14,7 @@ project.
The package set also provides support for multiple Node.js versions. The policy The package set also provides support for multiple Node.js versions. The policy
is that a new package should be added to the collection for the latest stable LTS is that a new package should be added to the collection for the latest stable LTS
release (which is currently 6.x), unless there is an explicit reason to support release (which is currently 8.x), unless there is an explicit reason to support
a different release. a different release.
If your package uses native addons, you need to examine what kind of native If your package uses native addons, you need to examine what kind of native
@ -26,7 +26,7 @@ build system it uses. Here are some examples:
After you have identified the correct system, you need to override your package After you have identified the correct system, you need to override your package
expression while adding in build system as a build input. For example, `dat` expression while adding in build system as a build input. For example, `dat`
requires `node-gyp-build`, so we override its expression in `default-v6.nix`: requires `node-gyp-build`, so we override its expression in `default-v8.nix`:
```nix ```nix
dat = nodePackages.dat.override (oldAttrs: { dat = nodePackages.dat.override (oldAttrs: {
@ -36,14 +36,14 @@ dat = nodePackages.dat.override (oldAttrs: {
To add a package from NPM to nixpkgs: To add a package from NPM to nixpkgs:
1. Modify `pkgs/development/node-packages/node-packages-v6.json` to add, update 1. Modify `pkgs/development/node-packages/node-packages-v8.json` to add, update
or remove package entries. (Or `pkgs/development/node-packages/node-packages-v4.json` or remove package entries. (Or `pkgs/development/node-packages/node-packages-v10.json`
for packages depending on Node.js 4.x) for packages depending on Node.js 10.x)
2. Run the script: `(cd pkgs/development/node-packages && ./generate.sh)`. 2. Run the script: `(cd pkgs/development/node-packages && ./generate.sh)`.
3. Build your new package to test your changes: 3. Build your new package to test your changes:
`cd /path/to/nixpkgs && nix-build -A nodePackages.<new-or-updated-package>`. `cd /path/to/nixpkgs && nix-build -A nodePackages.<new-or-updated-package>`.
To build against a specific Node.js version (e.g. 4.x): To build against a specific Node.js version (e.g. 10.x):
`nix-build -A nodePackages_4_x.<new-or-updated-package>` `nix-build -A nodePackages_10_x.<new-or-updated-package>`
4. Add and commit all modified and generated files. 4. Add and commit all modified and generated files.
For more information about the generation process, consult the For more information about the generation process, consult the

View File

@ -645,9 +645,15 @@ in python.withPackages(ps: [ps.blaze])).env
#### `buildPythonApplication` function #### `buildPythonApplication` function
The `buildPythonApplication` function is practically the same as `buildPythonPackage`. The `buildPythonApplication` function is practically the same as
The difference is that `buildPythonPackage` by default prefixes the names of the packages with the version of the interpreter. `buildPythonPackage`. The main purpose of this function is to build a Python
Because this is irrelevant for applications, the prefix is omitted. package where one is interested only in the executables, and not importable
modules. For that reason, when adding this package to a `python.buildEnv`, the
modules won't be made available.
Another difference is that `buildPythonPackage` by default prefixes the names of
the packages with the version of the interpreter. Because this is irrelevant for
applications, the prefix is omitted.
#### `toPythonApplication` function #### `toPythonApplication` function
@ -1068,4 +1074,5 @@ Following rules are desired to be respected:
* Make sure libraries build for all Python interpreters. * Make sure libraries build for all Python interpreters.
* By default we enable tests. Make sure the tests are found and, in the case of libraries, are passing for all interpreters. If certain tests fail they can be disabled individually. Try to avoid disabling the tests altogether. In any case, when you disable tests, leave a comment explaining why. * By default we enable tests. Make sure the tests are found and, in the case of libraries, are passing for all interpreters. If certain tests fail they can be disabled individually. Try to avoid disabling the tests altogether. In any case, when you disable tests, leave a comment explaining why.
* Commit names of Python libraries should reflect that they are Python libraries, so write for example `pythonPackages.numpy: 1.11 -> 1.12`. * Commit names of Python libraries should reflect that they are Python libraries, so write for example `pythonPackages.numpy: 1.11 -> 1.12`.
* Attribute names in `python-packages.nix` should be normalized according to [PEP 0503](https://www.python.org/dev/peps/pep-0503/#normalized-names).
This means that characters should be converted to lowercase and `.` and `_` should be replaced by a single `-` (foo-bar-baz instead of Foo__Bar.baz )

View File

@ -93,8 +93,8 @@ 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 # Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone
{ lib, buildPlatform, buildRustCrate, fetchgit }: { lib, stdenv, buildRustCrate, fetchgit }:
let kernel = buildPlatform.parsed.kernel.name; let kernel = stdenv.buildPlatform.parsed.kernel.name;
# ... (content skipped) # ... (content skipped)
in in
rec { rec {
@ -122,8 +122,8 @@ following nix file:
``` ```
# Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone # Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone
{ lib, buildPlatform, buildRustCrate, fetchgit }: { lib, stdenv, buildRustCrate, fetchgit }:
let kernel = buildPlatform.parsed.kernel.name; let kernel = stdenv.buildPlatform.parsed.kernel.name;
# ... (content skipped) # ... (content skipped)
in in
rec { rec {

View File

@ -8,7 +8,7 @@
under attribute <varname>texlive</varname>. under attribute <varname>texlive</varname>.
</para> </para>
<section> <section xml:id="sec-language-texlive-users-guide">
<title>User's guide</title> <title>User's guide</title>
<itemizedlist> <itemizedlist>
@ -68,7 +68,7 @@ nix-repl> texlive.collection-&lt;TAB>
</itemizedlist> </itemizedlist>
</section> </section>
<section> <section xml:id="sec-language-texlive-known-problems">
<title>Known problems</title> <title>Known problems</title>
<itemizedlist> <itemizedlist>

View File

@ -6,7 +6,7 @@
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="chap-multiple-output"> xml:id="chap-multiple-output">
<title>Multiple-output packages</title> <title>Multiple-output packages</title>
<section> <section xml:id="sec-multiple-outputs-introduction">
<title>Introduction</title> <title>Introduction</title>
<para> <para>
@ -38,7 +38,7 @@
</para> </para>
</note> </note>
</section> </section>
<section> <section xml:id="sec-multiple-outputs-installing">
<title>Installing a split package</title> <title>Installing a split package</title>
<para> <para>
@ -84,7 +84,7 @@
</listitem> </listitem>
</itemizedlist> </itemizedlist>
</section> </section>
<section> <section xml:id="sec-multiple-outputs-using-split-packages">
<title>Using a split package</title> <title>Using a split package</title>
<para> <para>
@ -102,7 +102,7 @@
also added. (See <xref linkend="multiple-output-file-type-groups" />.) also added. (See <xref linkend="multiple-output-file-type-groups" />.)
</para> </para>
</section> </section>
<section> <section xml:id="sec-multiple-outputs-">
<title>Writing a split derivation</title> <title>Writing a split derivation</title>
<para> <para>
@ -283,7 +283,7 @@
</variablelist> </variablelist>
</section> </section>
<section> <section xml:id="sec-multiple-outputs-caveats">
<title>Common caveats</title> <title>Common caveats</title>
<itemizedlist> <itemizedlist>

View File

@ -64,7 +64,7 @@ stdenv.mkDerivation {
sha256 = "1ian3kwh2vg6hr3ymrv48s04gijs539vzrq62xr76bxbhbwnz2np"; sha256 = "1ian3kwh2vg6hr3ymrv48s04gijs539vzrq62xr76bxbhbwnz2np";
}; };
inherit noSysDirs; inherit noSysDirs;
configureFlags = "--target=arm-linux"; configureFlags = [ "--target=arm-linux" ];
} }
--- ---
@ -78,7 +78,7 @@ Step 2: build kernel headers for the target architecture
--- ---
{stdenv, fetchurl}: {stdenv, fetchurl}:
assert stdenv.system == "i686-linux"; assert stdenv.buildPlatform.system == "i686-linux";
stdenv.mkDerivation { stdenv.mkDerivation {
name = "linux-headers-2.6.13.1-arm"; name = "linux-headers-2.6.13.1-arm";

View File

@ -181,7 +181,7 @@ $ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
</section> </section>
<!--============================================================--> <!--============================================================-->
<!-- <!--
<section> <section xml:id="sec-package-notes-gnome">
<title>Gnome</title> <title>Gnome</title>
<para>* Expression is auto-generated</para> <para>* Expression is auto-generated</para>
<para>* How to update</para> <para>* How to update</para>
@ -189,7 +189,7 @@ $ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
--> -->
<!--============================================================--> <!--============================================================-->
<!-- <!--
<section> <section xml:id="sec-package-notes-gcc">
<title>GCC</title> <title>GCC</title>
<para></para> <para></para>
</section> </section>
@ -671,6 +671,8 @@ overrides = super: self: rec {
plugins = with availablePlugins; [ python perl ]; plugins = with availablePlugins; [ python perl ];
} }
}</programlisting> }</programlisting>
If the <literal>configure</literal> function returns an attrset without the <literal>plugins</literal>
attribute, <literal>availablePlugins</literal> will be used automatically.
</para> </para>
<para> <para>
@ -704,45 +706,104 @@ overrides = super: self: rec {
}; } }; }
</programlisting> </programlisting>
</para> </para>
<para>
WeeChat allows to set defaults on startup using the <literal>--run-command</literal>.
The <literal>configure</literal> method can be used to pass commands to the program:
<programlisting>weechat.override {
configure = { availablePlugins, ... }: {
init = ''
/set foo bar
/server add freenode chat.freenode.org
'';
};
}</programlisting>
Further values can be added to the list of commands when running
<literal>weechat --run-command "your-commands"</literal>.
</para>
<para>
Additionally it's possible to specify scripts to be loaded when starting <literal>weechat</literal>.
These will be loaded before the commands from <literal>init</literal>:
<programlisting>weechat.override {
configure = { availablePlugins, ... }: {
scripts = with pkgs.weechatScripts; [
weechat-xmpp weechat-matrix-bridge wee-slack
];
init = ''
/set plugins.var.python.jabber.key "val"
'':
};
}</programlisting>
</para>
<para>
In <literal>nixpkgs</literal> there's a subpackage which contains derivations for
WeeChat scripts. Such derivations expect a <literal>passthru.scripts</literal> attribute
which contains a list of all scripts inside the store path. Furthermore all scripts
have to live in <literal>$out/share</literal>. An exemplary derivation looks like this:
<programlisting>{ stdenv, fetchurl }:
stdenv.mkDerivation {
name = "exemplary-weechat-script";
src = fetchurl {
url = "https://scripts.tld/your-scripts.tar.gz";
sha256 = "...";
};
passthru.scripts = [ "foo.py" "bar.lua" ];
installPhase = ''
mkdir $out/share
cp foo.py $out/share
cp bar.lua $out/share
'';
}</programlisting>
</para>
</section> </section>
<section xml:id="sec-citrix"> <section xml:id="sec-citrix">
<title>Citrix Receiver</title> <title>Citrix Receiver</title>
<para> <para>
The <link xlink:href="https://www.citrix.com/products/receiver/">Citrix Receiver</link> is a remote The <link xlink:href="https://www.citrix.com/products/receiver/">Citrix
desktop viewer which provides access to Receiver</link> is a remote desktop viewer which provides access to
<link xlink:href="https://www.citrix.com/products/xenapp-xendesktop/">XenDesktop</link> installations. <link xlink:href="https://www.citrix.com/products/xenapp-xendesktop/">XenDesktop</link>
installations.
</para> </para>
<section xml:id="sec-citrix-base"> <section xml:id="sec-citrix-base">
<title>Basic usage</title> <title>Basic usage</title>
<para> <para>
The tarball archive needs to be downloaded manually as the licenses agreements of the vendor The tarball archive needs to be downloaded manually as the licenses
need to be accepted first. This is available at the agreements of the vendor need to be accepted first. This is available at
<link xlink:href="https://www.citrix.com/downloads/citrix-receiver/">download page at citrix.com</link>. the
Then run <literal>nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz</literal>. <link xlink:href="https://www.citrix.com/downloads/citrix-receiver/">download
With the archive available in the store the package can be built and installed with Nix. page at citrix.com</link>. Then run <literal>nix-prefetch-url
file://$PWD/linuxx64-$version.tar.gz</literal>. With the archive available
in the store the package can be built and installed with Nix.
</para> </para>
<para> <para>
<emphasis>Note: it's recommended to install <literal>Citrix Receiver</literal> using <emphasis>Note: it's recommended to install <literal>Citrix
<literal>nix-env -i</literal> or globally to ensure that the <literal>.desktop</literal> files Receiver</literal> using <literal>nix-env -i</literal> or globally to
are installed properly into <literal>$XDG_CONFIG_DIRS</literal>. Otherwise it won't ensure that the <literal>.desktop</literal> files are installed properly
be possible to open <literal>.ica</literal> files into <literal>$XDG_CONFIG_DIRS</literal>. Otherwise it won't be possible to
automatically from the browser to start a Citrix connection.</emphasis> open <literal>.ica</literal> files automatically from the browser to start
a Citrix connection.</emphasis>
</para> </para>
</section> </section>
<section xml:id="sec-citrix-custom-certs"> <section xml:id="sec-citrix-custom-certs">
<title>Custom certificates</title> <title>Custom certificates</title>
<para> <para>
The <literal>Citrix Receiver</literal> in <literal>nixpkgs</literal> trusts several certificates The <literal>Citrix Receiver</literal> in <literal>nixpkgs</literal> trusts
<link xlink:href="https://curl.haxx.se/docs/caextract.html">from the Mozilla database</link> by default. several certificates
However several companies using Citrix might require their own corporate certificate. On distros with imperative <link xlink:href="https://curl.haxx.se/docs/caextract.html">from the
Mozilla database</link> by default. However several companies using Citrix
might require their own corporate certificate. On distros with imperative
packaging these certs can be stored easily in packaging these certs can be stored easily in
<link xlink:href="https://developer-docs.citrix.com/projects/receiver-for-linux-command-reference/en/13.7/"><literal>$ICAROOT</literal></link>, <link xlink:href="https://developer-docs.citrix.com/projects/receiver-for-linux-command-reference/en/13.7/"><literal>$ICAROOT</literal></link>,
however this directory is a store path in <literal>nixpkgs</literal>. In order to work around this issue the package provides a simple however this directory is a store path in <literal>nixpkgs</literal>. In
mechanism to add custom certificates without rebuilding the entire package using <literal>symlinkJoin</literal>: order to work around this issue the package provides a simple mechanism to
add custom certificates without rebuilding the entire package using
<literal>symlinkJoin</literal>:
<programlisting> <programlisting>
<![CDATA[with import <nixpkgs> { config.allowUnfree = true; }; <![CDATA[with import <nixpkgs> { config.allowUnfree = true; };
let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in

View File

@ -29,7 +29,6 @@
} }
</programlisting> </programlisting>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
On darwin libraries are linked using absolute paths, libraries are On darwin libraries are linked using absolute paths, libraries are
@ -47,19 +46,19 @@
} }
</programlisting> </programlisting>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Even if the libraries are linked using absolute paths and resolved via Even if the libraries are linked using absolute paths and resolved via
their <literal>install_name</literal> correctly, tests can sometimes fail their <literal>install_name</literal> correctly, tests can sometimes fail
to run binaries. This happens because the <varname>checkPhase</varname> to run binaries. This happens because the <varname>checkPhase</varname>
runs before the libraries are installed. runs before the libraries are installed.
</para> </para>
<para> <para>
This can usually be solved by running the tests after the This can usually be solved by running the tests after the
<varname>installPhase</varname> or alternatively by using <varname>installPhase</varname> or alternatively by using
<varname>DYLD_LIBRARY_PATH</varname>. More information about this variable <varname>DYLD_LIBRARY_PATH</varname>. More information about this variable
can be found in the <citerefentry><refentrytitle>dyld</refentrytitle> can be found in the <citerefentry>
<refentrytitle>dyld</refentrytitle>
<manvolnum>1</manvolnum></citerefentry> manpage. <manvolnum>1</manvolnum></citerefentry> manpage.
</para> </para>
<programlisting> <programlisting>
@ -77,7 +76,6 @@
} }
</programlisting> </programlisting>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Some packages assume xcode is available and use <command>xcrun</command> Some packages assume xcode is available and use <command>xcrun</command>

View File

@ -2,7 +2,7 @@
<article xmlns="http://docbook.org/ns/docbook" <article xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"> xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Nixpkgs Release Notes</title> <title>Nixpkgs Release Notes</title>
<section> <section xml:id="release-notes-0.14">
<title>Release 0.14 (June 4, 2012)</title> <title>Release 0.14 (June 4, 2012)</title>
<para> <para>
@ -17,7 +17,7 @@
packages by numerous contributors. For details, see the commit logs. packages by numerous contributors. For details, see the commit logs.
</para> </para>
</section> </section>
<section> <section xml:id="release-notes-0.13">
<title>Release 0.13 (February 5, 2010)</title> <title>Release 0.13 (February 5, 2010)</title>
<para> <para>
@ -51,7 +51,7 @@
</itemizedlist> </itemizedlist>
</para> </para>
</section> </section>
<section> <section xml:id="release-notes-0.12">
<title>Release 0.12 (April 24, 2009)</title> <title>Release 0.12 (April 24, 2009)</title>
<para> <para>
@ -145,7 +145,7 @@
<literal>nix-dev</literal> mailing list. <literal>nix-dev</literal> mailing list.
</para> </para>
</section> </section>
<section> <section xml:id="release-notes-0.11">
<title>Release 0.11 (September 11, 2007)</title> <title>Release 0.11 (September 11, 2007)</title>
<para> <para>
@ -344,7 +344,7 @@ export NIX_MIRRORS_sourceforge=http://osdn.dl.sourceforge.net/sourceforge/</prog
Bravenboer, Michael Raskin, Wouter den Breejen and Yury G. Kudryashov. Bravenboer, Michael Raskin, Wouter den Breejen and Yury G. Kudryashov.
</para> </para>
</section> </section>
<section> <section xml:id="release-notes-0.10">
<title>Release 0.10 (October 12, 2006)</title> <title>Release 0.10 (October 12, 2006)</title>
<note> <note>
@ -547,7 +547,7 @@ stdenv.mkDerivation {
Bravenboer, Merijn de Jonge, Rob Vermaas and Roy van den Broek. Bravenboer, Merijn de Jonge, Rob Vermaas and Roy van den Broek.
</para> </para>
</section> </section>
<section> <section xml:id="release-notes-0.9">
<title>Release 0.9 (January 31, 2006)</title> <title>Release 0.9 (January 31, 2006)</title>
<para> <para>
@ -676,7 +676,7 @@ stdenv.mkDerivation {
Martin Bravenboer, Rob Vermaas and Roy van den Broek. Martin Bravenboer, Rob Vermaas and Roy van den Broek.
</para> </para>
</section> </section>
<section> <section xml:id="release-notes-0.8">
<title>Release 0.8 (April 11, 2005)</title> <title>Release 0.8 (April 11, 2005)</title>
<para> <para>
@ -700,7 +700,7 @@ stdenv.mkDerivation {
</itemizedlist> </itemizedlist>
</para> </para>
</section> </section>
<section> <section xml:id="release-notes-0.7">
<title>Release 0.7 (March 14, 2005)</title> <title>Release 0.7 (March 14, 2005)</title>
<itemizedlist> <itemizedlist>

View File

@ -6,18 +6,20 @@
<title>Reviewing contributions</title> <title>Reviewing contributions</title>
<warning> <warning>
<para> <para>
The following section is a draft, and the policy for reviewing is still being The following section is a draft, and the policy for reviewing is still
discussed in issues such as <link being discussed in issues such as
<link
xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166
</link> and <link </link> and
<link
xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836
</link>. </link>.
</para> </para>
</warning> </warning>
<para> <para>
The nixpkgs project receives a fairly high number of contributions via The nixpkgs project receives a fairly high number of contributions via GitHub
GitHub pull-requests. Reviewing and approving these is an important task and pull-requests. Reviewing and approving these is an important task and a way
a way to contribute to the project. to contribute to the project.
</para> </para>
<para> <para>
The high change rate of nixpkgs makes any pull request that remains open for The high change rate of nixpkgs makes any pull request that remains open for
@ -40,10 +42,10 @@
to respect every community member and their work. to respect every community member and their work.
</para> </para>
<para> <para>
GitHub provides reactions as a simple and quick way to provide GitHub provides reactions as a simple and quick way to provide feedback to
feedback to pull-requests or any comments. The thumb-down reaction should be pull-requests or any comments. The thumb-down reaction should be used with
used with care and if possible accompanied with some explanation so the care and if possible accompanied with some explanation so the submitter has
submitter has directions to improve their contribution. directions to improve their contribution.
</para> </para>
<para> <para>
Pull-request reviews should include a list of what has been reviewed in a Pull-request reviews should include a list of what has been reviewed in a
@ -54,7 +56,7 @@
meant as examples. Their usage is optional and the reviewer is free to adapt meant as examples. Their usage is optional and the reviewer is free to adapt
them to their liking. them to their liking.
</para> </para>
<section> <section xml:id="reviewing-contributions-package-updates">
<title>Package updates</title> <title>Package updates</title>
<para> <para>
@ -117,8 +119,8 @@
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
License can change with version updates, so it should be checked to match License can change with version updates, so it should be checked to
the upstream license. match the upstream license.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@ -143,8 +145,8 @@
<listitem> <listitem>
<para> <para>
Pull-requests are often targeted to the master or staging branch, and Pull-requests are often targeted to the master or staging branch, and
building the pull-request locally when it is submitted can trigger building the pull-request locally when it is submitted can trigger many
many source builds. source builds.
</para> </para>
<para> <para>
It is possible to rebase the changes on nixos-unstable or It is possible to rebase the changes on nixos-unstable or
@ -206,7 +208,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<example> <example xml:id="reviewing-contributions-sample-package-update">
<title>Sample template for a package update review</title> <title>Sample template for a package update review</title>
<screen> <screen>
##### Reviewed points ##### Reviewed points
@ -224,7 +226,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</screen> </screen>
</example> </example>
</section> </section>
<section> <section xml:id="reviewing-contributions-new-packages">
<title>New packages</title> <title>New packages</title>
<para> <para>
@ -318,7 +320,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<example> <example xml:id="reviewing-contributions-sample-new-package">
<title>Sample template for a new package review</title> <title>Sample template for a new package review</title>
<screen> <screen>
##### Reviewed points ##### Reviewed points
@ -344,7 +346,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</screen> </screen>
</example> </example>
</section> </section>
<section> <section xml:id="reviewing-contributions-module-updates">
<title>Module updates</title> <title>Module updates</title>
<para> <para>
@ -441,7 +443,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<example> <example xml:id="reviewing-contributions-sample-module-update">
<title>Sample template for a module update review</title> <title>Sample template for a module update review</title>
<screen> <screen>
##### Reviewed points ##### Reviewed points
@ -462,7 +464,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</screen> </screen>
</example> </example>
</section> </section>
<section> <section xml:id="reviewing-contributions-new-modules">
<title>New modules</title> <title>New modules</title>
<para> <para>
@ -540,7 +542,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<example> <example xml:id="reviewing-contributions-sample-new-module">
<title>Sample template for a new module review</title> <title>Sample template for a new module review</title>
<screen> <screen>
##### Reviewed points ##### Reviewed points
@ -562,7 +564,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</screen> </screen>
</example> </example>
</section> </section>
<section> <section xml:id="reviewing-contributions-other-submissions">
<title>Other submissions</title> <title>Other submissions</title>
<para> <para>
@ -583,7 +585,7 @@ $ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
pull requests fitting this category. pull requests fitting this category.
</para> </para>
</section> </section>
<section> <section xml:id="reviewing-contributions--merging-pull-requests">
<title>Merging pull-requests</title> <title>Merging pull-requests</title>
<para> <para>
@ -606,9 +608,11 @@ policy.
<para> <para>
In a case a contributor leaves definitively the Nix community, he should 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 create an issue or post on
modules he maintains so the maintainership can be taken over by other <link
contributors. xlink:href="https://discourse.nixos.org">Discourse</link> with
references of packages and modules he maintains so the maintainership can be
taken over by other contributors.
</para> </para>
</section> </section>
</chapter> </chapter>

View File

@ -212,7 +212,7 @@ genericBuild
platforms relative to the new derivation's, and whether they are propagated. platforms relative to the new derivation's, and whether they are propagated.
The platform distinctions are motivated by cross compilation; see The platform distinctions are motivated by cross compilation; see
<xref linkend="chap-cross"/> for exactly what each platform means. <xref linkend="chap-cross"/> for exactly what each platform means.
<footnote> <footnote xml:id="footnote-stdenv-ignored-build-platform">
<para> <para>
The build platform is ignored because it is a mere implementation detail The build platform is ignored because it is a mere implementation detail
of the package satisfying the dependency: As a general programming of the package satisfying the dependency: As a general programming
@ -233,7 +233,7 @@ genericBuild
out only for dependencies whose host platform matches the new derivation's out only for dependencies whose host platform matches the new derivation's
build platformi.e. which run on the platform where the new derivation build platformi.e. which run on the platform where the new derivation
will be built. will be built.
<footnote> <footnote xml:id="footnote-stdenv-native-dependencies-in-path">
<para> <para>
Currently, that means for native builds all dependencies are put on the Currently, that means for native builds all dependencies are put on the
<envar>PATH</envar>. But in the future that may not be the case for sake <envar>PATH</envar>. But in the future that may not be the case for sake
@ -280,7 +280,7 @@ genericBuild
<link xlink:href="https://en.wikipedia.org/wiki/Natural_deduction">Natural <link xlink:href="https://en.wikipedia.org/wiki/Natural_deduction">Natural
Deduction</link> using the inference rules. This probably seems a bit Deduction</link> using the inference rules. This probably seems a bit
obtuse, but so is the bash code that actually implements it! obtuse, but so is the bash code that actually implements it!
<footnote> <footnote xml:id="footnote-stdenv-find-inputs-location">
<para> <para>
The <function>findInputs</function> function, currently residing in The <function>findInputs</function> function, currently residing in
<filename>pkgs/stdenv/generic/setup.sh</filename>, implements the <filename>pkgs/stdenv/generic/setup.sh</filename>, implements the
@ -1112,7 +1112,7 @@ passthru = {
By default, the configure phase applies some special hackery to all By default, the configure phase applies some special hackery to all
files called <filename>ltmain.sh</filename> before running the configure files called <filename>ltmain.sh</filename> before running the configure
script in order to improve the purity of Libtool-based packages script in order to improve the purity of Libtool-based packages
<footnote> <footnote xml:id="footnote-stdenv-sys-lib-search-path">
<para> <para>
It clears the It clears the
<varname>sys_lib_<replaceable>*</replaceable>search_path</varname> <varname>sys_lib_<replaceable>*</replaceable>search_path</varname>
@ -1151,7 +1151,7 @@ passthru = {
or a subset to control exactly which platform flags are passed. or a subset to control exactly which platform flags are passed.
Compilers and other tools should use this to also pass the target Compilers and other tools should use this to also pass the target
platform, for example. platform, for example.
<footnote> <footnote xml:id="footnote-stdenv-build-time-guessing-impurity">
<para> <para>
Eventually these will be passed when in native builds too, to improve Eventually these will be passed when in native builds too, to improve
determinism: build-time guessing, as is done today, is a risk of determinism: build-time guessing, as is done today, is a risk of
@ -1740,6 +1740,29 @@ set debug-file-directory ~/.nix-profile/lib/debug
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<varname>installCheckTarget</varname>
</term>
<listitem>
<para>
The make target that runs the install tests. Defaults to
<literal>installcheck</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<varname>installCheckFlags</varname> / <varname>installCheckFlagsArray</varname>
</term>
<listitem>
<para>
A list of strings passed as additional flags to <command>make</command>.
Like <varname>makeFlags</varname> and <varname>makeFlagsArray</varname>,
but only used by the installCheck phase.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<varname>installCheckInputs</varname> <varname>installCheckInputs</varname>
@ -2190,7 +2213,7 @@ addEnvHooks "$hostOffset" myBashFunction
<command>clang</command> is to be used. Secondly, this helps packages <command>clang</command> is to be used. Secondly, this helps packages
not get confused when cross-compiling, in which case multiple Bintools not get confused when cross-compiling, in which case multiple Bintools
Wrappers may simultaneously be in use. Wrappers may simultaneously be in use.
<footnote> <footnote xml:id="footnote-stdenv-per-platform-wrapper">
<para> <para>
Each wrapper targets a single platform, so if binaries for multiple Each wrapper targets a single platform, so if binaries for multiple
platforms are needed, the underlying binaries must be wrapped multiple platforms are needed, the underlying binaries must be wrapped multiple

View File

@ -2,7 +2,7 @@
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="chap-submitting-changes"> xml:id="chap-submitting-changes">
<title>Submitting changes</title> <title>Submitting changes</title>
<section> <section xml:id="submitting-changes-making-patches">
<title>Making patches</title> <title>Making patches</title>
<itemizedlist> <itemizedlist>
@ -205,7 +205,7 @@ Additional information.
</listitem> </listitem>
</itemizedlist> </itemizedlist>
</section> </section>
<section> <section xml:id="submitting-changes-submitting-changes">
<title>Submitting changes</title> <title>Submitting changes</title>
<itemizedlist> <itemizedlist>
@ -253,7 +253,7 @@ Additional information.
</listitem> </listitem>
</itemizedlist> </itemizedlist>
</section> </section>
<section> <section xml:id="submitting-changes-pull-request-template">
<title>Pull Request Template</title> <title>Pull Request Template</title>
<para> <para>
@ -269,7 +269,7 @@ Additional information.
below: below:
</para> </para>
<section> <section xml:id="submitting-changes-tested-with-sandbox">
<title>Tested using sandboxing</title> <title>Tested using sandboxing</title>
<para> <para>
@ -322,7 +322,7 @@ Additional information.
</para> </para>
</section> </section>
<section> <section xml:id="submitting-changes-platform-diversity">
<title>Built on platform(s)</title> <title>Built on platform(s)</title>
<para> <para>
@ -334,7 +334,7 @@ Additional information.
</para> </para>
</section> </section>
<section> <section xml:id="submitting-changes-nixos-tests">
<title>Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)</title> <title>Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)</title>
<para> <para>
@ -350,7 +350,7 @@ Additional information.
</para> </para>
</section> </section>
<section> <section xml:id="submitting-changes-tested-compilation">
<title>Tested compilation of all pkgs that depend on this change using <command>nox-review</command></title> <title>Tested compilation of all pkgs that depend on this change using <command>nox-review</command></title>
<para> <para>
@ -373,7 +373,7 @@ Additional information.
</para> </para>
</section> </section>
<section> <section xml:id="submitting-changes-tested-execution">
<title>Tested execution of all binary files (usually in <filename>./result/bin/</filename>)</title> <title>Tested execution of all binary files (usually in <filename>./result/bin/</filename>)</title>
<para> <para>
@ -387,8 +387,8 @@ Additional information.
</para> </para>
</section> </section>
<section> <section xml:id="submitting-changes-contribution-standards">
<title>Meets nixpkgs contribution standards</title> <title>Meets Nixpkgs contribution standards</title>
<para> <para>
The last checkbox is fits The last checkbox is fits
@ -402,7 +402,7 @@ Additional information.
</para> </para>
</section> </section>
</section> </section>
<section> <section xml:id="submitting-changes-hotfixing-pull-requests">
<title>Hotfixing pull requests</title> <title>Hotfixing pull requests</title>
<itemizedlist> <itemizedlist>
@ -430,7 +430,7 @@ Additional information.
</listitem> </listitem>
</itemizedlist> </itemizedlist>
</section> </section>
<section> <section xml:id="submitting-changes-commit-policy">
<title>Commit policy</title> <title>Commit policy</title>
<itemizedlist> <itemizedlist>
@ -456,7 +456,7 @@ Additional information.
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<section> <section xml:id="submitting-changes-master-branch">
<title>Master branch</title> <title>Master branch</title>
<itemizedlist> <itemizedlist>
@ -468,7 +468,7 @@ Additional information.
</itemizedlist> </itemizedlist>
</section> </section>
<section> <section xml:id="submitting-changes-staging-branch">
<title>Staging branch</title> <title>Staging branch</title>
<itemizedlist> <itemizedlist>
@ -493,7 +493,7 @@ Additional information.
</itemizedlist> </itemizedlist>
</section> </section>
<section> <section xml:id="submitting-changes-stable-release-branches">
<title>Stable release branches</title> <title>Stable release branches</title>
<itemizedlist> <itemizedlist>

44
lib/asserts.nix Normal file
View File

@ -0,0 +1,44 @@
{ lib }:
rec {
/* Print a trace message if pred is false.
Intended to be used to augment asserts with helpful error messages.
Example:
assertMsg false "nope"
=> false
stderr> trace: nope
assert (assertMsg ("foo" == "bar") "foo is not bar, silly"); ""
stderr> trace: foo is not bar, silly
stderr> assert failed at
Type:
assertMsg :: Bool -> String -> Bool
*/
# TODO(Profpatsch): add tests that check stderr
assertMsg = pred: msg:
if pred
then true
else builtins.trace msg false;
/* Specialized `assertMsg` for checking if val is one of the elements
of a list. Useful for checking enums.
Example:
let sslLibrary = "libressl"
in assertOneOf "sslLibrary" sslLibrary [ "openssl" "bearssl" ]
=> false
stderr> trace: sslLibrary must be one of "openssl", "bearssl", but is: "libressl"
Type:
assertOneOf :: String -> ComparableVal -> List ComparableVal -> Bool
*/
assertOneOf = name: val: xs: assertMsg
(lib.elem val xs)
"${name} must be one of ${
lib.generators.toPretty {} xs}, but is: ${
lib.generators.toPretty {} val}";
}

View File

@ -145,7 +145,7 @@ rec {
foldAttrs = op: nul: list_of_attrs: foldAttrs = op: nul: list_of_attrs:
fold (n: a: fold (n: a:
fold (name: o: fold (name: o:
o // (listToAttrs [{inherit name; value = op n.${name} (a.${name} or nul); }]) o // { ${name} = op n.${name} (a.${name} or nul); }
) a (attrNames n) ) a (attrNames n)
) {} list_of_attrs; ) {} list_of_attrs;
@ -384,11 +384,12 @@ rec {
recursiveUpdateUntil = pred: lhs: rhs: recursiveUpdateUntil = pred: lhs: rhs:
let f = attrPath: let f = attrPath:
zipAttrsWith (n: values: zipAttrsWith (n: values:
let here = attrPath ++ [n]; in
if tail values == [] if tail values == []
|| pred attrPath (head (tail values)) (head values) then || pred here (head (tail values)) (head values) then
head values head values
else else
f (attrPath ++ [n]) values f here values
); );
in f [] [rhs lhs]; in f [] [rhs lhs];

View File

@ -195,9 +195,10 @@ rec {
let self = f self // { let self = f self // {
newScope = scope: newScope (self // scope); newScope = scope: newScope (self // scope);
callPackage = self.newScope {}; callPackage = self.newScope {};
# TODO(@Ericson2314): Haromonize argument order of `g` with everything else
overrideScope = g: overrideScope = g:
makeScope newScope makeScope newScope
(self_: let super = f self_; in super // g super self_); (lib.fixedPoints.extends (lib.flip g) f);
packages = f; packages = f;
}; };
in self; in self;

View File

@ -38,10 +38,11 @@ let
systems = callLibs ./systems; systems = callLibs ./systems;
# misc # misc
asserts = callLibs ./asserts.nix;
debug = callLibs ./debug.nix; debug = callLibs ./debug.nix;
generators = callLibs ./generators.nix; generators = callLibs ./generators.nix;
misc = callLibs ./deprecated.nix; misc = callLibs ./deprecated.nix;
# domain-specific # domain-specific
fetchers = callLibs ./fetchers.nix; fetchers = callLibs ./fetchers.nix;
@ -60,7 +61,6 @@ let
boolToString mergeAttrs flip mapNullable inNixShell min max boolToString mergeAttrs flip mapNullable inNixShell min max
importJSON warn info nixpkgsVersion version mod compare importJSON warn info nixpkgsVersion version mod compare
splitByAndCompare functionArgs setFunctionArgs isFunction; splitByAndCompare functionArgs setFunctionArgs isFunction;
inherit (fixedPoints) fix fix' extends composeExtensions inherit (fixedPoints) fix fix' extends composeExtensions
makeExtensible makeExtensibleWithCustomName; makeExtensible makeExtensibleWithCustomName;
inherit (attrsets) attrByPath hasAttrByPath setAttrByPath inherit (attrsets) attrByPath hasAttrByPath setAttrByPath
@ -80,7 +80,7 @@ let
inherit (strings) concatStrings concatMapStrings concatImapStrings inherit (strings) concatStrings concatMapStrings concatImapStrings
intersperse concatStringsSep concatMapStringsSep intersperse concatStringsSep concatMapStringsSep
concatImapStringsSep makeSearchPath makeSearchPathOutput concatImapStringsSep makeSearchPath makeSearchPathOutput
makeLibraryPath makeBinPath makePerlPath optionalString makeLibraryPath makeBinPath makePerlPath makeFullPerlPath optionalString
hasPrefix hasSuffix stringToCharacters stringAsChars escape hasPrefix hasSuffix stringToCharacters stringAsChars escape
escapeShellArg escapeShellArgs replaceChars lowerChars escapeShellArg escapeShellArgs replaceChars lowerChars
upperChars toLower toUpper addContextFrom splitString upperChars toLower toUpper addContextFrom splitString
@ -117,6 +117,8 @@ let
unknownModule mkOption; unknownModule mkOption;
inherit (types) isType setType defaultTypeMerge defaultFunctor inherit (types) isType setType defaultTypeMerge defaultFunctor
isOptionType mkOptionType; isOptionType mkOptionType;
inherit (asserts)
assertMsg assertOneOf;
inherit (debug) addErrorContextToAttrs traceIf traceVal traceValFn inherit (debug) addErrorContextToAttrs traceIf traceVal traceValFn
traceXMLVal traceXMLValMarked traceSeq traceSeqN traceValSeq traceXMLVal traceXMLValMarked traceSeq traceSeqN traceValSeq
traceValSeqFn traceValSeqN traceValSeqNFn traceShowVal traceValSeqFn traceValSeqN traceValSeqNFn traceShowVal

View File

@ -210,6 +210,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Common Public License 1.0"; fullName = "Common Public License 1.0";
}; };
curl = {
fullName = "MIT/X11 derivate";
url = "https://curl.haxx.se/docs/copyright.html";
};
doc = spdx { doc = spdx {
spdxId = "DOC"; spdxId = "DOC";
fullName = "DOC License"; fullName = "DOC License";
@ -541,6 +546,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Public Domain"; fullName = "Public Domain";
}; };
purdueBsd = {
fullName = " Purdue BSD-Style License"; # also know as lsof license
url = https://enterprise.dejacode.com/licenses/public/purdue-bsd;
};
qpl = spdx { qpl = spdx {
spdxId = "QPL-1.0"; spdxId = "QPL-1.0";
fullName = "Q Public License 1.0"; fullName = "Q Public License 1.0";
@ -613,6 +623,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Vim License"; fullName = "Vim License";
}; };
virtualbox-puel = {
fullName = "Oracle VM VirtualBox Extension Pack Personal Use and Evaluation License (PUEL)";
url = "https://www.virtualbox.org/wiki/VirtualBox_PUEL";
free = false;
};
vsl10 = spdx { vsl10 = spdx {
spdxId = "VSL-1.0"; spdxId = "VSL-1.0";
fullName = "Vovida Software License v1.0"; fullName = "Vovida Software License v1.0";
@ -643,6 +659,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "wxWindows Library Licence, Version 3.1"; fullName = "wxWindows Library Licence, Version 3.1";
}; };
xfig = {
fullName = "xfig";
url = "http://mcj.sourceforge.net/authors.html#xfig";
};
zlib = spdx { zlib = spdx {
spdxId = "Zlib"; spdxId = "Zlib";
fullName = "zlib License"; fullName = "zlib License";

View File

@ -509,7 +509,8 @@ rec {
=> 3 => 3
*/ */
last = list: last = list:
assert list != []; elemAt list (length list - 1); assert lib.assertMsg (list != []) "lists.last: list must not be empty!";
elemAt list (length list - 1);
/* Return all elements but the last /* Return all elements but the last
@ -517,7 +518,9 @@ rec {
init [ 1 2 3 ] init [ 1 2 3 ]
=> [ 1 2 ] => [ 1 2 ]
*/ */
init = list: assert list != []; take (length list - 1) list; init = list:
assert lib.assertMsg (list != []) "lists.init: list must not be empty!";
take (length list - 1) list;
/* return the image of the cross product of some lists by a function /* return the image of the cross product of some lists by a function

View File

@ -1,2 +1,2 @@
# Expose the minimum required version for evaluating Nixpkgs # Expose the minimum required version for evaluating Nixpkgs
"1.11" "2.0"

View File

@ -192,29 +192,53 @@ rec {
(concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules); (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules);
mergeModules' = prefix: options: configs: mergeModules' = prefix: options: configs:
listToAttrs (map (name: { let
/* byName is like foldAttrs, but will look for attributes to merge in the
specified attribute name.
byName "foo" (module: value: ["module.hidden=${module.hidden},value=${value}"])
[
{
hidden="baz";
foo={qux="bar"; gla="flop";};
}
{
hidden="fli";
foo={qux="gne"; gli="flip";};
}
]
===>
{
gla = [ "module.hidden=baz,value=flop" ];
gli = [ "module.hidden=fli,value=flip" ];
qux = [ "module.hidden=baz,value=bar" "module.hidden=fli,value=gne" ];
}
*/
byName = attr: f: modules: foldl' (acc: module:
foldl' (inner: name:
inner // { ${name} = (acc.${name} or []) ++ (f module module.${attr}.${name}); }
) acc (attrNames module.${attr})
) {} modules;
# an attrset 'name' => list of submodules that declare name.
declsByName = byName "options"
(module: option: [{ inherit (module) file; options = option; }])
options;
# an attrset 'name' => list of submodules that define name.
defnsByName = byName "config" (module: value:
map (config: { inherit (module) file; inherit config; }) (pushDownProperties value)
) configs;
# extract the definitions for each loc
defnsByName' = byName "config"
(module: value: [{ inherit (module) file; inherit value; }])
configs;
in
(flip mapAttrs declsByName (name: decls:
# We're descending into attribute name. # We're descending into attribute name.
inherit name;
value =
let let
loc = prefix ++ [name]; loc = prefix ++ [name];
# Get all submodules that declare name. defns = defnsByName.${name} or [];
decls = concatMap (m: defns' = defnsByName'.${name} or [];
if m.options ? ${name}
then [ { inherit (m) file; options = m.options.${name}; } ]
else []
) options;
# Get all submodules that define name.
defns = concatMap (m:
if m.config ? ${name}
then map (config: { inherit (m) file; inherit config; })
(pushDownProperties m.config.${name})
else []
) configs;
nrOptions = count (m: isOption m.options) decls; nrOptions = count (m: isOption m.options) decls;
# Extract the definitions for this loc
defns' = map (m: { inherit (m) file; value = m.config.${name}; })
(filter (m: m.config ? ${name}) configs);
in in
if nrOptions == length decls then if nrOptions == length decls then
let opt = fixupOptionType loc (mergeOptionDecls loc decls); let opt = fixupOptionType loc (mergeOptionDecls loc decls);
@ -226,8 +250,8 @@ rec {
in in
throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'."
else else
mergeModules' loc decls defns; mergeModules' loc decls defns
}) (concatMap (m: attrNames m.options) options)) ))
// { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; }; // { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; };
/* Merge multiple option declarations into a single declaration. In /* Merge multiple option declarations into a single declaration. In

View File

@ -126,6 +126,15 @@ rec {
*/ */
makePerlPath = makeSearchPathOutput "lib" "lib/perl5/site_perl"; makePerlPath = makeSearchPathOutput "lib" "lib/perl5/site_perl";
/* Construct a perl search path recursively including all dependencies (such as $PERL5LIB)
Example:
pkgs = import <nixpkgs> { }
makeFullPerlPath [ pkgs.perlPackages.CGI ]
=> "/nix/store/fddivfrdc1xql02h9q500fpnqy12c74n-perl-CGI-4.38/lib/perl5/site_perl:/nix/store/8hsvdalmsxqkjg0c5ifigpf31vc4vsy2-perl-HTML-Parser-3.72/lib/perl5/site_perl:/nix/store/zhc7wh0xl8hz3y3f71nhlw1559iyvzld-perl-HTML-Tagset-3.20/lib/perl5/site_perl"
*/
makeFullPerlPath = deps: makePerlPath (lib.misc.closePropagation deps);
/* Depending on the boolean `cond', return either the given string /* Depending on the boolean `cond', return either the given string
or the empty string. Useful to concatenate against a bigger string. or the empty string. Useful to concatenate against a bigger string.
@ -401,7 +410,7 @@ rec {
components = splitString "/" url; components = splitString "/" url;
filename = lib.last components; filename = lib.last components;
name = builtins.head (splitString sep filename); name = builtins.head (splitString sep filename);
in assert name != filename; name; in assert name != filename; name;
/* Create an --{enable,disable}-<feat> string that can be passed to /* Create an --{enable,disable}-<feat> string that can be passed to
standard GNU Autoconf scripts. standard GNU Autoconf scripts.
@ -459,7 +468,10 @@ rec {
strw = lib.stringLength str; strw = lib.stringLength str;
reqWidth = width - (lib.stringLength filler); reqWidth = width - (lib.stringLength filler);
in in
assert strw <= width; assert lib.assertMsg (strw <= width)
"fixedWidthString: requested string length (${
toString width}) must not be shorter than actual length (${
toString strw})";
if strw == width then str else filler + fixedWidthString reqWidth filler str; if strw == width then str else filler + fixedWidthString reqWidth filler str;
/* Format a number adding leading zeroes up to fixed width. /* Format a number adding leading zeroes up to fixed width.
@ -492,7 +504,7 @@ rec {
isStorePath = x: isStorePath = x:
isCoercibleToString x isCoercibleToString x
&& builtins.substring 0 1 (toString x) == "/" && builtins.substring 0 1 (toString x) == "/"
&& dirOf (builtins.toPath x) == builtins.storeDir; && dirOf x == builtins.storeDir;
/* Convert string to int /* Convert string to int
Obviously, it is a bit hacky to use fromJSON that way. Obviously, it is a bit hacky to use fromJSON that way.
@ -528,11 +540,10 @@ rec {
*/ */
readPathsFromFile = rootPath: file: readPathsFromFile = rootPath: file:
let let
root = toString rootPath;
lines = lib.splitString "\n" (builtins.readFile file); lines = lib.splitString "\n" (builtins.readFile file);
removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line)); removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line));
relativePaths = removeComments lines; relativePaths = removeComments lines;
absolutePaths = builtins.map (path: builtins.toPath (root + "/" + path)) relativePaths; absolutePaths = builtins.map (path: rootPath + "/${path}") relativePaths;
in in
absolutePaths; absolutePaths;

View File

@ -36,7 +36,7 @@ in rec {
cygwin = filterDoubles predicates.isCygwin; cygwin = filterDoubles predicates.isCygwin;
darwin = filterDoubles predicates.isDarwin; darwin = filterDoubles predicates.isDarwin;
freebsd = filterDoubles predicates.isFreeBSD; freebsd = filterDoubles predicates.isFreeBSD;
# Should be better, but MinGW is unclear, and HURD is bit-rotted. # Should be better, but MinGW is unclear.
gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }); gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; });
illumos = filterDoubles predicates.isSunOS; illumos = filterDoubles predicates.isSunOS;
linux = filterDoubles predicates.isLinux; linux = filterDoubles predicates.isLinux;
@ -44,5 +44,5 @@ in rec {
openbsd = filterDoubles predicates.isOpenBSD; openbsd = filterDoubles predicates.isOpenBSD;
unix = filterDoubles predicates.isUnix; unix = filterDoubles predicates.isUnix;
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux"]; mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "powerpc64le-linux"];
} }

View File

@ -8,6 +8,14 @@ rec {
# #
# Linux # Linux
# #
powernv = {
config = "powerpc64le-unknown-linux-gnu";
platform = platforms.powernv;
};
musl-power = {
config = "powerpc64le-unknown-linux-musl";
platform = platforms.powernv;
};
sheevaplug = rec { sheevaplug = rec {
config = "armv5tel-unknown-linux-gnueabi"; config = "armv5tel-unknown-linux-gnueabi";

View File

@ -20,7 +20,7 @@ in rec {
cygwin = [ patterns.isCygwin ]; cygwin = [ patterns.isCygwin ];
darwin = [ patterns.isDarwin ]; darwin = [ patterns.isDarwin ];
freebsd = [ patterns.isFreeBSD ]; freebsd = [ patterns.isFreeBSD ];
# Should be better, but MinGW is unclear, and HURD is bit-rotted. # Should be better, but MinGW is unclear.
gnu = [ gnu = [
{ kernel = parse.kernels.linux; abi = abis.gnu; } { kernel = parse.kernels.linux; abi = abis.gnu; }
{ kernel = parse.kernels.linux; abi = abis.gnueabi; } { kernel = parse.kernels.linux; abi = abis.gnueabi; }

View File

@ -11,6 +11,7 @@ rec {
isi686 = { cpu = cpuTypes.i686; }; isi686 = { cpu = cpuTypes.i686; };
isx86_64 = { cpu = cpuTypes.x86_64; }; isx86_64 = { cpu = cpuTypes.x86_64; };
isPowerPC = { cpu = cpuTypes.powerpc; }; isPowerPC = { cpu = cpuTypes.powerpc; };
isPower = { cpu = { family = "power"; }; };
isx86 = { cpu = { family = "x86"; }; }; isx86 = { cpu = { family = "x86"; }; };
isAarch32 = { cpu = { family = "arm"; bits = 32; }; }; isAarch32 = { cpu = { family = "arm"; bits = 32; }; };
isAarch64 = { cpu = { family = "arm"; bits = 64; }; }; isAarch64 = { cpu = { family = "arm"; bits = 64; }; };
@ -26,14 +27,13 @@ rec {
isBSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; }; isBSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; };
isDarwin = { kernel = { families = { inherit (kernelFamilies) darwin; }; }; }; isDarwin = { kernel = { families = { inherit (kernelFamilies) darwin; }; }; };
isUnix = [ isBSD isDarwin isLinux isSunOS isHurd isCygwin ]; isUnix = [ isBSD isDarwin isLinux isSunOS isCygwin ];
isMacOS = { kernel = kernels.macos; }; isMacOS = { kernel = kernels.macos; };
isiOS = { kernel = kernels.ios; }; isiOS = { kernel = kernels.ios; };
isLinux = { kernel = kernels.linux; }; isLinux = { kernel = kernels.linux; };
isSunOS = { kernel = kernels.solaris; }; isSunOS = { kernel = kernels.solaris; };
isFreeBSD = { kernel = kernels.freebsd; }; isFreeBSD = { kernel = kernels.freebsd; };
isHurd = { kernel = kernels.hurd; };
isNetBSD = { kernel = kernels.netbsd; }; isNetBSD = { kernel = kernels.netbsd; };
isOpenBSD = { kernel = kernels.openbsd; }; isOpenBSD = { kernel = kernels.openbsd; };
isWindows = { kernel = kernels.windows; }; isWindows = { kernel = kernels.windows; };

View File

@ -90,6 +90,8 @@ rec {
mips64el = { bits = 64; significantByte = littleEndian; family = "mips"; }; mips64el = { bits = 64; significantByte = littleEndian; family = "mips"; };
powerpc = { bits = 32; significantByte = bigEndian; family = "power"; }; powerpc = { bits = 32; significantByte = bigEndian; family = "power"; };
powerpc64 = { bits = 64; significantByte = bigEndian; family = "power"; };
powerpc64le = { bits = 64; significantByte = littleEndian; family = "power"; };
riscv32 = { bits = 32; significantByte = littleEndian; family = "riscv"; }; riscv32 = { bits = 32; significantByte = littleEndian; family = "riscv"; };
riscv64 = { bits = 64; significantByte = littleEndian; family = "riscv"; }; riscv64 = { bits = 64; significantByte = littleEndian; family = "riscv"; };
@ -170,7 +172,6 @@ rec {
macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; };
ios = { execFormat = macho; families = { inherit darwin; }; }; ios = { execFormat = macho; families = { inherit darwin; }; };
freebsd = { execFormat = elf; families = { inherit bsd; }; }; freebsd = { execFormat = elf; families = { inherit bsd; }; };
hurd = { execFormat = elf; families = { }; };
linux = { execFormat = elf; families = { }; }; linux = { execFormat = elf; families = { }; };
netbsd = { execFormat = elf; families = { inherit bsd; }; }; netbsd = { execFormat = elf; families = { inherit bsd; }; };
none = { execFormat = unknown; families = { }; }; none = { execFormat = unknown; families = { }; };
@ -257,8 +258,6 @@ rec {
"2" = # We only do 2-part hacks for things Nix already supports "2" = # We only do 2-part hacks for things Nix already supports
if elemAt l 1 == "cygwin" if elemAt l 1 == "cygwin"
then { cpu = elemAt l 0; kernel = "windows"; abi = "cygnus"; } then { cpu = elemAt l 0; kernel = "windows"; abi = "cygnus"; }
else if elemAt l 1 == "gnu"
then { cpu = elemAt l 0; kernel = "hurd"; abi = "gnu"; }
else { cpu = elemAt l 0; kernel = elemAt l 1; }; else { cpu = elemAt l 0; kernel = elemAt l 1; };
"3" = # Awkwards hacks, beware! "3" = # Awkwards hacks, beware!
if elemAt l 1 == "apple" if elemAt l 1 == "apple"

View File

@ -20,6 +20,22 @@ rec {
kernelAutoModules = false; kernelAutoModules = false;
}; };
powernv = {
name = "PowerNV";
kernelArch = "powerpc";
kernelBaseConfig = "powernv_defconfig";
kernelTarget = "zImage";
kernelInstallTarget = "install";
kernelFile = "vmlinux";
kernelAutoModules = true;
# avoid driver/FS trouble arising from unusual page size
kernelExtraConfig = ''
PPC_64K_PAGES n
PPC_4K_PAGES y
IPV6 y
'';
};
## ##
## ARM ## ARM
## ##
@ -458,5 +474,6 @@ rec {
"armv7l-linux" = armv7l-hf-multiplatform; "armv7l-linux" = armv7l-hf-multiplatform;
"aarch64-linux" = aarch64-multiplatform; "aarch64-linux" = aarch64-multiplatform;
"mipsel-linux" = fuloong2f_n32; "mipsel-linux" = fuloong2f_n32;
"powerpc64le-linux" = powernv;
}.${system} or pcBase; }.${system} or pcBase;
} }

View File

@ -112,7 +112,7 @@ runTests {
storePathAppendix = isStorePath storePathAppendix = isStorePath
"${goodPath}/bin/python"; "${goodPath}/bin/python";
nonAbsolute = isStorePath (concatStrings (tail (stringToCharacters goodPath))); nonAbsolute = isStorePath (concatStrings (tail (stringToCharacters goodPath)));
asPath = isStorePath (builtins.toPath goodPath); asPath = isStorePath goodPath;
otherPath = isStorePath "/something/else"; otherPath = isStorePath "/something/else";
otherVals = { otherVals = {
attrset = isStorePath {}; attrset = isStorePath {};
@ -213,6 +213,30 @@ runTests {
}; };
# ATTRSETS
# code from the example
testRecursiveUpdateUntil = {
expr = recursiveUpdateUntil (path: l: r: path == ["foo"]) {
# first attribute set
foo.bar = 1;
foo.baz = 2;
bar = 3;
} {
#second attribute set
foo.bar = 1;
foo.quz = 2;
baz = 4;
};
expected = {
foo.bar = 1; # 'foo.*' from the second set
foo.quz = 2; #
bar = 3; # 'bar' from the first set
baz = 4; # 'baz' from the second set
};
};
# GENERATORS # GENERATORS
# these tests assume attributes are converted to lists # these tests assume attributes are converted to lists
# in alphabetical order # in alphabetical order
@ -333,7 +357,7 @@ runTests {
int = 42; int = 42;
bool = true; bool = true;
string = ''fno"rd''; string = ''fno"rd'';
path = /. + "/foo"; # toPath returns a string path = /. + "/foo";
null_ = null; null_ = null;
function = x: x; function = x: x;
functionArgs = { arg ? 4, foo }: arg; functionArgs = { arg ? 4, foo }: arg;

View File

@ -22,7 +22,7 @@ in with lib.systems.doubles; lib.runTests {
cygwin = assertTrue (mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ]); cygwin = assertTrue (mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ]);
darwin = assertTrue (mseteq darwin [ "x86_64-darwin" ]); darwin = assertTrue (mseteq darwin [ "x86_64-darwin" ]);
freebsd = assertTrue (mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ]); freebsd = assertTrue (mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ]);
gnu = assertTrue (mseteq gnu (linux /* ++ hurd ++ kfreebsd ++ ... */)); gnu = assertTrue (mseteq gnu (linux /* ++ kfreebsd ++ ... */));
illumos = assertTrue (mseteq illumos [ "x86_64-solaris" ]); illumos = assertTrue (mseteq illumos [ "x86_64-solaris" ]);
linux = assertTrue (mseteq linux [ "i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mipsel-linux" ]); linux = assertTrue (mseteq linux [ "i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mipsel-linux" ]);
netbsd = assertTrue (mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ]); netbsd = assertTrue (mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ]);

View File

@ -36,18 +36,18 @@ rec {
/* bitwise and */ /* bitwise and */
bitAnd = builtins.bitAnd bitAnd = builtins.bitAnd
or import ./zip-int-bits.nix or (import ./zip-int-bits.nix
(a: b: if a==1 && b==1 then 1 else 0); (a: b: if a==1 && b==1 then 1 else 0));
/* bitwise or */ /* bitwise or */
bitOr = builtins.bitOr bitOr = builtins.bitOr
or import ./zip-int-bits.nix or (import ./zip-int-bits.nix
(a: b: if a==1 || b==1 then 1 else 0); (a: b: if a==1 || b==1 then 1 else 0));
/* bitwise xor */ /* bitwise xor */
bitXor = builtins.bitXor bitXor = builtins.bitXor
or import ./zip-int-bits.nix or (import ./zip-int-bits.nix
(a: b: if a!=b then 1 else 0); (a: b: if a!=b then 1 else 0));
/* bitwise not */ /* bitwise not */
bitNot = builtins.sub (-1); bitNot = builtins.sub (-1);
@ -171,7 +171,7 @@ rec {
builtins.fromJSON (builtins.readFile path); builtins.fromJSON (builtins.readFile path);
## Warnings and asserts ## Warnings
/* See https://github.com/NixOS/nix/issues/749. Eventually we'd like these /* See https://github.com/NixOS/nix/issues/749. Eventually we'd like these
to expand to Nix builtins that carry metadata so that Nix can filter out to expand to Nix builtins that carry metadata so that Nix can filter out

View File

@ -119,7 +119,9 @@ rec {
let let
betweenDesc = lowest: highest: betweenDesc = lowest: highest:
"${toString lowest} and ${toString highest} (both inclusive)"; "${toString lowest} and ${toString highest} (both inclusive)";
between = lowest: highest: assert lowest <= highest; between = lowest: highest:
assert lib.assertMsg (lowest <= highest)
"ints.between: lowest must be smaller than highest";
addCheck int (x: x >= lowest && x <= highest) // { addCheck int (x: x >= lowest && x <= highest) // {
name = "intBetween"; name = "intBetween";
description = "integer between ${betweenDesc lowest highest}"; description = "integer between ${betweenDesc lowest highest}";
@ -439,7 +441,9 @@ rec {
# Either value of type `finalType` or `coercedType`, the latter is # Either value of type `finalType` or `coercedType`, the latter is
# converted to `finalType` using `coerceFunc`. # converted to `finalType` using `coerceFunc`.
coercedTo = coercedType: coerceFunc: finalType: coercedTo = coercedType: coerceFunc: finalType:
assert coercedType.getSubModules == null; assert lib.assertMsg (coercedType.getSubModules == null)
"coercedTo: coercedType must not have submodules (its a ${
coercedType.description})";
mkOptionType rec { mkOptionType rec {
name = "coercedTo"; name = "coercedTo";
description = "${finalType.description} or ${coercedType.description} convertible to it"; description = "${finalType.description} or ${coercedType.description} convertible to it";

View File

@ -23,6 +23,11 @@
github = "a1russell"; github = "a1russell";
name = "Adam Russell"; name = "Adam Russell";
}; };
aanderse = {
email = "aaron@fosslib.net";
github = "aanderse";
name = "Aaron Andersen";
};
aaronschif = { aaronschif = {
email = "aaronschif@gmail.com"; email = "aaronschif@gmail.com";
github = "aaronschif"; github = "aaronschif";
@ -425,6 +430,11 @@
github = "Baughn"; github = "Baughn";
name = "Svein Ove Aas"; name = "Svein Ove Aas";
}; };
bb010g = {
email = "me@bb010g.com";
github = "bb010g";
name = "Brayden Banks";
};
bbarker = { bbarker = {
email = "brandon.barker@gmail.com"; email = "brandon.barker@gmail.com";
github = "bbarker"; github = "bbarker";
@ -534,6 +544,11 @@
github = "bodil"; github = "bodil";
name = "Bodil Stokke"; name = "Bodil Stokke";
}; };
boj = {
email = "brian@uncannyworks.com";
github = "boj";
name = "Brian Jones";
};
boothead = { boothead = {
email = "ben@perurbis.com"; email = "ben@perurbis.com";
github = "boothead"; github = "boothead";
@ -668,6 +683,11 @@
github = "changlinli"; github = "changlinli";
name = "Changlin Li"; name = "Changlin Li";
}; };
CharlesHD = {
email = "charleshdespointes@gmail.com";
github = "CharlesHD";
name = "Charles Huyghues-Despointes";
};
chaoflow = { chaoflow = {
email = "flo@chaoflow.net"; email = "flo@chaoflow.net";
github = "chaoflow"; github = "chaoflow";
@ -817,6 +837,11 @@
github = "couchemar"; github = "couchemar";
name = "Andrey Pavlov"; name = "Andrey Pavlov";
}; };
countingsort = {
email = "niclas@countingsort.com";
github = "countingsort";
name = "Niclas Meyer";
};
cpages = { cpages = {
email = "page@ruiec.cat"; email = "page@ruiec.cat";
github = "cpages"; github = "cpages";
@ -1545,6 +1570,11 @@
github = "grburst"; github = "grburst";
name = "Julius Elias"; name = "Julius Elias";
}; };
greydot = {
email = "lanablack@amok.cc";
github = "greydot";
name = "Lana Black";
};
gridaphobe = { gridaphobe = {
email = "eric@seidel.io"; email = "eric@seidel.io";
github = "gridaphobe"; github = "gridaphobe";
@ -1585,6 +1615,11 @@
github = "havvy"; github = "havvy";
name = "Ryan Scheel"; name = "Ryan Scheel";
}; };
hax404 = {
email = "hax404foogit@hax404.de";
github = "hax404";
name = "Georg Haas";
};
hbunke = { hbunke = {
email = "bunke.hendrik@gmail.com"; email = "bunke.hendrik@gmail.com";
github = "hbunke"; github = "hbunke";
@ -1610,6 +1645,11 @@
github = "heel"; github = "heel";
name = "Sergii Paryzhskyi"; name = "Sergii Paryzhskyi";
}; };
helkafen = {
email = "arnaudpourseb@gmail.com";
github = "Helkafen";
name = "Sébastian Méric de Bellefon";
};
henrytill = { henrytill = {
email = "henrytill@gmail.com"; email = "henrytill@gmail.com";
github = "henrytill"; github = "henrytill";
@ -1837,6 +1877,11 @@
github = "jgillich"; github = "jgillich";
name = "Jakob Gillich"; name = "Jakob Gillich";
}; };
jglukasik = {
email = "joseph@jgl.me";
github = "jglukasik";
name = "Joseph Lukasik";
};
jhhuh = { jhhuh = {
email = "jhhuh.note@gmail.com"; email = "jhhuh.note@gmail.com";
github = "jhhuh"; github = "jhhuh";
@ -1930,6 +1975,11 @@
github = "jonafato"; github = "jonafato";
name = "Jon Banafato"; name = "Jon Banafato";
}; };
jonathanreeve = {
email = "jon.reeve@gmail.com";
github = "JonathanReeve";
name = "Jonathan Reeve";
};
joncojonathan = { joncojonathan = {
email = "joncojonathan@gmail.com"; email = "joncojonathan@gmail.com";
github = "joncojonathan"; github = "joncojonathan";
@ -1950,6 +2000,11 @@
github = "jpotier"; github = "jpotier";
name = "Martin Potier"; name = "Martin Potier";
}; };
jqueiroz = {
email = "nixos@johnjq.com";
github = "jqueiroz";
name = "Jonathan Queiroz";
};
jraygauthier = { jraygauthier = {
email = "jraygauthier@gmail.com"; email = "jraygauthier@gmail.com";
github = "jraygauthier"; github = "jraygauthier";
@ -2877,6 +2932,11 @@
github = "nocoolnametom"; github = "nocoolnametom";
name = "Tom Doggett"; name = "Tom Doggett";
}; };
noneucat = {
email = "andy@lolc.at";
github = "noneucat";
name = "Andy Chun";
};
notthemessiah = { notthemessiah = {
email = "brian.cohen.88@gmail.com"; email = "brian.cohen.88@gmail.com";
github = "notthemessiah"; github = "notthemessiah";
@ -3247,6 +3307,11 @@
github = "qoelet"; github = "qoelet";
name = "Kenny Shen"; name = "Kenny Shen";
}; };
qyliss = {
email = "hi@alyssa.is";
github = "alyssais";
name = "Alyssa Ross";
};
ragge = { ragge = {
email = "r.dahlen@gmail.com"; email = "r.dahlen@gmail.com";
github = "ragnard"; github = "ragnard";
@ -3281,6 +3346,11 @@
email = "ravloony@gmail.com"; email = "ravloony@gmail.com";
name = "Tom Macdonald"; name = "Tom Macdonald";
}; };
rawkode = {
email = "david.andrew.mckay@gmail.com";
github = "rawkode";
name = "David McKay";
};
razvan = { razvan = {
email = "razvan.panda@gmail.com"; email = "razvan.panda@gmail.com";
github = "razvan-panda"; github = "razvan-panda";
@ -3326,6 +3396,11 @@
github = "relrod"; github = "relrod";
name = "Ricky Elrod"; name = "Ricky Elrod";
}; };
renatoGarcia = {
email = "fgarcia.renato@gmail.com";
github = "renatoGarcia";
name = "Renato Garcia";
};
renzo = { renzo = {
email = "renzocarbonara@gmail.com"; email = "renzocarbonara@gmail.com";
github = "k0001"; github = "k0001";
@ -3655,6 +3730,11 @@
github = "siddharthist"; github = "siddharthist";
name = "Langston Barrett"; name = "Langston Barrett";
}; };
siers = {
email = "veinbahs+nixpkgs@gmail.com";
github = "siers";
name = "Raitis Veinbahs";
};
sifmelcara = { sifmelcara = {
email = "ming@culpring.com"; email = "ming@culpring.com";
github = "sifmelcara"; github = "sifmelcara";
@ -3813,6 +3893,11 @@
github = "StillerHarpo"; github = "StillerHarpo";
name = "Florian Engel"; name = "Florian Engel";
}; };
stites = {
email = "sam@stites.io";
github = "stites";
name = "Sam Stites";
};
stumoss = { stumoss = {
email = "samoss@gmail.com"; email = "samoss@gmail.com";
github = "stumoss"; github = "stumoss";
@ -3843,6 +3928,11 @@
github = "swarren83"; github = "swarren83";
name = "Shawn Warren"; name = "Shawn Warren";
}; };
swdunlop = {
email = "swdunlop@gmail.com";
github = "swdunlop";
name = "Scott W. Dunlop";
};
swflint = { swflint = {
email = "swflint@flintfam.org"; email = "swflint@flintfam.org";
github = "swflint"; github = "swflint";

View File

@ -11,7 +11,7 @@ manual-combined.xml: generated *.xml
.PHONY: format .PHONY: format
format: format:
find . -iname '*.xml' -type f -print0 | xargs -0 -I{} -n1 \ find ../../ -iname '*.xml' -type f -print0 | xargs -0 -I{} -n1 \
xmlformat --config-file "../xmlformat.conf" -i {} xmlformat --config-file "../xmlformat.conf" -i {}
.PHONY: fix-misc-xml .PHONY: fix-misc-xml

View File

@ -50,4 +50,14 @@ $ nix-store --optimise
Since this command needs to read the entire Nix store, it can take quite a Since this command needs to read the entire Nix store, it can take quite a
while to finish. while to finish.
</para> </para>
<section xml:id="sect-nixos-gc-boot-entries">
<title>NixOS Boot Entries</title>
<para>
If your <filename>/boot</filename> partition runs out of space, after
clearing old profiles you must rebuild your system with
<literal>nixos-rebuild</literal> to update the <filename>/boot</filename>
partition and clear space.
</para>
</section>
</chapter> </chapter>

View File

@ -66,14 +66,15 @@ nixpkgs.config.packageOverrides = pkgs:
sets the kernels TCP keepalive time to 120 seconds. To see the available sets the kernels TCP keepalive time to 120 seconds. To see the available
parameters, run <command>sysctl -a</command>. parameters, run <command>sysctl -a</command>.
</para> </para>
<section> <section xml:id="sec-linux-config-customizing">
<title>Customize your kernel</title> <title>Customize your kernel</title>
<para> <para>
The first step before compiling the kernel is to generate an appropriate The first step before compiling the kernel is to generate an appropriate
<literal>.config</literal> configuration. Either you pass your own config via <literal>.config</literal> configuration. Either you pass your own config
the <literal>configfile</literal> setting of <literal>linuxManualConfig</literal>: via the <literal>configfile</literal> setting of
<screen><![CDATA[ <literal>linuxManualConfig</literal>:
<screen><![CDATA[
custom-kernel = super.linuxManualConfig { custom-kernel = super.linuxManualConfig {
inherit (super) stdenv hostPlatform; inherit (super) stdenv hostPlatform;
inherit (linux_4_9) src; inherit (linux_4_9) src;
@ -117,7 +118,7 @@ You can edit the config with this snippet (by default <command>make menuconfig</
]]></screen> ]]></screen>
</para> </para>
</section> </section>
<section> <section xml:id="sec-linux-config-developing-modules">
<title>Developing kernel modules</title> <title>Developing kernel modules</title>
<para> <para>

View File

@ -74,7 +74,7 @@ The unique option `services.httpd.adminAddr' is defined multiple times, in `/etc
argument is for: it contains the complete, merged system configuration. That argument is for: it contains the complete, merged system configuration. That
is, <varname>config</varname> is the result of combining the configurations is, <varname>config</varname> is the result of combining the configurations
returned by every module returned by every module
<footnote> <footnote xml:id="footnote-nix-is-lazy">
<para> <para>
If youre wondering how its possible that the (indirect) If youre wondering how its possible that the (indirect)
<emphasis>result</emphasis> of a function is passed as an <emphasis>result</emphasis> of a function is passed as an

View File

@ -60,7 +60,7 @@
# systemctl start display-manager.service # systemctl start display-manager.service
</screen> </screen>
</para> </para>
<simplesect> <simplesect xml:id="sec-x11-graphics-cards-nvidia">
<title>NVIDIA Graphics Cards</title> <title>NVIDIA Graphics Cards</title>
<para> <para>
NVIDIA provides a proprietary driver for its graphics cards that has better NVIDIA provides a proprietary driver for its graphics cards that has better
@ -86,7 +86,7 @@
</programlisting> </programlisting>
</para> </para>
</simplesect> </simplesect>
<simplesect> <simplesect xml:id="sec-x11--graphics-cards-amd">
<title>AMD Graphics Cards</title> <title>AMD Graphics Cards</title>
<para> <para>
AMD provides a proprietary driver for its graphics cards that has better 3D AMD provides a proprietary driver for its graphics cards that has better 3D
@ -106,7 +106,7 @@
</programlisting> </programlisting>
</para> </para>
</simplesect> </simplesect>
<simplesect> <simplesect xml:id="sec-x11-touchpads">
<title>Touchpads</title> <title>Touchpads</title>
<para> <para>
Support for Synaptics touchpads (found in many laptops such as the Dell Support for Synaptics touchpads (found in many laptops such as the Dell
@ -123,7 +123,7 @@
since NixOS 17.09. since NixOS 17.09.
</para> </para>
</simplesect> </simplesect>
<simplesect> <simplesect xml:id="sec-x11-gtk-and-qt-themes">
<title>GTK/Qt themes</title> <title>GTK/Qt themes</title>
<para> <para>
GTK themes can be installed either to user profile or system-wide (via GTK themes can be installed either to user profile or system-wide (via

View File

@ -31,7 +31,7 @@
(system wide), put them into your (system wide), put them into your
<xref linkend="opt-environment.systemPackages"/>. <xref linkend="opt-environment.systemPackages"/>.
</para> </para>
<simplesect> <simplesect xml:id="sec-xfce-thunar-volumes">
<title>Thunar Volume Support</title> <title>Thunar Volume Support</title>
<para> <para>
To enable <emphasis>Thunar</emphasis> volume support, put To enable <emphasis>Thunar</emphasis> volume support, put
@ -41,7 +41,7 @@
into your <emphasis>configuration.nix</emphasis>. into your <emphasis>configuration.nix</emphasis>.
</para> </para>
</simplesect> </simplesect>
<simplesect> <simplesect xml:id="sec-xfce-polkit">
<title>Polkit Authentication Agent</title> <title>Polkit Authentication Agent</title>
<para> <para>
There is no authentication agent automatically installed alongside Xfce. To There is no authentication agent automatically installed alongside Xfce. To
@ -50,7 +50,7 @@
and login did the trick. and login did the trick.
</para> </para>
</simplesect> </simplesect>
<simplesect> <simplesect xml:id="sec-xfce-troubleshooting">
<title>Troubleshooting</title> <title>Troubleshooting</title>
<para> <para>
Even after enabling udisks2, volume management might not work. Thunar and/or Even after enabling udisks2, volume management might not work. Thunar and/or

View File

@ -90,7 +90,9 @@ let
fi fi
${buildPackages.libxslt.bin}/bin/xsltproc \ ${buildPackages.libxslt.bin}/bin/xsltproc \
--stringparam revision '${revision}' \ --stringparam revision '${revision}' \
-o $out ${./options-to-docbook.xsl} $optionsXML -o intermediate.xml ${./options-to-docbook.xsl} $optionsXML
${buildPackages.libxslt.bin}/bin/xsltproc \
-o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml
''; '';
sources = lib.sourceFilesBySuffices ./. [".xml"]; sources = lib.sourceFilesBySuffices ./. [".xml"];

View File

@ -20,7 +20,7 @@
NixOS module system. NixOS module system.
</para> </para>
<section> <section xml:id="sec-assertions-warnings">
<title>Warnings</title> <title>Warnings</title>
<para> <para>
@ -44,7 +44,7 @@
</programlisting> </programlisting>
</section> </section>
<section> <section xml:id="sec-assertions-assertions">
<title>Assertions</title> <title>Assertions</title>
<para> <para>

View File

@ -17,7 +17,7 @@ config = {
definitions in a <emphasis>property</emphasis> to achieve certain effects: definitions in a <emphasis>property</emphasis> to achieve certain effects:
</para> </para>
<simplesect> <simplesect xml:id="sec-option-definitions-delaying-conditionals">
<title>Delaying Conditionals</title> <title>Delaying Conditionals</title>
<para> <para>
If a set of option definitions is conditional on the value of another If a set of option definitions is conditional on the value of another
@ -59,7 +59,7 @@ config = {
</para> </para>
</simplesect> </simplesect>
<simplesect> <simplesect xml:id="sec-option-definitions-setting-priorities">
<title>Setting Priorities</title> <title>Setting Priorities</title>
<para> <para>
A module can override the definitions of an option in other modules by A module can override the definitions of an option in other modules by
@ -76,7 +76,7 @@ services.openssh.enable = mkOverride 10 false;
</para> </para>
</simplesect> </simplesect>
<simplesect> <simplesect xml:id="sec-option-definitions-merging">
<title>Merging Configurations</title> <title>Merging Configurations</title>
<para> <para>
In conjunction with <literal>mkIf</literal>, it is sometimes useful for a In conjunction with <literal>mkIf</literal>, it is sometimes useful for a

View File

@ -11,7 +11,7 @@
value definitions. value definitions.
</para> </para>
<section> <section xml:id="sec-option-types-basic">
<title>Basic Types</title> <title>Basic Types</title>
<para> <para>
@ -196,7 +196,7 @@
</variablelist> </variablelist>
</section> </section>
<section> <section xml:id="sec-option-types-value">
<title>Value Types</title> <title>Value Types</title>
<para> <para>
@ -257,7 +257,7 @@
</variablelist> </variablelist>
</section> </section>
<section> <section xml:id="sec-option-types-composed">
<title>Composed Types</title> <title>Composed Types</title>
<para> <para>
@ -483,7 +483,7 @@ config.mod.two = { foo = 2; bar = "two"; };</screen>
</example> </example>
</section> </section>
<section> <section xml:id="sec-option-types-extending">
<title>Extending types</title> <title>Extending types</title>
<para> <para>
@ -543,7 +543,7 @@ nixThings = mkOption {
</variablelist> </variablelist>
</section> </section>
<section> <section xml:id="sec-option-types-custom">
<title>Custom Types</title> <title>Custom Types</title>
<para> <para>

View File

@ -10,7 +10,7 @@
sources and presenting it in an accessible style would be a worthy sources and presenting it in an accessible style would be a worthy
contribution to the project. contribution to the project.
</para> </para>
<section> <section xml:id="sec-writing-docs-building-the-manual">
<title>Building the Manual</title> <title>Building the Manual</title>
<para> <para>
@ -42,7 +42,7 @@
<filename>./result/share/doc/nixos/index.html</filename>. <filename>./result/share/doc/nixos/index.html</filename>.
</para> </para>
</section> </section>
<section> <section xml:id="sec-writing-docs-editing-docbook-xml">
<title>Editing DocBook XML</title> <title>Editing DocBook XML</title>
<para> <para>
@ -76,7 +76,7 @@
Issue</link> and someone will handle the conversion to XML for you. Issue</link> and someone will handle the conversion to XML for you.
</para> </para>
</section> </section>
<section> <section xml:id="sec-writing-docs-creating-a-topic">
<title>Creating a Topic</title> <title>Creating a Topic</title>
<para> <para>
@ -128,7 +128,7 @@
</itemizedlist> </itemizedlist>
</para> </para>
</section> </section>
<section> <section xml:id="sec-writing-docs-adding-a-topic">
<title>Adding a Topic to the Book</title> <title>Adding a Topic to the Book</title>
<para> <para>

View File

@ -0,0 +1,47 @@
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="sec-installing-behind-proxy">
<title>Installing behind a proxy</title>
<para>
To install NixOS behind a proxy, do the following before running
<literal>nixos-install</literal>.
</para>
<orderedlist numeration="arabic">
<listitem>
<para>
Update proxy configuration in
<literal>/mnt/etc/nixos/configuration.nix</literal> to keep the
internet accessible after reboot.
</para>
<programlisting>
networking.proxy.default = &quot;http://user:password@proxy:port/&quot;;
networking.proxy.noProxy = &quot;127.0.0.1,localhost,internal.domain&quot;;
</programlisting>
</listitem>
<listitem>
<para>
Setup the proxy environment variables in the shell where you are
running <literal>nixos-install</literal>.
</para>
<programlisting>
# proxy_url=&quot;http://user:password@proxy:port/&quot;
# export http_proxy=&quot;$proxy_url&quot;
# export HTTP_PROXY=&quot;$proxy_url&quot;
# export https_proxy=&quot;$proxy_url&quot;
# export HTTPS_PROXY=&quot;$proxy_url&quot;
</programlisting>
</listitem>
</orderedlist>
<note>
<para>
If you are switching networks with different proxy configurations, use the
<literal>nesting.clone</literal> option in
<literal>configuration.nix</literal> to switch proxies at runtime.
Refer to <xref linkend="ch-options" /> for more information.
</para>
</note>
</section>

View File

@ -326,10 +326,9 @@ Retype new UNIX password: ***
</screen> </screen>
<note> <note>
<para> <para>
To prevent the password prompt, set For unattended installations, it is possible to use
<code><xref linkend="opt-users.mutableUsers"/> = false;</code> in <command>nixos-install --no-root-passwd</command>
<filename>configuration.nix</filename>, which allows unattended in order to disable the password prompt entirely.
installation necessary in automation.
</para> </para>
</note> </note>
</para> </para>
@ -444,4 +443,5 @@ $ nix-env -i w3m</screen>
<xi:include href="installing-pxe.xml" /> <xi:include href="installing-pxe.xml" />
<xi:include href="installing-virtualbox-guest.xml" /> <xi:include href="installing-virtualbox-guest.xml" />
<xi:include href="installing-from-other-distro.xml" /> <xi:include href="installing-from-other-distro.xml" />
<xi:include href="installing-behind-a-proxy.xml" />
</chapter> </chapter>

View File

@ -109,7 +109,7 @@ nixos https://nixos.org/channels/nixos-unstable
so in that case you will not be able to go back to your original channel. so in that case you will not be able to go back to your original channel.
</para> </para>
</warning> </warning>
<section> <section xml:id="sec-upgrading-automatic">
<title>Automatic Upgrades</title> <title>Automatic Upgrades</title>
<para> <para>

View File

@ -8,7 +8,7 @@
<subtitle>Version <xi:include href="./generated/version" parse="text" /> <subtitle>Version <xi:include href="./generated/version" parse="text" />
</subtitle> </subtitle>
</info> </info>
<preface> <preface xml:id="preface">
<title>Preface</title> <title>Preface</title>
<para> <para>
This manual describes how to install, use and extend NixOS, a Linux This manual describes how to install, use and extend NixOS, a Linux
@ -17,8 +17,8 @@
<para> <para>
If you encounter problems, please report them on the If you encounter problems, please report them on the
<literal <literal
xlink:href="https://groups.google.com/forum/#!forum/nix-devel">nix-devel</literal> xlink:href="https://discourse.nixos.org">Discourse</literal>
mailing list or on the <link or on the <link
xlink:href="irc://irc.freenode.net/#nixos"> xlink:href="irc://irc.freenode.net/#nixos">
<literal>#nixos</literal> channel on Freenode</link>. Bugs should be <literal>#nixos</literal> channel on Freenode</link>. Bugs should be
reported in reported in

View File

@ -4,6 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings" xmlns:str="http://exslt.org/strings"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:nixos="tag:nixos.org"
xmlns="http://docbook.org/ns/docbook" xmlns="http://docbook.org/ns/docbook"
extension-element-prefixes="str" extension-element-prefixes="str"
> >
@ -15,7 +16,7 @@
<xsl:template match="/expr/list"> <xsl:template match="/expr/list">
<appendix> <appendix xml:id="appendix-configuration-options">
<title>Configuration Options</title> <title>Configuration Options</title>
<variablelist xml:id="configuration-variable-list"> <variablelist xml:id="configuration-variable-list">
<xsl:for-each select="attrs"> <xsl:for-each select="attrs">
@ -30,10 +31,12 @@
<listitem> <listitem>
<para> <nixos:option-description>
<xsl:value-of disable-output-escaping="yes" <para>
select="attr[@name = 'description']/string/@value" /> <xsl:value-of disable-output-escaping="yes"
</para> select="attr[@name = 'description']/string/@value" />
</para>
</nixos:option-description>
<xsl:if test="attr[@name = 'type']"> <xsl:if test="attr[@name = 'type']">
<para> <para>

View File

@ -0,0 +1,115 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
xmlns:exsl="http://exslt.org/common"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:nixos="tag:nixos.org"
extension-element-prefixes="str exsl">
<xsl:output method='xml' encoding="UTF-8" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template name="break-up-description">
<xsl:param name="input" />
<xsl:param name="buffer" />
<!-- Every time we have two newlines following each other, we want to
break it into </para><para>. -->
<xsl:variable name="parbreak" select="'&#xa;&#xa;'" />
<!-- Similar to "(head:tail) = input" in Haskell. -->
<xsl:variable name="head" select="$input[1]" />
<xsl:variable name="tail" select="$input[position() &gt; 1]" />
<xsl:choose>
<xsl:when test="$head/self::text() and contains($head, $parbreak)">
<!-- If the haystack provided to str:split() directly starts or
ends with $parbreak, it doesn't generate a <token/> for that,
so we are doing this here. -->
<xsl:variable name="splitted-raw">
<xsl:if test="starts-with($head, $parbreak)"><token /></xsl:if>
<xsl:for-each select="str:split($head, $parbreak)">
<token><xsl:value-of select="node()" /></token>
</xsl:for-each>
<!-- Something like ends-with($head, $parbreak), but there is
no ends-with() in XSLT, so we need to use substring(). -->
<xsl:if test="
substring($head, string-length($head) -
string-length($parbreak) + 1) = $parbreak
"><token /></xsl:if>
</xsl:variable>
<xsl:variable name="splitted"
select="exsl:node-set($splitted-raw)/token" />
<!-- The buffer we had so far didn't contain any text nodes that
contain a $parbreak, so we can put the buffer along with the
first token of $splitted into a para element. -->
<para xmlns="http://docbook.org/ns/docbook">
<xsl:apply-templates select="exsl:node-set($buffer)" />
<xsl:apply-templates select="$splitted[1]/node()" />
</para>
<!-- We have already emitted the first splitted result, so the
last result is going to be set as the new $buffer later
because its contents may not be directly followed up by a
$parbreak. -->
<xsl:for-each select="$splitted[position() &gt; 1
and position() &lt; last()]">
<para xmlns="http://docbook.org/ns/docbook">
<xsl:apply-templates select="node()" />
</para>
</xsl:for-each>
<xsl:call-template name="break-up-description">
<xsl:with-param name="input" select="$tail" />
<xsl:with-param name="buffer" select="$splitted[last()]/node()" />
</xsl:call-template>
</xsl:when>
<!-- Either non-text node or one without $parbreak, which we just
want to buffer and continue recursing. -->
<xsl:when test="$input">
<xsl:call-template name="break-up-description">
<xsl:with-param name="input" select="$tail" />
<!-- This essentially appends $head to $buffer. -->
<xsl:with-param name="buffer">
<xsl:if test="$buffer">
<xsl:for-each select="exsl:node-set($buffer)">
<xsl:apply-templates select="." />
</xsl:for-each>
</xsl:if>
<xsl:apply-templates select="$head" />
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<!-- No more $input, just put the remaining $buffer in a para. -->
<xsl:otherwise>
<para xmlns="http://docbook.org/ns/docbook">
<xsl:apply-templates select="exsl:node-set($buffer)" />
</para>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="nixos:option-description">
<xsl:choose>
<!--
Only process nodes that are comprised of a single <para/> element,
because if that's not the case the description already contains
</para><para> in between and we need no further processing.
-->
<xsl:when test="count(db:para) > 1">
<xsl:apply-templates select="node()" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="break-up-description">
<xsl:with-param name="input"
select="exsl:node-set(db:para/node())" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -8,6 +8,7 @@
This section lists the release notes for each stable version of NixOS and This section lists the release notes for each stable version of NixOS and
current unstable revision. current unstable revision.
</para> </para>
<xi:include href="rl-1903.xml" />
<xi:include href="rl-1809.xml" /> <xi:include href="rl-1809.xml" />
<xi:include href="rl-1803.xml" /> <xi:include href="rl-1803.xml" />
<xi:include href="rl-1709.xml" /> <xi:include href="rl-1709.xml" />

View File

@ -111,6 +111,12 @@ $ nix-instantiate -E '(import &lt;nixpkgsunstable&gt; {}).gitFull'
<link xlink:href="https://github.com/strongswan/strongswan/blob/master/README_LEGACY.md">stroke configuration interface</link>. <link xlink:href="https://github.com/strongswan/strongswan/blob/master/README_LEGACY.md">stroke configuration interface</link>.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
The new <varname>services.elasticsearch-curator</varname> service
periodically curates or manages, your Elasticsearch indices and snapshots.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</section> </section>
@ -133,6 +139,50 @@ $ nix-instantiate -E '(import &lt;nixpkgsunstable&gt; {}).gitFull'
seen a complete rewrite. (See above.) seen a complete rewrite. (See above.)
</para> </para>
</listitem> </listitem>
<listitem>
<para>
The minimum version of Nix required to evaluate Nixpkgs is now 2.0.
</para>
<itemizedlist>
<listitem>
<para>
For users of NixOS 18.03, NixOS 18.03 defaulted to Nix 2.0, but
supported using Nix 1.11 by setting <literal>nix.package =
pkgs.nix1;</literal>. If this option is set to a Nix 1.11 package, you
will need to either unset the option or upgrade it to Nix 2.0.
</para>
</listitem>
<listitem>
<para>
For users of NixOS 17.09, you will first need to upgrade Nix by setting
<literal>nix.package = pkgs.nixStable2;</literal> and run
<command>nixos-rebuild switch</command> as the <literal>root</literal>
user.
</para>
</listitem>
<listitem>
<para>
For users of a daemon-less Nix installation on Linux or macOS, you can
upgrade Nix by running <command>curl https://nixos.org/nix/install |
sh</command>, or prior to doing a channel update, running
<command>nix-env -iA nix</command>.
</para>
<para>
If you have already run a channel update and Nix is no longer able to
evaluate Nixpkgs, the error message printed should provide adequate
directions for upgrading Nix.
</para>
</listitem>
<listitem>
<para>
For users of the Nix daemon on macOS, you can upgrade Nix by running
<command>sudo -i sh -c 'nix-channel --update &amp;&amp; nix-env -iA
nixpkgs.nix'; sudo launchctl stop org.nixos.nix-daemon; sudo launchctl
start org.nixos.nix-daemon</command>.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem> <listitem>
<para> <para>
<literal>lib.strict</literal> is removed. Use <literal>lib.strict</literal> is removed. Use
@ -190,6 +240,39 @@ $ nix-instantiate -E '(import &lt;nixpkgsunstable&gt; {}).gitFull'
which indicates that the nix output hash will be used as tag. which indicates that the nix output hash will be used as tag.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
The ELK stack: <varname>elasticsearch</varname>, <varname>logstash</varname> and <varname>kibana</varname>
has been upgraded from 2.* to 6.3.*.
The 2.* versions have been <link xlink:href="https://www.elastic.co/support/eol">unsupported since last year</link>
so they have been removed. You can still use the 5.* versions under the names
<varname>elasticsearch5</varname>, <varname>logstash5</varname> and
<varname>kibana5</varname>.
</para>
<para>
The elastic beats:
<varname>filebeat</varname>, <varname>heartbeat</varname>,
<varname>metricbeat</varname> and <varname>packetbeat</varname>
have had the same treatment: they now target 6.3.* as well.
The 5.* versions are available under the names:
<varname>filebeat5</varname>, <varname>heartbeat5</varname>,
<varname>metricbeat5</varname> and <varname>packetbeat5</varname>
</para>
<para>
The ELK-6.3 stack now comes with
<link xlink:href="https://www.elastic.co/products/x-pack/open">X-Pack by default</link>.
Since X-Pack is licensed under the
<link xlink:href="https://github.com/elastic/elasticsearch/blob/master/licenses/ELASTIC-LICENSE.txt">Elastic License</link>
the ELK packages now have an unfree license. To use them you need to specify
<literal>allowUnfree = true;</literal> in your nixpkgs configuration.
</para>
<para>
Fortunately there is also a free variant of the ELK stack without X-Pack.
The packages are available under the names:
<varname>elasticsearch-oss</varname>, <varname>logstash-oss</varname> and
<varname>kibana-oss</varname>.
</para>
</listitem>
<listitem> <listitem>
<para> <para>
Options Options
@ -200,6 +283,14 @@ $ nix-instantiate -E '(import &lt;nixpkgsunstable&gt; {}).gitFull'
from your config without any issues. from your config without any issues.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
<literal>stdenv.system</literal> and <literal>system</literal> in nixpkgs now refer to the host platform instead of the build platform.
For native builds this is not change, let alone a breaking one.
For cross builds, it is a breaking change, and <literal>stdenv.buildPlatform.system</literal> can be used instead for the old behavior.
They should be using that anyways for clarity.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</section> </section>
@ -278,6 +369,8 @@ inherit (pkgs.nixos {
<literal>lib.traceCallXml</literal> has been deprecated. Please complain <literal>lib.traceCallXml</literal> has been deprecated. Please complain
if you use the function regularly. if you use the function regularly.
</para> </para>
</listitem>
<listitem>
<para> <para>
The attribute <literal>lib.nixpkgsVersion</literal> has been deprecated in The attribute <literal>lib.nixpkgsVersion</literal> has been deprecated in
favor of <literal>lib.version</literal>. Please refer to the discussion in favor of <literal>lib.version</literal>. Please refer to the discussion in
@ -285,6 +378,13 @@ inherit (pkgs.nixos {
for further reference. for further reference.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
<literal>lib.recursiveUpdateUntil</literal> was not acting according to its
specification. It has been fixed to act according to the docstring, and a
test has been added.
</para>
</listitem>
<listitem> <listitem>
<para> <para>
The module for <option>security.dhparams</option> has two new options now: The module for <option>security.dhparams</option> has two new options now:
@ -422,6 +522,35 @@ inherit (pkgs.nixos {
The module option <option>nix.useSandbox</option> is now defaulted to <literal>true</literal>. The module option <option>nix.useSandbox</option> is now defaulted to <literal>true</literal>.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
The config activation script of <literal>nixos-rebuild</literal> now
<link xlink:href="https://www.freedesktop.org/software/systemd/man/systemctl.html#Manager%20Lifecycle%20Commands">reloads</link>
all user units for each authenticated user.
</para>
</listitem>
<listitem>
<para>
The default display manager is now LightDM.
To use SLiM set <literal>services.xserver.displayManager.slim.enable</literal>
to <literal>true</literal>.
</para>
</listitem>
<listitem>
<para>
NixOS option descriptions are now automatically broken up into individual
paragraphs if the text contains two consecutive newlines, so it's no
longer necessary to use <code>&lt;/para&gt;&lt;para&gt;</code> to start
a new paragraph.
</para>
</listitem>
<listitem>
<para>
Top-level <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and <literal>targetPlatform</literal> in Nixpkgs are deprecated.
Please use their equivalents in <literal>stdenv</literal> instead:
<literal>stdenv.buildPlatform</literal>, <literal>stdenv.hostPlatform</literal>, and <literal>stdenv.targetPlatform</literal>.
</para>
</listitem>
</itemizedlist> </itemizedlist>
</section> </section>
</section> </section>

View File

@ -0,0 +1,58 @@
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="sec-release-19.03">
<title>Release 19.03 (“Koi”, 2019/03/??)</title>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="sec-release-19.03-highlights">
<title>Highlights</title>
<para>
In addition to numerous new and upgraded packages, this release has the
following highlights:
</para>
<itemizedlist>
<listitem>
<para />
</listitem>
</itemizedlist>
</section>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="sec-release-19.03-new-services">
<title>New Services</title>
<para>
The following new services were added since the last release:
</para>
<itemizedlist>
<listitem>
<para />
</listitem>
</itemizedlist>
</section>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="sec-release-19.03-notable-changes">
<title>Other Notable Changes</title>
<itemizedlist>
<listitem>
<para />
</listitem>
</itemizedlist>
</section>
</section>

View File

@ -28,7 +28,7 @@
let extraArgs_ = extraArgs; pkgs_ = pkgs; let extraArgs_ = extraArgs; pkgs_ = pkgs;
extraModules = let e = builtins.getEnv "NIXOS_EXTRA_MODULE_PATH"; extraModules = let e = builtins.getEnv "NIXOS_EXTRA_MODULE_PATH";
in if e == "" then [] else [(import (builtins.toPath e))]; in if e == "" then [] else [(import e)];
in in
let let

View File

@ -6,16 +6,19 @@
, storePaths , storePaths
, volumeLabel , volumeLabel
, uuid ? "44444444-4444-4444-8888-888888888888" , uuid ? "44444444-4444-4444-8888-888888888888"
, e2fsprogs
, libfaketime
, perl
}: }:
let let
sdClosureInfo = pkgs.closureInfo { rootPaths = storePaths; }; sdClosureInfo = pkgs.buildPackages.closureInfo { rootPaths = storePaths; };
in in
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {
name = "ext4-fs.img"; name = "ext4-fs.img";
nativeBuildInputs = with pkgs; [e2fsprogs.bin libfaketime perl]; nativeBuildInputs = [e2fsprogs.bin libfaketime perl];
buildCommand = buildCommand =
'' ''

View File

@ -1,7 +1,7 @@
{ stdenv, perl, pixz, pathsFromGraph { stdenv, perl, pixz, pathsFromGraph
, # The file name of the resulting tarball , # The file name of the resulting tarball
fileName ? "nixos-system-${stdenv.system}" fileName ? "nixos-system-${stdenv.hostPlatform.system}"
, # The files and directories to be placed in the tarball. , # The files and directories to be placed in the tarball.
# This is a list of attribute sets {source, target} where `source' # This is a list of attribute sets {source, target} where `source'

View File

@ -1,21 +1,25 @@
# QEMU flags shared between various Nix expressions. # QEMU flags shared between various Nix expressions.
{ pkgs }: { pkgs }:
let
zeroPad = n: if n < 10 then "0${toString n}" else toString n;
in
{ {
qemuNICFlags = nic: net: machine: qemuNICFlags = nic: net: machine:
[ "-net nic,vlan=${toString nic},macaddr=52:54:00:12:${toString net}:${toString machine},model=virtio" [ "-device virtio-net-pci,netdev=vlan${toString nic},mac=52:54:00:12:${zeroPad net}:${zeroPad machine}"
"-net vde,vlan=${toString nic},sock=$QEMU_VDE_SOCKET_${toString net}" "-netdev vde,id=vlan${toString nic},sock=$QEMU_VDE_SOCKET_${toString net}"
]; ];
qemuSerialDevice = if pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 then "ttyS0" qemuSerialDevice = if pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 then "ttyS0"
else if pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64 then "ttyAMA0" else if pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64 then "ttyAMA0"
else throw "Unknown QEMU serial device for system '${pkgs.stdenv.system}'"; else throw "Unknown QEMU serial device for system '${pkgs.stdenv.hostPlatform.system}'";
qemuBinary = qemuPkg: { qemuBinary = qemuPkg: {
"x86_64-linux" = "${qemuPkg}/bin/qemu-kvm -cpu kvm64"; "x86_64-linux" = "${qemuPkg}/bin/qemu-kvm -cpu kvm64";
"armv7l-linux" = "${qemuPkg}/bin/qemu-system-arm -enable-kvm -machine virt -cpu host"; "armv7l-linux" = "${qemuPkg}/bin/qemu-system-arm -enable-kvm -machine virt -cpu host";
"aarch64-linux" = "${qemuPkg}/bin/qemu-system-aarch64 -enable-kvm -machine virt,gic-version=host -cpu host"; "aarch64-linux" = "${qemuPkg}/bin/qemu-system-aarch64 -enable-kvm -machine virt,gic-version=host -cpu host";
"x86_64-darwin" = "${qemuPkg}/bin/qemu-kvm -cpu kvm64"; "x86_64-darwin" = "${qemuPkg}/bin/qemu-kvm -cpu kvm64";
}.${pkgs.stdenv.system} or "${qemuPkg}/bin/qemu-kvm"; }.${pkgs.stdenv.hostPlatform.system} or "${qemuPkg}/bin/qemu-kvm";
} }

View File

@ -34,6 +34,7 @@ in
environment.variables = mkOption { environment.variables = mkOption {
default = {}; default = {};
example = { EDITOR = "nvim"; VISUAL = "nvim"; };
description = '' description = ''
A set of environment variables used in the global environment. A set of environment variables used in the global environment.
These variables will be set on shell initialisation (e.g. in /etc/profile). These variables will be set on shell initialisation (e.g. in /etc/profile).
@ -80,7 +81,7 @@ in
default = ""; default = "";
description = '' description = ''
Shell script code called during shell initialisation. Shell script code called during shell initialisation.
This code is asumed to be shell-independent, which means you should This code is assumed to be shell-independent, which means you should
stick to pure sh without sh word split. stick to pure sh without sh word split.
''; '';
type = types.lines; type = types.lines;
@ -90,7 +91,7 @@ in
default = ""; default = "";
description = '' description = ''
Shell script code called during login shell initialisation. Shell script code called during login shell initialisation.
This code is asumed to be shell-independent, which means you should This code is assumed to be shell-independent, which means you should
stick to pure sh without sh word split. stick to pure sh without sh word split.
''; '';
type = types.lines; type = types.lines;
@ -100,7 +101,7 @@ in
default = ""; default = "";
description = '' description = ''
Shell script code called during interactive shell initialisation. Shell script code called during interactive shell initialisation.
This code is asumed to be shell-independent, which means you should This code is assumed to be shell-independent, which means you should
stick to pure sh without sh word split. stick to pure sh without sh word split.
''; '';
type = types.lines; type = types.lines;
@ -162,15 +163,24 @@ in
/bin/sh /bin/sh
''; '';
# For resetting environment with `. /etc/set-environment` when needed
# and discoverability (see motivation of #30418).
environment.etc."set-environment".source = config.system.build.setEnvironment;
system.build.setEnvironment = pkgs.writeText "set-environment" system.build.setEnvironment = pkgs.writeText "set-environment"
'' ''
${exportedEnvVars} # DO NOT EDIT -- this file has been generated automatically.
${cfg.extraInit} # Prevent this file from being sourced by child shells.
export __NIXOS_SET_ENVIRONMENT_DONE=1
# ~/bin if it exists overrides other bin directories. ${exportedEnvVars}
export PATH="$HOME/bin:$PATH"
''; ${cfg.extraInit}
# ~/bin if it exists overrides other bin directories.
export PATH="$HOME/bin:$PATH"
'';
system.activationScripts.binsh = stringAfter [ "stdio" ] system.activationScripts.binsh = stringAfter [ "stdio" ]
'' ''

View File

@ -81,6 +81,12 @@ in
description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>."; description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
}; };
extraSetup = mkOption {
type = types.lines;
default = "";
description = "Shell fragments to be run after the system environment has been created. This should only be used for things that need to modify the internals of the environment, e.g. generating MIME caches. The environment being built can be accessed at $out.";
};
}; };
system = { system = {
@ -107,12 +113,7 @@ in
"/etc/gtk-3.0" "/etc/gtk-3.0"
"/lib" # FIXME: remove and update debug-info.nix "/lib" # FIXME: remove and update debug-info.nix
"/sbin" "/sbin"
"/share/applications"
"/share/desktop-directories"
"/share/emacs" "/share/emacs"
"/share/icons"
"/share/menus"
"/share/mime"
"/share/nano" "/share/nano"
"/share/org" "/share/org"
"/share/themes" "/share/themes"
@ -132,10 +133,6 @@ in
# outputs TODO: note that the tools will often not be linked by default # outputs TODO: note that the tools will often not be linked by default
postBuild = postBuild =
'' ''
if [ -x $out/bin/update-mime-database -a -w $out/share/mime ]; then
XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null
fi
if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
$out/bin/gtk-update-icon-cache $out/share/icons/hicolor $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
fi fi
@ -144,16 +141,7 @@ in
$out/bin/glib-compile-schemas $out/share/glib-2.0/schemas $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
fi fi
if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then ${config.environment.extraSetup}
$out/bin/update-desktop-database $out/share/applications
fi
if [ -x $out/bin/install-info -a -w $out/share/info ]; then
shopt -s nullglob
for i in $out/share/info/*.info $out/share/info/*.info.gz; do
$out/bin/install-info $i $out/share/info/dir
done
fi
''; '';
}; };

View File

@ -524,6 +524,8 @@ in {
utmp.gid = ids.gids.utmp; utmp.gid = ids.gids.utmp;
adm.gid = ids.gids.adm; adm.gid = ids.gids.adm;
input.gid = ids.gids.input; input.gid = ids.gids.input;
kvm.gid = ids.gids.kvm;
render.gid = ids.gids.render;
}; };
system.activationScripts.users = stringAfter [ "stdio" ] system.activationScripts.users = stringAfter [ "stdio" ]

View File

@ -0,0 +1,22 @@
{ config, lib, ... }:
with lib;
{
options = {
xdg.autostart.enable = mkOption {
type = types.bool;
default = true;
description = ''
Whether to install files to support the
<link xlink:href="https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html">XDG Autostart specification</link>.
'';
};
};
config = mkIf config.xdg.autostart.enable {
environment.pathsToLink = [
"/etc/xdg/autostart"
];
};
}

View File

@ -0,0 +1,27 @@
{ config, lib, ... }:
with lib;
{
options = {
xdg.icons.enable = mkOption {
type = types.bool;
default = true;
description = ''
Whether to install files to support the
<link xlink:href="https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html">XDG Icon Theme specification</link>.
'';
};
};
config = mkIf config.xdg.icons.enable {
environment.pathsToLink = [
"/share/icons"
"/share/pixmaps"
];
environment.profileRelativeEnvVars = {
XCURSOR_PATH = [ "/share/icons" ];
};
};
}

View File

@ -0,0 +1,25 @@
{ config, lib, ... }:
with lib;
{
options = {
xdg.menus.enable = mkOption {
type = types.bool;
default = true;
description = ''
Whether to install files to support the
<link xlink:href="https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html">XDG Desktop Menu specification</link>.
'';
};
};
config = mkIf config.xdg.menus.enable {
environment.pathsToLink = [
"/share/applications"
"/share/desktop-directories"
"/etc/xdg/menus"
"/etc/xdg/menus/applications-merged"
];
};
}

View File

@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
with lib;
{
options = {
xdg.mime.enable = mkOption {
type = types.bool;
default = true;
description = ''
Whether to install files to support the
<link xlink:href="https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html">XDG Shared MIME-info specification</link> and the
<link xlink:href="https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html">XDG MIME Applications specification</link>.
'';
};
};
config = mkIf config.xdg.mime.enable {
environment.pathsToLink = [ "/share/mime" ];
environment.systemPackages = [
# this package also installs some useful data, as well as its utilities
pkgs.shared-mime-info
];
environment.extraSetup = ''
if [ -w $out/share/mime ]; then
XDG_DATA_DIRS=$out/share ${pkgs.shared-mime-info}/bin/update-mime-database -V $out/share/mime > /dev/null
fi
if [ -w $out/share/applications ]; then
${pkgs.desktop-file-utils}/bin/update-desktop-database $out/share/applications
fi
'';
};
}

View File

@ -23,7 +23,7 @@
bridge.</para></listitem> bridge.</para></listitem>
</itemizedlist> </itemizedlist>
<section><title>IBus</title> <section xml:id="module-services-input-methods-ibus"><title>IBus</title>
<para>IBus is an Intelligent Input Bus. It provides full featured and user <para>IBus is an Intelligent Input Bus. It provides full featured and user
friendly input method user interface.</para> friendly input method user interface.</para>
@ -69,7 +69,7 @@ ibus.engines = with pkgs.ibus-engines; [ table table-others ];
as shown above, and also (after running <literal>nixos-rebuild</literal>) the as shown above, and also (after running <literal>nixos-rebuild</literal>) the
input method must be added from IBus' preference dialog.</para> input method must be added from IBus' preference dialog.</para>
<simplesect> <simplesect xml:id="module-services-input-methods-troubleshooting">
<title>Troubleshooting</title> <title>Troubleshooting</title>
<para>If IBus works in some applications but not others, a likely cause of <para>If IBus works in some applications but not others, a likely cause of
this is that IBus is depending on a different version of this is that IBus is depending on a different version of
@ -82,7 +82,7 @@ ibus.engines = with pkgs.ibus-engines; [ table table-others ];
</simplesect> </simplesect>
</section> </section>
<section><title>Fcitx</title> <section xml:id="module-services-input-methods-fcitx"><title>Fcitx</title>
<para>Fcitx is an input method framework with extension support. It has three <para>Fcitx is an input method framework with extension support. It has three
built-in Input Method Engine, Pinyin, QuWei and Table-based input built-in Input Method Engine, Pinyin, QuWei and Table-based input
@ -122,7 +122,7 @@ i18n.inputMethod = {
</itemizedlist> </itemizedlist>
</section> </section>
<section><title>Nabi</title> <section xml:id="module-services-input-methods-nabi"><title>Nabi</title>
<para>Nabi is an easy to use Korean X input method. It allows you to enter <para>Nabi is an easy to use Korean X input method. It allows you to enter
phonetic Korean characters (hangul) and pictographic Korean characters phonetic Korean characters (hangul) and pictographic Korean characters
@ -136,7 +136,7 @@ i18n.inputMethod = {
</programlisting> </programlisting>
</section> </section>
<section><title>Uim</title> <section xml:id="module-services-input-methods-uim"><title>Uim</title>
<para>Uim (short for "universal input method") is a multilingual input method <para>Uim (short for "universal input method") is a multilingual input method
framework. Applications can use it through so-called bridges.</para> framework. Applications can use it through so-called bridges.</para>

View File

@ -16,7 +16,7 @@ with lib;
]; ];
# ISO naming. # ISO naming.
isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixos.label}-${pkgs.stdenv.system}.iso"; isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.iso";
isoImage.volumeID = substring 0 11 "NIXOS_ISO"; isoImage.volumeID = substring 0 11 "NIXOS_ISO";

View File

@ -7,6 +7,63 @@
with lib; with lib;
let let
/**
* Given a list of `options`, concats the result of mapping each options
* to a menuentry for use in grub.
*
* * defaults: {name, image, params, initrd}
* * options: [ option... ]
* * option: {name, params, class}
*/
menuBuilderGrub2 =
defaults: options: lib.concatStrings
(
map
(option: ''
menuentry '${defaults.name} ${
# Name appended to menuentry defaults to params if no specific name given.
option.name or (if option ? params then "(${option.params})" else "")
}' ${if option ? class then " --class ${option.class}" else ""} {
linux ${defaults.image} ${defaults.params} ${
option.params or ""
}
initrd ${defaults.initrd}
}
'')
options
)
;
/**
* Given a `config`, builds the default options.
*/
buildMenuGrub2 = config:
buildMenuAdditionalParamsGrub2 config ""
;
/**
* Given a `config` and params to add to `params`, build a set of default options.
* Use this one when creating a variant (e.g. hidpi)
*/
buildMenuAdditionalParamsGrub2 = config: additional:
let
finalCfg = {
name = "NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}";
params = "init=${config.system.build.toplevel}/init ${additional} ${toString config.boot.kernelParams}";
image = "/boot/bzImage";
initrd = "/boot/initrd";
};
in
menuBuilderGrub2
finalCfg
[
{ class = "installer"; }
{ class = "nomodeset"; params = "nomodeset"; }
{ class = "copytoram"; params = "copytoram"; }
{ class = "debug"; params = "debug"; }
]
;
# Timeout in syslinux is in units of 1/10 of a second. # Timeout in syslinux is in units of 1/10 of a second.
# 0 is used to disable timeouts. # 0 is used to disable timeouts.
syslinuxTimeout = if config.boot.loader.timeout == null then syslinuxTimeout = if config.boot.loader.timeout == null then
@ -36,6 +93,28 @@ let
UI vesamenu.c32 UI vesamenu.c32
MENU TITLE NixOS MENU TITLE NixOS
MENU BACKGROUND /isolinux/background.png MENU BACKGROUND /isolinux/background.png
MENU RESOLUTION 800 600
MENU CLEAR
MENU ROWS 6
MENU CMDLINEROW -4
MENU TIMEOUTROW -3
MENU TABMSGROW -2
MENU HELPMSGROW -1
MENU HELPMSGENDROW -1
MENU MARGIN 0
# FG:AARRGGBB BG:AARRGGBB shadow
MENU COLOR BORDER 30;44 #00000000 #00000000 none
MENU COLOR SCREEN 37;40 #FF000000 #00E2E8FF none
MENU COLOR TABMSG 31;40 #80000000 #00000000 none
MENU COLOR TIMEOUT 1;37;40 #FF000000 #00000000 none
MENU COLOR TIMEOUT_MSG 37;40 #FF000000 #00000000 none
MENU COLOR CMDMARK 1;36;40 #FF000000 #00000000 none
MENU COLOR CMDLINE 37;40 #FF000000 #00000000 none
MENU COLOR TITLE 1;36;44 #00000000 #00000000 none
MENU COLOR UNSEL 37;44 #FF000000 #00000000 none
MENU COLOR SEL 7;37;40 #FFFFFFFF #FF5277C3 std
DEFAULT boot DEFAULT boot
LABEL boot LABEL boot
@ -76,49 +155,167 @@ let
isolinuxCfg = concatStringsSep "\n" isolinuxCfg = concatStringsSep "\n"
([ baseIsolinuxCfg ] ++ optional config.boot.loader.grub.memtest86.enable isolinuxMemtest86Entry); ([ baseIsolinuxCfg ] ++ optional config.boot.loader.grub.memtest86.enable isolinuxMemtest86Entry);
# Setup instructions for rEFInd.
refind =
if targetArch == "x64" then
''
# Adds rEFInd to the ISO.
cp -v ${pkgs.refind}/share/refind/refind_x64.efi $out/EFI/boot/
''
else
"# No refind for ia32"
;
grubMenuCfg = ''
#
# Menu configuration
#
insmod gfxterm
insmod png
set gfxpayload=keep
# Fonts can be loaded?
# (This font is assumed to always be provided as a fallback by NixOS)
if loadfont (hd0)/EFI/boot/unicode.pf2; then
# Use graphical term, it can be either with background image or a theme.
# input is "console", while output is "gfxterm".
# This enables "serial" input and output only when possible.
# Otherwise the failure mode is to not even enable gfxterm.
if test "\$with_serial" == "yes"; then
terminal_output gfxterm serial
terminal_input console serial
else
terminal_output gfxterm
terminal_input console
fi
else
# Sets colors for the non-graphical term.
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
${ # When there is a theme configured, use it, otherwise use the background image.
if (!isNull config.isoImage.grubTheme) then ''
# Sets theme.
set theme=(hd0)/EFI/boot/grub-theme/theme.txt
# Load theme fonts
$(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont (hd0)/EFI/boot/grub-theme/%P\n")
'' else ''
if background_image (hd0)/EFI/boot/efi-background.png; then
# Black background means transparent background when there
# is a background image set... This seems undocumented :(
set color_normal=black/black
set color_highlight=white/blue
else
# Falls back again to proper colors.
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
''}
'';
# The EFI boot image. # The EFI boot image.
# Notes about grub:
# * Yes, the grubMenuCfg has to be repeated in all submenus. Otherwise you
# will get white-on-black console-like text on sub-menus. *sigh*
efiDir = pkgs.runCommand "efi-directory" {} '' efiDir = pkgs.runCommand "efi-directory" {} ''
mkdir -p $out/EFI/boot mkdir -p $out/EFI/boot/
cp -v ${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${targetArch}.efi $out/EFI/boot/boot${targetArch}.efi
mkdir -p $out/loader/entries
cat << EOF > $out/loader/entries/nixos-iso.conf MODULES="fat iso9660 part_gpt part_msdos \
title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} normal boot linux configfile loopback chain halt \
linux /boot/${config.system.boot.loader.kernelFile} efifwsetup efi_gop efi_uga \
initrd /boot/${config.system.boot.loader.initrdFile} ls search search_label search_fs_uuid search_fs_file \
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} gfxmenu gfxterm gfxterm_background gfxterm_menu test all_video loadenv \
exfat ext2 ntfs btrfs hfsplus udf \
videoinfo png \
echo serial \
"
# Make our own efi program, we can't rely on "grub-install" since it seems to
# probe for devices, even with --skip-fs-probe.
${pkgs.grub2_efi}/bin/grub-mkimage -o $out/EFI/boot/${if targetArch == "x64" then "bootx64" else "bootx32"}.efi -p /EFI/boot -O ${if targetArch == "x64" then "x86_64" else "i386"}-efi \
$MODULES
cp ${pkgs.grub2_efi}/share/grub/unicode.pf2 $out/EFI/boot/
cat <<EOF > $out/EFI/boot/grub.cfg
# If you want to use serial for "terminal_*" commands, you need to set one up:
# Example manual configuration:
# → serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
# This uses the defaults, and makes the serial terminal available.
set with_serial=no
if serial; then set with_serial=yes ;fi
export with_serial
clear
set timeout=10
${grubMenuCfg}
#
# Menu entries
#
${buildMenuGrub2 config}
submenu "HiDPI, Quirks and Accessibility" --class hidpi --class submenu {
${grubMenuCfg}
submenu "Suggests resolution @720p" --class hidpi-720p {
${grubMenuCfg}
${buildMenuAdditionalParamsGrub2 config "video=1280x720@60"}
}
submenu "Suggests resolution @1080p" --class hidpi-1080p {
${grubMenuCfg}
${buildMenuAdditionalParamsGrub2 config "video=1920x1080@60"}
}
# Some laptop and convertibles have the panel installed in an
# inconvenient way, rotated away from the keyboard.
# Those entries makes it easier to use the installer.
submenu "" {return}
submenu "Rotate framebuffer Clockwise" --class rotate-90cw {
${grubMenuCfg}
${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:1"}
}
submenu "Rotate framebuffer Upside-Down" --class rotate-180 {
${grubMenuCfg}
${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:2"}
}
submenu "Rotate framebuffer Counter-Clockwise" --class rotate-90ccw {
${grubMenuCfg}
${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:3"}
}
# As a proof of concept, mainly. (Not sure it has accessibility merits.)
submenu "" {return}
submenu "Use black on white" --class accessibility-blakconwhite {
${grubMenuCfg}
${buildMenuAdditionalParamsGrub2 config "vt.default_red=0xFF,0xBC,0x4F,0xB4,0x56,0xBC,0x4F,0x00,0xA1,0xCF,0x84,0xCA,0x8D,0xB4,0x84,0x68 vt.default_grn=0xFF,0x55,0xBA,0xBA,0x4D,0x4D,0xB3,0x00,0xA0,0x8F,0xB3,0xCA,0x88,0x93,0xA4,0x68 vt.default_blu=0xFF,0x58,0x5F,0x58,0xC5,0xBD,0xC5,0x00,0xA8,0xBB,0xAB,0x97,0xBD,0xC7,0xC5,0x68"}
}
# Serial access is a must!
submenu "" {return}
submenu "Serial console=ttyS0,115200n8" --class serial {
${grubMenuCfg}
${buildMenuAdditionalParamsGrub2 config "console=ttyS0,115200n8"}
}
}
menuentry 'rEFInd' --class refind {
# UUID is hard-coded in the derivation.
search --set=root --no-floppy --fs-uuid 1234-5678
chainloader (\$root)/EFI/boot/refind_x64.efi
}
menuentry 'Firmware Setup' --class settings {
fwsetup
clear
echo ""
echo "If you see this message, your EFI system doesn't support this feature."
echo ""
}
menuentry 'Shutdown' --class shutdown {
halt
}
EOF EOF
# A variant to boot with 'nomodeset' ${refind}
cat << EOF > $out/loader/entries/nixos-iso-nomodeset.conf
title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
version nomodeset
linux /boot/${config.system.boot.loader.kernelFile}
initrd /boot/${config.system.boot.loader.initrdFile}
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
EOF
# A variant to boot with 'copytoram'
cat << EOF > $out/loader/entries/nixos-iso-copytoram.conf
title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
version copytoram
linux /boot/${config.system.boot.loader.kernelFile}
initrd /boot/${config.system.boot.loader.initrdFile}
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
EOF
# A variant to boot with verbose logging to the console
cat << EOF > $out/loader/entries/nixos-iso-debug.conf
title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (debug)
linux /boot/${config.system.boot.loader.kernelFile}
initrd /boot/${config.system.boot.loader.initrdFile}
options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
EOF
cat << EOF > $out/loader/loader.conf
default nixos-iso
timeout ${builtins.toString config.boot.loader.timeout}
EOF
''; '';
efiImg = pkgs.runCommand "efi-image_eltorito" { buildInputs = [ pkgs.mtools pkgs.libfaketime ]; } efiImg = pkgs.runCommand "efi-image_eltorito" { buildInputs = [ pkgs.mtools pkgs.libfaketime ]; }
@ -234,13 +431,31 @@ in
''; '';
}; };
isoImage.splashImage = mkOption { isoImage.efiSplashImage = mkOption {
default = pkgs.fetchurl { default = pkgs.fetchurl {
url = https://raw.githubusercontent.com/NixOS/nixos-artwork/5729ab16c6a5793c10a2913b5a1b3f59b91c36ee/ideas/grub-splash/grub-nixos-1.png; url = https://raw.githubusercontent.com/NixOS/nixos-artwork/a9e05d7deb38a8e005a2b52575a3f59a63a4dba0/bootloader/efi-background.png;
sha256 = "43fd8ad5decf6c23c87e9026170a13588c2eba249d9013cb9f888da5e2002217"; sha256 = "18lfwmp8yq923322nlb9gxrh5qikj1wsk6g5qvdh31c4h5b1538x";
}; };
description = '' description = ''
The splash image to use in the bootloader. The splash image to use in the EFI bootloader.
'';
};
isoImage.splashImage = mkOption {
default = pkgs.fetchurl {
url = https://raw.githubusercontent.com/NixOS/nixos-artwork/a9e05d7deb38a8e005a2b52575a3f59a63a4dba0/bootloader/isolinux/bios-boot.png;
sha256 = "1wp822zrhbg4fgfbwkr7cbkr4labx477209agzc0hr6k62fr6rxd";
};
description = ''
The splash image to use in the legacy-boot bootloader.
'';
};
isoImage.grubTheme = mkOption {
default = pkgs.nixos-grub2-theme;
type = types.nullOr (types.either types.path types.package);
description = ''
The grub2 theme used for UEFI boot.
''; '';
}; };
@ -318,7 +533,7 @@ in
options = [ "allow_other" "cow" "nonempty" "chroot=/mnt-root" "max_files=32768" "hide_meta_files" "dirs=/nix/.rw-store=rw:/nix/.ro-store=ro" ]; options = [ "allow_other" "cow" "nonempty" "chroot=/mnt-root" "max_files=32768" "hide_meta_files" "dirs=/nix/.rw-store=rw:/nix/.ro-store=ro" ];
}; };
boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "usb-storage" "uas" ]; boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "uas" ];
boot.blacklistedKernelModules = [ "nouveau" ]; boot.blacklistedKernelModules = [ "nouveau" ];
@ -358,6 +573,9 @@ in
{ source = "${pkgs.syslinux}/share/syslinux"; { source = "${pkgs.syslinux}/share/syslinux";
target = "/isolinux"; target = "/isolinux";
} }
{ source = config.isoImage.efiSplashImage;
target = "/EFI/boot/efi-background.png";
}
{ source = config.isoImage.splashImage; { source = config.isoImage.splashImage;
target = "/isolinux/background.png"; target = "/isolinux/background.png";
} }
@ -371,13 +589,14 @@ in
{ source = "${efiDir}/EFI"; { source = "${efiDir}/EFI";
target = "/EFI"; target = "/EFI";
} }
{ source = "${efiDir}/loader";
target = "/loader";
}
] ++ optionals config.boot.loader.grub.memtest86.enable [ ] ++ optionals config.boot.loader.grub.memtest86.enable [
{ source = "${pkgs.memtest86plus}/memtest.bin"; { source = "${pkgs.memtest86plus}/memtest.bin";
target = "/boot/memtest.bin"; target = "/boot/memtest.bin";
} }
] ++ optionals (!isNull config.isoImage.grubTheme) [
{ source = config.isoImage.grubTheme;
target = "/EFI/boot/grub-theme";
}
]; ];
boot.loader.timeout = 10; boot.loader.timeout = 10;

View File

@ -16,7 +16,8 @@ in
]; ];
assertions = lib.singleton { assertions = lib.singleton {
assertion = pkgs.stdenv.system == "aarch64-linux"; assertion = pkgs.stdenv.hostPlatform.system == "aarch64-linux"
&& pkgs.stdenv.hostPlatform.system == pkgs.stdenv.buildPlatform.system;
message = "sd-image-aarch64.nix can be only built natively on Aarch64 / ARM64; " + message = "sd-image-aarch64.nix can be only built natively on Aarch64 / ARM64; " +
"it cannot be cross compiled"; "it cannot be cross compiled";
}; };

View File

@ -16,7 +16,8 @@ in
]; ];
assertions = lib.singleton { assertions = lib.singleton {
assertion = pkgs.stdenv.system == "armv7l-linux"; assertion = pkgs.stdenv.hostPlatform.system == "armv7l-linux"
&& pkgs.stdenv.hostPlatform.system == pkgs.stdenv.buildPlatform.system;
message = "sd-image-armv7l-multiplatform.nix can be only built natively on ARMv7; " + message = "sd-image-armv7l-multiplatform.nix can be only built natively on ARMv7; " +
"it cannot be cross compiled"; "it cannot be cross compiled";
}; };

View File

@ -16,7 +16,8 @@ in
]; ];
assertions = lib.singleton { assertions = lib.singleton {
assertion = pkgs.stdenv.system == "armv6l-linux"; assertion = pkgs.stdenv.hostPlatform.system == "armv6l-linux"
&& pkgs.stdenv.hostPlatform.system == pkgs.stdenv.buildPlatform.system;
message = "sd-image-raspberrypi.nix can be only built natively on ARMv6; " + message = "sd-image-raspberrypi.nix can be only built natively on ARMv6; " +
"it cannot be cross compiled"; "it cannot be cross compiled";
}; };

View File

@ -12,18 +12,17 @@
with lib; with lib;
let let
rootfsImage = import ../../../lib/make-ext4-fs.nix { rootfsImage = pkgs.callPackage ../../../lib/make-ext4-fs.nix ({
inherit pkgs;
inherit (config.sdImage) storePaths; inherit (config.sdImage) storePaths;
volumeLabel = "NIXOS_SD"; volumeLabel = "NIXOS_SD";
} // optionalAttrs (config.sdImage.rootPartitionUUID != null) { } // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
uuid = config.sdImage.rootPartitionUUID; uuid = config.sdImage.rootPartitionUUID;
}; });
in in
{ {
options.sdImage = { options.sdImage = {
imageName = mkOption { imageName = mkOption {
default = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.system}.img"; default = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.img";
description = '' description = ''
Name of the generated image file. Name of the generated image file.
''; '';
@ -94,16 +93,16 @@ in
sdImage.storePaths = [ config.system.build.toplevel ]; sdImage.storePaths = [ config.system.build.toplevel ];
system.build.sdImage = pkgs.stdenv.mkDerivation { system.build.sdImage = pkgs.callPackage ({ stdenv, dosfstools, e2fsprogs, mtools, libfaketime, utillinux }: stdenv.mkDerivation {
name = config.sdImage.imageName; name = config.sdImage.imageName;
buildInputs = with pkgs; [ dosfstools e2fsprogs mtools libfaketime utillinux ]; nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux ];
buildCommand = '' buildCommand = ''
mkdir -p $out/nix-support $out/sd-image mkdir -p $out/nix-support $out/sd-image
export img=$out/sd-image/${config.sdImage.imageName} export img=$out/sd-image/${config.sdImage.imageName}
echo "${pkgs.stdenv.system}" > $out/nix-support/system echo "${pkgs.stdenv.buildPlatform.system}" > $out/nix-support/system
echo "file sd-image $img" >> $out/nix-support/hydra-build-products echo "file sd-image $img" >> $out/nix-support/hydra-build-products
# Create the image file sized to fit /boot and /, plus 20M of slack # Create the image file sized to fit /boot and /, plus 20M of slack
@ -138,7 +137,7 @@ in
(cd boot; mcopy -bpsvm -i ../bootpart.img ./* ::) (cd boot; mcopy -bpsvm -i ../bootpart.img ./* ::)
dd conv=notrunc if=bootpart.img of=$img seek=$START count=$SECTORS dd conv=notrunc if=bootpart.img of=$img seek=$START count=$SECTORS
''; '';
}; }) {};
boot.postBootCommands = '' boot.postBootCommands = ''
# On the first boot do some maintenance tasks # On the first boot do some maintenance tasks

View File

@ -25,10 +25,9 @@ with lib;
# !!! Hack - attributes expected by other modules. # !!! Hack - attributes expected by other modules.
environment.systemPackages = [ pkgs.grub2_efi ] environment.systemPackages = [ pkgs.grub2_efi ]
++ (if pkgs.stdenv.system == "aarch64-linux" ++ (if pkgs.stdenv.hostPlatform.system == "aarch64-linux"
then [] then []
else [ pkgs.grub2 pkgs.syslinux ]); else [ pkgs.grub2 pkgs.syslinux ]);
system.boot.loader.kernelFile = pkgs.stdenv.platform.kernelTarget;
fileSystems."/" = fileSystems."/" =
{ fsType = "tmpfs"; { fsType = "tmpfs";
@ -86,7 +85,7 @@ with lib;
system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" '' system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" ''
#!ipxe #!ipxe
kernel ${pkgs.stdenv.platform.kernelTarget} init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} kernel ${pkgs.stdenv.hostPlatform.platform.kernelTarget} init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
initrd initrd initrd initrd
boot boot
''; '';

View File

@ -1,6 +1,6 @@
{ {
x86_64-linux = "/nix/store/0d60i73mcv8z1m8d2m74yfn84980gfsa-nix-2.0.4"; x86_64-linux = "/nix/store/h180y3n5k1ypxgm1pcvj243qix5j45zz-nix-2.1.1";
i686-linux = "/nix/store/6ssafj2s5a2g9x28yld7b70vwd6vw6lb-nix-2.0.4"; i686-linux = "/nix/store/v2y4k4v9ml07jmfq739wyflapg3b7b5k-nix-2.1.1";
aarch64-linux = "/nix/store/3wwch7bp7n7xsl8apgy2a4b16yzyij1z-nix-2.0.4"; aarch64-linux = "/nix/store/v485craglq7xm5996ci8qy5dyc17dab0-nix-2.1.1";
x86_64-darwin = "/nix/store/771l8i0mz4c8kry8cz3sz8rr3alalckg-nix-2.0.4"; x86_64-darwin = "/nix/store/lc3ymlix73kaad5srjdgaxp9ngr1sg6g-nix-2.1.1";
} }

View File

@ -574,6 +574,10 @@ $bootLoaderConfig
# networking.hostName = "nixos"; # Define your hostname. # networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password\@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties. # Select internationalisation properties.
# i18n = { # i18n = {
# consoleFont = "Lat2-Terminus16"; # consoleFont = "Lat2-Terminus16";

View File

@ -82,6 +82,14 @@ let cfg = config.documentation; in
environment.systemPackages = [ pkgs.texinfoInteractive ]; environment.systemPackages = [ pkgs.texinfoInteractive ];
environment.pathsToLink = [ "/share/info" ]; environment.pathsToLink = [ "/share/info" ];
environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo"; environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo";
environment.extraSetup = ''
if [ -w $out/share/info ]; then
shopt -s nullglob
for i in $out/share/info/*.info $out/share/info/*.info.gz; do
${pkgs.texinfo}/bin/install-info $i $out/share/info/dir
done
fi
'';
}) })
(mkIf cfg.doc.enable { (mkIf cfg.doc.enable {

View File

@ -326,6 +326,9 @@
cfssl = 299; cfssl = 299;
cassandra = 300; cassandra = 300;
qemu-libvirtd = 301; qemu-libvirtd = 301;
# kvm = 302; # unused
# render = 303; # unused
zeronet = 304;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@ -612,6 +615,9 @@
cfssl = 299; cfssl = 299;
cassandra = 300; cassandra = 300;
qemu-libvirtd = 301; qemu-libvirtd = 301;
kvm = 302; # default udev rules from systemd requires these
render = 303; # default udev rules from systemd requires these
zeronet = 304;
# When adding a gid, make sure it doesn't match an existing # When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal # uid. Users and groups with the same name should have equal

View File

@ -84,7 +84,7 @@ in
versionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId)); versionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId));
# Note: the first letter is bumped on every release. It's an animal. # Note: the first letter is bumped on every release. It's an animal.
codeName = "Jellyfish"; codeName = "Koi";
}; };
# Generate /etc/os-release. See # Generate /etc/os-release. See

View File

@ -7,6 +7,10 @@
./config/fonts/fontdir.nix ./config/fonts/fontdir.nix
./config/fonts/fonts.nix ./config/fonts/fonts.nix
./config/fonts/ghostscript.nix ./config/fonts/ghostscript.nix
./config/xdg/autostart.nix
./config/xdg/icons.nix
./config/xdg/menus.nix
./config/xdg/mime.nix
./config/gnu.nix ./config/gnu.nix
./config/i18n.nix ./config/i18n.nix
./config/iproute2.nix ./config/iproute2.nix
@ -247,8 +251,10 @@
./services/desktops/gnome3/tracker-miners.nix ./services/desktops/gnome3/tracker-miners.nix
./services/desktops/profile-sync-daemon.nix ./services/desktops/profile-sync-daemon.nix
./services/desktops/telepathy.nix ./services/desktops/telepathy.nix
./services/desktops/zeitgeist.nix
./services/development/bloop.nix ./services/development/bloop.nix
./services/development/hoogle.nix ./services/development/hoogle.nix
./services/development/jupyter/default.nix
./services/editors/emacs.nix ./services/editors/emacs.nix
./services/editors/infinoted.nix ./services/editors/infinoted.nix
./services/games/factorio.nix ./services/games/factorio.nix
@ -280,6 +286,7 @@
./services/hardware/upower.nix ./services/hardware/upower.nix
./services/hardware/usbmuxd.nix ./services/hardware/usbmuxd.nix
./services/hardware/thermald.nix ./services/hardware/thermald.nix
./services/hardware/undervolt.nix
./services/logging/SystemdJournal2Gelf.nix ./services/logging/SystemdJournal2Gelf.nix
./services/logging/awstats.nix ./services/logging/awstats.nix
./services/logging/fluentd.nix ./services/logging/fluentd.nix
@ -399,6 +406,7 @@
./services/misc/taskserver ./services/misc/taskserver
./services/misc/tzupdate.nix ./services/misc/tzupdate.nix
./services/misc/uhub.nix ./services/misc/uhub.nix
./services/misc/weechat.nix
./services/misc/xmr-stak.nix ./services/misc/xmr-stak.nix
./services/misc/zookeeper.nix ./services/misc/zookeeper.nix
./services/monitoring/apcupsd.nix ./services/monitoring/apcupsd.nix
@ -407,12 +415,14 @@
./services/monitoring/cadvisor.nix ./services/monitoring/cadvisor.nix
./services/monitoring/collectd.nix ./services/monitoring/collectd.nix
./services/monitoring/das_watchdog.nix ./services/monitoring/das_watchdog.nix
./services/monitoring/datadog-agent.nix
./services/monitoring/dd-agent/dd-agent.nix ./services/monitoring/dd-agent/dd-agent.nix
./services/monitoring/fusion-inventory.nix ./services/monitoring/fusion-inventory.nix
./services/monitoring/grafana.nix ./services/monitoring/grafana.nix
./services/monitoring/graphite.nix ./services/monitoring/graphite.nix
./services/monitoring/hdaps.nix ./services/monitoring/hdaps.nix
./services/monitoring/heapster.nix ./services/monitoring/heapster.nix
./services/monitoring/incron.nix
./services/monitoring/longview.nix ./services/monitoring/longview.nix
./services/monitoring/monit.nix ./services/monitoring/monit.nix
./services/monitoring/munin.nix ./services/monitoring/munin.nix
@ -509,6 +519,7 @@
./services/networking/i2pd.nix ./services/networking/i2pd.nix
./services/networking/i2p.nix ./services/networking/i2p.nix
./services/networking/iodine.nix ./services/networking/iodine.nix
./services/networking/iperf3.nix
./services/networking/ircd-hybrid/default.nix ./services/networking/ircd-hybrid/default.nix
./services/networking/iwd.nix ./services/networking/iwd.nix
./services/networking/keepalived/default.nix ./services/networking/keepalived/default.nix
@ -611,6 +622,7 @@
./services/networking/xl2tpd.nix ./services/networking/xl2tpd.nix
./services/networking/xrdp.nix ./services/networking/xrdp.nix
./services/networking/zerobin.nix ./services/networking/zerobin.nix
./services/networking/zeronet.nix
./services/networking/zerotierone.nix ./services/networking/zerotierone.nix
./services/networking/znc.nix ./services/networking/znc.nix
./services/printing/cupsd.nix ./services/printing/cupsd.nix
@ -620,6 +632,7 @@
./services/scheduling/fcron.nix ./services/scheduling/fcron.nix
./services/scheduling/marathon.nix ./services/scheduling/marathon.nix
./services/search/elasticsearch.nix ./services/search/elasticsearch.nix
./services/search/elasticsearch-curator.nix
./services/search/hound.nix ./services/search/hound.nix
./services/search/kibana.nix ./services/search/kibana.nix
./services/search/solr.nix ./services/search/solr.nix

View File

@ -33,7 +33,7 @@
# USB support, especially for booting from USB CD-ROM # USB support, especially for booting from USB CD-ROM
# drives. # drives.
"usb_storage" "uas"
# Firewire support. Not tested. # Firewire support. Not tested.
"ohci1394" "sbp2" "ohci1394" "sbp2"

View File

@ -31,7 +31,8 @@ with lib;
#services.rogue.enable = true; #services.rogue.enable = true;
# Disable some other stuff we don't need. # Disable some other stuff we don't need.
security.sudo.enable = false; security.sudo.enable = mkDefault false;
services.udisks2.enable = mkDefault false;
# Automatically log in at the virtual consoles. # Automatically log in at the virtual consoles.
services.mingetty.autologinUser = "root"; services.mingetty.autologinUser = "root";

View File

@ -126,7 +126,9 @@ in
programs.bash = { programs.bash = {
shellInit = '' shellInit = ''
${config.system.build.setEnvironment.text} if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]; then
. ${config.system.build.setEnvironment}
fi
${cfge.shellInit} ${cfge.shellInit}
''; '';
@ -166,11 +168,11 @@ in
# Read system-wide modifications. # Read system-wide modifications.
if test -f /etc/profile.local; then if test -f /etc/profile.local; then
. /etc/profile.local . /etc/profile.local
fi fi
if [ -n "''${BASH_VERSION:-}" ]; then if [ -n "''${BASH_VERSION:-}" ]; then
. /etc/bashrc . /etc/bashrc
fi fi
''; '';
@ -191,12 +193,12 @@ in
# We are not always an interactive shell. # We are not always an interactive shell.
if [ -n "$PS1" ]; then if [ -n "$PS1" ]; then
${cfg.interactiveShellInit} ${cfg.interactiveShellInit}
fi fi
# Read system-wide modifications. # Read system-wide modifications.
if test -f /etc/bashrc.local; then if test -f /etc/bashrc.local; then
. /etc/bashrc.local . /etc/bashrc.local
fi fi
''; '';

View File

@ -32,6 +32,8 @@ in
environment.etc = optionals (cfg.profiles != {}) environment.etc = optionals (cfg.profiles != {})
(mapAttrsToList mkDconfProfile cfg.profiles); (mapAttrsToList mkDconfProfile cfg.profiles);
services.dbus.packages = [ pkgs.gnome3.dconf ];
environment.variables.GIO_EXTRA_MODULES = optional cfg.enable environment.variables.GIO_EXTRA_MODULES = optional cfg.enable
"${pkgs.gnome3.dconf.lib}/lib/gio/modules"; "${pkgs.gnome3.dconf.lib}/lib/gio/modules";
# https://github.com/NixOS/nixpkgs/pull/31891 # https://github.com/NixOS/nixpkgs/pull/31891

View File

@ -40,7 +40,6 @@ in
GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ]; GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ];
XDG_CONFIG_DIRS = [ "/etc/xdg" ]; XDG_CONFIG_DIRS = [ "/etc/xdg" ];
XDG_DATA_DIRS = [ "/share" ]; XDG_DATA_DIRS = [ "/share" ];
XCURSOR_PATH = [ "/share/icons" ];
MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ]; MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
LIBEXEC_PATH = [ "/lib/libexec" ]; LIBEXEC_PATH = [ "/lib/libexec" ];
}; };

View File

@ -109,7 +109,9 @@ in
set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $__fish_datadir/functions set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $__fish_datadir/functions
# source the NixOS environment config # source the NixOS environment config
fenv source ${config.system.build.setEnvironment} if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]
fenv source ${config.system.build.setEnvironment}
end
# clear fish_function_path so that it will be correctly set when we return to $__fish_datadir/config.fish # clear fish_function_path so that it will be correctly set when we return to $__fish_datadir/config.fish
set -e fish_function_path set -e fish_function_path
@ -150,7 +152,6 @@ in
and begin and begin
${fishAliases} ${fishAliases}
set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $fish_function_path set fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions $fish_function_path
fenv source /etc/fish/foreign-env/interactiveShellInit > /dev/null fenv source /etc/fish/foreign-env/interactiveShellInit > /dev/null
set -e fish_function_path[1] set -e fish_function_path[1]

View File

@ -10,7 +10,7 @@
to manage your <link xlink:href="https://www.zsh.org/">ZSH</link> configuration to manage your <link xlink:href="https://www.zsh.org/">ZSH</link> configuration
including completion scripts for several CLI tools or custom prompt themes.</para> including completion scripts for several CLI tools or custom prompt themes.</para>
<section><title>Basic usage</title> <section xml:id="module-programs-oh-my-zsh-usage"><title>Basic usage</title>
<para>The module uses the <literal>oh-my-zsh</literal> package with all available features. The <para>The module uses the <literal>oh-my-zsh</literal> package with all available features. The
initial setup using Nix expressions is fairly similar to the configuration format initial setup using Nix expressions is fairly similar to the configuration format
of <literal>oh-my-zsh</literal>. of <literal>oh-my-zsh</literal>.
@ -32,7 +32,7 @@ For a detailed explanation of these arguments please refer to the
configuration and writes it into your <literal>/etc/zshrc</literal>. configuration and writes it into your <literal>/etc/zshrc</literal>.
</para></section> </para></section>
<section><title>Custom additions</title> <section xml:id="module-programs-oh-my-zsh-additions"><title>Custom additions</title>
<para>Sometimes third-party or custom scripts such as a modified theme may be needed. <para>Sometimes third-party or custom scripts such as a modified theme may be needed.
<literal>oh-my-zsh</literal> provides the <literal>oh-my-zsh</literal> provides the
@ -48,7 +48,7 @@ environment variable for this which points to a directory with additional script
</programlisting> </programlisting>
</para></section> </para></section>
<section><title>Custom environments</title> <section xml:id="module-programs-oh-my-zsh-environments"><title>Custom environments</title>
<para>There are several extensions for <literal>oh-my-zsh</literal> packaged in <literal>nixpkgs</literal>. <para>There are several extensions for <literal>oh-my-zsh</literal> packaged in <literal>nixpkgs</literal>.
One of them is <link xlink:href="https://github.com/spwhitt/nix-zsh-completions">nix-zsh-completions</link> One of them is <link xlink:href="https://github.com/spwhitt/nix-zsh-completions">nix-zsh-completions</link>
@ -77,7 +77,7 @@ as it requires an immutable store path while <literal>custom</literal> shall rem
will be thrown if both <literal>custom</literal> and <literal>customPkgs</literal> are set.</emphasis> will be thrown if both <literal>custom</literal> and <literal>customPkgs</literal> are set.</emphasis>
</para></section> </para></section>
<section><title>Package your own customizations</title> <section xml:id="module-programs-oh-my-zsh-packaging-customizations"><title>Package your own customizations</title>
<para>If third-party customizations (e.g. new themes) are supposed to be added to <literal>oh-my-zsh</literal> <para>If third-party customizations (e.g. new themes) are supposed to be added to <literal>oh-my-zsh</literal>
there are several pitfalls to keep in mind:</para> there are several pitfalls to keep in mind:</para>

View File

@ -70,7 +70,7 @@ in
promptInit = mkOption { promptInit = mkOption {
default = '' default = ''
if [ "$TERM" != dumb ]; then if [ "$TERM" != dumb ]; then
autoload -U promptinit && promptinit && prompt walters autoload -U promptinit && promptinit && prompt walters
fi fi
''; '';
description = '' description = ''
@ -87,6 +87,19 @@ in
type = types.bool; type = types.bool;
}; };
enableGlobalCompInit = mkOption {
default = cfg.enableCompletion;
description = ''
Enable execution of compinit call for all interactive zsh shells.
This option can be disabled if the user wants to extend its
<literal>fpath</literal> and a custom <literal>compinit</literal>
call in the local config is required.
'';
type = types.bool;
};
}; };
}; };
@ -103,7 +116,9 @@ in
if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi
export __ETC_ZSHENV_SOURCED=1 export __ETC_ZSHENV_SOURCED=1
${config.system.build.setEnvironment.text} if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]; then
. ${config.system.build.setEnvironment}
fi
${cfge.shellInit} ${cfge.shellInit}
@ -111,7 +126,7 @@ in
# Read system-wide modifications. # Read system-wide modifications.
if test -f /etc/zshenv.local; then if test -f /etc/zshenv.local; then
. /etc/zshenv.local . /etc/zshenv.local
fi fi
''; '';
@ -130,7 +145,7 @@ in
# Read system-wide modifications. # Read system-wide modifications.
if test -f /etc/zprofile.local; then if test -f /etc/zprofile.local; then
. /etc/zprofile.local . /etc/zprofile.local
fi fi
''; '';
@ -156,10 +171,10 @@ in
# Tell zsh how to find installed completions # Tell zsh how to find installed completions
for p in ''${(z)NIX_PROFILES}; do for p in ''${(z)NIX_PROFILES}; do
fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions) fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions)
done done
${optionalString cfg.enableCompletion "autoload -U compinit && compinit"} ${optionalString cfg.enableGlobalCompInit "autoload -U compinit && compinit"}
${cfge.interactiveShellInit} ${cfge.interactiveShellInit}
@ -171,7 +186,7 @@ in
# Read system-wide modifications. # Read system-wide modifications.
if test -f /etc/zshrc.local; then if test -f /etc/zshrc.local; then
. /etc/zshrc.local . /etc/zshrc.local
fi fi
''; '';

View File

@ -219,7 +219,7 @@ with lib;
'') '')
# Profile splitting # Profile splitting
(mkRenamedOptionModule [ "virtualization" "growPartition" ] [ "boot" "growPartition" ]) (mkRenamedOptionModule [ "virtualisation" "growPartition" ] [ "boot" "growPartition" ])
# misc/version.nix # misc/version.nix
(mkRenamedOptionModule [ "system" "nixosVersion" ] [ "system" "nixos" "version" ]) (mkRenamedOptionModule [ "system" "nixosVersion" ] [ "system" "nixos" "version" ])
@ -256,6 +256,7 @@ with lib;
(mkRemovedOptionModule [ "fonts" "fontconfig" "forceAutohint" ] "") (mkRemovedOptionModule [ "fonts" "fontconfig" "forceAutohint" ] "")
(mkRemovedOptionModule [ "fonts" "fontconfig" "renderMonoTTFAsBitmap" ] "") (mkRemovedOptionModule [ "fonts" "fontconfig" "renderMonoTTFAsBitmap" ] "")
(mkRemovedOptionModule [ "virtualisation" "xen" "qemu" ] "You don't need this option anymore, it will work without it.") (mkRemovedOptionModule [ "virtualisation" "xen" "qemu" ] "You don't need this option anymore, it will work without it.")
(mkRemovedOptionModule [ "services" "logstash" "enableWeb" ] "The web interface was removed from logstash")
(mkRemovedOptionModule [ "boot" "zfs" "enableLegacyCrypto" ] "The corresponding package was removed from nixpkgs.") (mkRemovedOptionModule [ "boot" "zfs" "enableLegacyCrypto" ] "The corresponding package was removed from nixpkgs.")
# ZSH # ZSH

View File

@ -11,7 +11,7 @@ retrieval and renewal using the ACME protocol. This is currently only
implemented by and for Let's Encrypt. The alternative ACME client implemented by and for Let's Encrypt. The alternative ACME client
<literal>simp_le</literal> is used under the hood.</para> <literal>simp_le</literal> is used under the hood.</para>
<section><title>Prerequisites</title> <section xml:id="module-security-acme-prerequisites"><title>Prerequisites</title>
<para>You need to have a running HTTP server for verification. The server must <para>You need to have a running HTTP server for verification. The server must
have a webroot defined that can serve have a webroot defined that can serve
@ -41,7 +41,7 @@ http {
</section> </section>
<section><title>Configuring</title> <section xml:id="module-security-acme-configuring"><title>Configuring</title>
<para>To enable ACME certificate retrieval &amp; renewal for a certificate for <para>To enable ACME certificate retrieval &amp; renewal for a certificate for
<literal>foo.example.com</literal>, add the following in your <literal>foo.example.com</literal>, add the following in your
@ -66,7 +66,7 @@ options for the <link linkend="opt-security.acme.certs">security.acme</link> mod
</section> </section>
<section><title>Using ACME certificates in Nginx</title> <section xml:id="module-security-acme-nginx"><title>Using ACME certificates in Nginx</title>
<para>NixOS supports fetching ACME certificates for you by setting <para>NixOS supports fetching ACME certificates for you by setting
<literal><link linkend="opt-services.nginx.virtualHosts._name_.enableACME">enableACME</link> = true;</literal> in a virtualHost config. We <literal><link linkend="opt-services.nginx.virtualHosts._name_.enableACME">enableACME</link> = true;</literal> in a virtualHost config. We
first create self-signed placeholder certificates in place of the first create self-signed placeholder certificates in place of the

View File

@ -17,7 +17,7 @@
<para>FoundationDB (or "FDB") is an open source, distributed, transactional <para>FoundationDB (or "FDB") is an open source, distributed, transactional
key-value store.</para> key-value store.</para>
<section><title>Configuring and basic setup</title> <section xml:id="module-services-foundationdb-configuring"><title>Configuring and basic setup</title>
<para>To enable FoundationDB, add the following to your <para>To enable FoundationDB, add the following to your
<filename>configuration.nix</filename>: <filename>configuration.nix</filename>:
@ -133,7 +133,7 @@ corresponding <option>services.foundationdb.logDir</option> as well.</para>
</section> </section>
<section><title>Scaling processes and backup agents</title> <section xml:id="module-services-foundationdb-scaling"><title>Scaling processes and backup agents</title>
<para>Scaling the number of server processes is quite easy; simply specify <para>Scaling the number of server processes is quite easy; simply specify
<option>services.foundationdb.serverProcesses</option> to be the number of <option>services.foundationdb.serverProcesses</option> to be the number of
@ -151,7 +151,7 @@ available backup processes.</para>
</section> </section>
<section><title>Clustering</title> <section xml:id="module-services-foundationdb-clustering"><title>Clustering</title>
<para>FoundationDB on NixOS works similarly to other Linux systems, so this <para>FoundationDB on NixOS works similarly to other Linux systems, so this
section will be brief. Please refer to the full FoundationDB documentation for section will be brief. Please refer to the full FoundationDB documentation for
@ -221,7 +221,7 @@ informing all client processes to do the same.</para>
</section> </section>
<section><title>Client connectivity</title> <section xml:id="module-services-foundationdb-connectivity"><title>Client connectivity</title>
<para>By default, all clients must use the current <para>By default, all clients must use the current
<command>fdb.cluster</command> file to access a given FoundationDB cluster. <command>fdb.cluster</command> file to access a given FoundationDB cluster.
@ -232,7 +232,7 @@ to a new node in order to connect, if it is not part of the cluster.</para>
</section> </section>
<section><title>Client authorization and TLS</title> <section xml:id="module-services-foundationdb-authorization"><title>Client authorization and TLS</title>
<para>By default, any user who can connect to a FoundationDB process with the <para>By default, any user who can connect to a FoundationDB process with the
correct cluster configuration can access anything. FoundationDB uses a correct cluster configuration can access anything. FoundationDB uses a
@ -270,7 +270,7 @@ on.</para>
</section> </section>
<section><title>Backups and Disaster Recovery</title> <section xml:id="module-services-foundationdb-disaster-recovery"><title>Backups and Disaster Recovery</title>
<para>The usual rules for doing FoundationDB backups apply on NixOS as written <para>The usual rules for doing FoundationDB backups apply on NixOS as written
in the FoundationDB manual. However, one important difference is the security in the FoundationDB manual. However, one important difference is the security
@ -316,7 +316,7 @@ $ sudo -u foundationdb fdbbackup status -t default
</section> </section>
<section><title>Known limitations</title> <section xml:id="module-services-foundationdb-limitations"><title>Known limitations</title>
<para>The FoundationDB setup for NixOS should currently be considered beta. <para>The FoundationDB setup for NixOS should currently be considered beta.
FoundationDB is not new software, but the NixOS compilation and integration has FoundationDB is not new software, but the NixOS compilation and integration has
@ -333,7 +333,7 @@ only undergone fairly basic testing of all the available functionality.</para>
</section> </section>
<section><title>Options</title> <section xml:id="module-services-foundationdb-options"><title>Options</title>
<para>NixOS's FoundationDB module allows you to configure all of the most <para>NixOS's FoundationDB module allows you to configure all of the most
relevant configuration options for <command>fdbmonitor</command>, matching it relevant configuration options for <command>fdbmonitor</command>, matching it
@ -343,7 +343,7 @@ also read the FoundationDB documentation as well.</para>
</section> </section>
<section><title>Full documentation</title> <section xml:id="module-services-foundationdb-full-docs"><title>Full documentation</title>
<para>FoundationDB is a complex piece of software, and requires careful <para>FoundationDB is a complex piece of software, and requires careful
administration to properly use. Full documentation for administration can be administration to properly use. Full documentation for administration can be

View File

@ -17,7 +17,7 @@
<para>PostgreSQL is an advanced, free relational database.<!-- MORE --></para> <para>PostgreSQL is an advanced, free relational database.<!-- MORE --></para>
<section><title>Configuring</title> <section xml:id="module-services-postgres-configuring"><title>Configuring</title>
<para>To enable PostgreSQL, add the following to your <para>To enable PostgreSQL, add the following to your
<filename>configuration.nix</filename>: <filename>configuration.nix</filename>:
@ -60,14 +60,14 @@ alice=>
</section> </section>
<section><title>Upgrading</title> <section xml:id="module-services-postgres-upgrading"><title>Upgrading</title>
<para>FIXME: document dump/upgrade/load cycle.</para> <para>FIXME: document dump/upgrade/load cycle.</para>
</section> </section>
<section><title>Options</title> <section xml:id="module-services-postgres-options"><title>Options</title>
<para>A complete list of options for the PostgreSQL module may be found <link linkend="opt-services.postgresql.enable">here</link>.</para> <para>A complete list of options for the PostgreSQL module may be found <link linkend="opt-services.postgresql.enable">here</link>.</para>

View File

@ -32,15 +32,21 @@ with lib;
environment.systemPackages = [ pkgs.accountsservice ]; environment.systemPackages = [ pkgs.accountsservice ];
# Accounts daemon looks for dbus interfaces in $XDG_DATA_DIRS/accountsservice
environment.pathsToLink = [ "/share/accountsservice" ];
services.dbus.packages = [ pkgs.accountsservice ]; services.dbus.packages = [ pkgs.accountsservice ];
systemd.packages = [ pkgs.accountsservice ]; systemd.packages = [ pkgs.accountsservice ];
systemd.services.accounts-daemon= { systemd.services.accounts-daemon = {
wantedBy = [ "graphical.target" ]; wantedBy = [ "graphical.target" ];
} // (mkIf (!config.users.mutableUsers) { # Accounts daemon looks for dbus interfaces in $XDG_DATA_DIRS/accountsservice
environment.XDG_DATA_DIRS = "${config.system.path}/share";
} // (optionalAttrs (!config.users.mutableUsers) {
environment.NIXOS_USERS_PURE = "true"; environment.NIXOS_USERS_PURE = "true";
}); });
}; };

View File

@ -0,0 +1,26 @@
# Zeitgeist
{ config, lib, pkgs, ... }:
with lib;
{
###### interface
options = {
services.zeitgeist = {
enable = mkEnableOption "zeitgeist";
};
};
###### implementation
config = mkIf config.services.zeitgeist.enable {
environment.systemPackages = [ pkgs.zeitgeist ];
services.dbus.packages = [ pkgs.zeitgeist ];
systemd.packages = [ pkgs.zeitgeist ];
};
}

View File

@ -0,0 +1,184 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.jupyter;
# NOTE: We don't use top-level jupyter because we don't
# want to pass in JUPYTER_PATH but use .environment instead,
# saving a rebuild.
package = pkgs.python3.pkgs.notebook;
kernels = (pkgs.jupyter-kernel.create {
definitions = if cfg.kernels != null
then cfg.kernels
else pkgs.jupyter-kernel.default;
});
notebookConfig = pkgs.writeText "jupyter_config.py" ''
${cfg.notebookConfig}
c.NotebookApp.password = ${cfg.password}
'';
in {
meta.maintainers = with maintainers; [ aborsu ];
options.services.jupyter = {
enable = mkEnableOption "Jupyter development server";
ip = mkOption {
type = types.str;
default = "localhost";
description = ''
IP address Jupyter will be listening on.
'';
};
port = mkOption {
type = types.int;
default = 8888;
description = ''
Port number Jupyter will be listening on.
'';
};
notebookDir = mkOption {
type = types.str;
default = "~/";
description = ''
Root directory for notebooks.
'';
};
user = mkOption {
type = types.str;
default = "jupyter";
description = ''
Name of the user used to run the jupyter service.
For security reason, jupyter should really not be run as root.
If not set (jupyter), the service will create a jupyter user with appropriate settings.
'';
example = "aborsu";
};
group = mkOption {
type = types.str;
default = "jupyter";
description = ''
Name of the group used to run the jupyter service.
Use this if you want to create a group of users that are able to view the notebook directory's content.
'';
example = "users";
};
password = mkOption {
type = types.str;
description = ''
Password to use with notebook.
Can be generated using:
In [1]: from notebook.auth import passwd
In [2]: passwd('test')
Out[2]: 'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'
NOTE: you need to keep the single quote inside the nix string.
Or you can use a python oneliner:
"open('/path/secret_file', 'r', encoding='utf8').read().strip()"
It will be interpreted at the end of the notebookConfig.
'';
example = [
"'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'"
"open('/path/secret_file', 'r', encoding='utf8').read().strip()"
];
};
notebookConfig = mkOption {
type = types.lines;
default = "";
description = ''
Raw jupyter config.
'';
};
kernels = mkOption {
type = types.nullOr (types.attrsOf(types.submodule (import ./kernel-options.nix {
inherit lib;
})));
default = null;
example = literalExample ''
{
python3 = let
env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
ipykernel
pandas
scikitlearn
]));
in {
displayName = "Python 3 for machine learning";
argv = [
"$ {env.interpreter}"
"-m"
"ipykernel_launcher"
"-f"
"{connection_file}"
];
language = "python";
logo32 = "$ {env.sitePackages}/ipykernel/resources/logo-32x32.png";
logo64 = "$ {env.sitePackages}/ipykernel/resources/logo-64x64.png";
};
}
'';
description = "Declarative kernel config
Kernels can be declared in any language that supports and has the required
dependencies to communicate with a jupyter server.
In python's case, it means that ipykernel package must always be included in
the list of packages of the targeted environment.
";
};
};
config = mkMerge [
(mkIf cfg.enable {
systemd.services.jupyter = {
description = "Jupyter development server";
wantedBy = [ "multi-user.target" ];
# TODO: Patch notebook so we can explicitly pass in a shell
path = [ pkgs.bash ]; # needed for sh in cell magic to work
environment = {
JUPYTER_PATH = toString kernels;
};
serviceConfig = {
Restart = "always";
ExecStart = ''${package}/bin/jupyter-notebook \
--no-browser \
--ip=${cfg.ip} \
--port=${toString cfg.port} --port-retries 0 \
--notebook-dir=${cfg.notebookDir} \
--NotebookApp.config_file=${notebookConfig}
'';
User = cfg.user;
Group = cfg.group;
WorkingDirectory = "~";
};
};
})
(mkIf (cfg.enable && (cfg.group == "jupyter")) {
users.groups.jupyter = {};
})
(mkIf (cfg.enable && (cfg.user == "jupyter")) {
users.extraUsers.jupyter = {
extraGroups = [ cfg.group ];
home = "/var/lib/jupyter";
createHome = true;
useDefaultShell = true; # needed so that the user can start a terminal.
};
})
];
}

Some files were not shown because too many files have changed in this diff Show More