diff --git a/.mention-bot b/.mention-bot
new file mode 100644
index 00000000000..4c200e30279
--- /dev/null
+++ b/.mention-bot
@@ -0,0 +1,5 @@
+{
+ "userBlacklist": [
+ "civodul"
+ ]
+}
diff --git a/.travis.yml b/.travis.yml
index dbb04e29ee0..402347d5eda 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,7 @@
language: python
python: "3.4"
sudo: required
+dist: trusty
before_install: ./maintainers/scripts/travis-nox-review-pr.sh nix
install: ./maintainers/scripts/travis-nox-review-pr.sh nox
script: ./maintainers/scripts/travis-nox-review-pr.sh build
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b92308622ee..c20d540a25a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,8 @@
# How to contribute
+Note: contributing implies licensing those contributions
+under the terms of [COPYING](./COPYING), which is an MIT-like license.
+
## Opening issues
* Make sure you have a [GitHub account](https://github.com/signup/free)
diff --git a/COPYING b/COPYING
index 919d1e25bbe..0408a7e40b7 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2006 Eelco Dolstra
+Copyright (c) 2003-2016 Eelco Dolstra and the Nixpkgs/NixOS contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/README.md b/README.md
index 987cb2a1f97..9bd2e9b95c9 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
[](https://nixos.org/nixos)
[](https://travis-ci.org/NixOS/nixpkgs)
-[](http://www.issuestats.com/github/nixos/nixpkgs)
-[](http://www.issuestats.com/github/nixos/nixpkgs)
+[](http://www.issuestats.com/github/nixos/nixpkgs)
+[](http://www.issuestats.com/github/nixos/nixpkgs)
Nixpkgs is a collection of packages for the [Nix](https://nixos.org/nix/) package
manager. It is periodically built and tested by the [hydra](http://hydra.nixos.org/)
@@ -31,11 +31,10 @@ For pull-requests, please rebase onto nixpkgs `master`.
* [Documentation (Nix Expression Language chapter)](https://nixos.org/nix/manual/#ch-expression-language)
* [Manual (How to write packages for Nix)](https://nixos.org/nixpkgs/manual/)
* [Manual (NixOS)](https://nixos.org/nixos/manual/)
+* [Nix Wiki](https://nixos.org/wiki/)
* [Continuous package builds for unstable/master](https://hydra.nixos.org/jobset/nixos/trunk-combined)
-* [Continuous package builds for 14.12 release](https://hydra.nixos.org/jobset/nixos/release-14.12)
* [Continuous package builds for 15.09 release](https://hydra.nixos.org/jobset/nixos/release-15.09)
* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
-* [Tests for 14.12 release](https://hydra.nixos.org/job/nixos/release-14.12/tested#tabs-constituents)
* [Tests for 15.09 release](https://hydra.nixos.org/job/nixos/release-15.09/tested#tabs-constituents)
Communication:
diff --git a/default.nix b/default.nix
index e2227b13bbb..12c3cf87618 100644
--- a/default.nix
+++ b/default.nix
@@ -1,4 +1,4 @@
-let requiredVersion = "1.10"; in
+let requiredVersion = import ./lib/minver.nix; in
if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then
diff --git a/doc/configuration.xml b/doc/configuration.xml
new file mode 100644
index 00000000000..ce25bbfce77
--- /dev/null
+++ b/doc/configuration.xml
@@ -0,0 +1,109 @@
+
+
+~/.nixpkgs/config.nix: global configuration
+
+Nix packages can be configured to allow or deny certain options.
+
+To apply the configuration edit
+~/.nixpkgs/config.nix and set it like
+
+
+{
+ allowUnfree = true;
+}
+
+
+and will allow the Nix package manager to install unfree licensed packages.
+
+The configuration as listed also applies to NixOS under
+ set.
+
+
+
+
+ Allow installing of packages that are distributed under
+ unfree license by setting allowUnfree =
+ true; or deny them by setting it to
+ false.
+
+ Same can be achieved by setting the environment variable:
+
+
+$ export NIXPKGS_ALLOW_UNFREE=1
+
+
+
+
+
+
+ Whenever unfree packages are not allowed, single packages
+ can still be allowed by a predicate function that accepts package
+ as an argument and should return a boolean:
+
+
+allowUnfreePredicate = (pkg: ...);
+
+
+ Example to allow flash player only:
+
+
+allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name);
+
+
+
+
+
+
+ Whenever unfree packages are not allowed, packages can still
+ be whitelisted by their license:
+
+
+whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];
+
+
+
+
+
+ In addition to whitelisting licenses which are denied by the
+ allowUnfree setting, you can also explicitely
+ deny installation of packages which have a certain license:
+
+
+blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];
+
+
+
+
+
+
+A complete list of licenses can be found in the file
+lib/licenses.nix of the nix package tree.
+
+
+
+
+Modify
+packages via packageOverrides
+
+You can define a function called
+packageOverrides in your local
+~/.nixpkgs/config to overide nix packages. It
+must be a function that takes pkgs as an argument and return modified
+set of packages.
+
+
+{
+ packageOverrides = pkgs: rec {
+ foo = pkgs.foo.override { ... };
+ };
+}
+
+
+
+
+
+
+
+
diff --git a/doc/default.nix b/doc/default.nix
index b8dac00eb65..7e41380d635 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -1,10 +1,12 @@
with import ./.. { };
with lib;
-
+let
+ sources = sourceFilesBySuffices ./. [".xml"];
+ sources-langs = ./languages-frameworks;
+in
stdenv.mkDerivation {
name = "nixpkgs-manual";
- sources = sourceFilesBySuffices ./. [".xml"];
buildInputs = [ pandoc libxml2 libxslt ];
@@ -18,25 +20,39 @@ stdenv.mkDerivation {
--param callout.graphics.extension '.gif'
'';
- buildCommand = ''
- {
- echo ""
- echo ""
- echo "User's Guide to the Haskell Infrastructure"
- echo ""
- pandoc ${./haskell-users-guide.md} -w docbook | \
- sed -e 's|||' \
- -e 's|||'
- echo ""
- echo ""
- } >haskell-users-guide.xml
- ln -s "$sources/"*.xml .
+ buildCommand = let toDocbook = { useChapters ? false, inputFile, outputFile }:
+ let
+ extraHeader = ''xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" '';
+ in ''
+ {
+ pandoc '${inputFile}' -w docbook ${optionalString useChapters "--chapters"} \
+ | sed -e 's|||' \
+ -e 's|||' \
+ -e '1s| id=| xml:id=|' \
+ -e '1s|\(<[^ ]* \)|\1${extraHeader}|'
+ } > '${outputFile}'
+ '';
+ in
+ ''
+ ln -s '${sources}/'*.xml .
+ mkdir ./languages-frameworks
+ cp -s '${sources-langs}'/* ./languages-frameworks
+ ''
+ + toDocbook {
+ inputFile = ./haskell-users-guide.md;
+ outputFile = "haskell-users-guide.xml";
+ useChapters = true;
+ }
+ + toDocbook {
+ inputFile = ./../pkgs/development/idris-modules/README.md;
+ outputFile = "languages-frameworks/idris.xml";
+ }
+ + ''
+ cat languages-frameworks/idris.xml
echo ${nixpkgsVersion} > .version
xmllint --noout --nonet --xinclude --noxincludenode \
diff --git a/doc/erlang-users-guide.xml b/doc/erlang-users-guide.xml
new file mode 100644
index 00000000000..074ae50b1c0
--- /dev/null
+++ b/doc/erlang-users-guide.xml
@@ -0,0 +1,305 @@
+
+
+User's Guide to the Erlang Infrastructure
+
+ Build Tools
+
+ By default Rebar3 wants to manage it's own dependencies. In the
+ normal non-Nix, this is perfectly acceptable. In the Nix world it
+ is not. To support this we have created two versions of rebar3,
+ rebar3 and rebar3-open. The
+ rebar3 version has been patched to remove the
+ ability to download anything from it. If you are not running it a
+ nix-shell or a nix-build then its probably not going to work for
+ you. rebar3-open is the normal, un-modified
+ rebar3. It should work exactly as would any other version of
+ rebar3. Any Erlang package should rely on
+ rebar3 and thats really what you should be
+ using too.
+
+
+
+
+ How to install Erlang packages
+
+ Erlang packages are not registered in the top level simply because
+ they are not relevant to the vast majority of Nix users. They are
+ installable using the erlangPackages attribute set.
+
+ You can list the avialable packages in the
+ erlangPackages with the following command:
+
+
+
+$ nix-env -f "<nixpkgs>" -qaP -A erlangPackages
+erlangPackages.esqlite esqlite-0.2.1
+erlangPackages.goldrush goldrush-0.1.7
+erlangPackages.ibrowse ibrowse-4.2.2
+erlangPackages.jiffy jiffy-0.14.5
+erlangPackages.lager lager-3.0.2
+erlangPackages.meck meck-0.8.3
+erlangPackages.rebar3-pc pc-1.1.0
+
+
+ To install any of those packages into your profile, refer to them by
+ their attribute path (first column):
+
+
+$ nix-env -f "<nixpkgs>" -iA erlangPackages.ibrowse
+
+
+ The attribute path of any Erlang packages corresponds to the name
+ of that particular package in Hex or its OTP Application/Release name.
+
+
+
+ Packaging Erlang Applications
+
+ Rebar3 Packages
+
+ There is a Nix functional called
+ buildRebar3. We use this function to make a
+ derivation that understands how to build the rebar3 project. For
+ example, the epression we use to build the hex2nix
+ project follows.
+
+
+{stdenv, fetchFromGitHub, buildRebar3, ibrowse, jsx, erlware_commons }:
+
+buildRebar3 rec {
+ name = "hex2nix";
+ version = "0.0.1";
+
+ src = fetchFromGitHub {
+ owner = "ericbmerritt";
+ repo = "hex2nix";
+ rev = "${version}";
+ sha256 = "1w7xjidz1l5yjmhlplfx7kphmnpvqm67w99hd2m7kdixwdxq0zqg";
+ };
+
+ erlangDeps = [ ibrowse jsx erlware_commons ];
+}
+
+
+ The only visible difference between this derivation and
+ something like stdenv.mkDerivation is that we
+ have added erlangDeps to the derivation. If
+ you add your Erlang dependencies here they will be correctly
+ handled by the system.
+
+
+ If your package needs to compile native code via Rebar's port
+ compilation mechenism. You should add compilePort =
+ true; to the derivation.
+
+
+
+
+ Hex Packages
+
+ Hex packages are based on Rebar packages. In fact, at the moment
+ we can only compile Hex packages that are buildable with
+ Rebar3. Packages that use Mix and other build systems are not
+ supported. That being said, we know a lot more about Hex and can
+ do more for you.
+
+
+{ buildHex }:
+ buildHex {
+ name = "esqlite";
+ version = "0.2.1";
+ sha256 = "1296fn1lz4lz4zqzn4dwc3flgkh0i6n4sydg501faabfbv8d3wkr";
+ compilePort = true;
+}
+
+
+ For Hex packages you need to provide the name, the version, and
+ the Sha 256 digest of the package and use
+ buildHex to build it. Obviously, the package
+ needs to have already been published to Hex.
+
+
+
+
+ How to develop
+
+ Accessing an Environment
+
+ Often, all you want to do is be able to access a valid
+ environment that contains a specific package and its
+ dependencies. we can do that with the env
+ part of a derivation. For example, lets say we want to access an
+ erlang repl with ibrowse loaded up. We could do the following.
+
+
+ ~/w/nixpkgs ❯❯❯ nix-shell -A erlangPackages.ibrowse.env --run "erl"
+ Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
+
+ Eshell V7.0 (abort with ^G)
+ 1> m(ibrowse).
+ Module: ibrowse
+ MD5: 3b3e0137d0cbb28070146978a3392945
+ Compiled: January 10 2016, 23:34
+ Object file: /nix/store/g1rlf65rdgjs4abbyj4grp37ry7ywivj-ibrowse-4.2.2/lib/erlang/lib/ibrowse-4.2.2/ebin/ibrowse.beam
+ Compiler options: [{outdir,"/tmp/nix-build-ibrowse-4.2.2.drv-0/hex-source-ibrowse-4.2.2/_build/default/lib/ibrowse/ebin"},
+ debug_info,debug_info,nowarn_shadow_vars,
+ warn_unused_import,warn_unused_vars,warnings_as_errors,
+ {i,"/tmp/nix-build-ibrowse-4.2.2.drv-0/hex-source-ibrowse-4.2.2/_build/default/lib/ibrowse/include"}]
+ Exports:
+ add_config/1 send_req_direct/7
+ all_trace_off/0 set_dest/3
+ code_change/3 set_max_attempts/3
+ get_config_value/1 set_max_pipeline_size/3
+ get_config_value/2 set_max_sessions/3
+ get_metrics/0 show_dest_status/0
+ get_metrics/2 show_dest_status/1
+ handle_call/3 show_dest_status/2
+ handle_cast/2 spawn_link_worker_process/1
+ handle_info/2 spawn_link_worker_process/2
+ init/1 spawn_worker_process/1
+ module_info/0 spawn_worker_process/2
+ module_info/1 start/0
+ rescan_config/0 start_link/0
+ rescan_config/1 stop/0
+ send_req/3 stop_worker_process/1
+ send_req/4 stream_close/1
+ send_req/5 stream_next/1
+ send_req/6 terminate/2
+ send_req_direct/4 trace_off/0
+ send_req_direct/5 trace_off/2
+ send_req_direct/6 trace_on/0
+ trace_on/2
+ ok
+ 2>
+
+
+ Notice the -A erlangPackages.ibrowse.env.That
+ is the key to this functionality.
+
+
+
+ Creating a Shell
+
+ Getting access to an environment often isn't enough to do real
+ development. Many times we need to create a
+ shell.nix file and do our development inside
+ of the environment specified by that file. This file looks a lot
+ like the packageing described above. The main difference is that
+ src points to project root and we call the
+ package directly.
+
+
+{ pkgs ? import "<nixpkgs"> {} }:
+
+with pkgs;
+
+let
+
+ f = { buildHex, ibrowse, jsx, erlware_commons }:
+ buildHex {
+ name = "hex2nix";
+ version = "0.1.0";
+ src = ./.;
+ erlangDeps = [ ibrowse jsx erlware_commons ];
+ };
+ drv = erlangPackages.callPackage f {};
+
+in
+ drv
+
+
+ Building in a shell
+
+ Unfortunatly for us users of Nix, Rebar isn't very cooperative
+ with us from the standpoint of building a hermetic
+ environment. When building the rebar3 support we had to do some
+ sneaky things to get it not to go out and pull packages on its
+ own. Also unfortunately, you have to do some of the same things
+ when building a project inside of a Nix shell.
+
+
+
+ Run rebar3-nix-bootstrap every time
+ dependencies change
+
+
+ Set Home to the current directory.
+
+
+
+ If you do these two things then Rebar will be happy with you. I
+ codify these into a makefile. Forunately, rebar3-nix-bootstrap
+ is idempotent and fairly quick. so you can run it as often as
+ you like.
+
+
+# =============================================================================
+# Rules
+# =============================================================================
+.PHONY= all test clean repl shell build test analyze bootstrap
+
+all: test
+
+clean:
+ rm -rf _build
+ rm -rf .cache
+
+repl:
+ nix-shell --run "erl"
+
+shell:
+ nix-shell --run "bash"
+
+bootstrap:
+ nix-shell --pure --run "rebar3-nix-bootstrap"
+
+build: bootstrap
+ nix-shell --pure --run "HOME=$(CURDIR) rebar3 compile"
+
+analyze: bootstrap
+ nix-shell --pure --run "HOME=$(CURDIR) rebar3 do compile,dialyzer"
+
+test: bootstrap
+ nix-shell --pure --run "HOME=$(CURDIR) rebar3 do compile,dialyzer,eunit"
+
+
+
+ If you add the shell.nix as described and
+ user rebar as follows things should simply work.
+
+
+
+
+
+ Generating Packages from Hex with Hex2Nix
+
+ Updating the Hex packages requires the use of the
+ hex2nix tool. Given the path to the Erlang
+ modules (usually
+ pkgs/development/erlang-modules). It will
+ happily dump a file called
+ hex-packages.nix. That file will contain all
+ the packages that use a recognized build system in Hex. However,
+ it can't know whether or not all those packages are buildable.
+
+
+ To make life easier for our users, it makes good sense to go
+ ahead and attempt to build all those packages and remove the
+ ones that don't build. To do that, simply run the command (in
+ the root of your nixpkgs repository). that follows.
+
+
+$ nix-build -A erlangPackages
+
+
+ That will build every package in
+ erlangPackages. Then you can go through and
+ manually remove the ones that fail. Hopefully, someone will
+ improve hex2nix in the future to automate
+ that.
+
+
+
diff --git a/doc/functions.xml b/doc/functions.xml
index 39010f8ab14..7d250824f78 100644
--- a/doc/functions.xml
+++ b/doc/functions.xml
@@ -88,6 +88,13 @@ in ...
<pkg>.overrideDerivation
+
+ Do not use this function in Nixpkgs. Because it breaks
+ package abstraction and doesn’t provide error checking for
+ function arguments, it is only intended for ad-hoc customisation
+ (such as in ~/.nixpkgs/config.nix).
+
+
The function overrideDerivation is usually available for all the
derivations in the nixpkgs expression (pkgs).
@@ -270,7 +277,7 @@ c = lib.makeOverridable f { a = 1; b = 2; }
multiPkgs = pkgs: (with pkgs;
[ udev
alsaLib
- ]) ++ (with [];
+ ]);
runScript = "bash";
}).env
]]>
@@ -284,4 +291,339 @@ c = lib.makeOverridable f { a = 1; b = 2; }
+
+ pkgs.dockerTools
+
+
+ pkgs.dockerTools is a set of functions for creating and
+ manipulating Docker images according to the
+
+ Docker Image Specification v1.0.0
+ . Docker itself is not used to perform any of the operations done by these
+ functions.
+
+
+
+
+ The dockerTools API is unstable and may be subject to
+ backwards-incompatible changes in the future.
+
+
+
+
+ buildImage
+
+
+ This function is analogous to the docker build command,
+ in that can used to build a Docker-compatible repository tarball containing
+ a single image with one or multiple layers. As such, the result
+ is suitable for being loaded in Docker with docker load.
+
+
+
+ The parameters of buildImage with relative example values are
+ described below:
+
+
+ Docker build
+
+ buildImage {
+ name = "redis";
+ tag = "latest";
+
+ fromImage = someBaseImage;
+ fromImageName = null;
+ fromImageTag = "latest";
+
+ contents = pkgs.redis;
+ runAsRoot = ''
+ #!${stdenv.shell}
+ mkdir -p /data
+ '';
+
+ config = {
+ Cmd = [ "/bin/redis-server" ];
+ WorkingDir = "/data";
+ Volumes = {
+ "/data" = {};
+ };
+ };
+ }
+
+
+
+ The above example will build a Docker image redis/latest
+ from the given base image. Loading and running this image in Docker results in
+ redis-server being started automatically.
+
+
+
+
+
+ name specifies the name of the resulting image.
+ This is the only required argument for buildImage.
+
+
+
+
+
+ tag specifies the tag of the resulting image.
+ By default it's latest.
+
+
+
+
+
+ fromImage is the repository tarball containing the base image.
+ It must be a valid Docker image, such as exported by docker save.
+ By default it's null, which can be seen as equivalent
+ to FROM scratch of a Dockerfile.
+
+
+
+
+
+ fromImageName can be used to further specify
+ the base image within the repository, in case it contains multiple images.
+ By default it's null, in which case
+ buildImage will peek the first image available
+ in the repository.
+
+
+
+
+
+ fromImageTag can be used to further specify the tag
+ of the base image within the repository, in case an image contains multiple tags.
+ By default it's null, in which case
+ buildImage will peek the first tag available for the base image.
+
+
+
+
+
+ contents is a derivation that will be copied in the new
+ layer of the resulting image. This can be similarly seen as
+ ADD contents/ / in a Dockerfile.
+ By default it's null.
+
+
+
+
+
+ runAsRoot is a bash script that will run as root
+ in an environment that overlays the existing layers of the base image with
+ the new resulting layer, including the previously copied
+ contents derivation.
+ This can be similarly seen as
+ RUN ... in a Dockerfile.
+
+
+
+ Using this parameter requires the kvm
+ device to be available.
+
+
+
+
+
+
+
+ config is used to specify the configuration of the
+ containers that will be started off the built image in Docker.
+ The available options are listed in the
+
+ Docker Image Specification v1.0.0
+ .
+
+
+
+
+
+
+ After the new layer has been created, its closure
+ (to which contents, config and
+ runAsRoot contribute) will be copied in the layer itself.
+ Only new dependencies that are not already in the existing layers will be copied.
+
+
+
+ At the end of the process, only one new single layer will be produced and
+ added to the resulting image.
+
+
+
+ The resulting repository will only list the single image
+ image/tag. In the case of
+ it would be redis/latest.
+
+
+
+ It is possible to inspect the arguments with which an image was built
+ using its buildArgs attribute.
+
+
+
+
+
+ pullImage
+
+
+ This function is analogous to the docker pull command,
+ in that can be used to fetch a Docker image from a Docker registry.
+ Currently only registry v1 is supported.
+ By default Docker Hub
+ is used to pull images.
+
+
+
+ Its parameters are described in the example below:
+
+
+ Docker pull
+
+ pullImage {
+ imageName = "debian";
+ imageTag = "jessie";
+ imageId = null;
+ sha256 = "1bhw5hkz6chrnrih0ymjbmn69hyfriza2lr550xyvpdrnbzr4gk2";
+
+ indexUrl = "https://index.docker.io";
+ registryVersion = "v1";
+ }
+
+
+
+
+
+
+ imageName specifies the name of the image to be downloaded,
+ which can also include the registry namespace (e.g. library/debian).
+ This argument is required.
+
+
+
+
+
+ imageTag specifies the tag of the image to be downloaded.
+ By default it's latest.
+
+
+
+
+
+ imageId, if specified this exact image will be fetched, instead
+ of imageName/imageTag. However, the resulting repository
+ will still be named imageName/imageTag.
+ By default it's null.
+
+
+
+
+
+ sha256 is the checksum of the whole fetched image.
+ This argument is required.
+
+
+
+ The checksum is computed on the unpacked directory, not on the final tarball.
+
+
+
+
+
+
+ In the above example the default values are shown for the variables
+ indexUrl and registryVersion.
+ Hence by default the Docker.io registry is used to pull the images.
+
+
+
+
+
+
+
+ exportImage
+
+
+ This function is analogous to the docker export command,
+ in that can used to flatten a Docker image that contains multiple layers.
+ It is in fact the result of the merge of all the layers of the image.
+ As such, the result is suitable for being imported in Docker
+ with docker import.
+
+
+
+
+ Using this function requires the kvm
+ device to be available.
+
+
+
+
+ The parameters of exportImage are the following:
+
+
+ Docker export
+
+ exportImage {
+ fromImage = someLayeredImage;
+ fromImageName = null;
+ fromImageTag = null;
+
+ name = someLayeredImage.name;
+ }
+
+
+
+
+ The parameters relative to the base image have the same synopsis as
+ described in , except that
+ fromImage is the only required argument in this case.
+
+
+
+ The name argument is the name of the derivation output,
+ which defaults to fromImage.name.
+
+
+
+
+ shadowSetup
+
+
+ This constant string is a helper for setting up the base files for managing
+ users and groups, only if such files don't exist already.
+ It is suitable for being used in a
+ runAsRoot script for cases like
+ in the example below:
+
+
+ Shadow base files
+
+ buildImage {
+ name = "shadow-basic";
+
+ runAsRoot = ''
+ #!${stdenv.shell}
+ ${shadowSetup}
+ groupadd -r redis
+ useradd -r -g redis redis
+ mkdir /data
+ chown redis:redis /data
+ '';
+ }
+
+
+
+
+ Creating base files like /etc/passwd or
+ /etc/login.defs are necessary for shadow-utils to
+ manipulate users and groups.
+
+
+
+
+
+
diff --git a/doc/haskell-users-guide.md b/doc/haskell-users-guide.md
index 446f08eb697..b11e4cf09f8 100644
--- a/doc/haskell-users-guide.md
+++ b/doc/haskell-users-guide.md
@@ -3,8 +3,10 @@ title: User's Guide for Haskell in Nixpkgs
author: Peter Simons
date: 2015-06-01
---
+# User's Guide to the Haskell Infrastructure
-# How to install Haskell packages
+
+## How to install Haskell packages
Nixpkgs distributes build instructions for all Haskell packages registered on
[Hackage](http://hackage.haskell.org/), but strangely enough normal Nix package
@@ -111,9 +113,9 @@ version of GHC listed above, there exists a package set based on that compiler.
Also, the attributes `haskell.compiler.ghcXYC` and
`haskell.packages.ghcXYC.ghc` are synonymous for the sake of convenience.
-# How to create a development environment
+## How to create a development environment
-## How to install a compiler
+### How to install a compiler
A simple development environment consists of a Haskell compiler and the tool
`cabal-install`, and we saw in section [How to install Haskell packages] how
@@ -162,7 +164,7 @@ anymore once `nix-shell` has terminated. If you find that your Haskell builds
no longer work after garbage collection, then you'll have to re-run `cabal
configure` inside of a new `nix-shell` environment.
-## How to install a compiler with libraries
+### How to install a compiler with libraries
GHC expects to find all installed libraries inside of its own `lib` directory.
This approach works fine on traditional Unix systems, but it doesn't work for
@@ -257,7 +259,7 @@ environment in your profile:
export NIX_GHC_LIBDIR="$HOME/.nix-profile/lib/ghc-$($NIX_GHC --numeric-version)"
fi
-## How to install a compiler with libraries, hoogle and documentation indexes
+### How to install a compiler with libraries, hoogle and documentation indexes
If you plan to use your environment for interactive programming, not just
compiling random Haskell code, you might want to replace `ghcWithPackages` in
@@ -319,7 +321,7 @@ page](http://kb.mozillazine.org/Links_to_local_pages_do_not_work) for
workarounds.
-## How to create ad hoc environments for `nix-shell`
+### How to create ad hoc environments for `nix-shell`
The easiest way to create an ad hoc development environment is to run
`nix-shell` with the appropriate GHC environment given on the command-line:
@@ -369,14 +371,14 @@ development commands. Note that you need `cabal-install` installed in your
`$PATH` already to use it here --- the `nix-shell` environment does not provide
it.
-# How to create Nix builds for your own private Haskell packages
+## How to create Nix builds for your own private Haskell packages
If your own Haskell packages have build instructions for Cabal, then you can
convert those automatically into build instructions for Nix using the
`cabal2nix` utility, which you can install into your profile by running
`nix-env -i cabal2nix`.
-## How to build a stand-alone project
+### How to build a stand-alone project
For example, let's assume that you're working on a private project called
`foo`. To generate a Nix build expression for it, change into the project's
@@ -433,7 +435,7 @@ You can even use that generated file to run `nix-build`, too:
$ nix-build shell.nix
-## How to build projects that depend on each other
+### How to build projects that depend on each other
If you have multiple private Haskell packages that depend on each other, then
you'll have to register those packages in the Nixpkgs set to make them visible
@@ -468,9 +470,9 @@ or enter an interactive shell environment suitable for building them:
$ nix-shell "" -A haskellPackages.bar.env
-# Miscellaneous Topics
+## Miscellaneous Topics
-## How to build with profiling enabled
+### How to build with profiling enabled
Every Haskell package set takes a function called `overrides` that you can use
to manipulate the package as much as you please. One useful application of this
@@ -494,7 +496,7 @@ following snippet in your `~/.nixpkgs/config.nix` file:
Then, replace instances of `haskellPackages` in the `cabal2nix`-generated
`default.nix` or `shell.nix` files with `profiledHaskellPackages`.
-## How to override package versions in a compiler-specific package set
+### How to override package versions in a compiler-specific package set
Nixpkgs provides the latest version of
[`ghc-events`](http://hackage.haskell.org/package/ghc-events), which is 0.4.4.0
@@ -560,7 +562,7 @@ prefer one built with GHC 7.8.x in the first place. However, for users who
cannot use GHC 7.10.x at all for some reason, the approach of downgrading to an
older version might be useful.
-## How to recover from GHC's infamous non-deterministic library ID bug
+### How to recover from GHC's infamous non-deterministic library ID bug
GHC and distributed build farms don't get along well:
@@ -586,7 +588,7 @@ command, i.e. by running:
rm /nix/var/nix/manifests/*
rm /nix/var/nix/channel-cache/*
-## Builds on Darwin fail with `math.h` not found
+### Builds on Darwin fail with `math.h` not found
Users of GHC on Darwin have occasionally reported that builds fail, because the
compiler complains about a missing include file:
@@ -603,7 +605,7 @@ can configure the environment variables
in their `~/.bashrc` file to avoid the compiler error.
-## Using Stack together with Nix
+### Using Stack together with Nix
-- While building package zlib-0.5.4.2 using:
runhaskell -package=Cabal-1.22.4.0 -clear-package-db [... lots of flags ...]
@@ -666,7 +668,7 @@ to find out the store path of the system's zlib library. Now, you can
The same thing applies to `cabal configure`, of course, if you're
building with `cabal-install` instead of Stack.
-## Creating statically linked binaries
+### Creating statically linked binaries
There are two levels of static linking. The first option is to configure the
build with the Cabal flag `--disable-executable-dynamic`. In Nix expressions,
@@ -688,7 +690,7 @@ as shared libraries only, i.e. there is just no static library available that
Cabal could link!
-# Other resources
+## Other resources
- The Youtube video [Nix Loves Haskell](https://www.youtube.com/watch?v=BsBhi_r-OeE)
provides an introduction into Haskell NG aimed at beginners. The slides are
diff --git a/doc/language-support.xml b/doc/language-support.xml
deleted file mode 100644
index 48b9209b0ad..00000000000
--- a/doc/language-support.xml
+++ /dev/null
@@ -1,1066 +0,0 @@
-
-
-
-Support for specific programming languages
-
-The standard build
-environment makes it easy to build typical Autotools-based
-packages with very little code. Any other kind of package can be
-accomodated by overriding the appropriate phases of
-stdenv. However, there are specialised functions
-in Nixpkgs to easily build packages for other programming languages,
-such as Perl or Haskell. These are described in this chapter.
-
-
-Perl
-
-Nixpkgs provides a function buildPerlPackage,
-a generic package builder function for any Perl package that has a
-standard Makefile.PL. It’s implemented in pkgs/development/perl-modules/generic.
-
-Perl packages from CPAN are defined in pkgs/top-level/perl-packages.nix,
-rather than pkgs/all-packages.nix. Most Perl
-packages are so straight-forward to build that they are defined here
-directly, rather than having a separate function for each package
-called from perl-packages.nix. However, more
-complicated packages should be put in a separate file, typically in
-pkgs/development/perl-modules. Here is an
-example of the former:
-
-
-ClassC3 = buildPerlPackage rec {
- name = "Class-C3-0.21";
- src = fetchurl {
- url = "mirror://cpan/authors/id/F/FL/FLORA/${name}.tar.gz";
- sha256 = "1bl8z095y4js66pwxnm7s853pi9czala4sqc743fdlnk27kq94gz";
- };
-};
-
-
-Note the use of mirror://cpan/, and the
-${name} in the URL definition to ensure that the
-name attribute is consistent with the source that we’re actually
-downloading. Perl packages are made available in
-all-packages.nix through the variable
-perlPackages. For instance, if you have a package
-that needs ClassC3, you would typically write
-
-
-foo = import ../path/to/foo.nix {
- inherit stdenv fetchurl ...;
- inherit (perlPackages) ClassC3;
-};
-
-
-in all-packages.nix. You can test building a
-Perl package as follows:
-
-
-$ nix-build -A perlPackages.ClassC3
-
-
-buildPerlPackage adds perl- to
-the start of the name attribute, so the package above is actually
-called perl-Class-C3-0.21. So to install it, you
-can say:
-
-
-$ nix-env -i perl-Class-C3
-
-
-(Of course you can also install using the attribute name:
-nix-env -i -A perlPackages.ClassC3.)
-
-So what does buildPerlPackage do? It does
-the following:
-
-
-
- In the configure phase, it calls perl
- Makefile.PL to generate a Makefile. You can set the
- variable makeMakerFlags to pass flags to
- Makefile.PL
-
- It adds the contents of the PERL5LIB
- environment variable to #! .../bin/perl line of
- Perl scripts as -Idir
- flags. This ensures that a script can find its
- dependencies.
-
- In the fixup phase, it writes the propagated build
- inputs (propagatedBuildInputs) to the file
- $out/nix-support/propagated-user-env-packages.
- nix-env recursively installs all packages listed
- in this file when you install a package that has it. This ensures
- that a Perl package can find its dependencies.
-
-
-
-
-
-buildPerlPackage is built on top of
-stdenv, so everything can be customised in the
-usual way. For instance, the BerkeleyDB module has
-a preConfigure hook to generate a configuration
-file used by Makefile.PL:
-
-
-{ buildPerlPackage, fetchurl, db }:
-
-buildPerlPackage rec {
- name = "BerkeleyDB-0.36";
-
- src = fetchurl {
- url = "mirror://cpan/authors/id/P/PM/PMQS/${name}.tar.gz";
- sha256 = "07xf50riarb60l1h6m2dqmql8q5dij619712fsgw7ach04d8g3z1";
- };
-
- preConfigure = ''
- echo "LIB = ${db}/lib" > config.in
- echo "INCLUDE = ${db}/include" >> config.in
- '';
-}
-
-
-
-
-Dependencies on other Perl packages can be specified in the
-buildInputs and
-propagatedBuildInputs attributes. If something is
-exclusively a build-time dependency, use
-buildInputs; if it’s (also) a runtime dependency,
-use propagatedBuildInputs. For instance, this
-builds a Perl module that has runtime dependencies on a bunch of other
-modules:
-
-
-ClassC3Componentised = buildPerlPackage rec {
- name = "Class-C3-Componentised-1.0004";
- src = fetchurl {
- url = "mirror://cpan/authors/id/A/AS/ASH/${name}.tar.gz";
- sha256 = "0xql73jkcdbq4q9m0b0rnca6nrlvf5hyzy8is0crdk65bynvs8q1";
- };
- propagatedBuildInputs = [
- ClassC3 ClassInspector TestException MROCompat
- ];
-};
-
-
-
-
-Generation from CPAN
-
-Nix expressions for Perl packages can be generated (almost)
-automatically from CPAN. This is done by the program
-nix-generate-from-cpan, which can be installed
-as follows:
-
-
-$ nix-env -i nix-generate-from-cpan
-
-
-This program takes a Perl module name, looks it up on CPAN,
-fetches and unpacks the corresponding package, and prints a Nix
-expression on standard output. For example:
-
-
-$ nix-generate-from-cpan XML::Simple
- XMLSimple = buildPerlPackage {
- name = "XML-Simple-2.20";
- src = fetchurl {
- url = mirror://cpan/authors/id/G/GR/GRANTM/XML-Simple-2.20.tar.gz;
- sha256 = "5cff13d0802792da1eb45895ce1be461903d98ec97c9c953bc8406af7294434a";
- };
- propagatedBuildInputs = [ XMLNamespaceSupport XMLSAX XMLSAXExpat ];
- meta = {
- description = "Easily read/write XML (esp config files)";
- license = "perl";
- };
- };
-
-
-The output can be pasted into
-pkgs/top-level/perl-packages.nix or wherever else
-you need it.
-
-
-
-
-
-
-Python
-
-
- Currently supported interpreters are python26, python27,
- python32, python33, python34
- and pypy.
-
-
-
- python is an alias of python27 and python3 is an alias of python34.
-
-
-
- python26 and python27 do not include modules that require
- external dependencies (to reduce dependency bloat). Following modules need to be added as
- buildInput explicitly:
-
-
-
- python.modules.bsddb
- python.modules.curses
- python.modules.curses_panel
- python.modules.crypt
- python.modules.gdbm
- python.modules.sqlite3
- python.modules.tkinter
- python.modules.readline
-
-
-For convenience python27Full and python26Full
-are provided with all modules included.
-
-
- Python packages that
- use setuptools or distutils,
- can be built using the buildPythonPackage function as documented below.
-
-
-
- All packages depending on any Python interpreter get appended $out/${python.libPrefix}/site-packages
- to $PYTHONPATH if such directory exists.
-
-
-
-
- Useful attributes on interpreters packages:
-
-
-
- libPrefix
-
- Name of the folder in ${python}/lib/ for corresponding interpreter.
-
-
-
-
- interpreter
-
- Alias for ${python}/bin/${executable}.
-
-
-
-
- buildEnv
-
- Function to build python interpreter environments with extra packages bundled together.
- See for usage and documentation.
-
-
-
-
- sitePackages
-
- Alias for lib/${libPrefix}/site-packages.
-
-
-
-
- executable
-
- Name of the interpreter executable, ie python3.4.
-
-
-
-
-buildPythonPackage function
-
-
- The function is implemented in
- pkgs/development/python-modules/generic/default.nix.
- Example usage:
-
-
-twisted = buildPythonPackage {
- name = "twisted-8.1.0";
-
- src = pkgs.fetchurl {
- url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2;
- sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl";
- };
-
- propagatedBuildInputs = [ self.ZopeInterface ];
-
- meta = {
- homepage = http://twistedmatrix.com/;
- description = "Twisted, an event-driven networking engine written in Python";
- license = stdenv.lib.licenses.mit;
- };
-};
-
-
- Most of Python packages that use buildPythonPackage are defined
- in pkgs/top-level/python-packages.nix
- and generated for each python interpreter separately into attribute sets python26Packages,
- python27Packages, python32Packages, python33Packages,
- python34Packages and pypyPackages.
-
-
-
- buildPythonPackage mainly does four things:
-
-
-
- In the configurePhase, it patches
- setup.py to always include setuptools before
- distutils for monkeypatching machinery to take place.
-
-
-
- In the buildPhase, it calls
- ${python.interpreter} setup.py build ...
-
-
-
- In the installPhase, it calls
- ${python.interpreter} setup.py install ...
-
-
-
- In the postFixup phase, wrapPythonPrograms
- bash function is called to wrap all programs in $out/bin/*
- directory to include $PYTHONPATH and $PATH
- environment variables.
-
-
-
-
- By default doCheck = true is set and tests are run with
- ${python.interpreter} setup.py test command in checkPhase.
-
-
- As in Perl, dependencies on other Python packages can be specified in the
- buildInputs and
- propagatedBuildInputs attributes. If something is
- exclusively a build-time dependency, use
- buildInputs; if it’s (also) a runtime dependency,
- use propagatedBuildInputs.
-
-
-
- By default meta.platforms is set to the same value
- as the interpreter unless overriden otherwise.
-
-
-
-
- buildPythonPackage parameters
- (all parameters from mkDerivation function are still supported)
-
-
-
- namePrefix
-
- Prepended text to ${name} parameter.
- Defaults to "python3.3-" for Python 3.3, etc. Set it to
- ""
- if you're packaging an application or a command line tool.
-
-
-
-
- disabled
-
- If true, package is not build for
- particular python interpreter version. Grep around
- pkgs/top-level/python-packages.nix
- for examples.
-
-
-
-
- setupPyInstallFlags
-
- List of flags passed to setup.py install command.
-
-
-
-
- setupPyBuildFlags
-
- List of flags passed to setup.py build command.
-
-
-
-
- pythonPath
-
- List of packages to be added into $PYTHONPATH.
- Packages in pythonPath are not propagated into user environment
- (contrary to propagatedBuildInputs).
-
-
-
-
- preShellHook
-
- Hook to execute commands before shellHook.
-
-
-
-
- postShellHook
-
- Hook to execute commands after shellHook.
-
-
-
-
- distutilsExtraCfg
-
- Extra lines passed to [easy_install] section of
- distutils.cfg (acts as global setup.cfg
- configuration).
-
-
-
-
- makeWrapperArgs
-
- A list of strings. Arguments to be passed to
- makeWrapper, which wraps generated binaries. By
- default, the arguments to makeWrapper set
- PATH and PYTHONPATH environment
- variables before calling the binary. Additional arguments here can
- allow a developer to set environment variables which will be
- available when the binary is run. For example,
- makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"].
-
-
-
-
-
-
-
-python.buildEnv function
-
- Create Python environments using low-level pkgs.buildEnv function. Example default.nix:
-
-
- {};
-
-python.buildEnv.override {
- extraLibs = [ pkgs.pythonPackages.pyramid ];
- ignoreCollisions = true;
-}]]>
-
-
- Running nix-build will create
- /nix/store/cf1xhjwzmdki7fasgr4kz6di72ykicl5-python-2.7.8-env
- with wrapped binaries in bin/.
-
-
-
- You can also use env attribute to create local
- environments with needed packages installed (somewhat comparable to
- virtualenv). For example, with the following
- shell.nix:
-
-
- {};
-
-(python3.buildEnv.override {
- extraLibs = with python3Packages;
- [ numpy
- requests
- ];
-}).env]]>
-
-
- Running nix-shell will drop you into a shell where
- python will have specified packages in its path.
-
-
-
-
- python.buildEnv arguments
-
-
-
- extraLibs
-
- List of packages installed inside the environment.
-
-
-
-
- postBuild
-
- Shell command executed after the build of environment.
-
-
-
-
- ignoreCollisions
-
- Ignore file collisions inside the environment (default is false).
-
-
-
-
-
-Tools
-
-Packages inside nixpkgs are written by hand. However many tools
-exist in community to help save time. No tool is preferred at the moment.
-
-
-
-
-
- python2nix
- by Vladimir Kirillov
-
-
-
- pypi2nix
- by Rok Garbas
-
-
-
- pypi2nix
- by Jaka Hudoklin
-
-
-
-
-
-
-Development
-
-
- To develop Python packages buildPythonPackage has
- additional logic inside shellPhase to run
- ${python.interpreter} setup.py develop for the package.
-
-
- shellPhase is executed only if setup.py
- exists.
-
-
- Given a default.nix:
-
-
- {};
-
-buildPythonPackage {
- name = "myproject";
-
- buildInputs = with pkgs.pythonPackages; [ pyramid ];
-
- src = ./.;
-}]]>
-
-
- Running nix-shell with no arguments should give you
- the environment in which the package would be build with
- nix-build.
-
-
-
- Shortcut to setup environments with C headers/libraries and python packages:
-
- $ nix-shell -p pythonPackages.pyramid zlib libjpeg git
-
-
-
- There is a boolean value lib.inNixShell set to
- true if nix-shell is invoked.
-
-
-
-
-FAQ
-
-
-
-
- How to solve circular dependencies?
-
- If you have packages A and B that
- depend on each other, when packaging B override package
- A not to depend on B as input
- (and also the other way around).
-
-
-
-
- install_data / data_files problems resulting into error: could not create '/nix/store/6l1bvljpy8gazlsw2aw9skwwp4pmvyxw-python-2.7.8/etc': Permission denied
-
-
- Known bug in setuptools install_data does not respect --prefix. Example of
- such package using the feature is pkgs/tools/X11/xpra/default.nix. As workaround
- install it as an extra preInstall step:
-
- ${python.interpreter} setup.py install_data --install-dir=$out --root=$out
-sed -i '/ = data_files/d' setup.py
-
-
-
-
- Rationale of non-existent global site-packages
-
- There is no need to have global site-packages in Nix. Each package has isolated
- dependency tree and installing any python package will only populate $PATH
- inside user environment. See to create self-contained
- interpreter with a set of packages.
-
-
-
-
-
-
-
-
-Contributing guidelines
-
- Following rules are desired to be respected:
-
-
-
-
-
- Make sure package builds for all python interpreters. Use disabled argument to
- buildPythonPackage to set unsupported interpreters.
-
-
-
- If tests need to be disabled for a package, make sure you leave a comment about reasoning.
-
-
-
- Packages in pkgs/top-level/python-packages.nix
- are sorted quasi-alphabetically to avoid merge conflicts.
-
-
-
-
-
-
-
-
-
-Ruby
- There currently is support to bundle applications that are packaged as Ruby gems. The utility "bundix" allows you to write a Gemfile, let bundler create a Gemfile.lock, and then convert
- this into a nix expression that contains all Gem dependencies automatically.
-
- For example, to package sensu, we did:
-
-
- Gemfile
-source 'https://rubygems.org'
-gem 'sensu'
-$ bundler package --path /tmp/vendor/bundle
-$ $(nix-build '' -A bundix)/bin/bundix
-$ cat > default.nix
-{ lib, bundlerEnv, ruby }:
-
-bundlerEnv {
- name = "sensu-0.17.1";
-
- inherit ruby;
- gemfile = ./Gemfile;
- lockfile = ./Gemfile.lock;
- gemset = ./gemset.nix;
-
- meta = with lib; {
- description = "A monitoring framework that aims to be simple, malleable,
-and scalable.";
- homepage = http://sensuapp.org/;
- license = with licenses; mit;
- maintainers = with maintainers; [ theuni ];
- platforms = platforms.unix;
- };
-}]]>
-
-
-Please check in the Gemfile, Gemfile.lock and the gemset.nix so future updates can be run easily.
-
-
-
-
-Go
-
-The function buildGoPackage builds
-standard Go packages.
-
-
-buildGoPackage
-
-net = buildGoPackage rec {
- name = "go.net-${rev}";
- goPackagePath = "golang.org/x/net";
- subPackages = [ "ipv4" "ipv6" ];
- rev = "e0403b4e005";
- src = fetchFromGitHub {
- inherit rev;
- owner = "golang";
- repo = "net";
- sha256 = "1g7cjzw4g4301a3yqpbk8n1d4s97sfby2aysl275x04g0zh8jxqp";
- };
- goPackageAliases = [ "code.google.com/p/go.net" ];
- propagatedBuildInputs = [ goPackages.text ];
- buildFlags = "--tags release";
- disabled = isGo13;
-};
-
-
-
- is an example expression using buildGoPackage,
-the following arguments are of special significance to the function:
-
-
-
-
-
- goPackagePath specifies the package's canonical Go import path.
-
-
-
-
-
- subPackages limits the builder from building child packages that
- have not been listed. If subPackages is not specified, all child
- packages will be built.
-
-
- In this example only code.google.com/p/go.net/ipv4 and
- code.google.com/p/go.net/ipv4 will be built.
-
-
-
-
-
- goPackageAliases is a list of alternative import paths
- that are valid for this library.
- Packages that depend on this library will automatically rename
- import paths that match any of the aliases to goPackagePath.
-
-
- In this example imports will be renamed from
- code.google.com/p/go.net to
- golang.org/x/net in every package that depend on the
- go.net library.
-
-
-
-
-
- propagatedBuildInputs is where the dependencies of a Go library are
- listed. Only libraries should list propagatedBuildInputs. If a standalone
- program is being build instead, use buildInputs. If a library's tests require
- additional dependencies that are not propagated, they should be listed in buildInputs.
-
-
-
-
-
- buildFlags is a list of flags passed to the go build command.
-
-
-
-
-
- If disabled is true,
- nix will refuse to build this package.
-
-
- In this example the package will not be built for go 1.3. The isGo13
- is an utility function that returns true if go used to build the
- package has version 1.3.x.
-
-
-
-
-
-
-
-
-Reusable Go libraries may be found in the goPackages set. You can test
-build a Go package as follows:
-
-
-$ nix-build -A goPackages.net
-
-
-
-
-
-You may use Go packages installed into the active Nix profiles by adding
-the following to your ~/.bashrc:
-
-
-for p in $NIX_PROFILES; do
- GOPATH="$p/share/go:$GOPATH"
-done
-
-
-
- To extract dependency information from a Go package in automated way use go2nix.
-
-
-
-Java
-
-Ant-based Java packages are typically built from source as follows:
-
-
-stdenv.mkDerivation {
- name = "...";
- src = fetchurl { ... };
-
- buildInputs = [ jdk ant ];
-
- buildPhase = "ant";
-}
-
-
-Note that jdk is an alias for the OpenJDK.
-
-JAR files that are intended to be used by other packages should
-be installed in $out/share/java. The OpenJDK has
-a stdenv setup hook that adds any JARs in the
-share/java directories of the build inputs to the
-CLASSPATH environment variable. For instance, if the
-package libfoo installs a JAR named
-foo.jar in its share/java
-directory, and another package declares the attribute
-
-
-buildInputs = [ jdk libfoo ];
-
-
-then CLASSPATH will be set to
-/nix/store/...-libfoo/share/java/foo.jar.
-
-Private JARs
-should be installed in a location like
-$out/share/package-name.
-
-If your Java package provides a program, you need to generate a
-wrapper script to run it using the OpenJRE. You can use
-makeWrapper for this:
-
-
-buildInputs = [ makeWrapper ];
-
-installPhase =
- ''
- mkdir -p $out/bin
- makeWrapper ${jre}/bin/java $out/bin/foo \
- --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
- '';
-
-
-Note the use of jre, which is the part of the
-OpenJDK package that contains the Java Runtime Environment. By using
-${jre}/bin/java instead of
-${jdk}/bin/java, you prevent your package from
-depending on the JDK at runtime.
-
-It is possible to use a different Java compiler than
-javac from the OpenJDK. For instance, to use the
-Eclipse Java Compiler:
-
-
-buildInputs = [ jre ant ecj ];
-
-
-(Note that here you don’t need the full JDK as an input, but just the
-JRE.) The ECJ has a stdenv setup hook that sets some environment
-variables to cause Ant to use ECJ, but this doesn’t work with all Ant
-files. Similarly, you can use the GNU Java Compiler:
-
-
-buildInputs = [ gcj ant ];
-
-
-Here, Ant will automatically use gij (the GNU Java
-Runtime) instead of the OpenJRE.
-
-
-
-
-Lua
-
-
- Lua packages are built by the buildLuaPackage function. This function is
- implemented
- in
- pkgs/development/lua-modules/generic/default.nix
- and works similarly to buildPerlPackage. (See
- for details.)
-
-
-
- Lua packages are defined
- in pkgs/top-level/lua-packages.nix.
- Most of them are simple. For example:
-
-
-fileSystem = buildLuaPackage {
- name = "filesystem-1.6.2";
- src = fetchurl {
- url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz";
- sha256 = "1n8qdwa20ypbrny99vhkmx8q04zd2jjycdb5196xdhgvqzk10abz";
- };
- meta = {
- homepage = "https://github.com/keplerproject/luafilesystem";
- hydraPlatforms = stdenv.lib.platforms.linux;
- maintainers = with maintainers; [ flosse ];
- };
-};
-
-
-
-
- Though, more complicated package should be placed in a seperate file in
- pkgs/development/lua-modules.
-
-
- Lua packages accept additional parameter disabled, which defines
- the condition of disabling package from luaPackages. For example, if package has
- disabled assigned to lua.luaversion != "5.1",
- it will not be included in any luaPackages except lua51Packages, making it
- only be built for lua 5.1.
-
-
-
-
-Coq
-
- Coq libraries should be installed in
- $(out)/lib/coq/${coq.coq-version}/user-contrib/.
- Such directories are automatically added to the
- $COQPATH environment variable by the hook defined
- in the Coq derivation.
-
-
- Some libraries require OCaml and sometimes also Camlp5. The exact
- versions that were used to build Coq are saved in the
- coq.ocaml and coq.camlp5
- attributes.
-
-
- Here is a simple package example. It is a pure Coq library, thus it
- only depends on Coq. Its makefile has been
- generated using coq_makefile so we only have to
- set the $COQLIB variable at install time.
-
-
-{stdenv, fetchurl, coq}:
-stdenv.mkDerivation {
- src = fetchurl {
- url = http://coq.inria.fr/pylons/contribs/files/Karatsuba/v8.4/Karatsuba.tar.gz;
- sha256 = "0ymfpv4v49k4fm63nq6gcl1hbnnxrvjjp7yzc4973n49b853c5b1";
- };
-
- name = "coq-karatsuba";
-
- buildInputs = [ coq ];
-
- installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/";
-}
-
-
-
-Qt
-
-The information in this section applies to Qt 5.5 and later.
-
-Qt is an application development toolkit for C++. Although it is
-not a distinct programming language, there are special considerations
-for packaging Qt-based programs and libraries. A small set of tools
-and conventions has grown out of these considerations.
-
-Libraries
-
-Packages that provide libraries should be listed in
-qt5LibsFun so that the library is built with each
-Qt version. A set of packages is provided for each version of Qt; for
-example, qt5Libs always provides libraries built
-with the latest version, qt55Libs provides
-libraries built with Qt 5.5, and so on. To avoid version conflicts, no
-top-level attributes are created for these packages.
-
-
-
-Programs
-
-Application packages do not need to be built with every Qt
-version. To ensure consistency between the package's dependencies,
-call the package with qt5Libs.callPackage instead
-of the usual callPackage. An older version may be
-selected in case of incompatibility. For example, to build with Qt
-5.5, call the package with
-qt55Libs.callPackage.
-
-Several environment variables must be set at runtime for Qt
-applications to function correctly, including:
-
-
- QT_PLUGIN_PATH
- QML_IMPORT_PATH
- QML2_IMPORT_PATH
- XDG_DATA_DIRS
-
-
-To ensure that these are set correctly, the program must be wrapped by
-invoking wrapQtProgram program
-during installation (for example, during
-fixupPhase). wrapQtProgram
-accepts the same options as makeWrapper.
-
-
-
-
-KDE
-
-Many of the considerations above also apply to KDE packages,
-especially the need to set the correct environment variables at
-runtime. To ensure that this is done, invoke wrapKDEProgram
-program during
-installation. wrapKDEProgram also generates a
-ksycoca database so that required data and services
-can be found. Like its Qt counterpart,
-wrapKDEProgram accepts the same options as
-makeWrapper.
-
-
-
-
-
-
-
-
-
diff --git a/doc/languages-frameworks/coq.xml b/doc/languages-frameworks/coq.xml
new file mode 100644
index 00000000000..d16c9f3dc87
--- /dev/null
+++ b/doc/languages-frameworks/coq.xml
@@ -0,0 +1,41 @@
+
+
+Coq
+
+ Coq libraries should be installed in
+ $(out)/lib/coq/${coq.coq-version}/user-contrib/.
+ Such directories are automatically added to the
+ $COQPATH environment variable by the hook defined
+ in the Coq derivation.
+
+
+ Some libraries require OCaml and sometimes also Camlp5. The exact
+ versions that were used to build Coq are saved in the
+ coq.ocaml and coq.camlp5
+ attributes.
+
+
+ Here is a simple package example. It is a pure Coq library, thus it
+ only depends on Coq. Its makefile has been
+ generated using coq_makefile so we only have to
+ set the $COQLIB variable at install time.
+
+
+{stdenv, fetchurl, coq}:
+stdenv.mkDerivation {
+ src = fetchurl {
+ url = http://coq.inria.fr/pylons/contribs/files/Karatsuba/v8.4/Karatsuba.tar.gz;
+ sha256 = "0ymfpv4v49k4fm63nq6gcl1hbnnxrvjjp7yzc4973n49b853c5b1";
+ };
+
+ name = "coq-karatsuba";
+
+ buildInputs = [ coq ];
+
+ installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/";
+}
+
+
+
diff --git a/doc/languages-frameworks/go.xml b/doc/languages-frameworks/go.xml
new file mode 100644
index 00000000000..89908b3b8ff
--- /dev/null
+++ b/doc/languages-frameworks/go.xml
@@ -0,0 +1,124 @@
+
+
+Go
+
+The function buildGoPackage builds
+standard Go packages.
+
+
+buildGoPackage
+
+net = buildGoPackage rec {
+ name = "go.net-${rev}";
+ goPackagePath = "golang.org/x/net";
+ subPackages = [ "ipv4" "ipv6" ];
+ rev = "e0403b4e005";
+ src = fetchFromGitHub {
+ inherit rev;
+ owner = "golang";
+ repo = "net";
+ sha256 = "1g7cjzw4g4301a3yqpbk8n1d4s97sfby2aysl275x04g0zh8jxqp";
+ };
+ goPackageAliases = [ "code.google.com/p/go.net" ];
+ propagatedBuildInputs = [ goPackages.text ];
+ buildFlags = "--tags release";
+ disabled = isGo13;
+};
+
+
+
+ is an example expression using buildGoPackage,
+the following arguments are of special significance to the function:
+
+
+
+
+
+ goPackagePath specifies the package's canonical Go import path.
+
+
+
+
+
+ subPackages limits the builder from building child packages that
+ have not been listed. If subPackages is not specified, all child
+ packages will be built.
+
+
+ In this example only code.google.com/p/go.net/ipv4 and
+ code.google.com/p/go.net/ipv6 will be built.
+
+
+
+
+
+ goPackageAliases is a list of alternative import paths
+ that are valid for this library.
+ Packages that depend on this library will automatically rename
+ import paths that match any of the aliases to goPackagePath.
+
+
+ In this example imports will be renamed from
+ code.google.com/p/go.net to
+ golang.org/x/net in every package that depend on the
+ go.net library.
+
+
+
+
+
+ propagatedBuildInputs is where the dependencies of a Go library are
+ listed. Only libraries should list propagatedBuildInputs. If a standalone
+ program is being built instead, use buildInputs. If a library's tests require
+ additional dependencies that are not propagated, they should be listed in buildInputs.
+
+
+
+
+
+ buildFlags is a list of flags passed to the go build command.
+
+
+
+
+
+ If disabled is true,
+ nix will refuse to build this package.
+
+
+ In this example the package will not be built for go 1.3. The isGo13
+ is an utility function that returns true if go used to build the
+ package has version 1.3.x.
+
+
+
+
+
+
+
+
+Reusable Go libraries may be found in the goPackages set. You can test
+build a Go package as follows:
+
+
+$ nix-build -A goPackages.net
+
+
+
+
+
+You may use Go packages installed into the active Nix profiles by adding
+the following to your ~/.bashrc:
+
+
+for p in $NIX_PROFILES; do
+ GOPATH="$p/share/go:$GOPATH"
+done
+
+
+
+ To extract dependency information from a Go package in automated way use go2nix.
+
+
diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml
new file mode 100644
index 00000000000..743a1b70be7
--- /dev/null
+++ b/doc/languages-frameworks/index.xml
@@ -0,0 +1,43 @@
+
+
+Support for specific programming languages and frameworks
+
+The standard build
+environment makes it easy to build typical Autotools-based
+packages with very little code. Any other kind of package can be
+accomodated by overriding the appropriate phases of
+stdenv. However, there are specialised functions
+in Nixpkgs to easily build packages for other programming languages,
+such as Perl or Haskell. These are described in this chapter.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/languages-frameworks/java.xml b/doc/languages-frameworks/java.xml
new file mode 100644
index 00000000000..2d40a254ced
--- /dev/null
+++ b/doc/languages-frameworks/java.xml
@@ -0,0 +1,84 @@
+
+
+Java
+
+Ant-based Java packages are typically built from source as follows:
+
+
+stdenv.mkDerivation {
+ name = "...";
+ src = fetchurl { ... };
+
+ buildInputs = [ jdk ant ];
+
+ buildPhase = "ant";
+}
+
+
+Note that jdk is an alias for the OpenJDK.
+
+JAR files that are intended to be used by other packages should
+be installed in $out/share/java. The OpenJDK has
+a stdenv setup hook that adds any JARs in the
+share/java directories of the build inputs to the
+CLASSPATH environment variable. For instance, if the
+package libfoo installs a JAR named
+foo.jar in its share/java
+directory, and another package declares the attribute
+
+
+buildInputs = [ jdk libfoo ];
+
+
+then CLASSPATH will be set to
+/nix/store/...-libfoo/share/java/foo.jar.
+
+Private JARs
+should be installed in a location like
+$out/share/package-name.
+
+If your Java package provides a program, you need to generate a
+wrapper script to run it using the OpenJRE. You can use
+makeWrapper for this:
+
+
+buildInputs = [ makeWrapper ];
+
+installPhase =
+ ''
+ mkdir -p $out/bin
+ makeWrapper ${jre}/bin/java $out/bin/foo \
+ --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
+ '';
+
+
+Note the use of jre, which is the part of the
+OpenJDK package that contains the Java Runtime Environment. By using
+${jre}/bin/java instead of
+${jdk}/bin/java, you prevent your package from
+depending on the JDK at runtime.
+
+It is possible to use a different Java compiler than
+javac from the OpenJDK. For instance, to use the
+Eclipse Java Compiler:
+
+
+buildInputs = [ jre ant ecj ];
+
+
+(Note that here you don’t need the full JDK as an input, but just the
+JRE.) The ECJ has a stdenv setup hook that sets some environment
+variables to cause Ant to use ECJ, but this doesn’t work with all Ant
+files. Similarly, you can use the GNU Java Compiler:
+
+
+buildInputs = [ gcj ant ];
+
+
+Here, Ant will automatically use gij (the GNU Java
+Runtime) instead of the OpenJRE.
+
+
+
diff --git a/doc/languages-frameworks/lua.xml b/doc/languages-frameworks/lua.xml
new file mode 100644
index 00000000000..39b086af4cb
--- /dev/null
+++ b/doc/languages-frameworks/lua.xml
@@ -0,0 +1,51 @@
+
+
+Lua
+
+
+ Lua packages are built by the buildLuaPackage function. This function is
+ implemented
+ in
+ pkgs/development/lua-modules/generic/default.nix
+ and works similarly to buildPerlPackage. (See
+ for details.)
+
+
+
+ Lua packages are defined
+ in pkgs/top-level/lua-packages.nix.
+ Most of them are simple. For example:
+
+
+fileSystem = buildLuaPackage {
+ name = "filesystem-1.6.2";
+ src = fetchurl {
+ url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz";
+ sha256 = "1n8qdwa20ypbrny99vhkmx8q04zd2jjycdb5196xdhgvqzk10abz";
+ };
+ meta = {
+ homepage = "https://github.com/keplerproject/luafilesystem";
+ hydraPlatforms = stdenv.lib.platforms.linux;
+ maintainers = with maintainers; [ flosse ];
+ };
+};
+
+
+
+
+ Though, more complicated package should be placed in a seperate file in
+ pkgs/development/lua-modules.
+
+
+ Lua packages accept additional parameter disabled, which defines
+ the condition of disabling package from luaPackages. For example, if package has
+ disabled assigned to lua.luaversion != "5.1",
+ it will not be included in any luaPackages except lua51Packages, making it
+ only be built for lua 5.1.
+
+
+
+
diff --git a/doc/languages-frameworks/perl.xml b/doc/languages-frameworks/perl.xml
new file mode 100644
index 00000000000..54b82f4a056
--- /dev/null
+++ b/doc/languages-frameworks/perl.xml
@@ -0,0 +1,181 @@
+
+
+Perl
+
+Nixpkgs provides a function buildPerlPackage,
+a generic package builder function for any Perl package that has a
+standard Makefile.PL. It’s implemented in pkgs/development/perl-modules/generic.
+
+Perl packages from CPAN are defined in pkgs/top-level/perl-packages.nix,
+rather than pkgs/all-packages.nix. Most Perl
+packages are so straight-forward to build that they are defined here
+directly, rather than having a separate function for each package
+called from perl-packages.nix. However, more
+complicated packages should be put in a separate file, typically in
+pkgs/development/perl-modules. Here is an
+example of the former:
+
+
+ClassC3 = buildPerlPackage rec {
+ name = "Class-C3-0.21";
+ src = fetchurl {
+ url = "mirror://cpan/authors/id/F/FL/FLORA/${name}.tar.gz";
+ sha256 = "1bl8z095y4js66pwxnm7s853pi9czala4sqc743fdlnk27kq94gz";
+ };
+};
+
+
+Note the use of mirror://cpan/, and the
+${name} in the URL definition to ensure that the
+name attribute is consistent with the source that we’re actually
+downloading. Perl packages are made available in
+all-packages.nix through the variable
+perlPackages. For instance, if you have a package
+that needs ClassC3, you would typically write
+
+
+foo = import ../path/to/foo.nix {
+ inherit stdenv fetchurl ...;
+ inherit (perlPackages) ClassC3;
+};
+
+
+in all-packages.nix. You can test building a
+Perl package as follows:
+
+
+$ nix-build -A perlPackages.ClassC3
+
+
+buildPerlPackage adds perl- to
+the start of the name attribute, so the package above is actually
+called perl-Class-C3-0.21. So to install it, you
+can say:
+
+
+$ nix-env -i perl-Class-C3
+
+
+(Of course you can also install using the attribute name:
+nix-env -i -A perlPackages.ClassC3.)
+
+So what does buildPerlPackage do? It does
+the following:
+
+
+
+ In the configure phase, it calls perl
+ Makefile.PL to generate a Makefile. You can set the
+ variable makeMakerFlags to pass flags to
+ Makefile.PL
+
+ It adds the contents of the PERL5LIB
+ environment variable to #! .../bin/perl line of
+ Perl scripts as -Idir
+ flags. This ensures that a script can find its
+ dependencies.
+
+ In the fixup phase, it writes the propagated build
+ inputs (propagatedBuildInputs) to the file
+ $out/nix-support/propagated-user-env-packages.
+ nix-env recursively installs all packages listed
+ in this file when you install a package that has it. This ensures
+ that a Perl package can find its dependencies.
+
+
+
+
+
+buildPerlPackage is built on top of
+stdenv, so everything can be customised in the
+usual way. For instance, the BerkeleyDB module has
+a preConfigure hook to generate a configuration
+file used by Makefile.PL:
+
+
+{ buildPerlPackage, fetchurl, db }:
+
+buildPerlPackage rec {
+ name = "BerkeleyDB-0.36";
+
+ src = fetchurl {
+ url = "mirror://cpan/authors/id/P/PM/PMQS/${name}.tar.gz";
+ sha256 = "07xf50riarb60l1h6m2dqmql8q5dij619712fsgw7ach04d8g3z1";
+ };
+
+ preConfigure = ''
+ echo "LIB = ${db}/lib" > config.in
+ echo "INCLUDE = ${db}/include" >> config.in
+ '';
+}
+
+
+
+
+Dependencies on other Perl packages can be specified in the
+buildInputs and
+propagatedBuildInputs attributes. If something is
+exclusively a build-time dependency, use
+buildInputs; if it’s (also) a runtime dependency,
+use propagatedBuildInputs. For instance, this
+builds a Perl module that has runtime dependencies on a bunch of other
+modules:
+
+
+ClassC3Componentised = buildPerlPackage rec {
+ name = "Class-C3-Componentised-1.0004";
+ src = fetchurl {
+ url = "mirror://cpan/authors/id/A/AS/ASH/${name}.tar.gz";
+ sha256 = "0xql73jkcdbq4q9m0b0rnca6nrlvf5hyzy8is0crdk65bynvs8q1";
+ };
+ propagatedBuildInputs = [
+ ClassC3 ClassInspector TestException MROCompat
+ ];
+};
+
+
+
+
+Generation from CPAN
+
+Nix expressions for Perl packages can be generated (almost)
+automatically from CPAN. This is done by the program
+nix-generate-from-cpan, which can be installed
+as follows:
+
+
+$ nix-env -i nix-generate-from-cpan
+
+
+This program takes a Perl module name, looks it up on CPAN,
+fetches and unpacks the corresponding package, and prints a Nix
+expression on standard output. For example:
+
+
+$ nix-generate-from-cpan XML::Simple
+ XMLSimple = buildPerlPackage {
+ name = "XML-Simple-2.20";
+ src = fetchurl {
+ url = mirror://cpan/authors/id/G/GR/GRANTM/XML-Simple-2.20.tar.gz;
+ sha256 = "5cff13d0802792da1eb45895ce1be461903d98ec97c9c953bc8406af7294434a";
+ };
+ propagatedBuildInputs = [ XMLNamespaceSupport XMLSAX XMLSAXExpat ];
+ meta = {
+ description = "Easily read/write XML (esp config files)";
+ license = "perl";
+ };
+ };
+
+
+The output can be pasted into
+pkgs/top-level/perl-packages.nix or wherever else
+you need it.
+
+
+
+
+
diff --git a/doc/languages-frameworks/python.xml b/doc/languages-frameworks/python.xml
new file mode 100644
index 00000000000..57aceeb4868
--- /dev/null
+++ b/doc/languages-frameworks/python.xml
@@ -0,0 +1,447 @@
+
+
+Python
+
+
+ Currently supported interpreters are python26, python27,
+ python33, python34, python35
+ and pypy.
+
+
+
+ python is an alias to python27 and python3 is an alias to python34.
+
+
+
+ python26 and python27 do not include modules that require
+ external dependencies (to reduce dependency bloat). Following modules need to be added as
+ buildInput explicitly:
+
+
+
+ python.modules.bsddb
+ python.modules.curses
+ python.modules.curses_panel
+ python.modules.crypt
+ python.modules.gdbm
+ python.modules.sqlite3
+ python.modules.tkinter
+ python.modules.readline
+
+
+For convenience python27Full and python26Full
+are provided with all modules included.
+
+
+ Python packages that
+ use setuptools or distutils,
+ can be built using the buildPythonPackage function as documented below.
+
+
+
+ All packages depending on any Python interpreter get appended $out/${python.sitePackages}
+ to $PYTHONPATH if such directory exists.
+
+
+
+
+ Useful attributes on interpreters packages:
+
+
+
+ libPrefix
+
+ Name of the folder in ${python}/lib/ for corresponding interpreter.
+
+
+
+
+ interpreter
+
+ Alias for ${python}/bin/${executable}.
+
+
+
+
+ buildEnv
+
+ Function to build python interpreter environments with extra packages bundled together.
+ See for usage and documentation.
+
+
+
+
+ sitePackages
+
+ Alias for lib/${libPrefix}/site-packages.
+
+
+
+
+ executable
+
+ Name of the interpreter executable, ie python3.4.
+
+
+
+
+buildPythonPackage function
+
+
+ The function is implemented in
+ pkgs/development/python-modules/generic/default.nix.
+ Example usage:
+
+
+twisted = buildPythonPackage {
+ name = "twisted-8.1.0";
+
+ src = pkgs.fetchurl {
+ url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2;
+ sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl";
+ };
+
+ propagatedBuildInputs = [ self.ZopeInterface ];
+
+ meta = {
+ homepage = http://twistedmatrix.com/;
+ description = "Twisted, an event-driven networking engine written in Python";
+ license = stdenv.lib.licenses.mit;
+ };
+};
+
+
+ Most of Python packages that use buildPythonPackage are defined
+ in pkgs/top-level/python-packages.nix
+ and generated for each python interpreter separately into attribute sets python26Packages,
+ python27Packages, python35Packages, python33Packages,
+ python34Packages and pypyPackages.
+
+
+
+ buildPythonPackage mainly does four things:
+
+
+
+ In the buildPhase, it calls
+ ${python.interpreter} setup.py bdist_wheel to build a wheel binary zipfile.
+
+
+
+ In the installPhase, it installs the wheel file using
+ pip install *.whl.
+
+
+
+ In the postFixup phase, wrapPythonPrograms
+ bash function is called to wrap all programs in $out/bin/*
+ directory to include $PYTHONPATH and $PATH
+ environment variables.
+
+
+
+ In the installCheck phase, ${python.interpreter} setup.py test
+ is ran.
+
+
+
+
+ By default doCheck = true is set
+
+
+ As in Perl, dependencies on other Python packages can be specified in the
+ buildInputs and
+ propagatedBuildInputs attributes. If something is
+ exclusively a build-time dependency, use
+ buildInputs; if it’s (also) a runtime dependency,
+ use propagatedBuildInputs.
+
+
+
+ By default meta.platforms is set to the same value
+ as the interpreter unless overriden otherwise.
+
+
+
+
+ buildPythonPackage parameters
+ (all parameters from mkDerivation function are still supported)
+
+
+
+ namePrefix
+
+ Prepended text to ${name} parameter.
+ Defaults to "python3.3-" for Python 3.3, etc. Set it to
+ ""
+ if you're packaging an application or a command line tool.
+
+
+
+
+ disabled
+
+ If true, package is not build for
+ particular python interpreter version. Grep around
+ pkgs/top-level/python-packages.nix
+ for examples.
+
+
+
+
+ setupPyBuildFlags
+
+ List of flags passed to setup.py build_ext command.
+
+
+
+
+ pythonPath
+
+ List of packages to be added into $PYTHONPATH.
+ Packages in pythonPath are not propagated
+ (contrary to propagatedBuildInputs).
+
+
+
+
+ preShellHook
+
+ Hook to execute commands before shellHook.
+
+
+
+
+ postShellHook
+
+ Hook to execute commands after shellHook.
+
+
+
+
+ makeWrapperArgs
+
+ A list of strings. Arguments to be passed to
+ makeWrapper, which wraps generated binaries. By
+ default, the arguments to makeWrapper set
+ PATH and PYTHONPATH environment
+ variables before calling the binary. Additional arguments here can
+ allow a developer to set environment variables which will be
+ available when the binary is run. For example,
+ makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"].
+
+
+
+
+
+
+
+python.buildEnv function
+
+ Create Python environments using low-level pkgs.buildEnv function. Example default.nix:
+
+
+ {};
+
+python.buildEnv.override {
+ extraLibs = [ pkgs.pythonPackages.pyramid ];
+ ignoreCollisions = true;
+}]]>
+
+
+ Running nix-build will create
+ /nix/store/cf1xhjwzmdki7fasgr4kz6di72ykicl5-python-2.7.8-env
+ with wrapped binaries in bin/.
+
+
+
+ You can also use env attribute to create local
+ environments with needed packages installed (somewhat comparable to
+ virtualenv). For example, with the following
+ shell.nix:
+
+
+ {};
+
+(python3.buildEnv.override {
+ extraLibs = with python3Packages;
+ [ numpy
+ requests
+ ];
+}).env]]>
+
+
+ Running nix-shell will drop you into a shell where
+ python will have specified packages in its path.
+
+
+
+
+ python.buildEnv arguments
+
+
+
+ extraLibs
+
+ List of packages installed inside the environment.
+
+
+
+
+ postBuild
+
+ Shell command executed after the build of environment.
+
+
+
+
+ ignoreCollisions
+
+ Ignore file collisions inside the environment (default is false).
+
+
+
+
+
+Tools
+
+Packages inside nixpkgs are written by hand. However many tools
+exist in community to help save time. No tool is preferred at the moment.
+
+
+
+
+
+ python2nix
+ by Vladimir Kirillov
+
+
+
+ pypi2nix
+ by Rok Garbas
+
+
+
+ pypi2nix
+ by Jaka Hudoklin
+
+
+
+
+
+
+Development
+
+
+ To develop Python packages buildPythonPackage has
+ additional logic inside shellPhase to run
+ pip install -e . --prefix $TMPDIR/ for the package.
+
+
+ shellPhase is executed only if setup.py
+ exists.
+
+
+ Given a default.nix:
+
+
+ {};
+
+buildPythonPackage {
+ name = "myproject";
+
+ buildInputs = with pkgs.pythonPackages; [ pyramid ];
+
+ src = ./.;
+}]]>
+
+
+ Running nix-shell with no arguments should give you
+ the environment in which the package would be build with
+ nix-build.
+
+
+
+ Shortcut to setup environments with C headers/libraries and python packages:
+
+ $ nix-shell -p pythonPackages.pyramid zlib libjpeg git
+
+
+
+ There is a boolean value lib.inNixShell set to
+ true if nix-shell is invoked.
+
+
+
+
+FAQ
+
+
+
+
+ How to solve circular dependencies?
+
+ If you have packages A and B that
+ depend on each other, when packaging B override package
+ A not to depend on B as input
+ (and also the other way around).
+
+
+
+
+ install_data / data_files problems resulting into error: could not create '/nix/store/6l1bvljpy8gazlsw2aw9skwwp4pmvyxw-python-2.7.8/etc': Permission denied
+
+
+ Known bug in setuptools install_data does not respect --prefix. Example of
+ such package using the feature is pkgs/tools/X11/xpra/default.nix. As workaround
+ install it as an extra preInstall step:
+
+ ${python.interpreter} setup.py install_data --install-dir=$out --root=$out
+sed -i '/ = data_files/d' setup.py
+
+
+
+
+ Rationale of non-existent global site-packages
+
+ There is no need to have global site-packages in Nix. Each package has isolated
+ dependency tree and installing any python package will only populate $PATH
+ inside user environment. See to create self-contained
+ interpreter with a set of packages.
+
+
+
+
+
+
+
+
+Contributing guidelines
+
+ Following rules are desired to be respected:
+
+
+
+
+
+ Make sure package builds for all python interpreters. Use disabled argument to
+ buildPythonPackage to set unsupported interpreters.
+
+
+
+ If tests need to be disabled for a package, make sure you leave a comment about reasoning.
+
+
+
+ Packages in pkgs/top-level/python-packages.nix
+ are sorted quasi-alphabetically to avoid merge conflicts.
+
+
+
+
+
+
+
+
diff --git a/doc/languages-frameworks/qt.xml b/doc/languages-frameworks/qt.xml
new file mode 100644
index 00000000000..093c33c25a1
--- /dev/null
+++ b/doc/languages-frameworks/qt.xml
@@ -0,0 +1,70 @@
+
+
+Qt
+
+The information in this section applies to Qt 5.5 and later.
+
+Qt is an application development toolkit for C++. Although it is
+not a distinct programming language, there are special considerations
+for packaging Qt-based programs and libraries. A small set of tools
+and conventions has grown out of these considerations.
+
+Libraries
+
+Packages that provide libraries should be listed in
+qt5LibsFun so that the library is built with each
+Qt version. A set of packages is provided for each version of Qt; for
+example, qt5Libs always provides libraries built
+with the latest version, qt55Libs provides
+libraries built with Qt 5.5, and so on. To avoid version conflicts, no
+top-level attributes are created for these packages.
+
+
+
+Programs
+
+Application packages do not need to be built with every Qt
+version. To ensure consistency between the package's dependencies,
+call the package with qt5Libs.callPackage instead
+of the usual callPackage. An older version may be
+selected in case of incompatibility. For example, to build with Qt
+5.5, call the package with
+qt55Libs.callPackage.
+
+Several environment variables must be set at runtime for Qt
+applications to function correctly, including:
+
+
+ QT_PLUGIN_PATH
+ QML_IMPORT_PATH
+ QML2_IMPORT_PATH
+ XDG_DATA_DIRS
+
+
+To ensure that these are set correctly, the program must be wrapped by
+invoking wrapQtProgram program
+during installation (for example, during
+fixupPhase). wrapQtProgram
+accepts the same options as makeWrapper.
+
+
+
+
+KDE
+
+Many of the considerations above also apply to KDE packages,
+especially the need to set the correct environment variables at
+runtime. To ensure that this is done, invoke wrapKDEProgram
+program during
+installation. wrapKDEProgram also generates a
+ksycoca database so that required data and services
+can be found. Like its Qt counterpart,
+wrapKDEProgram accepts the same options as
+makeWrapper.
+
+
+
+
+
diff --git a/doc/languages-frameworks/ruby.xml b/doc/languages-frameworks/ruby.xml
new file mode 100644
index 00000000000..a2b4475a4a5
--- /dev/null
+++ b/doc/languages-frameworks/ruby.xml
@@ -0,0 +1,46 @@
+
+
+Ruby
+
+ There currently is support to bundle applications that are packaged as Ruby gems. The utility "bundix" allows you to write a Gemfile, let bundler create a Gemfile.lock, and then convert
+ this into a nix expression that contains all Gem dependencies automatically.
+
+ For example, to package sensu, we did:
+
+
+ Gemfile
+source 'https://rubygems.org'
+gem 'sensu'
+$ bundler package --path /tmp/vendor/bundle
+$ $(nix-build '' -A bundix)/bin/bundix
+$ cat > default.nix
+{ lib, bundlerEnv, ruby }:
+
+bundlerEnv {
+ name = "sensu-0.17.1";
+
+ inherit ruby;
+ gemfile = ./Gemfile;
+ lockfile = ./Gemfile.lock;
+ gemset = ./gemset.nix;
+
+ meta = with lib; {
+ description = "A monitoring framework that aims to be simple, malleable,
+and scalable.";
+ homepage = http://sensuapp.org/;
+ license = with licenses; mit;
+ maintainers = with maintainers; [ theuni ];
+ platforms = platforms.unix;
+ };
+}]]>
+
+
+Please check in the Gemfile, Gemfile.lock and the gemset.nix so future updates can be run easily.
+
+
+
+
diff --git a/doc/manual.xml b/doc/manual.xml
index 1f1f50f75fb..2b4f47aff1c 100644
--- a/doc/manual.xml
+++ b/doc/manual.xml
@@ -12,14 +12,15 @@
-
+
-
+
+
diff --git a/doc/meta.xml b/doc/meta.xml
index 98031612523..5266d83aea6 100644
--- a/doc/meta.xml
+++ b/doc/meta.xml
@@ -33,7 +33,7 @@ the package. The value of a meta-attribute must be a string.
command-line using nix-env:
-$ nix-env -qa hello --meta --json
+$ nix-env -qa hello --json
{
"hello": {
"meta": {
@@ -112,11 +112,6 @@ meta-attributes
package.
-
- version
- Package version.
-
-
branchRelease branch. Used to specify that a package is not
diff --git a/doc/package-notes.xml b/doc/package-notes.xml
index 9d8217d60bc..4148e87e018 100644
--- a/doc/package-notes.xml
+++ b/doc/package-notes.xml
@@ -125,7 +125,7 @@ $ make menuconfig ARCH=archIt may be that the new kernel requires updating the external
kernel modules and kernel-dependent packages listed in the
- kernelPackagesFor function in
+ linuxPackagesFor function in
all-packages.nix (such as the NVIDIA drivers,
AUFS, etc.). If the updated packages aren’t backwards compatible
with older kernels, you may need to keep the older versions
diff --git a/doc/packageconfig.xml b/doc/packageconfig.xml
deleted file mode 100644
index 4e0fcc3b6a4..00000000000
--- a/doc/packageconfig.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-~/.nixpkgs/config.nix: global configuration
-
-
- Nix packages can be configured to allow or deny certain options.
-
-
-
- To apply the configuration edit ~/.nixpkgs/config.nix
- and set it like
-{
- allowUnfree = true;
-}
- and will allow the Nix package manager to install unfree licensed packages.
-
- The configuration as listed also applies to NixOS under set.
-
-
-
-
-
- Allow installing of packages that are distributed under unfree license by setting
- allowUnfree = true;
- or deny them by setting it to false.
-
-
- Same can be achieved by setting the environment variable:
- $ export NIXPKGS_ALLOW_UNFREE=1
-
-
-
-
-
- Whenever unfree packages are not allowed, single packages can
- still be allowed by a predicate function that accepts package
- as an argument and should return a boolean:
- allowUnfreePredicate = (pkg: ...);
-
- Example to allow flash player only:
- allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name);
-
-
-
-
-
- Whenever unfree packages are not allowed, packages can still be
- whitelisted by their license:
- whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ];
-
-
-
-
-
- In addition to whitelisting licenses which are denied by the
- allowUnfree setting, you can also explicitely
- deny installation of packages which have a certain license:
- blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ];
-
-
-
-
-
- A complete list of licenses can be found in the file
- lib/licenses.nix of the nix package tree.
-
-
-Modify
-packages via packageOverrides
-
-
-
- You can define a function called packageOverrides
- in your local ~/.nixpkgs/config to overide nix
- packages. It must be a function that takes pkgs as an argument and
- return modified set of packages.
-
- {
- packageOverrides = pkgs: rec {
- foo = pkgs.foo.override { ... };
- };
-}
-
-
-
-
diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index 6bb1002a4c6..f8d9acb2fb0 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -224,6 +224,63 @@ genericBuild
+
+ Variables affecting build properties
+
+
+ enableParallelBuilding
+ If set, stdenv will pass specific
+ flags to make and other build tools to enable
+ parallel building with up to build-cores
+ workers.
+
+
+
+ preferLocalBuild
+ If set, specifies that the package is so lightweight
+ in terms of build operations (e.g. write a text file from a Nix string
+ to the store) that there's no need to look for it in binary caches --
+ it's faster to just build it locally. It also tells Hydra and other
+ facilities that this package doesn't need to be exported in binary
+ caches (noone would use it, after all).
+
+
+
+
+
+ Special variables
+
+
+ passthru
+ This is an attribute set which can be filled with arbitrary
+ values. For example:
+
+
+passthru = {
+ foo = "bar";
+ baz = {
+ value1 = 4;
+ value2 = 5;
+ };
+}
+
+
+
+
+ Values inside it are not passed to the builder, so you can change
+ them without triggering a rebuild. However, they can be accessed outside of a
+ derivation directly, as if they were set inside a derivation itself, e.g.
+ hello.baz.value1. We don't specify any usage or
+ schema of passthru - it is meant for values that would be
+ useful outside the derivation in other parts of a Nix expression (e.g. in other
+ derivations). An example would be to convey some specific dependency of your
+ derivation which contains a program with plugins support. Later, others who
+ make derivations with plugins can use passed-through dependency to ensure that
+ their plugin would be binary-compatible with built program.
+
+
+
+
@@ -1186,6 +1243,14 @@ echo @foo@
environment variable.
+
+ Autoconf
+ The autoreconfHook derivation adds
+ autoreconfPhase, which runs autoreconf, libtoolize and
+ automake, essentially preparing the configure script in autotools-based
+ builds.
+
+
libxml2Adds every file named
diff --git a/doc/submitting-changes.xml b/doc/submitting-changes.xml
index fe331d08250..0b09dffbb2d 100644
--- a/doc/submitting-changes.xml
+++ b/doc/submitting-changes.xml
@@ -261,23 +261,72 @@ Additional information.
Hydra builds for master and staging should not be used as testing platform, it's a build farm for changes that have been already tested.
-
-Master should only see non-breaking commits that do not cause mass rebuilds.
-
-
-
-Staging should only see non-breaking mass-rebuild commits. That means it's not to be used for testing, and changes must have been well tested already. Read policy here.
-
-
-
-If staging is already in a broken state, please refrain from adding extra new breakages. Stabilize it for a few days, merge into master, then resume development on staging. Keep an eye on the staging evaluations here.
-
-
When changing the bootloader installation process, extra care must be taken. Grub installations cannot be rolled back, hence changes may break people's installations forever. For any non-trivial change to the bootloader please file a PR asking for review, especially from @edolstra.
+
+ Master branch
+
+
+
+
+ It should only see non-breaking commits that do not cause mass rebuilds.
+
+
+
+
+
+
+ Staging branch
+
+
+
+
+ It's only for non-breaking mass-rebuild commits. That means it's not to
+ be used for testing, and changes must have been well tested already.
+ Read policy here.
+
+
+
+
+ If the branch is already in a broken state, please refrain from adding
+ extra new breakages. Stabilize it for a few days, merge into master,
+ then resume development on staging.
+ Keep an eye on the staging evaluations here.
+ If any fixes for staging happen to be already in master, then master can
+ be merged into staging.
+
+
+
+
+
+
+ Stable release branches
+
+
+
+
+ If you're cherry-picking a commit to a stable release branch, always use
+ git cherry-pick -xe and ensure the message contains a
+ clear description about why this needs to be included in the stable
+ branch.
+
+ An example of a cherry-picked commit would look like this:
+
+nixos: Refactor the world.
+
+The original commit message describing the reason why the world was torn apart.
+
+(cherry picked from commit abcdef)
+Reason: I just had a gut feeling that this would also be wanted by people from
+the stone age.
+
+
+
+
+
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 22ecc808679..84f6cb3658b 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -23,6 +23,17 @@ rec {
then attrByPath (tail attrPath) default e.${attr}
else default;
+ /* Return if an attribute from nested attribute set exists.
+ For instance ["x" "y"] applied to some set e returns true, if e.x.y exists. False
+ is returned otherwise. */
+ hasAttrByPath = attrPath: e:
+ let attr = head attrPath;
+ in
+ if attrPath == [] then true
+ else if e ? ${attr}
+ then hasAttrByPath (tail attrPath) e.${attr}
+ else false;
+
/* Return nested attribute set in which an attribute is set. For instance
["x" "y"] applied with some value v returns `x.y = v;' */
diff --git a/lib/default.nix b/lib/default.nix
index cd0d8161c8c..32ac0c58af6 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -17,10 +17,11 @@ let
systems = import ./systems.nix;
customisation = import ./customisation.nix;
licenses = import ./licenses.nix;
+ sandbox = import ./sandbox.nix;
in
{ inherit trivial lists strings stringsWithDeps attrsets sources options
- modules types meta debug maintainers licenses platforms systems;
+ modules types meta debug maintainers licenses platforms systems sandbox;
}
# !!! don't include everything at top-level; perhaps only the most
# commonly used functions.
diff --git a/lib/deprecated.nix b/lib/deprecated.nix
index 3646f9e032a..3729197f48b 100644
--- a/lib/deprecated.nix
+++ b/lib/deprecated.nix
@@ -411,7 +411,7 @@ rec {
nixType = x:
if isAttrs x then
if x ? outPath then "derivation"
- else "aattrs"
+ else "attrs"
else if isFunction x then "function"
else if isList x then "list"
else if x == true then "bool"
diff --git a/lib/licenses.nix b/lib/licenses.nix
index 107296089d0..4703587ed56 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -85,6 +85,26 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Creative Commons Zero v1.0 Universal";
};
+ cc-by-nc-sa-20 = spdx {
+ spdxId = "CC-BY-NC-SA-2.0";
+ fullName = "Creative Commons Attribution Non Commercial Share Alike 2.0";
+ };
+
+ cc-by-nc-sa-25 = spdx {
+ spdxId = "CC-BY-NC-SA-2.5";
+ fullName = "Creative Commons Attribution Non Commercial Share Alike 2.5";
+ };
+
+ cc-by-nc-sa-30 = spdx {
+ spdxId = "CC-BY-NC-SA-3.0";
+ fullName = "Creative Commons Attribution Non Commercial Share Alike 3.0";
+ };
+
+ cc-by-nc-sa-40 = spdx {
+ spdxId = "CC-BY-NC-SA-4.0";
+ fullName = "Creative Commons Attribution Non Commercial Share Alike 4.0";
+ };
+
cc-by-sa-25 = spdx {
spdxId = "CC-BY-SA-2.5";
fullName = "Creative Commons Attribution Share Alike 2.5";
@@ -402,6 +422,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "TCL/TK License";
};
+ ufl = {
+ fullName = "Ubuntu Font License 1.0";
+ url = http://font.ubuntu.com/ufl/ubuntu-font-licence-1.0.txt;
+ };
+
unfree = {
fullName = "Unfree";
free = false;
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index b64c236bde3..db6a55a283f 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -7,6 +7,7 @@
so it's easy to ping a package @maintainer.
*/
+ aaronschif = "Aaron Schif ";
a1russell = "Adam Russell ";
abaldeau = "Andreas Baldeau ";
abbradar = "Nikolay Amiantov ";
@@ -26,6 +27,7 @@
anderspapitto = "Anders Papitto ";
andres = "Andres Loeh ";
andrewrk = "Andrew Kelley ";
+ aneeshusa = "Aneesh Agrawal ";
antono = "Antono Vasiljev ";
ardumont = "Antoine R. Dumont ";
aristid = "Aristid Breitkreuz ";
@@ -38,6 +40,7 @@
aycanirican = "Aycan iRiCAN ";
badi = "Badi' Abdul-Wahid ";
balajisivaraman = "Balaji Sivaraman";
+ Baughn = "Svein Ove Aas ";
bbenoist = "Baptist BENOIST ";
bcarrell = "Brandon Carrell ";
bcdarwin = "Ben Darwin ";
@@ -64,6 +67,7 @@
chattered = "Phil Scott ";
christopherpoole = "Christopher Mark Poole ";
coconnor = "Corey O'Connor ";
+ codsl = "codsl ";
codyopel = "Cody Opel ";
copumpkin = "Dan Peebles ";
coroa = "Jonas Hörsch ";
@@ -76,10 +80,12 @@
dbohdan = "Danyil Bohdan ";
DerGuteMoritz = "Moritz Heidkamp ";
deepfire = "Kosyrev Serge <_deepfire@feelingofgreen.ru>";
+ demin-dmitriy = "Dmitriy Demin ";
desiderius = "Didier J. Devroye ";
devhell = "devhell <\"^\"@regexmail.net>";
dezgeg = "Tuomas Tynkkynen ";
dfoxfranke = "Daniel Fox Franke ";
+ dgonyeo = "Derek Gonyeo ";
dmalikov = "Dmitry Malikov ";
dochang = "Desmond O. Chang ";
doublec = "Chris Double ";
@@ -89,18 +95,21 @@
edwtjo = "Edward Tjörnhammar ";
eelco = "Eelco Dolstra ";
eikek = "Eike Kettner ";
+ elasticdog = "Aaron Bull Schaefer ";
ellis = "Ellis Whitehead ";
- emery = "Emery Hemingway ";
- enolan = "Echo Nolan ";
+ ehmry = "Emery Hemingway ";
epitrochoid = "Mabry Cervin ";
ericbmerritt = "Eric Merritt ";
+ ericsagnes = "Eric Sagnes ";
erikryb = "Erik Rybakken ";
ertes = "Ertugrul Söylemez ";
+ exi = "Reno Reckling ";
exlevan = "Alexey Levan ";
falsifian = "James Cook ";
flosse = "Markus Kohlhase ";
fluffynukeit = "Daniel Austin ";
forkk = "Andrew Okin ";
+ fornever = "Friedrich von Never ";
fpletz = "Franz Pletz ";
fps = "Florian Paul Schmidt ";
fridh = "Frederik Rietdijk ";
@@ -115,7 +124,8 @@
gebner = "Gabriel Ebner ";
gfxmonk = "Tim Cuthbertson ";
giogadi = "Luis G. Torres ";
- globin = "Robin Gloster ";
+ gleber = "Gleb Peregud ";
+ globin = "Robin Gloster ";
goibhniu = "Cillian de Róiste ";
gridaphobe = "Eric Seidel ";
guibert = "David Guibert ";
@@ -137,7 +147,8 @@
jcumming = "Jack Cummings ";
jefdaj = "Jeffrey David Johnson ";
jfb = "James Felix Black ";
- jgeerds = "Jascha Geerds ";
+ jgeerds = "Jascha Geerds ";
+ jgillich = "Jakob Gillich ";
jirkamarsik = "Jirka Marsik ";
joachifm = "Joachim Fasting ";
joamaki = "Jussi Maki ";
@@ -149,6 +160,7 @@
jzellner = "Jeff Zellner ";
kamilchm = "Kamil Chmielewski ";
kampfschlaefer = "Arnold Krille ";
+ kevincox = "Kevin Cox ";
khumba = "Bryan Gardiner ";
kkallio = "Karn Kallio ";
koral = "Koral ";
@@ -160,6 +172,7 @@
lebastr = "Alexander Lebedev ";
leonardoce = "Leonardo Cecchi ";
lethalman = "Luca Bruno ";
+ lewo = "Antoine Eiche ";
lhvwb = "Nathaniel Baxter ";
lihop = "Leroy Hopson ";
linquize = "Linquize ";
@@ -170,6 +183,8 @@
lsix = "Lancelot SIX ";
ludo = "Ludovic Courtès ";
lukego = "Luke Gorrie ";
+ luispedro = "Luis Pedro Coelho ";
+ lw = "Sergey Sofeychuk ";
madjar = "Georges Dubus ";
magnetophon = "Bart Brouns ";
mahe = "Matthias Herrmann ";
@@ -177,11 +192,14 @@
malyn = "Michael Alyn Miller ";
manveru = "Michael Fellinger ";
marcweber = "Marc Weber ";
+ markWot = "Markus Wotringer ";
maurer = "Matthew Maurer ";
matejc = "Matej Cotman ";
mathnerd314 = "Mathnerd314 ";
matthiasbeyer = "Matthias Beyer ";
mbakke = "Marius Bakke ";
+ mbe = "Brandon Edens ";
+ mcmtroffaes = "Matthias C. M. Troffaes ";
meditans = "Carlo Nucera ";
meisternu = "Matt Miemiec ";
michelk = "Michel Kuhlmann ";
@@ -189,14 +207,17 @@
mirdhyn = "Merlin Gaillard ";
mschristiansen = "Mikkel Christiansen ";
modulistic = "Pablo Costa ";
+ mog = "Matthew O'Gorman ";
mornfall = "Petr Ročkai ";
MP2E = "Cray Elliott ";
msackman = "Matthew Sackman ";
+ msteen = "Matthijs Steen ";
mtreskin = "Max Treskin ";
mudri = "James Wood ";
muflax = "Stefan Dorn ";
nathan-gs = "Nathan Bijnens ";
nckx = "Tobias Geerinckx-Rice ";
+ nequissimus = "Tim Steinbach ";
nico202 = "Nicolò Balzarotti ";
notthemessiah = "Brian Cohen ";
np = "Nicolas Pouillard ";
@@ -208,23 +229,28 @@
olcai = "Erik Timan ";
orbitz = "Malcolm Matalka ";
osener = "Ozan Sener ";
+ oxij = "Jan Malakhovski ";
page = "Carles Pagès ";
paholg = "Paho Lurie-Gregg ";
pakhfn = "Fedor Pakhomov ";
+ palo = "Ingolf Wanger ";
pashev = "Igor Pashev ";
pesterhazy = "Paulus Esterhazy ";
- phausmann = "Philipp Hausmann ";
+ phile314 = "Philipp Hausmann ";
philandstuff = "Philip Potter ";
phreedom = "Evgeny Egorochkin ";
+ phunehehe = "Hoang Xuan Phu ";
pierron = "Nicolas B. Pierron ";
piotr = "Piotr Pietraszkiewicz ";
pjbarnoy = "Perry Barnoy ";
pjones = "Peter Jones ";
pkmx = "Chih-Mao Chen ";
plcplc = "Philip Lykke Carlsen ";
+ Phlogistique = "Noé Rubinstein ";
pmahoney = "Patrick Mahoney ";
pmiddend = "Philipp Middendorf ";
prikhi = "Pavan Rikhi ";
+ profpatsch = "Profpatsch ";
psibi = "Sibi ";
pSub = "Pascal Wittmann ";
puffnfresh = "Brian McKenna ";
@@ -237,14 +263,17 @@
renzo = "Renzo Carbonara ";
rick68 = "Wei-Ming Yang ";
rickynils = "Rickard Nilsson ";
+ rnhmjoj = "Michele Guerini Rocco ";
rob = "Rob Vermaas ";
robberer = "Longrin Wischnewski ";
robbinch = "Robbin C. ";
+ robgssp = "Rob Glossop ";
roconnor = "Russell O'Connor ";
- roelof = "Roelof Wobben ";
romildo = "José Romildo Malaquias ";
rszibele = "Richard Szibele ";
rushmorem = "Rushmore Mushambi ";
+ rvl = "Rodney Lorrimar ";
+ rvlander = "Gaëtan André ";
rycee = "Robert Helgesson ";
samuelrivas = "Samuel Rivas ";
sander = "Sander van der Burg ";
@@ -258,31 +287,42 @@
simonvandel = "Simon Vandel Sillesen ";
sjagoe = "Simon Jagoe ";
sjmackenzie = "Stewart Mackenzie ";
+ sjourdois = "Stéphane ‘kwisatz’ Jourdois ";
skeidel = "Sven Keidel ";
smironov = "Sergey Mironov ";
spacefrogg = "Michael Raitza ";
+ spencerjanssen = "Spencer Janssen ";
+ spinus = "Tomasz Czyż ";
sprock = "Roger Mason ";
spwhitt = "Spencer Whitt ";
stephenmw = "Stephen Weinberg ";
+ steveej = "Stefan Junker ";
szczyp = "Szczyp ";
sztupi = "Attila Sztupak ";
+ taeer = "Taeer Bar-Yam ";
tailhook = "Paul Colomiets ";
taktoa = "Remy Goldschmidt ";
+ tavyc = "Octavian Cerna ";
telotortium = "Robert Irelan ";
+ thall = "Niclas Thall ";
thammers = "Tobias Hammerschmidt ";
the-kenny = "Moritz Ulrich ";
theuni = "Christian Theune ";
thoughtpolice = "Austin Seipp ";
titanous = "Jonathan Rudenberg ";
+ tohl = "Tomas Hlavaty ";
+ tokudan = "Daniel Frank ";
tomberek = "Thomas Bereknyei ";
travisbhartwell = "Travis B. Hartwell ";
trino = "Hubert Mühlhans ";
tstrobel = "Thomas Strobel ";
ttuegel = "Thomas Tuegel ";
tv = "Tomislav Viljetić ";
+ tvestelind = "Tomas Vestelind ";
twey = "James ‘Twey’ Kay ";
urkud = "Yury G. Kudryashov ";
vandenoever = "Jos van den Oever ";
+ vanzef = "Ivan Solyankin ";
vbgl = "Vincent Laporte ";
vbmithr = "Vincent Bernardoff ";
vcunat = "Vladimír Čunát ";
@@ -291,6 +331,8 @@
vlstill = "Vladimír Štill ";
vmandela = "Venkateswara Rao Mandela ";
vozz = "Oliver Hunt ";
+ wedens = "wedens ";
+ willtim = "Tim Philip Williams ";
winden = "Antonio Vargas Gonzalez ";
wizeman = "Ricardo M. Correia ";
wjlroe = "William Roe ";
@@ -301,8 +343,10 @@
wyvie = "Elijah Rum ";
yarr = "Dmitry V. ";
z77z = "Marco Maggesi ";
+ zagy = "Christian Zagrodnick ";
zef = "Zef Hemel ";
zimbatm = "zimbatm ";
+ zohl = "Al Zohali ";
zoomulator = "Kim Simmons ";
Gonzih = "Max Gonzih ";
}
diff --git a/lib/minver.nix b/lib/minver.nix
new file mode 100644
index 00000000000..4f448266d06
--- /dev/null
+++ b/lib/minver.nix
@@ -0,0 +1,2 @@
+# Expose the minimum required version for evaluating Nixpkgs
+"1.10"
diff --git a/lib/platforms.nix b/lib/platforms.nix
index 825cc4136a1..750829da375 100644
--- a/lib/platforms.nix
+++ b/lib/platforms.nix
@@ -8,8 +8,9 @@ rec {
openbsd = ["i686-openbsd" "x86_64-openbsd"];
netbsd = ["i686-netbsd" "x86_64-netbsd"];
cygwin = ["i686-cygwin" "x86_64-cygwin"];
- unix = linux ++ darwin ++ freebsd ++ openbsd;
- all = linux ++ darwin ++ cygwin ++ freebsd ++ openbsd;
+ illumos = ["x86_64-solaris"];
+ unix = linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
+ all = linux ++ darwin ++ cygwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
none = [];
allBut = platforms: lists.filter (x: !(builtins.elem x platforms)) all;
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux"];
diff --git a/lib/sandbox.nix b/lib/sandbox.nix
new file mode 100644
index 00000000000..414bf36f779
--- /dev/null
+++ b/lib/sandbox.nix
@@ -0,0 +1,47 @@
+with import ./strings.nix;
+
+/* Helpers for creating lisp S-exprs for the Apple sandbox
+
+lib.sandbox.allowFileRead [ "/usr/bin/file" ];
+ # => "(allow file-read* (literal \"/usr/bin/file\"))";
+
+lib.sandbox.allowFileRead {
+ literal = [ "/usr/bin/file" ];
+ subpath = [ "/usr/lib/system" ];
+}
+ # => "(allow file-read* (literal \"/usr/bin/file\") (subpath \"/usr/lib/system\"))"
+*/
+
+let
+
+sexp = tokens: "(" + builtins.concatStringsSep " " tokens + ")";
+generateFileList = files:
+ if builtins.isList files
+ then concatMapStringsSep " " (x: sexp [ "literal" ''"${x}"'' ]) files
+ else if builtins.isString files
+ then generateFileList [ files ]
+ else concatStringsSep " " (
+ (map (x: sexp [ "literal" ''"${x}"'' ]) (files.literal or [])) ++
+ (map (x: sexp [ "subpath" ''"${x}"'' ]) (files.subpath or []))
+ );
+applyToFiles = f: act: files: f "${act} ${generateFileList files}";
+genActions = actionName: let
+ action = feature: sexp [ actionName feature ];
+ self = {
+ "${actionName}" = action;
+ "${actionName}File" = applyToFiles action "file*";
+ "${actionName}FileRead" = applyToFiles action "file-read*";
+ "${actionName}FileReadMetadata" = applyToFiles action "file-read-metadata";
+ "${actionName}DirectoryList" = self."${actionName}FileReadMetadata";
+ "${actionName}FileWrite" = applyToFiles action "file-write*";
+ "${actionName}FileWriteMetadata" = applyToFiles action "file-write-metadata";
+ };
+ in self;
+
+in
+
+genActions "allow" // genActions "deny" // {
+ importProfile = derivation: ''
+ (import "${derivation}")
+ '';
+}
diff --git a/lib/strings.nix b/lib/strings.nix
index e72bdc6d968..fc6c2152b9f 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -52,6 +52,10 @@ rec {
# libraries for a set of packages, e.g. "${pkg1}/lib:${pkg2}/lib:...".
makeLibraryPath = makeSearchPath "lib";
+ # Construct a binary search path (such as $PATH) containing the
+ # binaries for a set of packages, e.g. "${pkg1}/bin:${pkg2}/bin:...".
+ makeBinPath = makeSearchPath "bin";
+
# Idem for Perl search paths.
makePerlPath = makeSearchPath "lib/perl5/site_perl";
@@ -185,9 +189,13 @@ rec {
versionAtLeast = v1: v2: !versionOlder v1 v2;
- # Get the version of the specified derivation, as specified in its
- # ‘name’ attribute.
- getVersion = drv: (builtins.parseDrvName drv.name).version;
+ # This function takes an argument that's either a derivation or a
+ # derivation's "name" attribute and extracts the version part from that
+ # argument. For example:
+ #
+ # lib.getVersion "youtube-dl-2016.01.01" ==> "2016.01.01"
+ # lib.getVersion pkgs.youtube-dl ==> "2016.01.01"
+ getVersion = x: (builtins.parseDrvName (x.name or x)).version;
# Extract name with version from URL. Ask for separator which is
@@ -223,4 +231,27 @@ rec {
# Check whether a value is a store path.
isStorePath = x: builtins.substring 0 1 (toString x) == "/" && dirOf (builtins.toPath x) == builtins.storeDir;
+ # Convert string to int
+ # Obviously, it is a bit hacky to use fromJSON that way.
+ toInt = str:
+ let may_be_int = builtins.fromJSON str; in
+ if builtins.isInt may_be_int
+ then may_be_int
+ else throw "Could not convert ${str} to int.";
+
+ # Read a list of paths from `file', relative to the `rootPath'. Lines
+ # beginning with `#' are treated as comments and ignored. Whitespace
+ # is significant.
+ readPathsFromFile = rootPath: file:
+ let
+ root = toString rootPath;
+ lines =
+ builtins.map (lib.removeSuffix "\n")
+ (lib.splitString "\n" (builtins.readFile file));
+ removeComments = lib.filter (line: !(lib.hasPrefix "#" line));
+ relativePaths = removeComments lines;
+ absolutePaths = builtins.map (path: builtins.toPath (root + "/" + path)) relativePaths;
+ in
+ absolutePaths;
+
}
diff --git a/lib/tests.nix b/lib/tests.nix
index 298bdffc379..c3b8839fda9 100644
--- a/lib/tests.nix
+++ b/lib/tests.nix
@@ -7,7 +7,7 @@ runTests {
expr = id 1;
expected = 1;
};
-
+
testConst = {
expr = const 2 3;
expected = 2;
@@ -19,12 +19,12 @@ runTests {
expected = true;
};
*/
-
+
testAnd = {
expr = and true false;
expected = false;
};
-
+
testFix = {
expr = fix (x: {a = if x ? a then "a" else "b";});
expected = {a = "a";};
@@ -67,7 +67,7 @@ runTests {
};
testOverridableDelayableArgsTest = {
- expr =
+ expr =
let res1 = defaultOverridableDelayableArgs id {};
res2 = defaultOverridableDelayableArgs id { a = 7; };
res3 = let x = defaultOverridableDelayableArgs id { a = 7; };
@@ -87,7 +87,7 @@ runTests {
in (x2.replace) { a = 10; }; # and override the value by 10
# fixed tests (delayed args): (when using them add some comments, please)
- resFixed1 =
+ resFixed1 =
let x = defaultOverridableDelayableArgs id ( x : { a = 7; c = x.fixed.b; });
y = x.merge (x : { name = "name-${builtins.toString x.fixed.c}"; });
in (y.merge) { b = 10; };
@@ -109,5 +109,25 @@ runTests {
expr = sort builtins.lessThan [ 40 2 30 42 ];
expected = [2 30 40 42];
};
-
+
+ testToIntShouldConvertStringToInt = {
+ expr = toInt "27";
+ expected = 27;
+ };
+
+ testToIntShouldThrowErrorIfItCouldNotConvertToInt = {
+ expr = builtins.tryEval (toInt "\"foo\"");
+ expected = { success = false; value = false; };
+ };
+
+ testHasAttrByPathTrue = {
+ expr = hasAttrByPath ["a" "b"] { a = { b = "yey"; }; };
+ expected = true;
+ };
+
+ testHasAttrByPathFalse = {
+ expr = hasAttrByPath ["a" "b"] { a = { c = "yey"; }; };
+ expected = false;
+ };
+
}
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 9fd5a7e1c57..cda8aa08a20 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -12,8 +12,46 @@ rec {
and = x: y: x && y;
mergeAttrs = x: y: x // y;
- # Take a function and evaluate it with its own returned value.
- fix = f: let result = f result; in result;
+ # Compute the fixed point of the given function `f`, which is usually an
+ # attribute set that expects its final, non-recursive representation as an
+ # argument:
+ #
+ # f = self: { foo = "foo"; bar = "bar"; foobar = self.foo + self.bar; }
+ #
+ # Nix evaluates this recursion until all references to `self` have been
+ # resolved. At that point, the final result is returned and `f x = x` holds:
+ #
+ # nix-repl> fix f
+ # { bar = "bar"; foo = "foo"; foobar = "foobar"; }
+ #
+ # See https://en.wikipedia.org/wiki/Fixed-point_combinator for further
+ # details.
+ fix = f: let x = f x; in x;
+
+ # A variant of `fix` that records the original recursive attribute set in the
+ # result. This is useful in combination with the `extends` function to
+ # implement deep overriding. See pkgs/development/haskell-modules/default.nix
+ # for a concrete example.
+ fix' = f: let x = f x // { __unfix__ = f; }; in x;
+
+ # Modify the contents of an explicitly recursive attribute set in a way that
+ # honors `self`-references. This is accomplished with a function
+ #
+ # g = self: super: { foo = super.foo + " + "; }
+ #
+ # that has access to the unmodified input (`super`) as well as the final
+ # non-recursive representation of the attribute set (`self`). `extends`
+ # differs from the native `//` operator insofar as that it's applied *before*
+ # references to `self` are resolved:
+ #
+ # nix-repl> fix (extends g f)
+ # { bar = "bar"; foo = "foo + "; foobar = "foo + bar"; }
+ #
+ # The name of the function is inspired by object-oriented inheritance, i.e.
+ # think of it as an infix operator `g extends f` that mimics the syntax from
+ # Java. It may seem counter-intuitive to have the "base class" as the second
+ # argument, but it's nice this way if several uses of `extends` are cascaded.
+ extends = f: rattrs: self: let super = rattrs self; in super // f self super;
# Flip the order of the arguments of a binary function.
flip = f: a: b: f b a;
diff --git a/lib/types.nix b/lib/types.nix
index 7276f9af9fe..b833417e73d 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -193,9 +193,9 @@ rec {
nullOr = elemType: mkOptionType {
name = "null or ${elemType.name}";
- check = x: builtins.isNull x || elemType.check x;
+ check = x: x == null || elemType.check x;
merge = loc: defs:
- let nrNulls = count (def: isNull def.value) defs; in
+ let nrNulls = count (def: def.value == null) defs; in
if nrNulls == length defs then null
else if nrNulls != 0 then
throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}."
@@ -230,11 +230,18 @@ rec {
substSubModules = m: submodule m;
};
- enum = values: mkOptionType {
- name = "one of ${concatStringsSep ", " values}";
- check = flip elem values;
- merge = mergeOneOption;
- };
+ enum = values:
+ let
+ show = v:
+ if builtins.isString v then ''"${v}"''
+ else if builtins.isInt v then builtins.toString v
+ else ''<${builtins.typeOf v}>'';
+ in
+ mkOptionType {
+ name = "one of ${concatMapStringsSep ", " show values}";
+ check = flip elem values;
+ merge = mergeOneOption;
+ };
either = t1: t2: mkOptionType {
name = "${t1.name} or ${t2.name}";
diff --git a/maintainers/scripts/all-tarballs.nix b/maintainers/scripts/all-tarballs.nix
new file mode 100644
index 00000000000..552f8802296
--- /dev/null
+++ b/maintainers/scripts/all-tarballs.nix
@@ -0,0 +1,18 @@
+/* Helper expression for copy-tarballs. This returns (nearly) all
+ tarballs used the free packages in Nixpkgs.
+
+ Typical usage:
+
+ $ copy-tarballs.pl --expr 'import '
+*/
+
+removeAttrs (import ../../pkgs/top-level/release.nix
+ { # Don't apply ‘hydraJob’ to jobs, because then we can't get to the
+ # dependency graph.
+ scrubJobs = false;
+ # No need to evaluate on i686.
+ supportedSystems = [ "x86_64-linux" ];
+ })
+ [ # Remove jobs whose evaluation depends on a writable Nix store.
+ "tarball" "unstable"
+ ]
diff --git a/maintainers/scripts/copy-tarballs.pl b/maintainers/scripts/copy-tarballs.pl
index c6d77529dd4..b1233827ad8 100755
--- a/maintainers/scripts/copy-tarballs.pl
+++ b/maintainers/scripts/copy-tarballs.pl
@@ -1,97 +1,171 @@
-#! /run/current-system/sw/bin/perl -w
+#! /usr/bin/env nix-shell
+#! nix-shell -i perl -p perl perlPackages.NetAmazonS3 perlPackages.FileSlurp nixUnstable
+
+# This command uploads tarballs to tarballs.nixos.org, the
+# content-addressed cache used by fetchurl as a fallback for when
+# upstream tarballs disappear or change. Usage:
+#
+# 1) To upload a single file:
+#
+# $ copy-tarballs.pl --file /path/to/tarball.tar.gz
+#
+# 2) To upload all files obtained via calls to fetchurl in a Nix derivation:
+#
+# $ copy-tarballs.pl --expr '(import {}).hello'
use strict;
-use XML::Simple;
+use warnings;
use File::Basename;
use File::Path;
-use File::Copy 'cp';
-use IPC::Open2;
+use File::Slurp;
+use JSON;
+use Net::Amazon::S3;
use Nix::Store;
-my $myDir = dirname($0);
+# S3 setup.
+my $aws_access_key_id = $ENV{'AWS_ACCESS_KEY_ID'} or die;
+my $aws_secret_access_key = $ENV{'AWS_SECRET_ACCESS_KEY'} or die;
-my $tarballsCache = $ENV{'NIX_TARBALLS_CACHE'} // "/tarballs";
+my $s3 = Net::Amazon::S3->new(
+ { aws_access_key_id => $aws_access_key_id,
+ aws_secret_access_key => $aws_secret_access_key,
+ retry => 1,
+ });
-my $xml = `nix-instantiate --eval-only --xml --strict ''`;
-die "$0: evaluation failed\n" if $? != 0;
+my $bucket = $s3->bucket("nixpkgs-tarballs") or die;
-my $data = XMLin($xml) or die;
+my $cacheFile = "/tmp/copy-tarballs-cache";
+my %cache;
+$cache{$_} = 1 foreach read_file($cacheFile, err_mode => 'quiet', chomp => 1);
-mkpath($tarballsCache);
-mkpath("$tarballsCache/md5");
-mkpath("$tarballsCache/sha1");
-mkpath("$tarballsCache/sha256");
-
-foreach my $file (@{$data->{list}->{attrs}}) {
- my $url = $file->{attr}->{url}->{string}->{value};
- my $algo = $file->{attr}->{type}->{string}->{value};
- my $hash = $file->{attr}->{hash}->{string}->{value};
-
- if ($url !~ /^http:/ && $url !~ /^https:/ && $url !~ /^ftp:/ && $url !~ /^mirror:/) {
- print STDERR "skipping $url (unsupported scheme)\n";
- next;
+END() {
+ write_file($cacheFile, map { "$_\n" } keys %cache);
+}
+
+sub alreadyMirrored {
+ my ($algo, $hash) = @_;
+ my $key = "$algo/$hash";
+ return 1 if defined $cache{$key};
+ my $res = defined $bucket->get_key($key);
+ $cache{$key} = 1 if $res;
+ return $res;
+}
+
+sub uploadFile {
+ my ($fn, $name) = @_;
+
+ my $md5_16 = hashFile("md5", 0, $fn) or die;
+ my $sha1_16 = hashFile("sha1", 0, $fn) or die;
+ my $sha256_32 = hashFile("sha256", 1, $fn) or die;
+ my $sha256_16 = hashFile("sha256", 0, $fn) or die;
+ my $sha512_32 = hashFile("sha512", 1, $fn) or die;
+ my $sha512_16 = hashFile("sha512", 0, $fn) or die;
+
+ my $mainKey = "sha512/$sha512_16";
+
+ # Create redirects from the other hash types.
+ sub redirect {
+ my ($name, $dest) = @_;
+ #print STDERR "linking $name to $dest...\n";
+ $bucket->add_key($name, "", { 'x-amz-website-redirect-location' => "/" . $dest })
+ or die "failed to create redirect from $name to $dest\n";
+ $cache{$name} = 1;
}
-
- $url =~ /([^\/]+)$/;
- my $fn = $1;
-
- if (!defined $fn) {
- print STDERR "skipping $url (no file name)\n";
- next;
- }
-
- if ($fn =~ /[&?=%]/ || $fn =~ /^\./) {
- print STDERR "skipping $url (bad character in file name)\n";
- next;
- }
-
- if ($fn !~ /[a-zA-Z]/) {
- print STDERR "skipping $url (no letter in file name)\n";
- next;
+ redirect "md5/$md5_16", $mainKey;
+ redirect "sha1/$sha1_16", $mainKey;
+ redirect "sha256/$sha256_32", $mainKey;
+ redirect "sha256/$sha256_16", $mainKey;
+ redirect "sha512/$sha512_32", $mainKey;
+
+ # Upload the file as sha512/.
+ print STDERR "uploading $fn to $mainKey...\n";
+ $bucket->add_key_filename($mainKey, $fn, { 'x-amz-meta-original-name' => $name })
+ or die "failed to upload $fn to $mainKey\n";
+ $cache{$mainKey} = 1;
+}
+
+my $op = shift @ARGV;
+
+if ($op eq "--file") {
+ my $res = 0;
+ foreach my $fn (@ARGV) {
+ eval {
+ if (alreadyMirrored("sha512", hashFile("sha512", 0, $fn))) {
+ print STDERR "$fn is already mirrored\n";
+ } else {
+ uploadFile($fn, basename $fn);
+ }
+ };
+ if ($@) {
+ warn "$@\n";
+ $res = 1;
+ }
}
-
- if ($fn !~ /[0-9]/) {
- print STDERR "skipping $url (no digit in file name)\n";
- next;
+ exit $res;
+}
+
+elsif ($op eq "--expr") {
+
+ # Evaluate find-tarballs.nix.
+ my $expr = $ARGV[0] // die "$0: --expr requires a Nix expression\n";
+ my $pid = open(JSON, "-|", "nix-instantiate", "--eval", "--json", "--strict",
+ "",
+ "--arg", "expr", $expr);
+ my $stdout = ;
+ waitpid($pid, 0);
+ die "$0: evaluation failed\n" if $?;
+ close JSON;
+
+ my $fetches = decode_json($stdout);
+
+ print STDERR "evaluation returned ", scalar(@{$fetches}), " tarballs\n";
+
+ # Check every fetchurl call discovered by find-tarballs.nix.
+ my $mirrored = 0;
+ my $have = 0;
+ foreach my $fetch (@{$fetches}) {
+ my $url = $fetch->{url};
+ my $algo = $fetch->{type};
+ my $hash = $fetch->{hash};
+
+ if (defined $ENV{DEBUG}) {
+ print "$url $algo $hash\n";
+ next;
+ }
+
+ if ($url !~ /^http:/ && $url !~ /^https:/ && $url !~ /^ftp:/ && $url !~ /^mirror:/) {
+ print STDERR "skipping $url (unsupported scheme)\n";
+ next;
+ }
+
+ if (alreadyMirrored($algo, $hash)) {
+ $have++;
+ next;
+ }
+
+ print STDERR "mirroring $url...\n";
+
+ next if $ENV{DRY_RUN};
+
+ # Download the file using nix-prefetch-url.
+ $ENV{QUIET} = 1;
+ $ENV{PRINT_PATH} = 1;
+ my $fh;
+ my $pid = open($fh, "-|", "nix-prefetch-url", "--type", $algo, $url, $hash) or die;
+ waitpid($pid, 0) or die;
+ if ($? != 0) {
+ print STDERR "failed to fetch $url: $?\n";
+ next;
+ }
+ <$fh>; my $storePath = <$fh>; chomp $storePath;
+
+ uploadFile($storePath, $url);
+ $mirrored++;
}
-
- if ($fn !~ /[-_\.]/) {
- print STDERR "skipping $url (no dash/dot/underscore in file name)\n";
- next;
- }
-
- my $dstPath = "$tarballsCache/$fn";
-
- next if -e $dstPath;
-
- print "downloading $url to $dstPath...\n";
-
- next if $ENV{DRY_RUN};
-
- $ENV{QUIET} = 1;
- $ENV{PRINT_PATH} = 1;
- my $fh;
- my $pid = open($fh, "-|", "nix-prefetch-url", "--type", $algo, $url, $hash) or die;
- waitpid($pid, 0) or die;
- if ($? != 0) {
- print STDERR "failed to fetch $url: $?\n";
- next;
- }
- <$fh>; my $storePath = <$fh>; chomp $storePath;
-
- die unless -e $storePath;
-
- cp($storePath, $dstPath) or die;
-
- my $md5 = hashFile("md5", 0, $storePath) or die;
- symlink("../$fn", "$tarballsCache/md5/$md5");
-
- my $sha1 = hashFile("sha1", 0, $storePath) or die;
- symlink("../$fn", "$tarballsCache/sha1/$sha1");
- my $sha256 = hashFile("sha256", 0, $storePath) or die;
- symlink("../$fn", "$tarballsCache/sha256/$sha256");
+ print STDERR "mirrored $mirrored files, already have $have files\n";
+}
- $sha256 = hashFile("sha256", 1, $storePath) or die;
- symlink("../$fn", "$tarballsCache/sha256/$sha256");
+else {
+ die "Syntax: $0 --file FILENAMES... | --expr EXPR\n";
}
diff --git a/maintainers/scripts/dep-licenses.sh b/maintainers/scripts/dep-licenses.sh
index 48c1efdeebc..28ad22c334f 100755
--- a/maintainers/scripts/dep-licenses.sh
+++ b/maintainers/scripts/dep-licenses.sh
@@ -17,7 +17,7 @@ trap "exitHandler" EXIT
# fetch the trace and the drvPath of the attribute.
nix-instantiate $NIXPKGS -A $attr --show-trace > "$tmp/drvPath" 2> "$tmp/trace" || {
cat 1>&2 - "$tmp/trace" <&2
+ echo "Usage: $0 gnome_dir || [major.minor]" >&2
+ echo "gnome_dir is for example pkgs/desktops/gnome-3/3.18" >&2
exit 0
}
-if [ "$#" -lt 1 ]; then
+if [ "$#" -lt 2 ]; then
usage
fi
+GNOME_TOP="$1"
+shift
+
action="$1"
-project="$2"
-majorVersion="$3"
-
-if [ "$action" != "show" ] && [ "$action" != "update" ]; then
- echo "Unknown action $action" >&2
- usage
-fi
-
-if [ -z "$project" ]; then
- echo "No project specified, exiting"
- exit 1
-fi
# curl -l ftp://... doesn't work from my office in HSE, and I don't want to have
# any conversations with sysadmin. Somehow lftp works.
@@ -39,79 +35,93 @@ else
}
fi
-if [ -z "$majorVersion" ]; then
- echo "Looking for available versions..." >&2
- available_baseversions=( `ls_ftp ftp://${GNOME_FTP}/${project} | grep '[0-9]\.[0-9]' | sort -t. -k1,1n -k 2,2n` )
- if [ "$?" -ne "0" ]; then
- echo "Project $project not found" >&2
- exit 1
+find_project() {
+ exec find "$GNOME_TOP" -mindepth 2 -maxdepth 2 -type d $@
+}
+
+show_project() {
+ local project="$1"
+ local majorVersion="$2"
+ local version=""
+
+ if [ -z "$majorVersion" ]; then
+ echo "Looking for available versions..." >&2
+ local available_baseversions=( `ls_ftp ftp://${GNOME_FTP}/${project} | grep '[0-9]\.[0-9]' | sort -t. -k1,1n -k 2,2n` )
+ if [ "$?" -ne "0" ]; then
+ echo "Project $project not found" >&2
+ return 1
+ fi
+
+ echo -e "The following versions are available:\n ${available_baseversions[@]}" >&2
+ echo -en "Choose one of them: " >&2
+ read majorVersion
fi
- echo -e "The following versions are available:\n ${available_baseversions[@]}" >&2
- echo -en "Choose one of them: " >&2
- read majorVersion
-fi
-
-if echo "$majorVersion" | grep -q "[0-9]\+\.[0-9]\+\.[0-9]\+"; then
- # not a major version
- version="$majorVersion"
- majorVersion=$(echo "$majorVersion" | cut -d '.' -f 1,2)
-fi
-
-FTPDIR="${GNOME_FTP}/${project}/${majorVersion}"
-
-#version=`curl -l ${FTPDIR}/ 2>/dev/null | grep LATEST-IS | sed -e s/LATEST-IS-//`
-# gnome's LATEST-IS is broken. Do not trust it.
-
-if [ -z "$version" ]; then
- files=$(ls_ftp "${FTPDIR}")
- declare -A versions
-
- for f in $files; do
- case $f in
- (LATEST-IS-*|*.news|*.changes|*.sha256sum|*.diff*):
- ;;
- ($project-*.*.9*.tar.*):
- tmp=${f#$project-}
- tmp=${tmp%.tar*}
- echo "Ignored unstable version ${tmp}" >&2
- ;;
- ($project-*.tar.*):
- tmp=${f#$project-}
- tmp=${tmp%.tar*}
- versions[${tmp}]=1
- ;;
- (*):
- echo "UNKNOWN FILE $f"
- ;;
- esac
- done
- echo "Found versions ${!versions[@]}" >&2
- version=`echo ${!versions[@]} | sed -e 's/ /\n/g' | sort -t. -k1,1n -k 2,2n -k 3,3n | tail -n1`
- echo "Latest version is: ${version}" >&2
-fi
-
-name=${project}-${version}
-echo "Fetching .sha256 file" >&2
-sha256out=$(curl -s -f http://${FTPDIR}/${name}.sha256sum)
-
-if [ "$?" -ne "0" ]; then
- echo "Version not found" >&2
- exit 1
-fi
-
-extensions=( "xz" "bz2" "gz" )
-echo "Choosing archive extension (known are ${extensions[@]})..." >&2
-for ext in ${extensions[@]}; do
- if echo -e "$sha256out" | grep -q "\\.tar\\.${ext}$"; then
- ext_pref=$ext
- sha256=$(echo -e "$sha256out" | grep "\\.tar\\.${ext}$" | cut -f1 -d\ )
- break
+ if echo "$majorVersion" | grep -q "[0-9]\+\.[0-9]\+\.[0-9]\+"; then
+ # not a major version
+ version="$majorVersion"
+ majorVersion=$(echo "$majorVersion" | cut -d '.' -f 1,2)
fi
-done
-echo "Chosen ${ext_pref}, hash is ${sha256}" >&2
+
+ local FTPDIR="${GNOME_FTP}/${project}/${majorVersion}"
+
+ #version=`curl -l ${FTPDIR}/ 2>/dev/null | grep LATEST-IS | sed -e s/LATEST-IS-//`
+ # gnome's LATEST-IS is broken. Do not trust it.
+
+ if [ -z "$version" ]; then
+ local files=$(ls_ftp "${FTPDIR}")
+ declare -A versions
+
+ for f in $files; do
+ case $f in
+ (LATEST-IS-*|*.news|*.changes|*.sha256sum|*.diff*):
+ ;;
+ ($project-*.*.9*.tar.*):
+ tmp=${f#$project-}
+ tmp=${tmp%.tar*}
+ echo "Ignored unstable version ${tmp}" >&2
+ ;;
+ ($project-*.tar.*):
+ tmp=${f#$project-}
+ tmp=${tmp%.tar*}
+ versions[${tmp}]=1
+ ;;
+ (*):
+ echo "UNKNOWN FILE $f" >&2
+ ;;
+ esac
+ done
+ echo "Found versions ${!versions[@]}" >&2
+ version=`echo ${!versions[@]} | sed -e 's/ /\n/g' | sort -t. -k1,1n -k 2,2n -k 3,3n | tail -n1`
+ if [ -z "$version" ]; then
+ echo "No version available for major $majorVersion" >&2
+ return 1
+ fi
-src="# Autogenerated by maintainers/scripts/gnome.sh update
+ echo "Latest version is: ${version}" >&2
+ fi
+
+ local name=${project}-${version}
+ echo "Fetching .sha256 file" >&2
+ local sha256out=$(curl -s -f http://${FTPDIR}/${name}.sha256sum)
+
+ if [ "$?" -ne "0" ]; then
+ echo "Version not found" >&2
+ return 1
+ fi
+
+ extensions=( "xz" "bz2" "gz" )
+ echo "Choosing archive extension (known are ${extensions[@]})..." >&2
+ for ext in ${extensions[@]}; do
+ if echo -e "$sha256out" | grep -q "\\.tar\\.${ext}$"; then
+ ext_pref=$ext
+ sha256=$(echo -e "$sha256out" | grep "\\.tar\\.${ext}$" | cut -f1 -d\ )
+ break
+ fi
+ done
+ echo "Chosen ${ext_pref}, hash is ${sha256}" >&2
+
+ echo "# Autogenerated by maintainers/scripts/gnome.sh update
fetchurl: {
name = \"${project}-${version}\";
@@ -122,17 +132,63 @@ fetchurl: {
};
}"
-if [ "$action" == "update" ]; then
+ return 0
+}
+
+update_project() {
+ local project="$1"
+ local majorVersion="$2"
+
# find project in nixpkgs tree
- GNOME_TOP=$(readlink -e $(dirname "${BASH_SOURCE[0]}")"/../../pkgs/desktops/gnome-3/")
- projectPath=$(find "$GNOME_TOP" -name "$project" -print)
+ projectPath=$(find_project -name "$project" -print)
if [ -z "$projectPath" ]; then
echo "Project $project not found under $GNOME_TOP"
exit 1
fi
- echo "Updating $projectPath/src.nix"
- echo -e "$src" > "$projectPath/src.nix"
+ src=$(show_project "$project" "$majorVersion")
+
+ if [ "$?" -eq "0" ]; then
+ echo "Updating $projectPath/src.nix" >&2
+ echo -e "$src" > "$projectPath/src.nix"
+ fi
+
+ return 0
+}
+
+if [ "$action" == "update-all" ]; then
+ majorVersion="$2"
+ if [ -z "$majorVersion" ]; then
+ echo "No major version specified" >&2
+ usage
+ fi
+
+ # find projects
+ projects=$(find_project -exec basename '{}' \;)
+ for project in $projects; do
+ if echo "$NO_GNOME_MAJOR"|grep -q $project; then
+ echo "Skipping $project"
+ else
+ echo "= Updating $project to $majorVersion" >&2
+ update_project $project $majorVersion
+ echo >&2
+ fi
+ done
else
- echo -e "\n$src"
-fi
\ No newline at end of file
+ project="$2"
+ majorVersion="$3"
+
+ if [ -z "$project" ]; then
+ echo "No project specified, exiting" >&2
+ usage
+ fi
+
+ if [ "$action" == "show" ]; then
+ show_project $project $majorVersion
+ elif [ "$action" == "update" ]; then
+ update_project $project $majorVersion
+ else
+ echo "Unknown action $action" >&2
+ usage
+ fi
+fi
diff --git a/maintainers/scripts/vanity.sh b/maintainers/scripts/vanity.sh
index fd8f78ac5ef..c5665ab862a 100755
--- a/maintainers/scripts/vanity.sh
+++ b/maintainers/scripts/vanity.sh
@@ -12,7 +12,7 @@ git_data="$(echo "$raw_git_log" | grep 'Author:' |
# Also there are a few manual entries
maintainers="$(cat "$(dirname "$0")/../../lib/maintainers.nix" |
grep '=' | sed -re 's/\\"/''/g;
- s/ *([^ =]*) *= *" *(.*[^ ]) *[<](.*)[>] *".*/\1\t\2\t\3/')"
+ s/[ ]*([^ =]*)[ ]*=[ ]*" *(.*[^ ]) *[<](.*)[>] *".*/\1\t\2\t\3/')"
git_lines="$( ( echo "$git_data";
cat "$(dirname "$0")/vanity-manual-equalities.txt") | sort |uniq)"
diff --git a/nixos/default.nix b/nixos/default.nix
index 5d69b79e13a..6359d10c880 100644
--- a/nixos/default.nix
+++ b/nixos/default.nix
@@ -1,12 +1,20 @@
{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG"
, system ? builtins.currentSystem
+, extraModules ? []
+ # This attribute is used to specify a different nixos version, a different
+ # system or additional modules which might be set conditionally.
+, reEnter ? false
}:
let
+ reEnterModule = {
+ config.nixos.path = with (import ../lib); mkIf reEnter (mkForce null);
+ config.nixos.configuration = configuration;
+ };
eval = import ./lib/eval-config.nix {
inherit system;
- modules = [ configuration ];
+ modules = [ configuration reEnterModule ] ++ extraModules;
};
inherit (eval) pkgs;
@@ -14,14 +22,14 @@ let
# This is for `nixos-rebuild build-vm'.
vmConfig = (import ./lib/eval-config.nix {
inherit system;
- modules = [ configuration ./modules/virtualisation/qemu-vm.nix ];
+ modules = [ configuration reEnterModule ./modules/virtualisation/qemu-vm.nix ] ++ extraModules;
}).config;
# This is for `nixos-rebuild build-vm-with-bootloader'.
vmWithBootLoaderConfig = (import ./lib/eval-config.nix {
inherit system;
modules =
- [ configuration
+ [ configuration reEnterModule
./modules/virtualisation/qemu-vm.nix
{ virtualisation.useBootLoader = true; }
];
@@ -30,7 +38,7 @@ let
in
{
- inherit (eval) config options;
+ inherit (eval.config.nixos.reflect) config options;
system = eval.config.system.build.toplevel;
diff --git a/nixos/doc/manual/administration/declarative-containers.xml b/nixos/doc/manual/administration/declarative-containers.xml
index 228c45b0c1f..f3f65edcec2 100644
--- a/nixos/doc/manual/administration/declarative-containers.xml
+++ b/nixos/doc/manual/administration/declarative-containers.xml
@@ -22,8 +22,10 @@ containers.database =
If you run nixos-rebuild switch, the container will
-be built and started. If the container was already running, it will be
-updated in place, without rebooting.
+be built. If the container was already running, it will be
+updated in place, without rebooting. The container can be configured to
+start automatically by setting containers.database.autoStart = true
+in its configuration.
By default, declarative containers share the network namespace
of the host, meaning that they can listen on (privileged)
@@ -41,13 +43,15 @@ containers.database =
This gives the container a private virtual Ethernet interface with IP
address 192.168.100.11, which is hooked up to a
virtual Ethernet interface on the host with IP address
-192.168.100.10. (See the next section for details
+192.168.100.10. (See the next section for details
on container networking.)To disable the container, just remove it from
configuration.nix and run nixos-rebuild
switch. Note that this will not delete the root directory of
-the container in /var/lib/containers.
+the container in /var/lib/containers. Containers can be
+destroyed using the imperative method: nixos-container destroy
+ foo.
Declarative containers can be started and stopped using the
corresponding systemd service, e.g. systemctl start
diff --git a/nixos/doc/manual/configuration/config-file.xml b/nixos/doc/manual/configuration/config-file.xml
index b613c7f06cc..9b240979273 100644
--- a/nixos/doc/manual/configuration/config-file.xml
+++ b/nixos/doc/manual/configuration/config-file.xml
@@ -157,7 +157,7 @@ boot.kernel.sysctl."net.ipv4.tcp_keepalive_time" = 60;
fileSystems."/boot" =
{ device = "/dev/sda1";
fsType = "ext4";
- options = "rw,data=ordered,relatime";
+ options = [ "rw" "data=ordered" "relatime" ];
};
diff --git a/nixos/doc/manual/configuration/configuration.xml b/nixos/doc/manual/configuration/configuration.xml
index 8fde0dc7e61..1e488b59343 100644
--- a/nixos/doc/manual/configuration/configuration.xml
+++ b/nixos/doc/manual/configuration/configuration.xml
@@ -26,6 +26,8 @@ effect after you run nixos-rebuild.
+
+
diff --git a/nixos/doc/manual/configuration/user-mgmt.xml b/nixos/doc/manual/configuration/user-mgmt.xml
index 40362fbbb23..63174205927 100644
--- a/nixos/doc/manual/configuration/user-mgmt.xml
+++ b/nixos/doc/manual/configuration/user-mgmt.xml
@@ -65,6 +65,14 @@ account named alice:
$ useradd -m alice
+To make all nix tools available to this new user use `su - USER` which
+opens a login shell (==shell that loads the profile) for given user.
+This will create the ~/.nix-defexpr symlink. So run:
+
+
+$ su - alice -c "true"
+
+
The flag causes the creation of a home directory
for the new user, which is generally what you want. The user does not
have an initial password and therefore cannot log in. A password can
diff --git a/nixos/doc/manual/configuration/wireless.xml b/nixos/doc/manual/configuration/wireless.xml
index 373a9168cc8..e4560f2da36 100644
--- a/nixos/doc/manual/configuration/wireless.xml
+++ b/nixos/doc/manual/configuration/wireless.xml
@@ -18,8 +18,20 @@ NixOS will start wpa_supplicant for you if you enable this setting:
networking.wireless.enable = true;
-NixOS currently does not generate wpa_supplicant's
-configuration file, /etc/wpa_supplicant.conf. You should edit this file
+NixOS lets you specify networks for wpa_supplicant declaratively:
+
+networking.wireless.networks = {
+ echelon = {
+ psk = "abcdefgh";
+ };
+ "free.wifi" = {};
+}
+
+
+Be aware that keys will be written to the nix store in plaintext!
+
+When no networks are set, it will default to using a configuration file at
+/etc/wpa_supplicant.conf. You should edit this file
yourself to define wireless networks, WPA keys and so on (see
wpa_supplicant.conf(5)).
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix
index 87964e27bb9..b4eb3cde81b 100644
--- a/nixos/doc/manual/default.nix
+++ b/nixos/doc/manual/default.nix
@@ -1,4 +1,4 @@
-{ pkgs, options, version, revision }:
+{ pkgs, options, version, revision, extraSources ? [] }:
with pkgs;
with pkgs.lib;
@@ -17,19 +17,20 @@ let
# Clean up declaration sites to not refer to the NixOS source tree.
optionsList' = flip map optionsList (opt: opt // {
- declarations = map (fn: stripPrefix fn) opt.declarations;
+ declarations = map stripAnyPrefixes opt.declarations;
}
// optionalAttrs (opt ? example) { example = substFunction opt.example; }
// optionalAttrs (opt ? default) { default = substFunction opt.default; }
// optionalAttrs (opt ? type) { type = substFunction opt.type; });
- prefix = toString ../../..;
-
- stripPrefix = fn:
- if substring 0 (stringLength prefix) fn == prefix then
- substring (stringLength prefix + 1) 1000 fn
- else
- fn;
+ # We need to strip references to /nix/store/* from options,
+ # including any `extraSources` if some modules came from elsewhere,
+ # or else the build will fail.
+ #
+ # E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
+ # you'd need to include `extraSources = [ pkgs.customModules ]`
+ prefixesToStrip = map (p: "${toString p}/") ([ ../../.. ] ++ extraSources);
+ stripAnyPrefixes = flip (fold removePrefix) prefixesToStrip;
# Convert the list of options into an XML file.
optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList');
@@ -55,6 +56,8 @@ let
cp -prd $sources/* . # */
chmod -R u+w .
cp ${../../modules/services/databases/postgresql.xml} configuration/postgresql.xml
+ cp ${../../modules/security/acme.xml} configuration/acme.xml
+ cp ${../../modules/misc/nixos.xml} configuration/nixos.xml
ln -s ${optionsDocBook} options-db.xml
echo "${version}" > version
'';
diff --git a/nixos/doc/manual/development/writing-modules.xml b/nixos/doc/manual/development/writing-modules.xml
index a699e74e5f6..971e586f20b 100644
--- a/nixos/doc/manual/development/writing-modules.xml
+++ b/nixos/doc/manual/development/writing-modules.xml
@@ -107,12 +107,12 @@ the file system. This module declares two options that can be defined
by other modules (typically the user’s
configuration.nix):
(whether the database should
-be updated) and (when the
+be updated) and (when the
update should be done). It implements its functionality by defining
two options declared by other modules:
(the set of all systemd services)
-and (the list of
-commands to be executed periodically by cron).
+and (the list of commands to be
+executed periodically by systemd).
NixOS Module for the “locate” Service
@@ -120,53 +120,59 @@ commands to be executed periodically by cron).
with lib;
-let locatedb = "/var/cache/locatedb"; in
-
-{
- options = {
-
- services.locate = {
-
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- If enabled, NixOS will periodically update the database of
- files used by the locate command.
- '';
- };
-
- period = mkOption {
- type = types.str;
- default = "15 02 * * *";
- description = ''
- This option defines (in the format used by cron) when the
- locate database is updated. The default is to update at
- 02:15 at night every day.
- '';
- };
-
+let
+ cfg = config.services.locate;
+in {
+ options.services.locate = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If enabled, NixOS will periodically update the database of
+ files used by the locate command.
+ '';
};
+ interval = mkOption {
+ type = types.str;
+ default = "02:15";
+ example = "hourly";
+ description = ''
+ Update the locate database at this interval. Updates by
+ default at 2:15 AM every day.
+
+ The format is described in
+ systemd.time
+ 7.
+ '';
+ };
+
+ # Other options omitted for documentation
};
config = {
-
systemd.services.update-locatedb =
{ description = "Update Locate Database";
path = [ pkgs.su ];
script =
''
- mkdir -m 0755 -p $(dirname ${locatedb})
- exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /run'
+ mkdir -m 0755 -p $(dirname ${toString cfg.output})
+ exec updatedb \
+ --localuser=${cfg.localuser} \
+ ${optionalString (!cfg.includeStore) "--prunepaths='/nix/store'"} \
+ --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
'';
};
- services.cron.systemCronJobs = optional config.services.locate.enable
- "${config.services.locate.period} root ${config.systemd.package}/bin/systemctl start update-locatedb.service";
-
+ systemd.timers.update-locatedb = mkIf cfg.enable
+ { description = "Update timer for locate database";
+ partOf = [ "update-locatedb.service" ];
+ wantedBy = [ "timers.target" ];
+ timerConfig.OnCalendar = cfg.interval;
+ };
};
-}
+}
+
diff --git a/nixos/doc/manual/installation/installing.xml b/nixos/doc/manual/installation/installing.xml
index 6d734cd8cac..9aec57fb6d5 100644
--- a/nixos/doc/manual/installation/installing.xml
+++ b/nixos/doc/manual/installation/installing.xml
@@ -35,7 +35,7 @@
systemctl stop network-manager.
The NixOS installer doesn’t do any partitioning or
- formatting yet, so you need to that yourself. Use the following
+ formatting yet, so you need to do that yourself. Use the following
commands:
diff --git a/nixos/doc/manual/installation/obtaining.xml b/nixos/doc/manual/installation/obtaining.xml
index afd6c9543f7..f6e8b218e2b 100644
--- a/nixos/doc/manual/installation/obtaining.xml
+++ b/nixos/doc/manual/installation/obtaining.xml
@@ -39,8 +39,8 @@ running NixOS system through several other means:
Using NixOps, the NixOS-based cloud deployment tool, which
allows you to provision VirtualBox and EC2 NixOS instances from
declarative specifications. Check out the