From 3618e03be9947344969dea46e8433251265b2e77 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:32:42 +0100 Subject: [PATCH 001/179] dwarf-therapist: disable Hydra builds because of unfree dwarf-fortress dependency --- pkgs/games/dwarf-therapist/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/games/dwarf-therapist/default.nix b/pkgs/games/dwarf-therapist/default.nix index 8ac84a96aeb..d8f39ceeea4 100644 --- a/pkgs/games/dwarf-therapist/default.nix +++ b/pkgs/games/dwarf-therapist/default.nix @@ -54,7 +54,7 @@ stdenv.mkDerivation rec { description = "Tool to manage dwarves in in a running game of Dwarf Fortress"; maintainers = with stdenv.lib.maintainers; [ the-kenny ]; license = "MIT"; - platforms = stdenv.lib.platforms.linux; + platforms = stdenv.lib.platforms.none; homepage = https://code.google.com/r/splintermind-attributes/; }; } From 41fe95f7707321bea4c04e8fffc151341b955183 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:33:39 +0100 Subject: [PATCH 002/179] haskell-cufft: disable Hydra builds because of unfree dependency on CUDA --- pkgs/development/libraries/haskell/cufft/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/haskell/cufft/default.nix b/pkgs/development/libraries/haskell/cufft/default.nix index 213072b5cdf..e9f1fe166bd 100644 --- a/pkgs/development/libraries/haskell/cufft/default.nix +++ b/pkgs/development/libraries/haskell/cufft/default.nix @@ -10,6 +10,6 @@ cabal.mkDerivation (self: { homepage = "http://github.com/robeverest/cufft"; description = "Haskell bindings for the CUFFT library"; license = self.stdenv.lib.licenses.bsd3; - platforms = self.stdenv.lib.platforms.linux; + platforms = self.stdenv.lib.platforms.none; }; }) From 5ff31ef887778881320a9ef95a2d77326224737a Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:33:48 +0100 Subject: [PATCH 003/179] haskell-accelerate-fft: disable Hydra builds because of unfree dependency on CUDA --- pkgs/development/libraries/haskell/accelerate-fft/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/haskell/accelerate-fft/default.nix b/pkgs/development/libraries/haskell/accelerate-fft/default.nix index 4e9a75f64ee..b3c1cb90b29 100644 --- a/pkgs/development/libraries/haskell/accelerate-fft/default.nix +++ b/pkgs/development/libraries/haskell/accelerate-fft/default.nix @@ -9,6 +9,6 @@ cabal.mkDerivation (self: { homepage = "https://github.com/AccelerateHS/accelerate-fft"; description = "FFT using the Accelerate library"; license = self.stdenv.lib.licenses.bsd3; - platforms = self.stdenv.lib.platforms.linux; + platforms = self.stdenv.lib.platforms.none; }; }) From 3d5edb453f5da38f2d8fe06c69bdd849bae89669 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:34:30 +0100 Subject: [PATCH 004/179] sdlmame: fixed trivial typo --- pkgs/games/sdlmame/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/games/sdlmame/default.nix b/pkgs/games/sdlmame/default.nix index bd6e9011178..645312dd54e 100644 --- a/pkgs/games/sdlmame/default.nix +++ b/pkgs/games/sdlmame/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, alsaLib, qt48, SDL, fontconfig, freetype, SDL_ttf, xlibs }: -assert stdenv.system == "x86_64-linux" || stdenv.system == "1686-linux"; +assert stdenv.system == "x86_64-linux" || stdenv.system == "i686-linux"; stdenv.mkDerivation rec { version = "0.150.u0-1"; From 78876a8292dadca81039b7279455bc9d4d28393e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 27 Oct 2013 14:26:13 +0100 Subject: [PATCH 005/179] add ngrok: Reverse proxy that creates a secure tunnel between from a public endpoint to a locally running web service --- pkgs/tools/misc/ngrok/default.nix | 34 +++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 36 insertions(+) create mode 100644 pkgs/tools/misc/ngrok/default.nix diff --git a/pkgs/tools/misc/ngrok/default.nix b/pkgs/tools/misc/ngrok/default.nix new file mode 100644 index 00000000000..2a1a1e57e31 --- /dev/null +++ b/pkgs/tools/misc/ngrok/default.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchurl, go, git, mercurial, bazaar, cacert }: + +stdenv.mkDerivation rec { + name = "ngrok-${version}"; + version = "1.6"; + + src = fetchurl { + url = "https://github.com/inconshreveable/ngrok/archive/${version}.tar.gz"; + sha256 = "0w54ck00ma8wd87gc3dligypdjs7vrzbi9py46sqphsid3rihkjr"; + }; + + buildInputs = [ go git mercurial bazaar ]; + + GIT_SSL_CAINFO = "${cacert}/etc/ca-bundle.crt"; + + preBuild = '' + export HOME="$PWD" + ''; + + installPhase = '' + make release-client + mkdir -p $out/bin + cp bin/ngrok $out/bin + cp -R assets $out/ + ''; + + meta = with stdenv.lib; { + description = "Reverse proxy that creates a secure tunnel between from a public endpoint to a locally running web service"; + homepage = https://ngrok.com/; + license = licenses.asl20; + maintainers = with maintainers; [ iElectric ]; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 13dd923c96a..5c13002273e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1407,6 +1407,8 @@ let newsbeuter = callPackage ../applications/networking/feedreaders/newsbeuter { }; + ngrok = callPackage ../tools/misc/ngrok { }; + mpack = callPackage ../tools/networking/mpack { }; pa_applet = callPackage ../tools/audio/pa-applet { }; From 37f7c96a7eb74e48ce42152d75757b4e3c552cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sun, 27 Oct 2013 16:42:56 +0100 Subject: [PATCH 006/179] Update youtubeDL. Now vimeo downloads work again. --- pkgs/tools/misc/youtube-dl/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/misc/youtube-dl/default.nix b/pkgs/tools/misc/youtube-dl/default.nix index e4d934968b2..86ef7617808 100644 --- a/pkgs/tools/misc/youtube-dl/default.nix +++ b/pkgs/tools/misc/youtube-dl/default.nix @@ -1,14 +1,14 @@ { stdenv, fetchurl, python, zip }: let - version = "2013.06.21"; + version = "2013.10.23.2"; in stdenv.mkDerivation rec { name = "youtube-dl-${version}"; src = fetchurl { url = "http://youtube-dl.org/downloads/${version}/${name}.tar.gz"; - sha256 = "3d4e9cc38af3c2fccfafd83d0c6382080531fd03e9067ceccc6864dfbea92b1e"; + sha256 = "d3f4c9e0da165395856e690314caa5eef4382bd994dd46f041a520bf9747c35d"; }; buildInputs = [ python ]; From 3cad44d26c617d9417a0b49ebf085a02114a46d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 27 Oct 2013 17:26:09 +0100 Subject: [PATCH 007/179] ngrok: linux only --- pkgs/tools/misc/ngrok/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/misc/ngrok/default.nix b/pkgs/tools/misc/ngrok/default.nix index 2a1a1e57e31..fe2aa236cd5 100644 --- a/pkgs/tools/misc/ngrok/default.nix +++ b/pkgs/tools/misc/ngrok/default.nix @@ -29,6 +29,6 @@ stdenv.mkDerivation rec { homepage = https://ngrok.com/; license = licenses.asl20; maintainers = with maintainers; [ iElectric ]; - platforms = stdenv.lib.platforms.all; + platforms = stdenv.lib.platforms.linux; }; } From 7daab7444030d6602acd0f6b76f2e4f0a545b982 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:13 +0100 Subject: [PATCH 008/179] haskell-Cabal: update to version 1.18.1.2 --- .../libraries/haskell/Cabal/{1.18.1.1.nix => 1.18.1.2.nix} | 4 ++-- pkgs/top-level/haskell-packages.nix | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename pkgs/development/libraries/haskell/Cabal/{1.18.1.1.nix => 1.18.1.2.nix} (89%) diff --git a/pkgs/development/libraries/haskell/Cabal/1.18.1.1.nix b/pkgs/development/libraries/haskell/Cabal/1.18.1.2.nix similarity index 89% rename from pkgs/development/libraries/haskell/Cabal/1.18.1.1.nix rename to pkgs/development/libraries/haskell/Cabal/1.18.1.2.nix index 431c62b85e0..024a4d5c135 100644 --- a/pkgs/development/libraries/haskell/Cabal/1.18.1.1.nix +++ b/pkgs/development/libraries/haskell/Cabal/1.18.1.2.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "Cabal"; - version = "1.18.1.1"; - sha256 = "1qa6z9kb46hmix15fdjw80jqd69v4rxr52mfq25m8c60l3kxbiny"; + version = "1.18.1.2"; + sha256 = "0pbg9d40lskcps248fdcnm4hnib3vl10mbcdf830zw45q29gfkjr"; buildDepends = [ deepseq filepath time ]; testDepends = [ extensibleExceptions filepath HUnit QuickCheck regexPosix diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index c8d7b0dee85..708041317e7 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -659,7 +659,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x Cabal_1_14_0 = callPackage ../development/libraries/haskell/Cabal/1.14.0.nix { cabal = self.cabal.override { Cabal = null; }; }; Cabal_1_16_0_3 = callPackage ../development/libraries/haskell/Cabal/1.16.0.3.nix { cabal = self.cabal.override { Cabal = null; }; }; - Cabal_1_18_1_1 = callPackage ../development/libraries/haskell/Cabal/1.18.1.1.nix { + Cabal_1_18_1_2 = callPackage ../development/libraries/haskell/Cabal/1.18.1.2.nix { cabal = self.cabal.override { Cabal = null; }; deepseq = self.deepseq_1_3_0_1; }; @@ -2476,7 +2476,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x cabalInstall_0_14_0 = callPackage ../tools/package-management/cabal-install/0.14.0.nix {}; cabalInstall_1_16_0_2 = callPackage ../tools/package-management/cabal-install/1.16.0.2.nix {}; cabalInstall_1_18_0_2 = callPackage ../tools/package-management/cabal-install/1.18.0.2.nix { - Cabal = self.Cabal_1_18_1_1; + Cabal = self.Cabal_1_18_1_2; }; cabalInstall = self.cabalInstall_1_18_0_2; From c05bf33b770650e0588b5328eb02f414db1029a8 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:36 +0100 Subject: [PATCH 009/179] haskell-git-annex: update to version 4.20131024 --- .../version-management/git-and-tools/git-annex/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/git-and-tools/git-annex/default.nix b/pkgs/applications/version-management/git-and-tools/git-annex/default.nix index f67fc8553c0..e32a7dc52b9 100644 --- a/pkgs/applications/version-management/git-and-tools/git-annex/default.nix +++ b/pkgs/applications/version-management/git-and-tools/git-annex/default.nix @@ -14,8 +14,8 @@ cabal.mkDerivation (self: { pname = "git-annex"; - version = "4.20131002"; - sha256 = "00pjb0ivcggpx4qdihrarss68c1q5viwfz4jgg7rqjnhslwvk440"; + version = "4.20131024"; + sha256 = "1a4mrx8zr5znhcy2cszv5ri9avqj7lcn467nmaj172f00vn4fd5x"; isLibrary = false; isExecutable = true; buildDepends = [ From 19cfd3da634d19645755ccab47ca910f4d75aeae Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:36 +0100 Subject: [PATCH 010/179] haskell-Elm: update to version 0.10.0.1 --- pkgs/development/compilers/elm/elm.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/elm/elm.nix b/pkgs/development/compilers/elm/elm.nix index 17b173a3334..c9e9fb9e14b 100644 --- a/pkgs/development/compilers/elm/elm.nix +++ b/pkgs/development/compilers/elm/elm.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "Elm"; - version = "0.10"; - sha256 = "0wwda9w9r3qw7b23bj4qnfj4vgl7zwwnslxmgz3rv0cmxn9klqx2"; + version = "0.10.0.1"; + sha256 = "1r7z2fw9v6ngr9w4lmj1l6sc78rmxvqkqlxv4a9yc5jm80k3ar0i"; isLibrary = true; isExecutable = true; buildDepends = [ From e93599cb23ebfd85013740aada2936b5265ef66f Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:36 +0100 Subject: [PATCH 011/179] haskell-cipher-des: update to version 0.0.6 --- pkgs/development/libraries/haskell/cipher-des/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/cipher-des/default.nix b/pkgs/development/libraries/haskell/cipher-des/default.nix index 16b953c10bd..fdc30278425 100644 --- a/pkgs/development/libraries/haskell/cipher-des/default.nix +++ b/pkgs/development/libraries/haskell/cipher-des/default.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "cipher-des"; - version = "0.0.5"; - sha256 = "1j4nbmxdc3nb5q9gqmwp40dj7pdy71135kvhvl7dfh6mb18bk22v"; + version = "0.0.6"; + sha256 = "1isazxa2nr1y13y0danfk7wghy34rfpn3f43rw714nk2xk6vrwc5"; buildDepends = [ byteable cryptoCipherTypes securemem ]; testDepends = [ byteable cryptoCipherTests cryptoCipherTypes QuickCheck From ef29da6cc5a25b4f0c63946e625bae96d3d6dfbd Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:36 +0100 Subject: [PATCH 012/179] haskell-crypto-cipher-tests: update to version 0.0.11 --- .../libraries/haskell/crypto-cipher-tests/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/crypto-cipher-tests/default.nix b/pkgs/development/libraries/haskell/crypto-cipher-tests/default.nix index ed071bbc92a..3c514936468 100644 --- a/pkgs/development/libraries/haskell/crypto-cipher-tests/default.nix +++ b/pkgs/development/libraries/haskell/crypto-cipher-tests/default.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "crypto-cipher-tests"; - version = "0.0.10"; - sha256 = "1gmhpk1pdc9axkmpw9fyr1zgv6pskyzzlsq8icp2w4fc83l61smb"; + version = "0.0.11"; + sha256 = "19wqignlq90qwpam01hnmmrxaxh5lkax9l1l6rlbi4a07nvp1dnz"; buildDepends = [ byteable cryptoCipherTypes HUnit mtl QuickCheck securemem testFramework testFrameworkHunit testFrameworkQuickcheck2 From 3807c0ffc387c5eaaa2d754196d0e98091b91853 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:36 +0100 Subject: [PATCH 013/179] haskell-crypto-cipher-types: update to version 0.0.9 --- .../libraries/haskell/crypto-cipher-types/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/crypto-cipher-types/default.nix b/pkgs/development/libraries/haskell/crypto-cipher-types/default.nix index 70e61054137..8f52f724bcd 100644 --- a/pkgs/development/libraries/haskell/crypto-cipher-types/default.nix +++ b/pkgs/development/libraries/haskell/crypto-cipher-types/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "crypto-cipher-types"; - version = "0.0.7"; - sha256 = "1zvlc88c4w4rhj1imx3w3j3f4b6im9sj78fgwwyzwmn14mn1y6l8"; + version = "0.0.9"; + sha256 = "03qa1i1kj07pfrxsi7fiaqnnd0vi94jd4jfswbmnm4gp1nvzcwr0"; buildDepends = [ byteable securemem ]; meta = { homepage = "http://github.com/vincenthz/hs-crypto-cipher"; From 4aabba9dab2568a641761806cd0d7a089ca0461d Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:36 +0100 Subject: [PATCH 014/179] haskell-cryptocipher: update to version 0.6.2 --- pkgs/development/libraries/haskell/cryptocipher/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/cryptocipher/default.nix b/pkgs/development/libraries/haskell/cryptocipher/default.nix index 57d0e2483f8..7d3ddf57e52 100644 --- a/pkgs/development/libraries/haskell/cryptocipher/default.nix +++ b/pkgs/development/libraries/haskell/cryptocipher/default.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "cryptocipher"; - version = "0.6.1"; - sha256 = "1qa0s7mr1a3nv4ppyk8wr57rxbfc2qpw9rq26pfziwnpin5k2j3x"; + version = "0.6.2"; + sha256 = "0ip3a2as0df6drl29sryayxx22sx55v6bs60s2fh3i1nxqnydf9l"; buildDepends = [ cipherAes cipherBlowfish cipherCamellia cipherDes cipherRc4 cryptoCipherTypes From 06c22ac95d92fc6e1c60b1b7937083089b8419bc Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:36 +0100 Subject: [PATCH 015/179] haskell-data-lens: update to version 2.10.4 --- .../libraries/haskell/data-lens/default.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/haskell/data-lens/default.nix b/pkgs/development/libraries/haskell/data-lens/default.nix index 25a81084a4a..5276c1c9707 100644 --- a/pkgs/development/libraries/haskell/data-lens/default.nix +++ b/pkgs/development/libraries/haskell/data-lens/default.nix @@ -1,13 +1,10 @@ -{ cabal, comonad, comonadTransformers, semigroupoids, transformers -}: +{ cabal, comonad, semigroupoids, transformers }: cabal.mkDerivation (self: { pname = "data-lens"; - version = "2.10.3"; - sha256 = "0x8qrcsnl1z2n3vwld0jcnapmzlzjgyzpa34qjyxpv4f15xn8vic"; - buildDepends = [ - comonad comonadTransformers semigroupoids transformers - ]; + version = "2.10.4"; + sha256 = "1pzswlpphpipsqja825pyqjixp4akc5nmw9y61jwv6r4vsgdpg5i"; + buildDepends = [ comonad semigroupoids transformers ]; meta = { homepage = "http://github.com/roconnor/data-lens/"; description = "Haskell 98 Lenses"; From 089506aac6a3e2b7009c2b61f6d21f81075b4bf0 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:36 +0100 Subject: [PATCH 016/179] haskell-diagrams-svg: update to version 0.8.0.2 --- pkgs/development/libraries/haskell/diagrams/svg.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/diagrams/svg.nix b/pkgs/development/libraries/haskell/diagrams/svg.nix index 320b9b481a6..062cee83e41 100644 --- a/pkgs/development/libraries/haskell/diagrams/svg.nix +++ b/pkgs/development/libraries/haskell/diagrams/svg.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "diagrams-svg"; - version = "0.8.0.1"; - sha256 = "0ar7z46759s75fff0132mf51q53fvp2fkyqhw8b3lszsxvqs4r7y"; + version = "0.8.0.2"; + sha256 = "0ahapj040qy74kcj9f786ddd28xysq1wch087wsh8sdfp57z5dbz"; buildDepends = [ blazeSvg cmdargs colour diagramsCore diagramsLib filepath monoidExtras mtl split time vectorSpace From fbe6b6cbffba34f7c4e89e91300a3fb0e46274dc Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:37 +0100 Subject: [PATCH 017/179] haskell-modular-arithmetic: update to version 1.1.0.0 --- .../libraries/haskell/modular-arithmetic/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/modular-arithmetic/default.nix b/pkgs/development/libraries/haskell/modular-arithmetic/default.nix index c4a77630e6a..9a15b32f307 100644 --- a/pkgs/development/libraries/haskell/modular-arithmetic/default.nix +++ b/pkgs/development/libraries/haskell/modular-arithmetic/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "modular-arithmetic"; - version = "1.0.1.1"; - sha256 = "14n83kjmz8mqjivjhwxk1zckms5z3gn77yq2hsw2yybzff2vkdkd"; + version = "1.1.0.0"; + sha256 = "02zxxz204ydyj28p65fqb920x5gbm7gba4yf9mhiw6ff0dcmxp37"; meta = { description = "A type for integers modulo some constant"; license = self.stdenv.lib.licenses.bsd3; From aab65b9f2ba5e0c132ff9c2d9a38a9cbfc3129c1 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:37 +0100 Subject: [PATCH 018/179] haskell-socks: update to version 0.5.4 --- pkgs/development/libraries/haskell/socks/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/socks/default.nix b/pkgs/development/libraries/haskell/socks/default.nix index f939708c16a..1953e3436ee 100644 --- a/pkgs/development/libraries/haskell/socks/default.nix +++ b/pkgs/development/libraries/haskell/socks/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "socks"; - version = "0.5.3"; - sha256 = "0cajbl7vrljawaxl3vbbf0sq92ry3cj925sww4nw70lhpz96ay4x"; + version = "0.5.4"; + sha256 = "1nmldlwxqasmg359i2aa3a903gi3lmnlspvf12xk49jrg3mf3dg9"; buildDepends = [ cereal network ]; meta = { homepage = "http://github.com/vincenthz/hs-socks"; From 216e9976fe0977bf26a3225369c4ef97cc6af066 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 27 Oct 2013 12:39:37 +0100 Subject: [PATCH 019/179] haskell-uniplate: update to version 1.6.12 --- pkgs/development/libraries/haskell/uniplate/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/uniplate/default.nix b/pkgs/development/libraries/haskell/uniplate/default.nix index 8b0825ea119..ab9471bc3f2 100644 --- a/pkgs/development/libraries/haskell/uniplate/default.nix +++ b/pkgs/development/libraries/haskell/uniplate/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "uniplate"; - version = "1.6.11"; - sha256 = "10ppc9hqc0y17r3y4vdajshrp3956dybna7qa5zm0akgl3pbla9j"; + version = "1.6.12"; + sha256 = "1dx8f9aw27fz8kw0ad1nm6355w5rdl7bjvb427v2bsgnng30pipw"; buildDepends = [ hashable syb unorderedContainers ]; meta = { homepage = "http://community.haskell.org/~ndm/uniplate/"; From 59de62317dbc5270eafd00503c9633af60eb590b Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Sun, 27 Oct 2013 04:19:18 -0500 Subject: [PATCH 020/179] btrfs: fix build to link against libgcc_s so that pthread_cancel is linked Currently, the command btrfs scrub start attempts to invoke the pthread_cancel routine and ends with an error melibgcc_sssage about it being missing. This prevents btrfs scrub status from maintaining proper statistics about the running scrub. Close #1127. --- pkgs/tools/filesystems/btrfsprogs/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/tools/filesystems/btrfsprogs/default.nix b/pkgs/tools/filesystems/btrfsprogs/default.nix index 9c8d18231f0..0661755d2e1 100644 --- a/pkgs/tools/filesystems/btrfsprogs/default.nix +++ b/pkgs/tools/filesystems/btrfsprogs/default.nix @@ -13,6 +13,9 @@ stdenv.mkDerivation { buildInputs = [ zlib libuuid acl attr e2fsprogs lzo ]; + # for btrfs to get the rpath to libgcc_s, needed for pthread_cancel to work + NIX_CFLAGS_LINK = "-lgcc_s"; + postPatch = '' cp ${./btrfs-set-received-uuid.c} btrfs-set-received-uuid.c ''; From 3022fff7db8c9649d9502de3e60a09c97dc27b61 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Mon, 28 Oct 2013 00:09:46 +0400 Subject: [PATCH 021/179] Adding Quantum Minigolf game --- nixos/modules/services/networking/vsftpd.nix | 2 +- pkgs/games/quantumminigolf/default.nix | 40 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 pkgs/games/quantumminigolf/default.nix diff --git a/nixos/modules/services/networking/vsftpd.nix b/nixos/modules/services/networking/vsftpd.nix index d9f1e96b1d2..0a6355e6ff1 100644 --- a/nixos/modules/services/networking/vsftpd.nix +++ b/nixos/modules/services/networking/vsftpd.nix @@ -75,7 +75,7 @@ let { cfgText = if cfg.rsaCertFile == null then "" else '' - sslEnable=YES + ssl_enable=YES rsa_cert_file=${cfg.rsaCertFile} ''; diff --git a/pkgs/games/quantumminigolf/default.nix b/pkgs/games/quantumminigolf/default.nix new file mode 100644 index 00000000000..94035179016 --- /dev/null +++ b/pkgs/games/quantumminigolf/default.nix @@ -0,0 +1,40 @@ +{stdenv, fetchurl, fftwSinglePrec, freetype, SDL, SDL_ttf}: +let + s = # Generated upstream information + rec { + baseName="quantumminigolf"; + version="1.1.1"; + name="${baseName}-${version}"; + hash="16av7fk0irhi5nd7y9h9vhb0kf0dk12p6976ai3f60m99qdd8wk3"; + url="mirror://sourceforge/project/quantumminigolf/quantumminigolf/1.1.1/quantumminigolf-1.1.1.src.tar.gz"; + sha256="16av7fk0irhi5nd7y9h9vhb0kf0dk12p6976ai3f60m99qdd8wk3"; + }; + buildInputs = [ + fftwSinglePrec freetype SDL SDL_ttf + ]; +in +stdenv.mkDerivation { + inherit (s) name version; + inherit buildInputs; + src = fetchurl { + inherit (s) url sha256; + }; + preBuild = '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${SDL}/include/SDL" + + sed -re 's@"(gfx|fonts|tracks)/@"'"$out"'/share/quantumminigolf/\1/@g' -i *.cpp + ''; + installPhase = '' + mkdir -p "$out"/{share/doc,share/quantumminigolf,bin} + cp README THANKS LICENSE "$out/share/doc" + cp -r fonts gfx tracks "$out/share/quantumminigolf" + cp quantumminigolf "$out/bin" + ''; + meta = { + inherit (s) version; + description = ''Quantum mechanics-based minigolf-like game''; + license = stdenv.lib.licenses.gpl2 ; + maintainers = [stdenv.lib.maintainers.raskin]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5c13002273e..f81c20a6b4b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9293,6 +9293,8 @@ let quake3game = callPackage ../games/quake3/game { }; + quantumminigolf = callPackage ../games/quantumminigolf {}; + racer = callPackage ../games/racer { }; residualvm = callPackage ../games/residualvm { From ab18b33f3e4947428056ee43a5d3c2af7f42980b Mon Sep 17 00:00:00 2001 From: "Jason \"Don\" O'Conal" Date: Sat, 12 Oct 2013 22:38:52 +0000 Subject: [PATCH 022/179] sup: update to latest version --- .../networking/mailreaders/sup/default.nix | 28 ++++++++------ .../interpreters/ruby/generated.nix | 38 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 25 +++++------- 3 files changed, 64 insertions(+), 27 deletions(-) diff --git a/pkgs/applications/networking/mailreaders/sup/default.nix b/pkgs/applications/networking/mailreaders/sup/default.nix index 05833537026..dd2837da40a 100644 --- a/pkgs/applications/networking/mailreaders/sup/default.nix +++ b/pkgs/applications/networking/mailreaders/sup/default.nix @@ -1,9 +1,10 @@ { stdenv, fetchurl, ruby, rake, rubygems, makeWrapper, ncursesw_sup -, xapian_ruby, gpgme, libiconvOrEmpty, rmail, mime_types, chronic, trollop -, lockfile, gettext, iconv, locale, text, highline }: +, xapian_ruby, gpgme, libiconvOrEmpty, mime_types, chronic, trollop, lockfile +, gettext, iconv, locale, text, highline, rmail_sup, unicode, gnupg, which }: -stdenv.mkDerivation { - name = "sup-896ab66c0263e5ce0fa45857fb08e0fb78fcb6bd"; +stdenv.mkDerivation rec { + version = "f27661b1656ae1f0d28fd89595b5a16f268d8d3d"; + name = "sup-${version}"; meta = { homepage = http://supmua.org; @@ -16,8 +17,8 @@ stdenv.mkDerivation { dontStrip = true; src = fetchurl { - url = "https://github.com/sup-heliotrope/sup/archive/896ab66c0263e5ce0fa45857fb08e0fb78fcb6bd.tar.gz"; - sha256 = "0sknf4ha13m2478fa27qnm43bcn59g6qbd8f2nmv64k2zs7xnwmk"; + url = "https://github.com/sup-heliotrope/sup/archive/${version}.tar.gz"; + sha256 = "08fxf1knji3260d0mrp86x6yayp43iq7kc5rfay3hga8i2sckdia"; }; buildInputs = @@ -26,8 +27,6 @@ stdenv.mkDerivation { buildPhase = "rake gem"; - # TODO: Move gem dependencies out - installPhase = '' export HOME=$TMP/home; mkdir -pv "$HOME" @@ -35,16 +34,17 @@ stdenv.mkDerivation { GEM_PATH="$GEM_PATH:${chronic}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${gettext}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${gpgme}/${ruby.gemPath}" + GEM_PATH="$GEM_PATH:${highline}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${iconv}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${locale}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${lockfile}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${mime_types}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${ncursesw_sup}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${rmail}/${ruby.gemPath}" + GEM_PATH="$GEM_PATH:${rmail_sup}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${text}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${trollop}/${ruby.gemPath}" + GEM_PATH="$GEM_PATH:${unicode}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${xapian_ruby}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${highline}/${ruby.gemPath}" # Don't install some dependencies -- we have already installed # the dependencies but gem doesn't acknowledge this @@ -52,8 +52,13 @@ stdenv.mkDerivation { --bindir "$out/bin" --no-rdoc --no-ri pkg/sup-999.gem \ --ignore-dependencies + # specify ruby interpreter explicitly + sed -i '1 s|^.*$|#!${ruby}/bin/ruby|' bin/sup-sync-back-maildir + + cp bin/sup-sync-back-maildir "$out"/bin + for prog in $out/bin/*; do - wrapProgram "$prog" --prefix GEM_PATH : "$GEM_PATH" + wrapProgram "$prog" --prefix GEM_PATH : "$GEM_PATH" --prefix PATH : "${gnupg}/bin:${which}/bin" done for prog in $out/gems/*/bin/*; do @@ -61,4 +66,3 @@ stdenv.mkDerivation { done ''; } - diff --git a/pkgs/development/interpreters/ruby/generated.nix b/pkgs/development/interpreters/ruby/generated.nix index 323d068bc9c..f0cfa7b0152 100644 --- a/pkgs/development/interpreters/ruby/generated.nix +++ b/pkgs/development/interpreters/ruby/generated.nix @@ -97,6 +97,7 @@ g: # Get dependencies from patched gems rjb = g.rjb_1_4_8; rkelly_remix = g.rkelly_remix_0_0_4; rmail = g.rmail_1_0_0; + rmail_sup = g.rmail_sup_1_0_1; rspec = g.rspec_2_11_0; rspec_core = g.rspec_core_2_11_1; rspec_expectations = g.rspec_expectations_2_11_3; @@ -129,6 +130,7 @@ g: # Get dependencies from patched gems tzinfo = g.tzinfo_0_3_37; unf = g.unf_0_1_2; unf_ext = g.unf_ext_0_0_6; + unicode = g.unicode_0_4_4; uuid = g.uuid_2_3_7; uuidtools = g.uuidtools_2_1_4; webrobots = g.webrobots_0_1_1; @@ -433,6 +435,17 @@ for those one-off tasks, with a language that's a joy to use. requiredGems = [ g.ffi_1_9_0 ]; sha256 = ''0jbz2ix7ff9ry8717lhcq9w8j8yd45akw48giwgdqccay5mlph7d''; }; + chronic_0_9_1 = { + basename = ''chronic''; + meta = { + description = ''Natural language date/time parsing.''; + homepage = ''http://github.com/mojombo/chronic''; + longDescription = ''Chronic is a natural language date/time parser written in pure Ruby.''; + }; + name = ''chronic-0.9.1''; + requiredGems = [ ]; + sha256 = ''0kspaxpfy7yvyk1lvpx31w852qfj8wb9z04mcj5bzi70ljb9awqk''; + }; chronic_0_10_1 = { basename = ''chronic''; meta = { @@ -1612,6 +1625,20 @@ in JSDuck. requiredGems = [ ]; sha256 = ''0nsg7yda1gdwa96j4hlrp2s0m06vrhcc4zy5mbq7gxmlmwf9yixp''; }; + rmail_sup_1_0_1 = { + basename = ''rmail_sup''; + meta = { + description = ''A MIME mail parsing and generation library.''; + homepage = ''http://supmua.org''; + longDescription = '' RMail is a lightweight mail library containing various utility classes and + modules that allow ruby scripts to parse, modify, and generate MIME mail + messages. +''; + }; + name = ''rmail-sup-1.0.1''; + requiredGems = [ ]; + sha256 = ''1xswk101s560lxqaax3plqh8vjx7jjspnggdwb3q80m358f92q9g''; + }; rspec_2_11_0 = { basename = ''rspec''; meta = { @@ -1991,6 +2018,17 @@ to Ruby/JRuby. requiredGems = [ ]; sha256 = ''07zbmkzcid6pzdqgla3456ipfdka7j1v4hsx1iaa8rbnllqbmkdg''; }; + unicode_0_4_4 = { + basename = ''unicode''; + meta = { + description = ''Unicode normalization library.''; + homepage = ''http://www.yoshidam.net/Ruby.html#unicode''; + longDescription = ''Unicode normalization library.''; + }; + name = ''unicode-0.4.4''; + requiredGems = [ ]; + sha256 = ''0la9dyxj7pr57g5727gj1h5c6h5kpbjdjpiv2vqi5gw5iglg0yqi''; + }; uuid_2_3_7 = { basename = ''uuid''; meta = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f81c20a6b4b..7b274c4043b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8381,23 +8381,18 @@ let smplayer = callPackage ../applications/video/smplayer { }; - sup = callPackage ../applications/networking/mailreaders/sup { - ruby = ruby19; + sup = with rubyLibs; callPackage ../applications/networking/mailreaders/sup { + ruby = ruby19.override { + cursesSupport = true; + }; - chronic = rubyLibs.chronic; - gettext = rubyLibs.gettext; - gpgme = ruby_gpgme; - highline = rubyLibs.highline; - iconv = rubyLibs.iconv; - locale = rubyLibs.locale; - lockfile = rubyLibs.lockfile; - mime_types = rubyLibs.mime_types; + inherit gettext highline iconv locale lockfile mime_types rmail_sup text + trollop unicode xapian_ruby which; + + chronic = chronic_0_9_1; + gpgme = ruby_gpgme; ncursesw_sup = ruby_ncursesw_sup; - rake = rubyLibs.rake_10_1_0; - rmail = rubyLibs.rmail; - text = rubyLibs.text; - trollop = rubyLibs.trollop; - xapian_ruby = rubyLibs.xapian_ruby; + rake = rake_10_1_0; }; msmtp = callPackage ../applications/networking/msmtp { }; From f4aaced654579a3e795793189558302daca95ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 27 Oct 2013 22:56:59 +0100 Subject: [PATCH 023/179] ngrok: rewrite to download all dependencies with fetch* functions --- pkgs/tools/misc/ngrok/default.nix | 72 ++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/misc/ngrok/default.nix b/pkgs/tools/misc/ngrok/default.nix index fe2aa236cd5..971c42aac71 100644 --- a/pkgs/tools/misc/ngrok/default.nix +++ b/pkgs/tools/misc/ngrok/default.nix @@ -1,6 +1,41 @@ -{ stdenv, fetchurl, go, git, mercurial, bazaar, cacert }: +{ stdenv, fetchurl, go, fetchgit, fetchbzr, fetchhg }: -stdenv.mkDerivation rec { +let + go-websocket = fetchgit { + url = "git://github.com/garyburd/go-websocket"; + rev = "refs/heads/master"; + sha256 = "1e4fcff29c961cd7433ba1b655412d466edfeb1f0829b41f578764857bc801fe"; + }; + go-metrics = fetchgit { + url = "https://github.com/inconshreveable/go-metrics"; + sha256 = "3dc8c229ce5123d86269c0c48401a9cdd2cde7558d85374c9dbc4bbd531e86d5"; + }; + termbox-go = fetchgit { + url = "https://github.com/nsf/termbox-go"; + sha256 = "6b23e8eabb1c7a99dc8c5a7dd5ecb2c2ae736c7f54e485548d08ac337b3a0400"; + }; + go-bindata = fetchgit { + url = "https://github.com/inconshreveable/go-bindata"; + sha256 = "518a5b61cfbe58f8bc55bd6139adcd69997b6ba474536a70b538879aaf118578"; + }; + go-update = fetchgit { + url = "https://github.com/inconshreveable/go-update"; + sha256 = "34647689a50b9d12e85a280d9034cc1772079163481c4778ee4b3e6c4b41e2f4"; + }; + goyaml = fetchbzr { + url = "https://launchpad.net/goyaml"; + sha256 = "03is37cgw62cha316xrs5h7q97im46ry5qldkfvbhimjq3ww0swj"; + revision = "branch:lp:goyaml"; + }; + log4go = fetchhg { + url = "https://code.google.com/p/log4go/"; + sha256 = "0q906sxrmwir295virfibqvdzlaj340qh2r4ysx1ccjrjazc0q5p"; + }; + osext = fetchhg { + url = "https://bitbucket.org/kardianos/osext"; + sha256 = "1w9x2zj716agfd5x5497ajb9nz3ljar74768vjidsyly143vzjws"; + }; +in stdenv.mkDerivation rec { name = "ngrok-${version}"; version = "1.6"; @@ -9,19 +44,44 @@ stdenv.mkDerivation rec { sha256 = "0w54ck00ma8wd87gc3dligypdjs7vrzbi9py46sqphsid3rihkjr"; }; - buildInputs = [ go git mercurial bazaar ]; - - GIT_SSL_CAINFO = "${cacert}/etc/ca-bundle.crt"; + buildInputs = [ go ]; preBuild = '' export HOME="$PWD" + + mkdir -p src/github.com/garyburd/go-websocket/ + ln -s ${go-websocket}/* src/github.com/garyburd/go-websocket + + mkdir -p src/github.com/inconshreveable/go-metrics/ + ln -s ${go-metrics}/* src/github.com/inconshreveable/go-metrics + + mkdir -p src/github.com/inconshreveable/go-bindata + ln -s ${go-bindata}/* src/github.com/inconshreveable/go-bindata + + mkdir -p src/github.com/inconshreveable/go-update + ln -s ${go-update}/* src/github.com/inconshreveable/go-update + + mkdir -p src/github.com/nsf/termbox-go/ + ln -s ${termbox-go}/* src/github.com/nsf/termbox-go + + mkdir -p src/launchpad.net/goyaml + ln -s ${goyaml}/* src/launchpad.net/goyaml + + mkdir -p src/code.google.com/p/log4go + ln -s ${log4go}/* src/code.google.com/p/log4go + + mkdir -p src/bitbucket.org/kardianos/osext + ln -s ${osext}/* src/bitbucket.org/kardianos/osext + + # don't download dependencies as we already have them + sed -i '/go get/d' Makefile ''; installPhase = '' make release-client mkdir -p $out/bin cp bin/ngrok $out/bin - cp -R assets $out/ + cp -R assets $out ''; meta = with stdenv.lib; { From f79ae71748efe77af215dfe0e07e331784cf2453 Mon Sep 17 00:00:00 2001 From: "Jason \"Don\" O'Conal" Date: Sun, 27 Oct 2013 23:57:44 +0000 Subject: [PATCH 024/179] php54: add pcntl option --- pkgs/development/interpreters/php/5.4.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/interpreters/php/5.4.nix b/pkgs/development/interpreters/php/5.4.nix index eb3d796f229..3edf25b0cd9 100644 --- a/pkgs/development/interpreters/php/5.4.nix +++ b/pkgs/development/interpreters/php/5.4.nix @@ -58,6 +58,10 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) buildInputs = [ libxml2 ]; }; + pcntl = { + configureFlags = [ "--enable-pcntl" ]; + }; + readline = { configureFlags = ["--with-readline=${readline}"]; buildInputs = [ readline ]; @@ -188,6 +192,7 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) socketsSupport = config.php.sockets or true; curlSupport = config.php.curl or true; gettextSupport = config.php.gettext or true; + pcntlSupport = config.php.pcntl or true; postgresqlSupport = config.php.postgresql or true; readlineSupport = config.php.readline or true; sqliteSupport = config.php.sqlite or true; From 0229f45cf3284a70ff1a7f30c750bbf5aea3b10d Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 28 Oct 2013 17:08:33 +0100 Subject: [PATCH 025/179] nixos/graphite: graphite requires pidfile set for startup --- nixos/modules/services/monitoring/graphite.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index 7fa3ab22b00..a4928963f70 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -8,7 +8,7 @@ let dataDir = "/var/db/graphite"; carbonOpts = name: with config.ids; '' - --nodaemon --syslog --prefix=${name} \ + --nodaemon --syslog --prefix=${name} --pidfile /var/run/${name}.pid \ --uid ${toString uids.graphite} --gid ${toString uids.graphite} ${name} ''; carbonEnv = { From c1ad1892953e81df17abfeebc90572878d31d2b9 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 28 Oct 2013 17:09:53 +0100 Subject: [PATCH 026/179] nixos/graphite: limit amount of log message defaults --- nixos/modules/services/monitoring/graphite.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index a4928963f70..dc4261bdb09 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -52,6 +52,9 @@ in { PICKLE_RECEIVER_INTERFACE = 127.0.0.1 LINE_RECEIVER_INTERFACE = 127.0.0.1 CACHE_QUERY_INTERFACE = 127.0.0.1 + # Do not log every update + LOG_UPDATES = False + LOG_CACHE_HITS = False ''; type = types.uniq types.string; }; From b20c08d2cb85ba9e2b2f45f0b57b6cd77d2f66c9 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 28 Oct 2013 18:14:01 +0100 Subject: [PATCH 027/179] nixos/redis: user set uid, make it compatible #1076 --- nixos/modules/misc/ids.nix | 1 + nixos/modules/services/databases/redis.nix | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index adaa2b0d9ae..66f04668a70 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -102,6 +102,7 @@ tcpcryptd = 93; # tcpcryptd uses a hard-coded uid. We patch it in Nixpkgs to match this choice. zope2 = 94; firebird = 95; + redis = 96; # When adding a uid, make sure it doesn't match an existing gid. diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix index 5bc58c73bd6..059b157498d 100644 --- a/nixos/modules/services/databases/redis.nix +++ b/nixos/modules/services/databases/redis.nix @@ -177,8 +177,9 @@ in config = mkIf config.services.redis.enable { - users.extraUsers = singleton + users.extraUsers.redis = { name = cfg.user; + uid = config.ids.uids.redis; description = "Redis database user"; }; From d28a9619a1d48b0885a027aa0ad976966f7778eb Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 28 Oct 2013 18:14:49 +0100 Subject: [PATCH 028/179] nixos/redis: log to syslog by default --- nixos/modules/services/databases/redis.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix index 059b157498d..ea6399ba4f4 100644 --- a/nixos/modules/services/databases/redis.nix +++ b/nixos/modules/services/databases/redis.nix @@ -14,6 +14,7 @@ let ${condOption "unixsocket" cfg.unixSocket} loglevel ${cfg.logLevel} logfile ${cfg.logfile} + syslog-enabled ${redisBool cfg.syslog} databases ${toString cfg.databases} ${concatMapStrings (d: "save ${toString (builtins.elemAt d 0)} ${toString (builtins.elemAt d 1)}\n") cfg.save} dbfilename ${cfg.dbFilename} @@ -82,12 +83,18 @@ in }; logfile = mkOption { - default = "stdout"; + default = "/dev/null"; description = "Specify the log file name. Also 'stdout' can be used to force Redis to log on the standard output."; example = "/var/log/redis.log"; type = with types; string; }; + syslog = mkOption { + default = true; + description = "Enable logging to the system logger."; + type = with types; bool; + }; + databases = mkOption { default = 16; description = "Set the number of databases."; From 094edba311acbe4447d96a2f290b99f6a19f0f51 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Mon, 28 Oct 2013 17:54:28 +0100 Subject: [PATCH 029/179] ghc-with-packages.nix: make sure that GHC itself is included in the environment --- pkgs/development/compilers/ghc/with-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/with-packages.nix b/pkgs/development/compilers/ghc/with-packages.nix index 979b2480586..b32b12d5b95 100644 --- a/pkgs/development/compilers/ghc/with-packages.nix +++ b/pkgs/development/compilers/ghc/with-packages.nix @@ -10,7 +10,7 @@ let in buildEnv { name = "haskell-env-${ghc.name}"; - paths = stdenv.lib.filter (x: x ? ghc) (stdenv.lib.closePropagation (packages ++ [ghc])); + paths = stdenv.lib.filter (x: x ? ghc) (stdenv.lib.closePropagation packages) ++ [ghc]; postBuild = '' . ${makeWrapper}/nix-support/setup-hook From a80598b535b0d0e087c18a53f9033b748fcfbe05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 28 Oct 2013 19:44:36 +0100 Subject: [PATCH 030/179] nixops: build nixops also for OSX and FreeBSD --- pkgs/tools/package-management/nixops/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/package-management/nixops/default.nix b/pkgs/tools/package-management/nixops/default.nix index 18144b41d91..b23c8139309 100644 --- a/pkgs/tools/package-management/nixops/default.nix +++ b/pkgs/tools/package-management/nixops/default.nix @@ -40,6 +40,6 @@ pythonPackages.buildPythonPackage rec { homepage = https://github.com/NixOS/nixops; description = "NixOS cloud provisioning and deployment tool"; maintainers = [ lib.maintainers.eelco lib.maintainers.rob ]; - platforms = lib.platforms.linux; + platforms = lib.platforms.unix; }; } From 46b2bd427cce0fcc65f1c22449e6f7a759d1e99a Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 28 Oct 2013 03:09:10 +0100 Subject: [PATCH 031/179] portmidi: New package in version 217. This uses a patch from Gentoo to disable Java support for now, as it is not needed for supporting Mixxx (which is the package I'm preparing). Hopefully, the patch will be applied upstream so we can safely drop it here. Signed-off-by: aszlig --- .../libraries/portmidi/default.nix | 54 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 56 insertions(+) create mode 100644 pkgs/development/libraries/portmidi/default.nix diff --git a/pkgs/development/libraries/portmidi/default.nix b/pkgs/development/libraries/portmidi/default.nix new file mode 100644 index 00000000000..19eb390388b --- /dev/null +++ b/pkgs/development/libraries/portmidi/default.nix @@ -0,0 +1,54 @@ +{ stdenv, fetchurl, unzip, cmake, /*openjdk,*/ alsaLib }: + +stdenv.mkDerivation rec { + name = "portmidi-${version}"; + version = "217"; + + src = fetchurl { + url = "mirror://sourceforge/portmedia/portmidi-src-${version}.zip"; + sha256 = "03rfsk7z6rdahq2ihy5k13qjzgx757f75yqka88v3gc0pn9ais88"; + }; + + cmakeFlags = let + #base = "${openjdk}/jre/lib/${openjdk.architecture}"; + in [ + "-DPORTMIDI_ENABLE_JAVA=0" + /* TODO: Fix Java support. + "-DJAVA_AWT_LIBRARY=${base}/libawt.so" + "-DJAVA_JVM_LIBRARY=${base}/server/libjvm.so" + */ + "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=Release" + "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=Release" + "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=Release" + ]; + + # XXX: This is to deactivate Java support. + patches = stdenv.lib.singleton (fetchurl rec { + url = "https://raw.github.com/Rogentos/argent-gentoo/master/media-libs/" + + "portmidi/files/portmidi-217-cmake-libdir-java-opts.patch"; + sha256 = "1jbjwan61iqq9fqfpq2a4fd30k3clg7a6j0gfgsw87r8c76kqf6h"; + }); + + postPatch = '' + sed -i -e 's|/usr/local/|'"$out"'|' -e 's|/usr/share/|'"$out"'/share/|' \ + pm_common/CMakeLists.txt pm_dylib/CMakeLists.txt pm_java/CMakeLists.txt + sed -i \ + -e 's|-classpath .|-classpath '"$(pwd)"'/pm_java|' \ + -e 's|pmdefaults/|'"$(pwd)"'/pm_java/&|g' \ + -e 's|jportmidi/|'"$(pwd)"'/pm_java/&|g' \ + -e 's/WORKING_DIRECTORY pm_java//' \ + pm_java/CMakeLists.txt + ''; + + postInstall = '' + ln -s libportmidi.so "$out/lib/libporttime.so" + ''; + + buildInputs = [ unzip cmake /*openjdk*/ alsaLib ]; + + meta = { + homepage = "http://portmedia.sourceforge.net/portmidi/"; + description = "Platform independent library for MIDI I/O"; + license = stdenv.lib.licenses.mit; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7b274c4043b..376a59a47f1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5416,6 +5416,8 @@ let portaudioSVN = callPackage ../development/libraries/portaudio/svn-head.nix { }; + portmidi = callPackage ../development/libraries/portmidi {}; + prison = callPackage ../development/libraries/prison { }; proj = callPackage ../development/libraries/proj { }; From 45e740b1192368fc0f2622fcaba3bdf4bf155af1 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 28 Oct 2013 03:16:32 +0100 Subject: [PATCH 032/179] mixxx: New package in version 1.11.0. Compiles fine on linux i686 and amd64. Adding myself as maintainer, even though I'm not using the package by myself, but a friend is using it for DJing from a NixOS live system I'm maintaining. Signed-off-by: aszlig --- pkgs/applications/audio/mixxx/default.nix | 51 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++ 2 files changed, 55 insertions(+) create mode 100644 pkgs/applications/audio/mixxx/default.nix diff --git a/pkgs/applications/audio/mixxx/default.nix b/pkgs/applications/audio/mixxx/default.nix new file mode 100644 index 00000000000..b76eecc9e4a --- /dev/null +++ b/pkgs/applications/audio/mixxx/default.nix @@ -0,0 +1,51 @@ +{ stdenv, fetchurl, scons, pkgconfig, qt4, portaudio, portmidi, libusb1 +, libmad, protobuf, libvorbis, taglib, libid3tag, flac, libsndfile, libshout +, fftw, vampSDK +}: + +stdenv.mkDerivation rec { + name = "mixxx-${version}"; + version = "1.11.0"; + + src = fetchurl { + url = "http://downloads.mixxx.org/${name}/${name}-src.tar.gz"; + sha256 = "0c833gf4169xvpfn7car9vzvwfwl9d3xwmbfsy36cv8ydifip5h0"; + }; + + buildInputs = [ + scons pkgconfig qt4 portaudio portmidi libusb1 libmad protobuf libvorbis + taglib libid3tag flac libsndfile libshout fftw vampSDK + ]; + + sconsFlags = [ + "build=release" + "qtdir=${qt4}" + ]; + + postPatch = '' + sed -i -e 's/"which /"type -P /' build/depends.py + ''; + + buildPhase = '' + runHook preBuild + ensureDir "$out" + scons \ + -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \ + $sconsFlags "prefix=$out" + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + scons $sconsFlags "prefix=$out" install + runHook postInstall + ''; + + meta = { + homepage = "http://mixxx.org/"; + description = "Digital DJ mixing software"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = [ stdenv.lib.maintainers.aszlig ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 376a59a47f1..32621d2312e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8291,6 +8291,10 @@ let mirage = callPackage ../applications/graphics/mirage {}; + mixxx = callPackage ../applications/audio/mixxx { + inherit (vamp) vampSDK; + }; + mmex = callPackage ../applications/office/mmex { }; monkeysAudio = callPackage ../applications/audio/monkeys-audio { }; From 877614ce993714507fc88afb581643736bb17d6f Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 28 Oct 2013 03:24:35 +0100 Subject: [PATCH 033/179] python-paramiko: Fix maintainerS attribute name. Signed-off-by: aszlig --- pkgs/top-level/python-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6f6c52a1b0d..a4efec899e4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4022,7 +4022,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { homepage = "https://github.com/paramiko/paramiko/"; description = "Native Python SSHv2 protocol library"; license = stdenv.lib.licenses.lgpl21Plus; - maintainer = [ stdenv.lib.maintainers.aszlig ]; + maintainers = [ stdenv.lib.maintainers.aszlig ]; longDescription = '' This is a library for making SSH2 connections (client or server). From 246b59ec1116fc97ab9fd45a4724eea9b37761a4 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 28 Oct 2013 19:07:51 +0100 Subject: [PATCH 034/179] chromium: Update stable and beta channels. stable: 30.0.1599.101 -> 30.0.1599.114 http://googlechromereleases.blogspot.de/2013/10/stable-channel-update_22.html beta: 31.0.1650.26 -> 31.0.1650.34 http://googlechromereleases.blogspot.de/2013/10/beta-channel-update_23.html Builds and tests pass on my machine. The update for the dev channel is currently not building and I'm going to fix it later. Signed-off-by: aszlig --- .../networking/browsers/chromium/sources.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/sources.nix b/pkgs/applications/networking/browsers/chromium/sources.nix index ae49890caf3..aae71e8dfb6 100644 --- a/pkgs/applications/networking/browsers/chromium/sources.nix +++ b/pkgs/applications/networking/browsers/chromium/sources.nix @@ -6,13 +6,13 @@ sha256 = "0bv86ig3mrd95zh78880bcyh9b8w46s7slxq3mwwmrmqp0s8qaq0"; }; beta = { - version = "31.0.1650.26"; - url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-31.0.1650.26.tar.xz"; - sha256 = "14jvbjn7nsc4psi7n6rjsb5d930k4jawbgqlx3hkhmkz5nhbrplx"; + version = "31.0.1650.34"; + url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-31.0.1650.34.tar.xz"; + sha256 = "0c73kvp09cmq4x42rcf45v0mnbyb8rcyi5i4pj0pvfn451vbngdq"; }; stable = { - version = "30.0.1599.101"; - url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-30.0.1599.101.tar.xz"; - sha256 = "0bd49k9qpycpp4z230pqwsi22565lzhyq59js34baawjqql6ynfr"; + version = "30.0.1599.114"; + url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-30.0.1599.114.tar.xz"; + sha256 = "0q5pq8bj4y0c7hd121db1fa9g3apkpkhb6cf14ag7abgrda2pzw2"; }; } From aa018de67da8e9f47053649d9c1e20db1f3c4f2e Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 28 Oct 2013 19:12:52 +0100 Subject: [PATCH 035/179] python-pywebkitgtk: New package, version 1.1.8. This is needed as a build dependency for miro. Signed-off-by: aszlig --- pkgs/top-level/python-packages.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a4efec899e4..b0ffa1acf74 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5205,6 +5205,27 @@ pythonPackages = modules // import ./python-packages-generated.nix { }); + pywebkitgtk = stdenv.mkDerivation rec { + name = "pywebkitgtk-${version}"; + version = "1.1.8"; + + src = fetchurl { + url = "http://pywebkitgtk.googlecode.com/files/${name}.tar.bz2"; + sha256 = "1svlwyl61rvbqbcbalkg6pbf38yjyv7qkq9sx4x35yk69lscaac2"; + }; + + buildInputs = with pkgs; [ + pkgconfig python gtk2 pygtk libxml2 libxslt libsoup webkit_gtk2 icu + ]; + + meta = { + homepage = "https://code.google.com/p/pywebkitgtk/"; + description = "Python bindings for the WebKit GTK+ port"; + license = stdenv.lib.licenses.lgpl2Plus; + }; + }; + + pyxattr = buildPythonPackage (rec { name = "pyxattr-0.5.1"; From df4a3cc9f94ff21e20f64206c47c2f2e354ed299 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 28 Oct 2013 19:15:32 +0100 Subject: [PATCH 036/179] miro: New package, version 6.0. I actually had this breeding in my nixpkgs overrides for a year and only recently took the time to fix it and thus revive my video feeds :-) The package uses a patch which is removing the dependency on gconf and switches to storage within a shelve in ~/.miro/config instead. Signed-off-by: aszlig --- pkgs/applications/video/miro/default.nix | 76 +++++ pkgs/applications/video/miro/gconf.patch | 374 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 + 3 files changed, 454 insertions(+) create mode 100644 pkgs/applications/video/miro/default.nix create mode 100644 pkgs/applications/video/miro/gconf.patch diff --git a/pkgs/applications/video/miro/default.nix b/pkgs/applications/video/miro/default.nix new file mode 100644 index 00000000000..5ca6c80dc7c --- /dev/null +++ b/pkgs/applications/video/miro/default.nix @@ -0,0 +1,76 @@ +{ stdenv, fetchurl, python, buildPythonPackage, pythonPackages, pkgconfig +, pyrex096, ffmpeg, boost, glib, pygobject, gtk2, webkit_gtk2, libsoup, pygtk +, taglib, pysqlite, pycurl, mutagen, pycairo, pythonDBus, pywebkitgtk +, libtorrentRasterbar +, gst_python, gst_plugins_base, gst_plugins_good, gst_ffmpeg +}: + +buildPythonPackage rec { + name = "miro-${version}"; + namePrefix = ""; + version = "6.0"; + + src = fetchurl { + url = "http://ftp.osuosl.org/pub/pculture.org/miro/src/${name}.tar.gz"; + sha256 = "0sq25w365i1fz95398vxql3yjl5i6mq77mnmlhmn0pgyg111k3am"; + }; + + setSourceRoot = '' + sourceRoot=${name}/linux + ''; + + patches = [ ./gconf.patch ]; + + postPatch = '' + sed -i -e '2i import os; os.environ["GST_PLUGIN_PATH"] = \\\ + '"'$GST_PLUGIN_PATH'" miro.real + + sed -i -e 's/\$(shell which python)/python/' Makefile + sed -i -e 's|/usr/bin/||' -e 's|/usr||' \ + -e 's/BUILD_TIME[^,]*/BUILD_TIME=0/' setup.py + + sed -i -e 's|default="/usr/bin/ffmpeg"|default="${ffmpeg}/bin/ffmpeg"|' \ + plat/options.py + + sed -i -e 's|/usr/share/miro/themes|'"$out/share/miro/themes"'|' \ + -e 's/gnome-open/xdg-open/g' \ + -e '/RESOURCE_ROOT =.*(/,/)/ { + c RESOURCE_ROOT = '"'$out/share/miro/resources/'"' + }' \ + plat/resources.py + ''; + + installCommand = '' + python setup.py install --prefix= --root="$out" + ''; + + # Disabled for now, because it requires networking and even if we skip those + # tests, the whole test run takes around 10-20 minutes. + doCheck = false; + checkPhase = '' + HOME="$TEMPDIR" LANG=en_US.UTF-8 python miro.real --unittest + ''; + + postInstall = '' + mv "$out/bin/miro.real" "$out/bin/miro" + ''; + + buildInputs = [ + pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkit_gtk2 libsoup + pygtk taglib + ]; + + propagatedBuildInputs = [ + pygobject pygtk pycurl python.modules.sqlite3 mutagen pycairo pythonDBus + pywebkitgtk libtorrentRasterbar + gst_python gst_plugins_base gst_plugins_good gst_ffmpeg + ]; + + meta = { + homepage = "http://www.getmiro.com/"; + description = "Video and audio feed aggregator"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = [ stdenv.lib.maintainers.aszlig ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/applications/video/miro/gconf.patch b/pkgs/applications/video/miro/gconf.patch new file mode 100644 index 00000000000..bc516da9cbf --- /dev/null +++ b/pkgs/applications/video/miro/gconf.patch @@ -0,0 +1,374 @@ +diff --git a/plat/associate.py b/plat/associate.py +index 0f3cd31..f9b5a76 100644 +--- a/plat/associate.py ++++ b/plat/associate.py +@@ -31,69 +31,8 @@ + Holds functions that associate Miro with certain protocols + """ + +-import gconf +-from miro.plat.config import gconf_lock +- + def associate_protocols(command): +- _associate_protocol("magnet", command, False) ++ pass + + def disassociate_protocols(command): +- _disassociate_protocol("magnet", command) +- +-def _associate_protocol(name, command, overwrite_existing=False): +- url_handlers_key = "/desktop/gnome/url-handlers/" + name + "/" +- if not _is_associated(name) or overwrite_existing: +- gconf_lock.acquire() +- try: +- gconf_client = gconf.client_get_default() +- if gconf_client.set_string(url_handlers_key + "command", command): +- gconf_client.set_bool(url_handlers_key + "needs_terminal", False) +- gconf_client.set_bool(url_handlers_key + "enabled", True) +- success = True +- else: +- success = False +- finally: +- gconf_lock.release() +- else: +- success = True +- return success +- +-def _disassociate_protocol(name, command): +- url_handlers_key = "/desktop/gnome/url-handlers/" + name + "/" +- if _is_associated(name, command): +- gconf_lock.acquire() +- try: +- gconf_client = gconf.client_get_default() +- if gconf_client.set_bool(url_handlers_key + "enabled", False): +- success = True +- else: +- success = False +- finally: +- gconf_lock.release() +- else: +- success = True +- return success +- +-def _is_associated(protocol, command=None): +- """ Checks whether a protocol currently is +- associated with the given command, or, +- if none is given, whether the protocol +- is associated with anything at all. +- """ +- url_handlers_key = "/desktop/gnome/url-handlers/" + protocol + "/" +- gconf_lock.acquire() +- try: +- gconf_client = gconf.client_get_default() +- key = gconf_client.get(url_handlers_key + "command") +- if key is None: +- associated = False +- else: +- enabled = gconf_client.get(url_handlers_key + "enabled") +- if command: +- associated = key.get_string() == command and enabled.get_bool() +- else: +- associated = key.get_string() != "" and enabled.get_bool() +- finally: +- gconf_lock.release() +- return associated +- ++ pass +diff --git a/plat/config.py b/plat/config.py +index 40895af..24f8815 100644 +--- a/plat/config.py ++++ b/plat/config.py +@@ -39,51 +39,20 @@ Preferences are listed in miro.pref and also miro.plat.options. + import os + import logging + from miro import prefs +-import gconf ++import shelve + import threading + from miro.plat import options + from miro.plat import resources + +-client = gconf.client_get_default() +-gconf_lock = threading.RLock() +- +- +-def gconf_key(key): +- if options.gconf_name is None: +- options.gconf_name = "miro" +- return '/apps/%s/%s' % (options.gconf_name, key) +- +- +-def _convert_gconf_value(value): +- if value.type == gconf.VALUE_STRING: +- return value.get_string() +- if value.type == gconf.VALUE_INT: +- return value.get_int() +- if value.type == gconf.VALUE_BOOL: +- return value.get_bool() +- if value.type == gconf.VALUE_FLOAT: +- return value.get_float() +- if value.type == gconf.VALUE_LIST: +- return [_convert_gconf_value(v) for v in value.get_list()] +- raise TypeError("unknown gconf type %s" % value.type) +- +- +-def _get_gconf(fullkey, default=None): +- gconf_lock.acquire() +- try: +- value = client.get(fullkey) +- if value != None: +- try: +- return _convert_gconf_value(value) +- except TypeError, e: +- logging.warn("type error while getting gconf value %s: %s", +- fullkey, str(e)) +- return default +- finally: +- gconf_lock.release() +- +- +-class GconfDict: ++ ++class ConfigFile(object): ++ def __init__(self): ++ support_dir = get(prefs.SUPPORT_DIRECTORY) ++ if not os.path.exists(support_dir): ++ os.makedirs(support_dir) ++ path = os.path.join(support_dir, 'config') ++ self.conf = shelve.open(path, 'c', -1, True) ++ + def get(self, key, default=None): + if not isinstance(key, str): + raise TypeError() +@@ -91,19 +56,16 @@ class GconfDict: + if "MIRO_%s" % key.upper() in os.environ: + return os.environ["MIRO_%s" % key.upper()] + +- fullkey = gconf_key(key) +- return _get_gconf(fullkey, default) ++ return self.conf.get(key, default) ++ ++ def __del__(self): ++ self.conf.close() + + def __contains__(self, key): + if "MIRO_%s" % key.upper() in os.environ: + return True + +- gconf_lock.acquire() +- try: +- fullkey = gconf_key(key) +- return client.get(fullkey) is not None +- finally: +- gconf_lock.release() ++ return key in self.conf + + def __getitem__(self, key): + rv = self.get(key) +@@ -116,43 +78,11 @@ class GconfDict: + if "MIRO_%s" % key.upper() in os.environ: + return + +- gconf_lock.acquire() +- try: +- if not isinstance(key, str): +- raise TypeError() +- +- fullkey = gconf_key(key) +- if isinstance(value, str): +- client.set_string(fullkey, value) +- elif isinstance(value, bool): +- client.set_bool(fullkey, value) +- elif isinstance(value, int): +- client.set_int(fullkey, value) +- elif isinstance(value, float): +- client.set_float(fullkey, value) +- elif isinstance(value, list): +- # this is lame, but there isn't enough information to +- # figure it out another way +- if len(value) == 0 or isinstance(value[0], str): +- list_type = gconf.VALUE_STRING +- elif isinstance(value[0], int): +- list_type = gconf.VALUE_INT +- elif isinstance(value[0], float): +- list_type = gconf.VALUE_FLOAT +- elif isinstance(value[0], bool): +- list_type = gconf.VALUE_BOOL +- else: +- raise TypeError("unknown gconf type %s" % type(value[0])) +- +- client.set_list(fullkey, list_type, value) +- else: +- raise TypeError() +- finally: +- gconf_lock.release() ++ self.conf[key] = value + + + def load(): +- return GconfDict() ++ return ConfigFile() + + + def save(data): +@@ -208,25 +138,4 @@ def get(descriptor): + value = get(prefs.SUPPORT_DIRECTORY) + value = os.path.join(value, 'miro-helper.log') + +- elif descriptor == prefs.HTTP_PROXY_ACTIVE: +- return _get_gconf("/system/http_proxy/use_http_proxy") +- +- elif descriptor == prefs.HTTP_PROXY_HOST: +- return _get_gconf("/system/http_proxy/host") +- +- elif descriptor == prefs.HTTP_PROXY_PORT: +- return _get_gconf("/system/http_proxy/port") +- +- elif descriptor == prefs.HTTP_PROXY_AUTHORIZATION_ACTIVE: +- return _get_gconf("/system/http_proxy/use_authentication") +- +- elif descriptor == prefs.HTTP_PROXY_AUTHORIZATION_USERNAME: +- return _get_gconf("/system/http_proxy/authentication_user") +- +- elif descriptor == prefs.HTTP_PROXY_AUTHORIZATION_PASSWORD: +- return _get_gconf("/system/http_proxy/authentication_password") +- +- elif descriptor == prefs.HTTP_PROXY_IGNORE_HOSTS: +- return _get_gconf("/system/http_proxy/ignore_hosts", []) +- + return value +diff --git a/plat/frontends/widgets/application.py b/plat/frontends/widgets/application.py +index a1eaaf3..20f4c23 100644 +--- a/plat/frontends/widgets/application.py ++++ b/plat/frontends/widgets/application.py +@@ -35,7 +35,6 @@ except RuntimeError: + sys.exit(1) + import gobject + import os +-import gconf + import shutil + import platform + +@@ -53,7 +52,6 @@ from miro import prefs + from miro.frontends.widgets.application import Application + # from miro.plat.frontends.widgets import threads + from miro.plat import renderers, options +-from miro.plat.config import gconf_lock, gconf_key + try: + from miro.plat.frontends.widgets import miroappindicator + APP_INDICATOR_SUPPORT = True +@@ -77,29 +75,13 @@ import sys + + + def _get_pref(key, getter_name): +- gconf_lock.acquire() +- try: +- client = gconf.client_get_default() +- fullkey = gconf_key(key) +- value = client.get(fullkey) +- if value is not None: +- getter = getattr(value, getter_name) +- return getter() +- else: +- return None +- finally: +- gconf_lock.release() ++ # XXX: ugly! ++ return app.config._data.get(key) + + + def _set_pref(key, setter_name, value): +- gconf_lock.acquire() +- try: +- client = gconf.client_get_default() +- fullkey = gconf_key(key) +- setter = getattr(client, setter_name) +- setter(fullkey, value) +- finally: +- gconf_lock.release() ++ # XXX: ugly! ++ app.config._data[key] = value + + + def get_int(key): +diff --git a/plat/options.py b/plat/options.py +index 4ea1a67..8e75e20 100644 +--- a/plat/options.py ++++ b/plat/options.py +@@ -69,14 +69,14 @@ USE_RENDERER = LinuxPref( + + GSTREAMER_IMAGESINK = LinuxPref( + key="DefaultGstreamerImagesink", +- default="gconfvideosink", ++ default="autovideosink", + alias="gstreamer-imagesink", + helptext=("Which GStreamer image sink to use for video. " + "(autovideosink, ximagesink, xvimagesink, gconfvideosink, ...)")) + + GSTREAMER_AUDIOSINK = LinuxPref( + key="DefaultGstreamerAudiosink", +- default="gconfaudiosink", ++ default="autoaudiosink", + alias="gstreamer-audiosink", + helptext=("Which GStreamer sink to use for audio. " + "(autoaudiosink, osssink, alsasink, gconfaudiosink, ...)")) +diff --git a/plat/upgrade.py b/plat/upgrade.py +index 9677e3a..f812ad4 100644 +--- a/plat/upgrade.py ++++ b/plat/upgrade.py +@@ -30,7 +30,6 @@ + import os + import shutil + from miro.plat import resources +-import gconf + + + def upgrade(): +@@ -64,47 +63,3 @@ def upgrade(): + os.remove(old_file) + except OSError: + pass +- +- # gconf settings +- client = gconf.client_get_default() +- +- def _copy_gconf(src, dst): +- for entry in client.all_entries(src): +- entry_dst = dst + '/' + entry.key.split('/')[-1] +- client.set(entry_dst, entry.value) +- for subdir in client.all_dirs(src): +- subdir_dst = dst + '/' + subdir.split('/')[-1] +- _copy_gconf(subdir, subdir_dst) +- +- if ((client.dir_exists("/apps/democracy/player") +- and not client.dir_exists("/apps/miro"))): +- _copy_gconf("/apps/democracy/player", "/apps/miro") +- client.recursive_unset("/apps/democracy", 1) +- +- # Set the MoviesDirectory and NonVideoDirectory based on the +- # possibilities that we've had over the years and what exists on +- # the user's system. This codifies it in the user's gconf so that +- # when we change it in future, then the user isn't affected. +- from miro.plat import options +- if options.gconf_name is None: +- options.gconf_name = "miro" +- key = "/apps/%s/MoviesDirectory" % options.gconf_name +- if client.get(key) is None: +- for mem in ["~/.miro/Movies", # packages +- "~/Videos/Miro", +- "~/Movies/Miro", # pre 3.5 +- "~/Movies/Democracy" # democracy player +- ]: +- mem = os.path.expanduser(mem) +- if os.path.exists(mem): +- client.set_string(key, mem) +- break +- +- key = "/apps/%s/NonVideoDirectory" % options.gconf_name +- if client.get(key) is None: +- for mem in ["~/.miro/Nonvideo" # packages +- ]: +- mem = os.path.expanduser(mem) +- if os.path.exists(mem): +- client.set_string(key, mem) +- break diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 32621d2312e..f27e504bb3b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5210,6 +5210,10 @@ let minmay = callPackage ../development/libraries/minmay { }; + miro = callPackage ../applications/video/miro { + inherit (pythonPackages) pywebkitgtk pysqlite pycurl mutagen; + }; + mkvtoolnix = callPackage ../applications/video/mkvtoolnix { }; mlt = callPackage ../development/libraries/mlt { From d9b4fe9e5d6a3cca942ef85ffbcb7af9f959b510 Mon Sep 17 00:00:00 2001 From: "Jason \"Don\" O'Conal" Date: Mon, 28 Oct 2013 21:10:19 +0000 Subject: [PATCH 037/179] pythonPackages.sympy: add expression --- pkgs/top-level/python-packages.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b0ffa1acf74..fc3eaa2679f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5678,6 +5678,23 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; }; + sympy = buildPythonPackage rec { + name = "sympy-0.7.3"; + + src = fetchurl { + url = "https://github.com/sympy/sympy/releases/download/${name}/${name}.tar.gz"; + sha256 = "081g9gs2d1d41ipn8zr034d98cnrxvc4zsmihqmfwzirwzpcii5x"; + }; + + meta = with stdenv.lib; { + description = "A Python library for symbolic mathematics"; + homepage = http://www.sympy.org/; + license = "free"; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; + }; + }; + pilkit = buildPythonPackage rec { name = "pilkit-1.1.4"; From 41c8f9598ede18fe2185a922be4730cbe8530843 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 27 Oct 2013 23:36:41 +0100 Subject: [PATCH 038/179] Remove dead code --- nixos/modules/services/system/dbus.nix | 37 +------------------------- 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index eab876be76d..196fa40c551 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -122,7 +122,7 @@ in [Socket] ListenStream=/var/run/dbus/system_bus_socket ''; - + systemd.units."dbus.service".text = '' [Unit] @@ -137,41 +137,6 @@ in OOMScoreAdjust=-900 ''; - /* - jobs.dbus = - { startOn = "started udev and started syslogd"; - - restartIfChanged = false; - - path = [ pkgs.dbus_daemon pkgs.dbus_tools ]; - - preStart = - '' - mkdir -m 0755 -p ${homeDir} - chown messagebus ${homeDir} - - mkdir -m 0755 -p /var/lib/dbus - dbus-uuidgen --ensure - - rm -f ${homeDir}/pid - ''; - - daemonType = "fork"; - - exec = "dbus-daemon --system"; - - postStop = - '' - # !!! Hack: doesn't belong here. - pid=$(cat /var/run/ConsoleKit/pid || true) - if test -n "$pid"; then - kill $pid || true - rm -f /var/run/ConsoleKit/pid - fi - ''; - }; - */ - security.setuidOwners = singleton { program = "dbus-daemon-launch-helper"; source = "${pkgs.dbus_daemon}/libexec/dbus-daemon-launch-helper"; From 335422f7beeca0707986319707268c358d36a0c1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 00:07:27 +0100 Subject: [PATCH 039/179] Get rid of the only use of mkDefaultValue --- nixos/modules/system/upstart/upstart.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/system/upstart/upstart.nix b/nixos/modules/system/upstart/upstart.nix index 5d5139b7a57..58523652864 100644 --- a/nixos/modules/system/upstart/upstart.nix +++ b/nixos/modules/system/upstart/upstart.nix @@ -246,7 +246,7 @@ let config = { # The default name is the name extracted from the attribute path. - name = mkDefaultValue name; + name = mkDefault name; }; From 5b8c4d2a7d3fc59636e44c69f7bddd5ffd9b0bed Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 00:08:07 +0100 Subject: [PATCH 040/179] Get rid of the only use of mkNotdef --- nixos/modules/config/swap.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix index 7d4654ae287..fb171050d3e 100644 --- a/nixos/modules/config/swap.nix +++ b/nixos/modules/config/swap.nix @@ -72,11 +72,8 @@ with utils; }; config = { - device = - if options.label.isDefined then - "/dev/disk/by-label/${config.label}" - else - mkNotdef; + device = mkIf options.label.isDefined + "/dev/disk/by-label/${config.label}"; }; }; From 2cc37c17d9313a22c5f4f2acbdd5b665c53f9f3c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 00:08:42 +0100 Subject: [PATCH 041/179] openvpn.nix: Improve types --- nixos/modules/services/networking/openvpn.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix index 1e862591406..8cc19506e21 100644 --- a/nixos/modules/services/networking/openvpn.nix +++ b/nixos/modules/services/networking/openvpn.nix @@ -117,11 +117,11 @@ in type = types.attrsOf types.optionSet; - options = { + options = { config = mkOption { - type = types.string; - description = '' + type = types.lines; + description = '' Configuration of this OpenVPN instance. See openvpn8 for details. @@ -130,7 +130,7 @@ in up = mkOption { default = ""; - type = types.string; + type = types.lines; description = '' Shell commands executed when the instance is starting. ''; @@ -138,7 +138,7 @@ in down = mkOption { default = ""; - type = types.string; + type = types.lines; description = '' Shell commands executed when the instance is shutting down. ''; From f4dadc5df8561405df9aabf4fa2c2dcd13234b22 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 00:13:13 +0100 Subject: [PATCH 042/179] rename.nix: Don't use the extraConfigs feature --- nixos/modules/rename.nix | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 1d19fe6da76..82ba051eebf 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -32,7 +32,6 @@ let zipAttrsWith (n: v: if tail v != [] then if n == "_type" then (head v) - else if n == "extraConfigs" then concatLists v else if n == "warnings" then concatLists v else if n == "description" || n == "apply" then abort "Cannot rename an option to multiple options." @@ -55,12 +54,7 @@ let inherit visible; }); } - { options = setTo (mkOption { - extraConfigs = - let externalDefs = (fromOf options).definitions; in - if externalDefs == [] then [] - else map (def: def.value) (define externalDefs); - }); + { config = setTo (mkIf (fromOf options).isDefined (define (mkMerge (fromOf options).definitions))); } ]; From 0e333688cea468a28516bf6935648c03ed62a7bb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 00:56:22 +0100 Subject: [PATCH 043/179] Big cleanup of the NixOS module system The major changes are: * The evaluation is now driven by the declared options. In particular, this fixes the long-standing problem with lack of laziness of disabled option definitions. Thus, a configuration like config = mkIf false { environment.systemPackages = throw "bla"; }; will now evaluate without throwing an error. This also improves performance since we're not evaluating unused option definitions. * The implementation of properties is greatly simplified. * There is a new type constructor "submodule" that replaces "optionSet". Unlike "optionSet", "submodule" gets its option declarations as an argument, making it more like "listOf" and other type constructors. A typical use is: foo = mkOption { type = type.attrsOf (type.submodule ( { config, ... }: { bar = mkOption { ... }; xyzzy = mkOption { ... }; })); }; Existing uses of "optionSet" are automatically mapped to "submodule". * Modules are now checked for unsupported attributes: you get an error if a module contains an attribute other than "config", "options" or "imports". * The new implementation is faster and uses much less memory. --- lib/default.nix | 5 +- lib/lists.nix | 5 +- lib/modules.nix | 580 +++++++----------- lib/options.nix | 46 +- lib/properties.nix | 464 -------------- lib/types.nix | 144 ++--- nixos/lib/eval-config.nix | 13 +- nixos/modules/config/shells-environment.nix | 9 +- .../system/activation/activation-script.nix | 2 +- 9 files changed, 294 insertions(+), 974 deletions(-) delete mode 100644 lib/properties.nix diff --git a/lib/default.nix b/lib/default.nix index 033269e6b60..fc92e04503b 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -8,7 +8,6 @@ let sources = import ./sources.nix; modules = import ./modules.nix; options = import ./options.nix; - properties = import ./properties.nix; types = import ./types.nix; meta = import ./meta.nix; debug = import ./debug.nix; @@ -21,13 +20,13 @@ let in { inherit trivial lists strings stringsWithDeps attrsets sources options - properties modules types meta debug maintainers licenses platforms systems; + modules types meta debug maintainers licenses platforms systems; # Pull in some builtins not included elsewhere. inherit (builtins) pathExists readFile; } # !!! don't include everything at top-level; perhaps only the most # commonly used functions. // trivial // lists // strings // stringsWithDeps // attrsets // sources - // properties // options // types // meta // debug // misc // modules + // options // types // meta // debug // misc // modules // systems // customisation diff --git a/lib/lists.nix b/lib/lists.nix index 262a529b2b6..eb7e6baf5ed 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -165,10 +165,11 @@ in rec { zipLists = zipListsWith (fst: snd: { inherit fst snd; }); - - # Reverse the order of the elements of a list. + + # Reverse the order of the elements of a list. FIXME: O(n^2)! reverseList = fold (e: acc: acc ++ [ e ]) []; + # Sort a list based on a comparator function which compares two # elements and returns true if the first argument is strictly below # the second argument. The returned list is sorted in an increasing diff --git a/lib/modules.nix b/lib/modules.nix index f914947e784..f5a82d7d8e9 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1,379 +1,245 @@ -# NixOS module handling. - -let lib = import ./default.nix; in - -with { inherit (builtins) head; }; -with import ./trivial.nix; -with import ./lists.nix; -with import ./misc.nix; -with import ./attrsets.nix; -with import ./options.nix; -with import ./properties.nix; +with import ./.. {}; +with lib; rec { - # Unfortunately this can also be a string. - isPath = x: !( - builtins.isFunction x - || builtins.isAttrs x - || builtins.isInt x - || builtins.isBool x - || builtins.isList x - ); - - - importIfPath = path: - if isPath path then - import path - else - path; - - - applyIfFunction = f: arg: - if builtins.isFunction f then - f arg - else - f; - - - isModule = m: - (m ? config && isAttrs m.config && ! isOption m.config) - || (m ? options && isAttrs m.options && ! isOption m.options); - - - # Convert module to a set which has imports / options and config - # attributes. - unifyModuleSyntax = m: + /* Evaluate a set of modules. The result is a set of two + attributes: ‘options’: the nested set of all option declarations, + and ‘config’: the nested set of all option values. */ + evalModules = modules: args: let - delayedModule = delayProperties m; - - getImports = - toList (rmProperties (delayedModule.require or [])); - getImportedPaths = filter isPath getImports; - getImportedSets = filter (x: !isPath x) getImports; - - getConfig = - removeAttrs delayedModule ["require" "key" "imports"]; + args' = args // result; + closed = closeModules modules args'; + # Note: the list of modules is reversed to maintain backward + # compatibility with the old module system. Not sure if this is + # the most sensible policy. + options = mergeModules (reverseList closed); + config = yieldConfig options; + yieldConfig = mapAttrs (n: v: if isOption v then v.value else yieldConfig v); + result = { inherit options config; }; + in result; + /* Close a set of modules under the ‘imports’ relation. */ + closeModules = modules: args: + let + coerceToModule = n: x: + if isAttrs x || builtins.isFunction x then + unifyModuleSyntax "anon-${toString n}" (applyIfFunction x args) + else + unifyModuleSyntax (toString x) (applyIfFunction (import x) args); + toClosureList = imap (path: coerceToModule path); in - if isModule m then - { key = ""; } // m + builtins.genericClosure { + startSet = toClosureList modules; + operator = m: toClosureList m.imports; + }; + + /* Massage a module into canonical form, that is, a set consisting + of ‘options’, ‘config’ and ‘imports’ attributes. */ + unifyModuleSyntax = key: m: + if m ? config || m ? options || m ? imports then + let badAttrs = removeAttrs m ["imports" "options" "config"]; in + if badAttrs != {} then + throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. ${builtins.toXML m} " else - { key = ""; - imports = (m.imports or []) ++ getImportedPaths; - config = getConfig; - } // ( - if getImportedSets != [] then - assert length getImportedSets == 1; - { options = head getImportedSets; } + { inherit key; + imports = m.imports or []; + options = m.options or {}; + config = m.config or {}; + } + else + { inherit key; + imports = m.require or []; + options = {}; + config = m; + }; + + applyIfFunction = f: arg: if builtins.isFunction f then f arg else f; + + /* Merge a list of modules. This will recurse over the option + declarations in all modules, combining them into a single set. + At the same time, for each option declaration, it will merge the + corresponding option definitions in all machines, returning them + in the ‘value’ attribute of each option. */ + mergeModules = modules: + mergeModules' [] (map (m: m.options) modules) (concatMap (m: pushDownProperties m.config) modules); + + mergeModules' = loc: options: configs: + zipAttrsWith (name: vals: + let loc' = loc ++ [name]; in + if all isOption vals then + let opt = fixupOptionType loc' (mergeOptionDecls loc' vals); + in evalOptionValue loc' opt (catAttrs name configs) + else if any isOption vals then + throw "There are options with the prefix `${showOption loc'}', which is itself an option." + else + mergeModules' loc' vals (concatMap pushDownProperties (catAttrs name configs)) + ) options; + + /* Merge multiple option declarations into a single declaration. In + general, there should be only one declaration of each option. + The exception is the ‘options’ attribute, which specifies + sub-options. These can be specified multiple times to allow one + module to add sub-options to an option declared somewhere else + (e.g. multiple modules define sub-options for ‘fileSystems’). */ + mergeOptionDecls = loc: opts: + fold (opt1: opt2: + if opt1 ? default && opt2 ? default || + opt1 ? example && opt2 ? example || + opt1 ? description && opt2 ? description || + opt1 ? merge && opt2 ? merge || + opt1 ? apply && opt2 ? apply || + opt1 ? type && opt2 ? type + then + throw "Conflicting declarations of the option `${showOption loc}'." + else + opt1 // opt2 + // optionalAttrs (opt1 ? options && opt2 ? options) + { options = [ opt1.options opt2.options ]; } + ) {} opts; + + /* Merge all the definitions of an option to produce the final + config value. */ + evalOptionValue = loc: opt: defs: + let + # Process mkMerge and mkIf properties. + defs' = concatMap dischargeProperties defs; + # Process mkOverride properties, adding in the default + # value specified in the option declaration (if any). + defsFinal = filterOverrides (optional (opt ? default) (mkOptionDefault opt.default) ++ defs'); + # Type-check the remaining definitions, and merge them + # if possible. + merged = + if defsFinal == [] then + throw "The option `${showOption loc}' is used but not defined." + else + if all opt.type.check defsFinal then + opt.type.merge defsFinal + #throw "The option `${showOption loc}' has multiple values (with no way to merge them)." else - {} - ); - - - unifyOptionModule = {key ? ""}: name: index: m: (args: - let - module = lib.applyIfFunction m args; - key_ = rec { - file = key; - option = name; - number = index; - outPath = key; - }; - in if lib.isModule module then - { key = key_; } // module - else - { key = key_; options = module; } - ); - - - moduleClosure = initModules: args: - let - moduleImport = origin: index: m: - let m' = applyIfFunction (importIfPath m) args; - in (unifyModuleSyntax m') // { - # used by generic closure to avoid duplicated imports. - key = - if isPath m then m - else m'.key or (newModuleName origin index); - }; - - getImports = m: m.imports or []; - - newModuleName = origin: index: - "${origin.key}:"; - - topLevel = { - key = ""; + throw "A value of the option `${showOption loc}' has a bad type."; + # Finally, apply the ‘apply’ function to the merged + # value. This allows options to yield a value computed + # from the definitions. + value = (opt.apply or id) merged; + in opt // + { inherit value; + definitions = defsFinal; + isDefined = defsFinal != []; }; - in - (lazyGenericClosure { - startSet = imap (moduleImport topLevel) initModules; - operator = m: imap (moduleImport m) (getImports m); - }); + /* Given a config set, expand mkMerge properties, and push down the + mkIf properties into the children. The result is a list of + config sets that do not have properties at top-level. For + example, + mkMerge [ { boot = set1; } (mkIf cond { boot = set2; services = set3; }) ] - moduleApply = funs: module: - lib.mapAttrs (name: value: - if builtins.hasAttr name funs then - let fun = lib.getAttr name funs; in - fun value + is transformed into + + [ { boot = set1; } { boot = mkIf cond set2; services mkIf cond set3; } ]. + + This transform is the critical step that allows mkIf conditions + to refer to the full configuration without creating an infinite + recursion. + */ + pushDownProperties = cfg: + if cfg._type or "" == "merge" then + concatMap pushDownProperties cfg.contents + else if cfg._type or "" == "if" then + map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content) + else + # FIXME: handle mkOverride? + [ cfg ]; + + /* Given a config value, expand mkMerge properties, and discharge + any mkIf conditions. That is, this is the place where mkIf + conditions are actually evaluated. The result is a list of + config values. For example, ‘mkIf false x’ yields ‘[]’, + ‘mkIf true x’ yields ‘[x]’, and + + mkMerge [ 1 (mkIf true 2) (mkIf true (mkIf false 3)) ] + + yields ‘[ 1 2 ]’. + */ + dischargeProperties = def: + if def._type or "" == "merge" then + concatMap dischargeProperties def.contents + else if def._type or "" == "if" then + if def.condition then + dischargeProperties def.content else - value - ) module; - - - # Handle mkMerge function left behind after a delay property. - moduleFlattenMerge = module: - if module ? config && - isProperty module.config && - isMerge module.config.property - then - (map (cfg: { key = module.key; config = cfg; }) module.config.content) - ++ [ (module // { config = {}; }) ] + [ ] else - [ module ]; + [ def ]; + /* Given a list of config value, process the mkOverride properties, + that is, return the values that have the highest (that + is,. numerically lowest) priority, and strip the mkOverride + properties. For example, - # Handle mkMerge attributes which are left behind by previous delay - # properties and convert them into a list of modules. Delay properties - # inside the config attribute of a module and create a second module if a - # mkMerge attribute was left behind. - # - # Module -> [ Module ] - delayModule = module: - map (moduleApply { config = delayProperties; }) (moduleFlattenMerge module); + [ (mkOverride 10 "a") (mkOverride 20 "b") "z" (mkOverride 10 "d") ] - - evalDefinitions = opt: values: - if opt.type.delayOnGlobalEval or false then - map (delayPropertiesWithIter opt.type.iter opt.name) - (evalLocalProperties values) - else - evalProperties values; - - - selectModule = name: m: - { inherit (m) key; - } // ( - if m ? options && builtins.hasAttr name m.options then - { options = lib.getAttr name m.options; } - else {} - ) // ( - if m ? config && builtins.hasAttr name m.config then - { config = lib.getAttr name m.config; } - else {} - ); - - filterModules = name: modules: - filter (m: m ? config || m ? options) ( - map (selectModule name) modules - ); - - - modulesNames = modules: - lib.concatMap (m: [] - ++ optionals (m ? options) (lib.attrNames m.options) - ++ optionals (m ? config) (lib.attrNames m.config) - ) modules; - - - moduleZip = funs: modules: - lib.mapAttrs (name: fun: - fun (catAttrs name modules) - ) funs; - - - moduleMerge = path: modules_: + yields ‘[ "a" "d" ]’. Note that "z" has the default priority 100. + */ + filterOverrides = defs: let - addName = name: - if path == "" then name else path + "." + name; + defaultPrio = 100; + getPrio = def: if def._type or "" == "override" then def.priority else defaultPrio; + min = x: y: if x < y then x else y; + highestPrio = fold (def: prio: min (getPrio def) prio) 9999 defs; + strip = def: if def._type or "" == "override" then def.content else def; + in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs; - modules = concatLists (map delayModule modules_); - - modulesOf = name: filterModules name modules; - declarationsOf = name: filter (m: m ? options) (modulesOf name); - definitionsOf = name: filter (m: m ? config ) (modulesOf name); - - recurseInto = name: - moduleMerge (addName name) (modulesOf name); - - recurseForOption = name: modules: args: - moduleMerge name ( - moduleClosure modules args - ); - - errorSource = modules: - "The error may come from the following files:\n" + ( - lib.concatStringsSep "\n" ( - map (m: - if m ? key then toString m.key else "" - ) modules - ) - ); - - eol = "\n"; - - allNames = modulesNames modules; - - getResults = m: - let fetchResult = s: mapAttrs (n: v: v.result) s; in { - options = fetchResult m.options; - config = fetchResult m.config; - }; - - endRecursion = { options = {}; config = {}; }; - - in if modules == [] then endRecursion else - getResults (fix (crossResults: moduleZip { - options = lib.zipWithNames allNames (name: values: rec { - config = lib.getAttr name crossResults.config; - - declarations = declarationsOf name; - declarationSources = - map (m: { - source = m.key; - }) declarations; - - hasOptions = values != []; - isOption = any lib.isOption values; - - decls = # add location to sub-module options. - map (m: - mapSubOptions - (unifyOptionModule {inherit (m) key;} name) - m.options - ) declarations; - - decl = - lib.addErrorContext "${eol - }while enhancing option `${addName name}':${eol - }${errorSource declarations}${eol - }" ( - addOptionMakeUp - { name = addName name; recurseInto = recurseForOption; } - (mergeOptionDecls decls) - ); - - value = decl // (with config; { - inherit (config) isNotDefined; - isDefined = ! isNotDefined; - declarations = declarationSources; - definitions = definitionSources; - config = strictResult; - }); - - recurse = (recurseInto name).options; - - result = - if isOption then value - else if !hasOptions then {} - else if all isAttrs values then recurse - else - throw "${eol - }Unexpected type where option declarations are expected.${eol - }${errorSource declarations}${eol - }"; - - }); - - config = lib.zipWithNames allNames (name: values_: rec { - option = lib.getAttr name crossResults.options; - - definitions = definitionsOf name; - definitionSources = - map (m: { - source = m.key; - value = m.config; - }) definitions; - - values = values_ ++ - optionals (option.isOption && option.decl ? extraConfigs) - option.decl.extraConfigs; - - defs = evalDefinitions option.decl values; - - isNotDefined = defs == []; - - value = - lib.addErrorContext "${eol - }while evaluating the option `${addName name}':${eol - }${errorSource (modulesOf name)}${eol - }" ( - let opt = option.decl; in - opt.apply ( - if isNotDefined then - opt.default or (throw "Option `${addName name}' not defined and does not have a default value.") - else opt.merge defs - ) - ); - - strictResult = builtins.tryEval (builtins.toXML value); - - recurse = (recurseInto name).config; - - configIsAnOption = v: isOption (rmProperties v); - errConfigIsAnOption = - let badModules = filter (m: configIsAnOption m.config) definitions; in - "${eol - }Option ${addName name} is defined in the configuration section.${eol - }${errorSource badModules}${eol - }"; - - errDefinedWithoutDeclaration = - let badModules = definitions; in - "${eol - }Option '${addName name}' defined without option declaration.${eol - }${errorSource badModules}${eol - }"; - - result = - if option.isOption then value - else if !option.hasOptions then throw errDefinedWithoutDeclaration - else if any configIsAnOption values then throw errConfigIsAnOption - else if all isAttrs values then recurse - # plain value during the traversal - else throw errDefinedWithoutDeclaration; - - }); - } modules)); - - - fixMergeModules = initModules: {...}@args: - lib.fix (result: - # This trick avoids an infinite loop because names of attribute - # are know and it is not required to evaluate the result of - # moduleMerge to know which attributes are present as arguments. - let module = { inherit (result) options config; }; in - moduleMerge "" ( - moduleClosure initModules (module // args) - ) - ); - - - # Visit all definitions to raise errors related to undeclared options. - checkModule = path: {config, options, ...}@m: + /* Hack for backward compatibility: convert options of type + optionSet to configOf. FIXME: remove eventually. */ + fixupOptionType = loc: opt: let - eol = "\n"; - addName = name: - if path == "" then name else path + "." + name; - in - if lib.isOption options then - if options ? options then - options.type.fold - (cfg: res: res && checkModule (options.type.docPath path) cfg._args) - true config - else - true - else if isAttrs options && lib.attrNames m.options != [] then - all (name: - lib.addErrorContext "${eol - }while checking the attribute `${addName name}':${eol - }" (checkModule (addName name) (selectModule name m)) - ) (lib.attrNames m.config) - else - builtins.trace "try to evaluate config ${lib.showVal config}." - false; + options' = opt.options or + (throw "Option `${showOption loc'}' has type optionSet but has no option attribute."); + coerce = x: + if builtins.isFunction x then x + else { config, ... }: { options = x; }; + options = map coerce (flatten options'); + f = tp: + if tp.name == "option set" then types.submodule options + else if tp.name == "attribute set of option sets" then types.attrsOf (types.submodule options) + else if tp.name == "list or attribute set of option sets" then types.loaOf (types.submodule options) + else if tp.name == "list of option sets" then types.listOf (types.submodule options) + else if tp.name == "null or option set" then types.nullOr (types.submodule options) + else tp; + in opt // { type = f (opt.type or types.unspecified); }; + + + /* Properties. */ + + mkIf = condition: content: + { _type = "if"; + inherit condition content; + }; + + mkAssert = assertion: message: content: + mkIf + (if assertion then true else throw "\nFailed assertion: ${message}") + content; + + mkMerge = contents: + { _type = "merge"; + inherit contents; + }; + + mkOverride = priority: content: + { _type = "override"; + inherit priority content; + }; + + mkOptionDefault = mkOverride 1001; + mkDefault = mkOverride 1000; + mkForce = mkOverride 50; + + mkFixStrictness = id; # obsolete, no-op + + # FIXME: Add mkOrder back in. It's not currently used anywhere in + # NixOS, but it should be useful. } diff --git a/lib/options.nix b/lib/options.nix index b6a88008bb7..0fa702a616c 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -2,12 +2,10 @@ let lib = import ./default.nix; in -with { inherit (builtins) head length; }; with import ./trivial.nix; with import ./lists.nix; with import ./misc.nix; with import ./attrsets.nix; -with import ./properties.nix; rec { @@ -137,46 +135,6 @@ rec { handleOptionSets ]; - # Merge a list of options containning different field. This is useful to - # separate the merge & apply fields from the interface. - mergeOptionDecls = opts: - if opts == [] then {} - else if length opts == 1 then - let opt = head opts; in - if opt ? options then - opt // { options = toList opt.options; } - else - opt - else - fold (opt1: opt2: - lib.addErrorContext "opt1 = ${lib.showVal opt1}\nopt2 = ${lib.showVal opt2}" ( - # You cannot merge if two options have the same field. - assert opt1 ? default -> ! opt2 ? default; - assert opt1 ? example -> ! opt2 ? example; - assert opt1 ? description -> ! opt2 ? description; - assert opt1 ? merge -> ! opt2 ? merge; - assert opt1 ? apply -> ! opt2 ? apply; - assert opt1 ? type -> ! opt2 ? type; - opt1 // opt2 - // optionalAttrs (opt1 ? options || opt2 ? options) { - options = - (toList (opt1.options or [])) - ++ (toList (opt2.options or [])); - } - // optionalAttrs (opt1 ? extraConfigs || opt2 ? extraConfigs) { - extraConfigs = opt1.extraConfigs or [] ++ opt2.extraConfigs or []; - } - // optionalAttrs (opt1 ? extraArgs || opt2 ? extraArgs) { - extraArgs = opt1.extraArgs or {} // opt2.extraArgs or {}; - } - // optionalAttrs (opt1 ? individualExtraArgs || opt2 ? individualExtraArgs) { - individualExtraArgs = zipAttrsWith (name: values: - if length values == 1 then head values else (head values // (head (tail values))) - ) [ (opt1.individualExtraArgs or {}) (opt2.individualExtraArgs or {}) ]; - } - )) {} opts; - - # !!! This function will be removed because this can be done with the # multiple option declarations. addDefaultOptionValues = defs: opts: opts // @@ -285,6 +243,7 @@ rec { else []; in + # FIXME: expensive (O(n^2) [ docOption ] ++ subOptions ++ rest ) [] options; @@ -308,4 +267,7 @@ rec { literalExample = text: { _type = "literalExample"; inherit text; }; + /* Helper functions. */ + showOption = concatStringsSep "."; + } diff --git a/lib/properties.nix b/lib/properties.nix deleted file mode 100644 index 22aa8d891d8..00000000000 --- a/lib/properties.nix +++ /dev/null @@ -1,464 +0,0 @@ -# Nixpkgs/NixOS properties. Generalize the problem of delayable (not yet -# evaluable) properties like mkIf. - -let lib = import ./default.nix; in - -with { inherit (builtins) head tail; }; -with import ./trivial.nix; -with import ./lists.nix; -with import ./misc.nix; -with import ./attrsets.nix; - -rec { - - inherit (lib) isType; - - # Tell that nothing is defined. When properties are evaluated, this type - # is used to remove an entry. Thus if your property evaluation semantic - # implies that you have to mute the content of an attribute, then your - # property should produce this value. - isNotdef = isType "notdef"; - mkNotdef = {_type = "notdef";}; - - # General property type, it has a property attribute and a content - # attribute. The property attribute refers to an attribute set which - # contains a _type attribute and a list of functions which are used to - # evaluate this property. The content attribute is used to stack properties - # on top of each other. - # - # The optional functions which may be contained in the property attribute - # are: - # - onDelay: run on a copied property. - # - onGlobalDelay: run on all copied properties. - # - onEval: run on an evaluated property. - # - onGlobalEval: run on a list of property stack on top of their values. - isProperty = isType "property"; - mkProperty = p@{property, content, ...}: p // { - _type = "property"; - }; - - # Go through the stack of properties and apply the function `op' on all - # property and call the function `nul' on the final value which is not a - # property. The stack is traversed in reversed order. The `op' function - # should expect a property with a content which have been modified. - # - # Warning: The `op' function expects only one argument in order to avoid - # calls to mkProperties as the argument is already a valid property which - # contains the result of the folding inside the content attribute. - foldProperty = op: nul: attrs: - if isProperty attrs then - op (attrs // { - content = foldProperty op nul attrs.content; - }) - else - nul attrs; - - # Simple function which can be used as the `op' argument of the - # foldProperty function. Properties that you don't want to handle can be - # ignored with the `id' function. `isSearched' is a function which should - # check the type of a property and return a boolean value. `thenFun' and - # `elseFun' are functions which behave as the `op' argument of the - # foldProperty function. - foldFilter = isSearched: thenFun: elseFun: attrs: - if isSearched attrs.property then - thenFun attrs - else - elseFun attrs; - - - # Move properties from the current attribute set to the attribute - # contained in this attribute set. This trigger property handlers called - # `onDelay' and `onGlobalDelay'. - delayPropertiesWithIter = iter: path: attrs: - let cleanAttrs = rmProperties attrs; in - if isProperty attrs then - iter (a: v: - lib.addErrorContext "while moving properties on the attribute `${a}':" ( - triggerPropertiesGlobalDelay a ( - triggerPropertiesDelay a ( - copyProperties attrs v - )))) path cleanAttrs - else - attrs; - - delayProperties = # implicit attrs argument. - let - # mapAttrs except that it also recurse into potential mkMerge - # functions. This may cause a strictness issue because looking the - # type of a string implies evaluating it. - iter = fun: path: value: - lib.mapAttrs (attr: val: - if isProperty val && isMerge val.property then - val // { content = map (fun attr) val.content; } - else - fun attr val - ) value; - in - delayPropertiesWithIter iter ""; - - # Call onDelay functions. - triggerPropertiesDelay = name: attrs: - let - callOnDelay = p@{property, ...}: - if property ? onDelay then - property.onDelay name p - else - p; - in - foldProperty callOnDelay id attrs; - - # Call onGlobalDelay functions. - triggerPropertiesGlobalDelay = name: attrs: - let - globalDelayFuns = uniqListExt { - getter = property: property._type; - inputList = foldProperty (p@{property, content, ...}: - if property ? onGlobalDelay then - [ property ] ++ content - else - content - ) (a: []) attrs; - }; - - callOnGlobalDelay = property: content: - property.onGlobalDelay name content; - in - fold callOnGlobalDelay attrs globalDelayFuns; - - # Expect a list of values which may have properties and return the same - # list of values where all properties have been evaluated and where all - # ignored values are removed. This trigger property handlers called - # `onEval' and `onGlobalEval'. - evalProperties = valList: - if valList != [] then - filter (x: !isNotdef x) ( - triggerPropertiesGlobalEval ( - evalLocalProperties valList - ) - ) - else - valList; - - evalLocalProperties = valList: - filter (x: !isNotdef x) ( - map triggerPropertiesEval valList - ); - - # Call onEval function - triggerPropertiesEval = val: - foldProperty (p@{property, ...}: - if property ? onEval then - property.onEval p - else - p - ) id val; - - # Call onGlobalEval function - triggerPropertiesGlobalEval = valList: - let - globalEvalFuns = uniqListExt { - getter = property: property._type; - inputList = - fold (attrs: list: - foldProperty (p@{property, content, ...}: - if property ? onGlobalEval then - [ property ] ++ content - else - content - ) (a: list) attrs - ) [] valList; - }; - - callOnGlobalEval = property: valList: property.onGlobalEval valList; - in - fold callOnGlobalEval valList globalEvalFuns; - - # Remove all properties on top of a value and return the value. - rmProperties = - foldProperty (p@{content, ...}: content) id; - - # Copy properties defined on a value on another value. - copyProperties = attrs: newAttrs: - foldProperty id (x: newAttrs) attrs; - - /* Merge. */ - - # Create "merge" statement which is skipped by the delayProperty function - # and interpreted by the underlying system using properties (modules). - - # Create a "Merge" property which only contains a condition. - isMerge = isType "merge"; - mkMerge = content: mkProperty { - property = { - _type = "merge"; - onDelay = name: val: throw "mkMerge is not the first of the list of properties."; - onEval = val: throw "mkMerge is not allowed on option definitions."; - }; - inherit content; - }; - - /* If. ThenElse. Always. */ - - # create "if" statement that can be delayed on sets until a "then-else" or - # "always" set is reached. When an always set is reached the condition - # is ignore. - - # Create a "If" property which only contains a condition. - isIf = isType "if"; - mkIf = condition: content: mkProperty { - property = { - _type = "if"; - onGlobalDelay = onIfGlobalDelay; - onEval = onIfEval; - inherit condition; - }; - inherit content; - }; - - mkAssert = assertion: message: content: - mkIf - (if assertion then true else throw "\nFailed assertion: ${message}") - content; - - # Evaluate the "If" statements when either "ThenElse" or "Always" - # statement is encountered. Otherwise it removes multiple If statements and - # replaces them by one "If" statement where the condition is the list of all - # conditions joined with a "and" operation. - onIfGlobalDelay = name: content: - let - # extract if statements and non-if statements and repectively put them - # in the attribute list and attrs. - ifProps = - foldProperty - (foldFilter (p: isIf p) - # then, push the condition inside the list list - (p@{property, content, ...}: - { inherit (content) attrs; - list = [property] ++ content.list; - } - ) - # otherwise, add the propertie. - (p@{property, content, ...}: - { inherit (content) list; - attrs = p // { content = content.attrs; }; - } - ) - ) - (attrs: { list = []; inherit attrs; }) - content; - - # compute the list of if statements. - evalIf = content: condition: list: - if list == [] then - mkIf condition content - else - let p = head list; in - evalIf content (condition && p.condition) (tail list); - in - evalIf ifProps.attrs true ifProps.list; - - # Evaluate the condition of the "If" statement to either get the value or - # to ignore the value. - onIfEval = p@{property, content, ...}: - if property.condition then - content - else - mkNotdef; - - /* mkOverride */ - - # Create an "Override" statement which allow the user to define - # priorities between values. The default priority is 100. The lowest - # priorities are kept. The template argument must reproduce the same - # attribute set hierarchy to override leaves of the hierarchy. - isOverride = isType "override"; - mkOverrideTemplate = priority: template: content: mkProperty { - property = { - _type = "override"; - onDelay = onOverrideDelay; - onGlobalEval = onOverrideGlobalEval; - inherit priority template; - }; - inherit content; - }; - - # Like mkOverrideTemplate, but without the template argument. - mkOverride = priority: content: mkOverrideTemplate priority {} content; - - # Sugar to override the default value of the option by making a new - # default value based on the configuration. - mkDefaultValue = mkOverride 1000; - mkDefault = mkOverride 1000; - mkForce = mkOverride 50; - mkStrict = mkOverride 0; - - # Make the template traversal in function of the property traversal. If - # the template define a non-empty attribute set, then the property is - # copied only on all mentionned attributes inside the template. - # Otherwise, the property is kept on all sub-attribute definitions. - onOverrideDelay = name: p@{property, content, ...}: - let inherit (property) template; in - if isAttrs template && template != {} then - if hasAttr name template then - p // { - property = p.property // { - template = builtins.getAttr name template; - }; - } - # Do not override the attribute \name\ - else - content - # Override values defined inside the attribute \name\. - else - p; - - # Keep values having lowest priority numbers only throwing away those having - # a higher priority assigned. - onOverrideGlobalEval = valList: - let - defaultPrio = 100; - - inherit (builtins) lessThan; - - getPrioVal = - foldProperty - (foldFilter isOverride - (p@{property, content, ...}: - if content ? priority && lessThan content.priority property.priority then - content - else - content // { - inherit (property) priority; - } - ) - (p@{property, content, ...}: - content // { - value = p // { content = content.value; }; - } - ) - ) (value: { inherit value; }); - - addDefaultPrio = x: - if x ? priority then x - else x // { priority = defaultPrio; }; - - prioValList = map (x: addDefaultPrio (getPrioVal x)) valList; - - higherPrio = - if prioValList == [] then - defaultPrio - else - fold (x: min: - if lessThan x.priority min then - x.priority - else - min - ) (head prioValList).priority (tail prioValList); - in - map (x: - if x.priority == higherPrio then - x.value - else - mkNotdef - ) prioValList; - - /* mkOrder */ - - # Order definitions based on there index value. This property is useful - # when the result of the merge function depends on the order on the - # initial list. (e.g. concatStrings) Definitions are ordered based on - # their rank. The lowest ranked definition would be the first to element - # of the list used by the merge function. And the highest ranked - # definition would be the last. Definitions which does not have any rank - # value have the default rank of 100. - isOrder = isType "order"; - mkOrder = rank: content: mkProperty { - property = { - _type = "order"; - onGlobalEval = onOrderGlobalEval; - inherit rank; - }; - inherit content; - }; - - mkHeader = mkOrder 10; - mkFooter = mkOrder 1000; - - # Fetch the rank of each definition (add the default rank is none) and - # sort them based on their ranking. - onOrderGlobalEval = valList: - let - defaultRank = 100; - - inherit (builtins) lessThan; - - getRankVal = - foldProperty - (foldFilter isOrder - (p@{property, content, ...}: - if content ? rank then - content - else - content // { - inherit (property) rank; - } - ) - (p@{property, content, ...}: - content // { - value = p // { content = content.value; }; - } - ) - ) (value: { inherit value; }); - - addDefaultRank = x: - if x ? rank then x - else x // { rank = defaultRank; }; - - rankValList = map (x: addDefaultRank (getRankVal x)) valList; - - cmp = x: y: - builtins.lessThan x.rank y.rank; - in - map (x: x.value) (sort cmp rankValList); - - /* mkFixStrictness */ - - # This is a hack used to restore laziness on some option definitions. - # Some option definitions are evaluated when they are not used. This - # error is caused by the strictness of type checking builtins. Builtins - # like 'isAttrs' are too strict because they have to evaluate their - # arguments to check if the type is correct. This evaluation, cause the - # strictness of properties. - # - # Properties can be stacked on top of each other. The stackability of - # properties on top of the option definition is nice for user manipulation - # but require to check if the content of the property is not another - # property. Such testing implies to verify if this is an attribute set - # and if it possess the type 'property'. (see isProperty & typeOf/isType) - # - # To avoid strict evaluation of option definitions, 'mkFixStrictness' is - # introduced. This property protects an option definition by replacing - # the base of the stack of properties by 'mkNotDef', when this property is - # evaluated it returns the original definition. - # - # This property is useful over any elements which depends on options which - # are raising errors when they get evaluated without the proper settings. - # - # Plain list and attribute set are lazy structures, which means that the - # container gets evaluated but not the content. Thus, using this property - # on top of plain list or attribute set is pointless. - # - # This is a Hack, you should avoid it! - - # This property has a long name because you should avoid it. - isFixStrictness = attrs: (typeOf attrs) == "fix-strictness"; - mkFixStrictness = value: - mkProperty { - property = { - _type = "fix-strictness"; - onEval = p: value; - }; - content = mkNotdef; - }; - -} diff --git a/lib/types.nix b/lib/types.nix index 156d72ac5e7..0545cd6a3c2 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -3,10 +3,11 @@ let lib = import ./default.nix; in -with import ./lists.nix; -with import ./attrsets.nix; -with import ./options.nix; -with import ./trivial.nix; +with lib.lists; +with lib.attrsets; +with lib.options; +with lib.trivial; +with lib.modules; rec { @@ -20,48 +21,43 @@ rec { # name (name of the type) - # check (check the config value. Before returning false it should trace the bad value eg using traceValIfNot) + # check (check the config value) # merge (default merge function) - # iter (iterate on all elements contained in this type) - # fold (fold all elements contained in this type) - # hasOptions (boolean: whatever this option contains an option set) - # delayOnGlobalEval (boolean: should properties go through the evaluation of this option) # docPath (path concatenated to the option name contained in the option set) isOptionType = isType "option-type"; mkOptionType = { name , check ? (x: true) , merge ? mergeDefaultOption - # Handle complex structure types. - , iter ? (f: path: v: f path v) - , fold ? (op: nul: v: op v nul) + , merge' ? args: merge , docPath ? lib.id - # If the type can contains option sets. - , hasOptions ? false - , delayOnGlobalEval ? false }: { _type = "option-type"; - inherit name check merge iter fold docPath hasOptions delayOnGlobalEval; + inherit name check merge merge' docPath; }; types = rec { + unspecified = mkOptionType { + name = "unspecified"; + }; + bool = mkOptionType { name = "boolean"; - check = lib.traceValIfNot builtins.isBool; + check = builtins.isBool; merge = fold lib.or false; }; int = mkOptionType { name = "integer"; - check = lib.traceValIfNot builtins.isInt; + check = builtins.isInt; }; string = mkOptionType { name = "string"; - check = lib.traceValIfNot builtins.isString; + check = builtins.isString; merge = lib.concatStrings; }; @@ -69,7 +65,7 @@ rec { # configuration file contents. lines = mkOptionType { name = "string"; - check = lib.traceValIfNot builtins.isString; + check = builtins.isString; merge = lib.concatStringsSep "\n"; }; @@ -81,48 +77,37 @@ rec { attrs = mkOptionType { name = "attribute set"; - check = lib.traceValIfNot isAttrs; + check = isAttrs; merge = fold lib.mergeAttrs {}; }; # derivation is a reserved keyword. package = mkOptionType { name = "derivation"; - check = lib.traceValIfNot isDerivation; + check = isDerivation; }; path = mkOptionType { name = "path"; # Hacky: there is no ‘isPath’ primop. - check = lib.traceValIfNot (x: builtins.unsafeDiscardStringContext (builtins.substring 0 1 (toString x)) == "/"); + check = x: builtins.unsafeDiscardStringContext (builtins.substring 0 1 (toString x)) == "/"; }; # drop this in the future: - list = builtins.trace "types.list is deprecated, use types.listOf instead" types.listOf; + list = builtins.trace "types.list is deprecated; use types.listOf instead" types.listOf; - listOf = elemType: mkOptionType { + listOf = elemType: mkOptionType { name = "list of ${elemType.name}s"; - check = value: lib.traceValIfNot isList value && all elemType.check value; - merge = concatLists; - iter = f: path: list: map (elemType.iter f (path + ".*")) list; - fold = op: nul: list: lib.fold (e: l: elemType.fold op l e) nul list; + check = value: isList value && all elemType.check value; + merge = defs: map (def: elemType.merge [def]) (concatLists defs); docPath = path: elemType.docPath (path + ".*"); - inherit (elemType) hasOptions; - - # You cannot define multiple configurations of one entity, therefore - # no reason justify to delay properties inside list elements. - delayOnGlobalEval = false; }; attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; - check = x: lib.traceValIfNot isAttrs x - && all elemType.check (lib.attrValues x); - merge = lib.zipAttrsWith (name: elemType.merge); - iter = f: path: set: lib.mapAttrs (name: elemType.iter f (path + "." + name)) set; - fold = op: nul: set: fold (e: l: elemType.fold op l e) nul (lib.attrValues set); + check = x: isAttrs x && all elemType.check (lib.attrValues x); + merge = lib.zipAttrsWith (name: elemType.merge' { inherit name; }); docPath = path: elemType.docPath (path + "."); - inherit (elemType) hasOptions delayOnGlobalEval; }; # List or attribute set of ... @@ -143,26 +128,13 @@ rec { check = x: if isList x then listOnly.check x else if isAttrs x then attrOnly.check x - else lib.traceValIfNot (x: false) x; - ## The merge function returns an attribute set - merge = defs: - attrOnly.merge (imap convertIfList defs); - iter = f: path: def: - if isList def then listOnly.iter f path def - else if isAttrs def then attrOnly.iter f path def - else throw "Unexpected value"; - fold = op: nul: def: - if isList def then listOnly.fold op nul def - else if isAttrs def then attrOnly.fold op nul def - else throw "Unexpected value"; - + else false; + merge = defs: attrOnly.merge (imap convertIfList defs); docPath = path: elemType.docPath (path + "."); - inherit (elemType) hasOptions delayOnGlobalEval; - } - ; + }; uniq = elemType: mkOptionType { - inherit (elemType) name check iter fold docPath hasOptions; + inherit (elemType) name check docPath; merge = list: if length list == 1 then head list @@ -171,54 +143,46 @@ rec { }; none = elemType: mkOptionType { - inherit (elemType) name check iter fold docPath hasOptions; + inherit (elemType) name check docPath; merge = list: throw "No definitions are allowed for this option."; }; nullOr = elemType: mkOptionType { - inherit (elemType) name merge docPath hasOptions; + inherit (elemType) docPath; + name = "null or ${elemType.name}"; check = x: builtins.isNull x || elemType.check x; - iter = f: path: v: if v == null then v else elemType.iter f path v; - fold = op: nul: v: if v == null then nul else elemType.fold op nul v; + merge = defs: + if all isNull defs then null + else if any isNull defs then + throw "Some but not all values are null." + else elemType.merge defs; }; functionTo = elemType: mkOptionType { name = "function that evaluates to a(n) ${elemType.name}"; - check = lib.traceValIfNot builtins.isFunction; + check = builtins.isFunction; merge = fns: args: elemType.merge (map (fn: fn args) fns); - # These are guesses, I don't fully understand iter, fold, delayOnGlobalEval - iter = f: path: v: - args: elemType.iter f path (v args); - fold = op: nul: v: - args: elemType.fold op nul (v args); - inherit (elemType) delayOnGlobalEval; - hasOptions = false; }; - # usually used with listOf, attrsOf, loaOf like this: - # users = mkOption { - # type = loaOf optionSet; - # - # # you can omit the list if there is one element only - # options = [ { - # name = mkOption { - # description = "name of the user" - # ... - # }; - # # more options here - # } { more options } ]; - # } - # TODO: !!! document passing options as an argument to optionSet, - # deprecate the current approach. - optionSet = mkOptionType { - name = "option set"; - # merge is done in "options.nix > addOptionMakeUp > handleOptionSets" - merge = lib.id; + submodule = opts: mkOptionType rec { + name = "submodule"; check = x: isAttrs x || builtins.isFunction x; - hasOptions = true; - delayOnGlobalEval = true; + # FIXME: make error messages include the parent attrpath. + merge = merge' {}; + merge' = args: defs: + let + coerce = def: if builtins.isFunction def then def else { config = def; }; + modules = (toList opts) ++ map coerce defs; + in (evalModules modules args).config; + }; + + # Obsolete alternative to configOf. It takes its option + # declarations from the ‘options’ attribute of containing option + # declaration. + optionSet = mkOptionType { + name = /* builtins.trace "types.optionSet is deprecated; use types.submodule instead" */ "option set"; }; }; diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index cd543c958ff..119bba78ff1 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -19,11 +19,9 @@ rec { # Merge the option definitions in all modules, forming the full # system configuration. It's not checked for undeclared options. systemModule = - pkgs.lib.fixMergeModules configComponents extraArgs; + pkgs.lib.evalModules configComponents extraArgs; - optionDefinitions = systemModule.config; - optionDeclarations = systemModule.options; - inherit (systemModule) options; + config = systemModule.config; # These are the extra arguments passed to every module. In # particular, Nixpkgs is passed through the "pkgs" argument. @@ -56,16 +54,11 @@ rec { # define nixpkgs.config, so it's pointless to evaluate them. baseModules = [ ../modules/misc/nixpkgs.nix ]; pkgs = import ./nixpkgs.nix { system = system_; config = {}; }; - }).optionDefinitions.nixpkgs; + }).config.nixpkgs; in { inherit system; inherit (nixpkgsOptions) config; }); - # Optionally check wether all config values have corresponding - # option declarations. - config = - assert optionDefinitions.environment.checkConfigurationOptions -> pkgs.lib.checkModule "" systemModule; - systemModule.config; } diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix index 4f7447f435b..5b8b6bc600c 100644 --- a/nixos/modules/config/shells-environment.nix +++ b/nixos/modules/config/shells-environment.nix @@ -26,11 +26,10 @@ in type = types.attrsOf (mkOptionType { name = "a string or a list of strings"; merge = xs: - let xs' = evalProperties xs; in - if isList (head xs') then concatLists xs' - else if builtins.lessThan 1 (length xs') then abort "variable in ‘environment.variables’ has multiple values" - else if !builtins.isString (head xs') then abort "variable in ‘environment.variables’ does not have a string value" - else head xs'; + if isList (head xs) then concatLists xs + else if builtins.lessThan 1 (length xs) then abort "variable in ‘environment.variables’ has multiple values" + else if !builtins.isString (head xs) then abort "variable in ‘environment.variables’ does not have a string value" + else head xs; }); apply = mapAttrs (n: v: if isList v then concatStringsSep ":" v else v); }; diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix index ff3c844030b..b502484a520 100644 --- a/nixos/modules/system/activation/activation-script.nix +++ b/nixos/modules/system/activation/activation-script.nix @@ -52,7 +52,7 @@ in idempotent and fast. ''; - merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {}); + type = types.attrsOf types.unspecified; # FIXME apply = set: { script = From 4b1a9dd00b508a3ea2273db916a600689d15f7f6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 01:14:16 +0100 Subject: [PATCH 044/179] Remove uses of mkFixStrictness mkFixStrictness is no longer needed, woohoo! --- lib/options.nix | 1 + nixos/modules/services/x11/display-managers/kdm.nix | 2 +- nixos/modules/services/x11/display-managers/lightdm.nix | 2 +- nixos/modules/system/boot/loader/grub/memtest.nix | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/options.nix b/lib/options.nix index 0fa702a616c..0aed3619a74 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -6,6 +6,7 @@ with import ./trivial.nix; with import ./lists.nix; with import ./misc.nix; with import ./attrsets.nix; +with import ./strings.nix; rec { diff --git a/nixos/modules/services/x11/display-managers/kdm.nix b/nixos/modules/services/x11/display-managers/kdm.nix index c03f7116454..2e84adcb4ce 100644 --- a/nixos/modules/services/x11/display-managers/kdm.nix +++ b/nixos/modules/services/x11/display-managers/kdm.nix @@ -128,7 +128,7 @@ in services.xserver.displayManager.slim.enable = false; services.xserver.displayManager.job = - { execCmd = mkFixStrictness + { execCmd = '' mkdir -m 0755 -p /var/lib/kdm chown kdm /var/lib/kdm diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix index f4fb5ee003a..e4125891e6c 100644 --- a/nixos/modules/services/x11/display-managers/lightdm.nix +++ b/nixos/modules/services/x11/display-managers/lightdm.nix @@ -96,7 +96,7 @@ in logsXsession = true; # lightdm relaunches itself via just `lightdm`, so needs to be on the PATH - execCmd = mkFixStrictness '' + execCmd = '' export PATH=${lightdm}/sbin:$PATH ${lightdm}/sbin/lightdm --log-dir=/var/log --run-dir=/run --config=${lightdmConf} ''; diff --git a/nixos/modules/system/boot/loader/grub/memtest.nix b/nixos/modules/system/boot/loader/grub/memtest.nix index a0726c01e20..80c1a160cfd 100644 --- a/nixos/modules/system/boot/loader/grub/memtest.nix +++ b/nixos/modules/system/boot/loader/grub/memtest.nix @@ -23,7 +23,7 @@ in config = mkIf config.boot.loader.grub.memtest86 { - boot.loader.grub.extraEntries = mkFixStrictness ( + boot.loader.grub.extraEntries = if config.boot.loader.grub.version == 2 then '' menuentry "Memtest86+" { @@ -31,7 +31,7 @@ in } '' else - throw "Memtest86+ is not supported with GRUB 1."); + throw "Memtest86+ is not supported with GRUB 1."; boot.loader.grub.extraFiles."memtest.bin" = "${memtest86}/memtest.bin"; From cfab329437a24811104bc8daa2b83b80614f753c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 01:24:30 +0100 Subject: [PATCH 045/179] Use isType instead of typeOf --- lib/systems.nix | 4 ++-- lib/types.nix | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/systems.nix b/lib/systems.nix index 1ef869fb012..afa2002c6e4 100644 --- a/lib/systems.nix +++ b/lib/systems.nix @@ -22,7 +22,7 @@ rec { }; - isCpuType = x: typeOf x == "cpu-type" + isCpuType = x: isType "cpu-type" x && elem x.bits [8 16 32 64 128] && (builtins.lessThan 8 x.bits -> isSignificantByte x.significantByte); @@ -69,7 +69,7 @@ rec { }; - isSystem = x: typeOf x == "system" + isSystem = x: isType "system" x && isCpuType x.cpu && isArchitecture x.arch && isKernel x.kernel; diff --git a/lib/types.nix b/lib/types.nix index 0545cd6a3c2..aa8a371d953 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -12,7 +12,6 @@ with lib.modules; rec { isType = type: x: (x._type or "") == type; - hasType = x: isAttrs x && x ? _type; typeOf = x: x._type or ""; setType = typeName: value: value // { From 40913958a2c61e49348d2038ae6f2a1d32c126fe Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 04:46:36 +0100 Subject: [PATCH 046/179] Keep position information for option declarations and definitions Also, when an option definition fails to type-check, print the file name of the module in which the offending definition occurs, e.g. error: user-thrown exception: The option value `boot.loader.grub.version' in `/etc/nixos/configuration.nix' is not a integer. --- lib/attrsets.nix | 2 +- lib/lists.nix | 5 ++ lib/modules.nix | 122 +++++++++++++++++++++++++++++++---------------- 3 files changed, 86 insertions(+), 43 deletions(-) diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 01d51779c80..40bc1667b85 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -240,7 +240,7 @@ rec { # names, hopefully this does not affect the system because the maximal # laziness avoid computing twice the same expression and listToAttrs does # not care about duplicated attribute names. - zipAttrsWith = f: sets: zipWithNames (concatMap attrNames sets) f sets; + zipAttrsWith = f: sets: zipAttrsWithNames (concatMap attrNames sets) f sets; zipAttrs = zipAttrsWith (name: values: values); diff --git a/lib/lists.nix b/lib/lists.nix index eb7e6baf5ed..d0b09539bf6 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -118,6 +118,11 @@ in rec { all = pred: fold (x: y: if pred x then y else false) true; + # Count how many times function `pred' returns true for the elements + # of `list'. + count = pred: fold (x: c: if pred x then inc c else c) 0; + + # Return a singleton list or an empty list, depending on a boolean # value. Useful when building lists with optional elements # (e.g. `++ optional (system == "i686-linux") flashplayer'). diff --git a/lib/modules.nix b/lib/modules.nix index f5a82d7d8e9..6161a6a0ee5 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -24,9 +24,9 @@ rec { let coerceToModule = n: x: if isAttrs x || builtins.isFunction x then - unifyModuleSyntax "anon-${toString n}" (applyIfFunction x args) + unifyModuleSyntax "" "anon-${toString n}" (applyIfFunction x args) else - unifyModuleSyntax (toString x) (applyIfFunction (import x) args); + unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args); toClosureList = imap (path: coerceToModule path); in builtins.genericClosure { @@ -36,19 +36,19 @@ rec { /* Massage a module into canonical form, that is, a set consisting of ‘options’, ‘config’ and ‘imports’ attributes. */ - unifyModuleSyntax = key: m: + unifyModuleSyntax = file: key: m: if m ? config || m ? options || m ? imports then let badAttrs = removeAttrs m ["imports" "options" "config"]; in if badAttrs != {} then throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. ${builtins.toXML m} " else - { inherit key; + { inherit file key; imports = m.imports or []; options = m.options or {}; config = m.config or {}; } else - { inherit key; + { inherit file key; imports = m.require or []; options = {}; config = m; @@ -62,19 +62,47 @@ rec { corresponding option definitions in all machines, returning them in the ‘value’ attribute of each option. */ mergeModules = modules: - mergeModules' [] (map (m: m.options) modules) (concatMap (m: pushDownProperties m.config) modules); + mergeModules' [] modules + (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules); mergeModules' = loc: options: configs: - zipAttrsWith (name: vals: - let loc' = loc ++ [name]; in - if all isOption vals then - let opt = fixupOptionType loc' (mergeOptionDecls loc' vals); - in evalOptionValue loc' opt (catAttrs name configs) - else if any isOption vals then - throw "There are options with the prefix `${showOption loc'}', which is itself an option." - else - mergeModules' loc' vals (concatMap pushDownProperties (catAttrs name configs)) - ) options; + let names = concatMap (m: attrNames m.options) options; + in listToAttrs (map (name: { + # We're descending into attribute ‘name’. + inherit name; + value = + let + loc' = loc ++ [name]; + # Get all submodules that declare ‘name’. + decls = concatLists (map (m: + optional (hasAttr name m.options) + { inherit (m) file; options = getAttr name m.options; } + ) options); + # Get all submodules that define ‘name’. + defns = concatLists (map (m: + optionals (hasAttr name m.config) + (map (config: { inherit (m) file; inherit config; }) + (pushDownProperties (getAttr name m.config))) + ) configs); + nrOptions = count (m: isOption m.options) decls; + + defns2 = concatMap (m: + optional (hasAttr name m.config) + { inherit (m) file; config = getAttr name m.config; } + ) configs; + in + if nrOptions == length decls then + let opt = fixupOptionType loc' (mergeOptionDecls loc' decls); + in evalOptionValue loc' opt defns2 + else if nrOptions != 0 then + let + firstOption = findFirst (m: isOption m.options) "" decls; + firstNonOption = findFirst (m: !isOption m.options) "" decls; + in + throw "The option `${showOption loc'}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." + else + mergeModules' loc' decls defns; + }) names); /* Merge multiple option declarations into a single declaration. In general, there should be only one declaration of each option. @@ -83,41 +111,41 @@ rec { module to add sub-options to an option declared somewhere else (e.g. multiple modules define sub-options for ‘fileSystems’). */ mergeOptionDecls = loc: opts: - fold (opt1: opt2: - if opt1 ? default && opt2 ? default || - opt1 ? example && opt2 ? example || - opt1 ? description && opt2 ? description || - opt1 ? merge && opt2 ? merge || - opt1 ? apply && opt2 ? apply || - opt1 ? type && opt2 ? type + fold (opt: res: + if opt.options ? default && res ? default || + opt.options ? example && res ? example || + opt.options ? description && res ? description || + opt.options ? merge && res ? merge || + opt.options ? apply && res ? apply || + opt.options ? type && res ? type then - throw "Conflicting declarations of the option `${showOption loc}'." + throw "The option `${showOption loc}' in `${opt.file}' is already declared in ${concatStringsSep " and " (map (d: "`${d}'") res.declarations)}." else - opt1 // opt2 - // optionalAttrs (opt1 ? options && opt2 ? options) - { options = [ opt1.options opt2.options ]; } - ) {} opts; + opt.options // res // + { declarations = [opt.file] ++ res.declarations; + options = optionals (opt.options ? options) (toList opt.options.options ++ res.options); + } + ) { declarations = []; options = []; } opts; /* Merge all the definitions of an option to produce the final config value. */ - evalOptionValue = loc: opt: defs: + evalOptionValue = loc: opt: cfgs: let # Process mkMerge and mkIf properties. - defs' = concatMap dischargeProperties defs; + defs' = concatMap (m: map (config: { inherit (m) file; inherit config; }) (dischargeProperties m.config)) cfgs; # Process mkOverride properties, adding in the default # value specified in the option declaration (if any). - defsFinal = filterOverrides (optional (opt ? default) (mkOptionDefault opt.default) ++ defs'); - # Type-check the remaining definitions, and merge them - # if possible. + defsFinal = filterOverrides (optional (opt ? default) ({ file = head opt.declarations; config = mkOptionDefault opt.default; }) ++ defs'); + # Type-check the remaining definitions, and merge them if + # possible. merged = if defsFinal == [] then throw "The option `${showOption loc}' is used but not defined." else - if all opt.type.check defsFinal then - opt.type.merge defsFinal - #throw "The option `${showOption loc}' has multiple values (with no way to merge them)." - else - throw "A value of the option `${showOption loc}' has a bad type."; + fold (def: res: + if opt.type.check def.config then res + else throw "The option value `${showOption loc}' in `${def.file}' is not a ${opt.type.name}.") + (opt.type.merge (map (m: m.config) defsFinal)) defsFinal; # Finally, apply the ‘apply’ function to the merged # value. This allows options to yield a value computed # from the definitions. @@ -178,17 +206,27 @@ rec { is,. numerically lowest) priority, and strip the mkOverride properties. For example, - [ (mkOverride 10 "a") (mkOverride 20 "b") "z" (mkOverride 10 "d") ] + [ { file = "/1"; config = mkOverride 10 "a"; } + { file = "/2"; config = mkOverride 20 "b"; } + { file = "/3"; config = "z"; } + { file = "/4"; config = mkOverride 10 "d"; } + ] - yields ‘[ "a" "d" ]’. Note that "z" has the default priority 100. + yields + + [ { file = "/1"; config = "a"; } + { file = "/4"; config = "d"; } + ] + + Note that "z" has the default priority 100. */ filterOverrides = defs: let defaultPrio = 100; - getPrio = def: if def._type or "" == "override" then def.priority else defaultPrio; + getPrio = def: if def.config._type or "" == "override" then def.config.priority else defaultPrio; min = x: y: if x < y then x else y; highestPrio = fold (def: prio: min (getPrio def) prio) 9999 defs; - strip = def: if def._type or "" == "override" then def.content else def; + strip = def: if def.config._type or "" == "override" then def // { config = def.config.content; } else def; in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs; /* Hack for backward compatibility: convert options of type From 97696712600302690f55c0efe8d20ef101077749 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 05:23:10 +0100 Subject: [PATCH 047/179] Reduce the number of allocations a bit --- lib/modules.nix | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 6161a6a0ee5..3bb5023cb99 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -85,15 +85,15 @@ rec { (pushDownProperties (getAttr name m.config))) ) configs); nrOptions = count (m: isOption m.options) decls; - - defns2 = concatMap (m: - optional (hasAttr name m.config) - { inherit (m) file; config = getAttr name m.config; } + # Process mkMerge and mkIf properties. + defns' = concatMap (m: + optionals (hasAttr name m.config) + (map (m': { inherit (m) file; value = m'; }) (dischargeProperties (getAttr name m.config))) ) configs; in if nrOptions == length decls then let opt = fixupOptionType loc' (mergeOptionDecls loc' decls); - in evalOptionValue loc' opt defns2 + in evalOptionValue loc' opt defns' else if nrOptions != 0 then let firstOption = findFirst (m: isOption m.options) "" decls; @@ -129,13 +129,11 @@ rec { /* Merge all the definitions of an option to produce the final config value. */ - evalOptionValue = loc: opt: cfgs: + evalOptionValue = loc: opt: defs: let - # Process mkMerge and mkIf properties. - defs' = concatMap (m: map (config: { inherit (m) file; inherit config; }) (dischargeProperties m.config)) cfgs; # Process mkOverride properties, adding in the default # value specified in the option declaration (if any). - defsFinal = filterOverrides (optional (opt ? default) ({ file = head opt.declarations; config = mkOptionDefault opt.default; }) ++ defs'); + defsFinal = filterOverrides (optional (opt ? default) ({ file = head opt.declarations; value = mkOptionDefault opt.default; }) ++ defs); # Type-check the remaining definitions, and merge them if # possible. merged = @@ -143,9 +141,9 @@ rec { throw "The option `${showOption loc}' is used but not defined." else fold (def: res: - if opt.type.check def.config then res + if opt.type.check def.value then res else throw "The option value `${showOption loc}' in `${def.file}' is not a ${opt.type.name}.") - (opt.type.merge (map (m: m.config) defsFinal)) defsFinal; + (opt.type.merge (map (m: m.value) defsFinal)) defsFinal; # Finally, apply the ‘apply’ function to the merged # value. This allows options to yield a value computed # from the definitions. @@ -223,10 +221,10 @@ rec { filterOverrides = defs: let defaultPrio = 100; - getPrio = def: if def.config._type or "" == "override" then def.config.priority else defaultPrio; + getPrio = def: if def.value._type or "" == "override" then def.value.priority else defaultPrio; min = x: y: if x < y then x else y; highestPrio = fold (def: prio: min (getPrio def) prio) 9999 defs; - strip = def: if def.config._type or "" == "override" then def // { config = def.config.content; } else def; + strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def; in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs; /* Hack for backward compatibility: convert options of type From b479dac8dfe3baefe5a080a2f17b41fd1ef37025 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 07:51:46 +0100 Subject: [PATCH 048/179] Inline some functions on the critical path --- lib/attrsets.nix | 7 +++---- lib/modules.nix | 22 +++++++++++++--------- lib/types.nix | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 40bc1667b85..7c93d8698de 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -29,9 +29,8 @@ rec { ["x" "y"] applied with some value v returns `x.y = v;' */ setAttrByPath = attrPath: value: if attrPath == [] then value - else listToAttrs [( - nameValuePair (head attrPath) (setAttrByPath (tail attrPath) value) - )]; + else listToAttrs + [ { name = head attrPath; value = setAttrByPath (tail attrPath) value; } ]; getAttrFromPath = attrPath: set: @@ -133,7 +132,7 @@ rec { => { x = "x-foo"; y = "y-bar"; } */ mapAttrs = f: set: - listToAttrs (map (attr: nameValuePair attr (f attr (getAttr attr set))) (attrNames set)); + listToAttrs (map (attr: { name = attr; value = f attr (getAttr attr set); }) (attrNames set)); /* Like `mapAttrs', but allows the name of each attribute to be diff --git a/lib/modules.nix b/lib/modules.nix index 3bb5023cb99..d1fcfbc8fe8 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -75,20 +75,23 @@ rec { loc' = loc ++ [name]; # Get all submodules that declare ‘name’. decls = concatLists (map (m: - optional (hasAttr name m.options) - { inherit (m) file; options = getAttr name m.options; } + if hasAttr name m.options + then [ { inherit (m) file; options = getAttr name m.options; } ] + else [] ) options); # Get all submodules that define ‘name’. defns = concatLists (map (m: - optionals (hasAttr name m.config) - (map (config: { inherit (m) file; inherit config; }) - (pushDownProperties (getAttr name m.config))) + if hasAttr name m.config + then map (config: { inherit (m) file; inherit config; }) + (pushDownProperties (getAttr name m.config)) + else [] ) configs); nrOptions = count (m: isOption m.options) decls; # Process mkMerge and mkIf properties. defns' = concatMap (m: - optionals (hasAttr name m.config) - (map (m': { inherit (m) file; value = m'; }) (dischargeProperties (getAttr name m.config))) + if hasAttr name m.config + then map (m': { inherit (m) file; value = m'; }) (dischargeProperties (getAttr name m.config)) + else [] ) configs; in if nrOptions == length decls then @@ -123,7 +126,7 @@ rec { else opt.options // res // { declarations = [opt.file] ++ res.declarations; - options = optionals (opt.options ? options) (toList opt.options.options ++ res.options); + options = if opt.options ? options then [(toList opt.options.options ++ res.options)] else []; } ) { declarations = []; options = []; } opts; @@ -133,7 +136,8 @@ rec { let # Process mkOverride properties, adding in the default # value specified in the option declaration (if any). - defsFinal = filterOverrides (optional (opt ? default) ({ file = head opt.declarations; value = mkOptionDefault opt.default; }) ++ defs); + defsFinal = filterOverrides + ((if opt ? default then [{ file = head opt.declarations; value = mkOptionDefault opt.default; }] else []) ++ defs); # Type-check the remaining definitions, and merge them if # possible. merged = diff --git a/lib/types.nix b/lib/types.nix index aa8a371d953..7cfd8e606d7 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -116,7 +116,7 @@ rec { if isList def then listToAttrs ( flip imap def (elemIdx: elem: - nameValuePair "unnamed-${toString defIdx}.${toString elemIdx}" elem)) + { name = "unnamed-${toString defIdx}.${toString elemIdx}"; value = elem; })) else def; listOnly = listOf elemType; From b6b14dae78b80993145a47d5a5713b87c4a419c1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 07:52:24 +0100 Subject: [PATCH 049/179] Fix comment --- lib/modules.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index d1fcfbc8fe8..afbfda378f8 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -203,21 +203,21 @@ rec { else [ def ]; - /* Given a list of config value, process the mkOverride properties, - that is, return the values that have the highest (that - is,. numerically lowest) priority, and strip the mkOverride + /* Given a list of config values, process the mkOverride properties, + that is, return the values that have the highest (that is, + numerically lowest) priority, and strip the mkOverride properties. For example, - [ { file = "/1"; config = mkOverride 10 "a"; } - { file = "/2"; config = mkOverride 20 "b"; } - { file = "/3"; config = "z"; } - { file = "/4"; config = mkOverride 10 "d"; } + [ { file = "/1"; value = mkOverride 10 "a"; } + { file = "/2"; value = mkOverride 20 "b"; } + { file = "/3"; value = "z"; } + { file = "/4"; value = mkOverride 10 "d"; } ] yields - [ { file = "/1"; config = "a"; } - { file = "/4"; config = "d"; } + [ { file = "/1"; value = "a"; } + { file = "/4"; value = "d"; } ] Note that "z" has the default priority 100. From 3bfbdcdfbf36e3bb9e8f9cac112008183883aaf9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 13:28:56 +0100 Subject: [PATCH 050/179] Remove dead code --- lib/options.nix | 135 ------------------------------------------------ 1 file changed, 135 deletions(-) diff --git a/lib/options.nix b/lib/options.nix index 0aed3619a74..d94a9fad388 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -21,7 +21,6 @@ rec { # merge (function used to merge definitions into one definition: [ /type/ ] -> /type/) # apply (convert the option value to ease the manipulation of the option result) # options (set of sub-options declarations & definitions) - # extraConfigs (list of possible configurations) }; mkEnableOption = name: mkOption { @@ -31,111 +30,6 @@ rec { type = lib.types.bool; }; - mapSubOptions = f: opt: - if opt ? options then - opt // { - options = imap f (toList opt.options); - } - else - opt; - - # Make the option declaration more user-friendly by adding default - # settings and some verifications based on the declaration content (like - # type correctness). - addOptionMakeUp = {name, recurseInto}: decl: - let - init = { - inherit name; - merge = mergeDefaultOption; - apply = lib.id; - }; - - functionsFromType = opt: - opt // (builtins.intersectAttrs { merge = 1; check = 1; } (decl.type or {})); - - addDeclaration = opt: opt // decl; - - ensureMergeInputType = opt: - if opt ? check then - opt // { - merge = list: - if all opt.check list then - opt.merge list - else - throw "A value of the option `${name}' has a bad type."; - } - else opt; - - checkDefault = opt: - if opt ? check && opt ? default then - opt // { - default = - if opt.check opt.default then - opt.default - else - throw "The default value of the option `${name}' has a bad type."; - } - else opt; - - handleOptionSets = opt: - if opt ? type && opt.type.hasOptions then - let - # Evaluate sub-modules. - subModuleMerge = path: vals: - lib.fix (args: - let - result = recurseInto path (opt.options ++ imap (index: v: args: { - key = rec { - #!!! Would be nice if we had the file the val was from - option = path; - number = index; - outPath = "option ${option} config number ${toString number}"; - }; - } // (lib.applyIfFunction v args)) (toList vals)) args; - name = lib.removePrefix (opt.name + ".") path; - extraArgs = opt.extraArgs or {}; - individualExtraArgs = opt.individualExtraArgs or {}; - in { - inherit (result) config options; - inherit name; - } // - (opt.extraArgs or {}) // - (if hasAttr name individualExtraArgs then getAttr name individualExtraArgs else {}) - ); - - # Add _options in sub-modules to make it viewable from other - # modules. - subModuleMergeConfig = path: vals: - let result = subModuleMerge path vals; in - { _args = result; } // result.config; - - in - opt // { - merge = list: - opt.type.iter - subModuleMergeConfig - opt.name - (opt.merge list); - options = - let path = opt.type.docPath opt.name; in - (subModuleMerge path []).options; - } - else - opt; - in - foldl (opt: f: f opt) init [ - # default settings - functionsFromType - - # user settings - addDeclaration - - # override settings - ensureMergeInputType - checkDefault - handleOptionSets - ]; - # !!! This function will be removed because this can be done with the # multiple option declarations. addDefaultOptionValues = defs: opts: opts // @@ -191,35 +85,6 @@ rec { else head list; - fixableMergeFun = merge: f: config: - merge ( - # generate the list of option sets. - f config - ); - - fixableMergeModules = merge: initModules: {...}@args: config: - fixableMergeFun merge (config: - lib.moduleClosure initModules (args // { inherit config; }) - ) config; - - - fixableDefinitionsOf = initModules: {...}@args: - fixableMergeModules (modules: (lib.moduleMerge "" modules).config) initModules args; - - fixableDeclarationsOf = initModules: {...}@args: - fixableMergeModules (modules: (lib.moduleMerge "" modules).options) initModules args; - - definitionsOf = initModules: {...}@args: - (lib.fix (module: - fixableMergeModules (lib.moduleMerge "") initModules args module.config - )).config; - - declarationsOf = initModules: {...}@args: - (lib.fix (module: - fixableMergeModules (lib.moduleMerge "") initModules args module.config - )).options; - - # Generate documentation template from the list of option declaration like # the set generated with filterOptionSets. optionAttrSetToDocList = attrs: From 7cf0e0bda87a1b71aac70d4eaf04aceda3dc3188 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 13:36:45 +0100 Subject: [PATCH 051/179] Manual: Fix bad \" characters --- nixos/modules/services/misc/nix-daemon.nix | 2 +- nixos/modules/tasks/filesystems.nix | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index ff0bdf65ced..e98f63f6886 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -160,7 +160,7 @@ in user name to be used for the SSH connection (sshUser), the Nix system type (system, e.g., - \"i686-linux\"), the maximum number of + "i686-linux"), the maximum number of jobs to be run in parallel on that machine (maxJobs), the path to the SSH private key to be used to connect (sshKey), a diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix index 4ca309f5a10..6e3d019ea93 100644 --- a/nixos/modules/tasks/filesystems.nix +++ b/nixos/modules/tasks/filesystems.nix @@ -95,14 +95,14 @@ in options = [ fileSystemOpts ]; description = '' The file systems to be mounted. It must include an entry for - the root directory (mountPoint = \"/\"). Each + the root directory (mountPoint = "/"). Each entry in the list is an attribute set with the following fields: mountPoint, device, fsType (a file system type recognised by mount; defaults to - \"auto\"), and options + "auto"), and options (the mount options passed to mount using the - flag; defaults to \"defaults\"). + flag; defaults to "defaults"). Instead of specifying device, you can also specify a volume label (label) for file From 89bd18b3affc6612ad6402c05cc4d80a59efe9b8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 14:25:58 +0100 Subject: [PATCH 052/179] Fix manual generation --- lib/modules.nix | 35 +++++++------- lib/options.nix | 46 +++++++++--------- lib/types.nix | 49 ++++++++++++-------- nixos/modules/services/misc/nixos-manual.nix | 2 +- 4 files changed, 70 insertions(+), 62 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index afbfda378f8..f429653d94e 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -6,14 +6,16 @@ rec { /* Evaluate a set of modules. The result is a set of two attributes: ‘options’: the nested set of all option declarations, and ‘config’: the nested set of all option values. */ - evalModules = modules: args: + evalModules = evalModules' []; + + evalModules' = prefix: modules: args: let args' = args // result; closed = closeModules modules args'; # Note: the list of modules is reversed to maintain backward # compatibility with the old module system. Not sure if this is # the most sensible policy. - options = mergeModules (reverseList closed); + options = mergeModules prefix (reverseList closed); config = yieldConfig options; yieldConfig = mapAttrs (n: v: if isOption v then v.value else yieldConfig v); result = { inherit options config; }; @@ -22,16 +24,15 @@ rec { /* Close a set of modules under the ‘imports’ relation. */ closeModules = modules: args: let - coerceToModule = n: x: + toClosureList = parent: imap (n: x: if isAttrs x || builtins.isFunction x then - unifyModuleSyntax "" "anon-${toString n}" (applyIfFunction x args) + unifyModuleSyntax parent "anon-${toString n}" (applyIfFunction x args) else - unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args); - toClosureList = imap (path: coerceToModule path); + unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args)); in builtins.genericClosure { - startSet = toClosureList modules; - operator = m: toClosureList m.imports; + startSet = toClosureList unknownModule modules; + operator = m: toClosureList m.file m.imports; }; /* Massage a module into canonical form, that is, a set consisting @@ -61,18 +62,18 @@ rec { At the same time, for each option declaration, it will merge the corresponding option definitions in all machines, returning them in the ‘value’ attribute of each option. */ - mergeModules = modules: - mergeModules' [] modules + mergeModules = prefix: modules: + mergeModules' prefix modules (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules); - mergeModules' = loc: options: configs: + mergeModules' = prefix: options: configs: let names = concatMap (m: attrNames m.options) options; in listToAttrs (map (name: { # We're descending into attribute ‘name’. inherit name; value = let - loc' = loc ++ [name]; + loc = prefix ++ [name]; # Get all submodules that declare ‘name’. decls = concatLists (map (m: if hasAttr name m.options @@ -95,16 +96,16 @@ rec { ) configs; in if nrOptions == length decls then - let opt = fixupOptionType loc' (mergeOptionDecls loc' decls); - in evalOptionValue loc' opt defns' + let opt = fixupOptionType loc (mergeOptionDecls loc decls); + in evalOptionValue loc opt defns' else if nrOptions != 0 then let firstOption = findFirst (m: isOption m.options) "" decls; firstNonOption = findFirst (m: !isOption m.options) "" decls; in - throw "The option `${showOption loc'}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." + throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." else - mergeModules' loc' decls defns; + mergeModules' loc decls defns; }) names); /* Merge multiple option declarations into a single declaration. In @@ -128,7 +129,7 @@ rec { { declarations = [opt.file] ++ res.declarations; options = if opt.options ? options then [(toList opt.options.options ++ res.options)] else []; } - ) { declarations = []; options = []; } opts; + ) { inherit loc; declarations = []; options = []; } opts; /* Merge all the definitions of an option to produce the final config value. */ diff --git a/lib/options.nix b/lib/options.nix index d94a9fad388..480837fd1cf 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -87,31 +87,28 @@ rec { # Generate documentation template from the list of option declaration like # the set generated with filterOptionSets. - optionAttrSetToDocList = attrs: - let options = collect isOption attrs; in - fold (opt: rest: - let - docOption = { - inherit (opt) name; - description = opt.description or (throw "Option ${opt.name}: No description."); - declarations = map (x: toString x.source) opt.declarations; - #definitions = map (x: toString x.source) opt.definitions; - internal = opt.internal or false; - visible = opt.visible or true; - } - // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; } - // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; } - // optionalAttrs (opt ? defaultText) { default = opt.defaultText; }; + optionAttrSetToDocList = optionAttrSetToDocList' []; - subOptions = - if opt ? options then - optionAttrSetToDocList opt.options - else - []; - in - # FIXME: expensive (O(n^2) - [ docOption ] ++ subOptions ++ rest - ) [] options; + optionAttrSetToDocList' = prefix: options: + fold (opt: rest: + let + docOption = rec { + name = showOption opt.loc; + description = opt.description or (throw "Option `${name}' has no description."); + declarations = filter (x: x != unknownModule) opt.declarations; + internal = opt.internal or false; + visible = opt.visible or true; + } + // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; } + // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; } + // optionalAttrs (opt ? defaultText) { default = opt.defaultText; }; + + subOptions = + let ss = opt.type.getSubOptions opt.loc; + in if ss != {} then optionAttrSetToDocList' opt.loc ss else []; + in + # FIXME: expensive, O(n^2) + [ docOption ] ++ subOptions ++ rest) [] (collect isOption options); /* This function recursively removes all derivation attributes from @@ -135,5 +132,6 @@ rec { /* Helper functions. */ showOption = concatStringsSep "."; + unknownModule = ""; } diff --git a/lib/types.nix b/lib/types.nix index 7cfd8e606d7..dec9d82d608 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -22,18 +22,18 @@ rec { # name (name of the type) # check (check the config value) # merge (default merge function) - # docPath (path concatenated to the option name contained in the option set) + # getSubOptions (returns sub-options for manual generation) isOptionType = isType "option-type"; mkOptionType = { name , check ? (x: true) , merge ? mergeDefaultOption , merge' ? args: merge - , docPath ? lib.id + , getSubOptions ? prefix: {} }: { _type = "option-type"; - inherit name check merge merge' docPath; + inherit name check merge merge' getSubOptions; }; @@ -99,14 +99,14 @@ rec { name = "list of ${elemType.name}s"; check = value: isList value && all elemType.check value; merge = defs: map (def: elemType.merge [def]) (concatLists defs); - docPath = path: elemType.docPath (path + ".*"); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); }; attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; check = x: isAttrs x && all elemType.check (lib.attrValues x); merge = lib.zipAttrsWith (name: elemType.merge' { inherit name; }); - docPath = path: elemType.docPath (path + "."); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; # List or attribute set of ... @@ -129,26 +129,27 @@ rec { else if isAttrs x then attrOnly.check x else false; merge = defs: attrOnly.merge (imap convertIfList defs); - docPath = path: elemType.docPath (path + "."); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; uniq = elemType: mkOptionType { - inherit (elemType) name check docPath; + inherit (elemType) name check; merge = list: if length list == 1 then head list else throw "Multiple definitions of ${elemType.name}. Only one is allowed for this option."; + getSubOptions = elemType.getSubOptions; }; none = elemType: mkOptionType { - inherit (elemType) name check docPath; + inherit (elemType) name check; merge = list: throw "No definitions are allowed for this option."; + getSubOptions = elemType.getSubOptions; }; nullOr = elemType: mkOptionType { - inherit (elemType) docPath; name = "null or ${elemType.name}"; check = x: builtins.isNull x || elemType.check x; merge = defs: @@ -156,6 +157,7 @@ rec { else if any isNull defs then throw "Some but not all values are null." else elemType.merge defs; + getSubOptions = elemType.getSubOptions; }; functionTo = elemType: mkOptionType { @@ -163,19 +165,26 @@ rec { check = builtins.isFunction; merge = fns: args: elemType.merge (map (fn: fn args) fns); + getSubOptions = elemType.getSubOptions; }; - submodule = opts: mkOptionType rec { - name = "submodule"; - check = x: isAttrs x || builtins.isFunction x; - # FIXME: make error messages include the parent attrpath. - merge = merge' {}; - merge' = args: defs: - let - coerce = def: if builtins.isFunction def then def else { config = def; }; - modules = (toList opts) ++ map coerce defs; - in (evalModules modules args).config; - }; + submodule = opts: + let opts' = toList opts; in + mkOptionType rec { + name = "submodule"; + check = x: isAttrs x || builtins.isFunction x; + # FIXME: make error messages include the parent attrpath. + merge = merge' {}; + merge' = args: defs: + let + coerce = def: if builtins.isFunction def then def else { config = def; }; + modules = opts' ++ map coerce defs; + in (evalModules modules args).config; + getSubOptions = prefix: (evalModules' prefix opts' + # FIXME: hack to get shit to evaluate. + { name = ""; } + ).options; + }; # Obsolete alternative to configOf. It takes its option # declarations from the ‘options’ attribute of containing option diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index a593d05ee62..66d46d9114a 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -19,7 +19,7 @@ let manual = import ../../../doc/manual { inherit pkgs; revision = config.system.nixosRevision; - options = (fixMergeModules ([ versionModule ] ++ baseModules) + options = (evalModules ([ versionModule ] ++ baseModules) (removeAttrs extraArgs ["config" "options"]) // { modules = [ ]; }).options; From 1408ac51a4e516e4a435369691121580186a2e4e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 15:08:57 +0100 Subject: [PATCH 053/179] Add missing types --- nixos/modules/system/boot/kernel.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 4ceabb20df5..0a3368ae416 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -78,6 +78,7 @@ in }; boot.kernelModules = mkOption { + type = types.listOf types.string; default = []; description = '' The set of kernel modules to be loaded in the second stage of @@ -89,6 +90,7 @@ in }; boot.initrd.availableKernelModules = mkOption { + type = types.listOf types.string; default = []; example = [ "sata_nv" "ext3" ]; description = '' @@ -109,6 +111,7 @@ in }; boot.initrd.kernelModules = mkOption { + type = types.listOf types.string; default = []; description = "List of modules that are always loaded by the initrd."; }; From a40583e7e4eec305a08839df246455b0211dd7d1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 15:12:11 +0100 Subject: [PATCH 054/179] Fix bogus mkOption types Among others, systemd unit options were not being type-checked because of this. mkOption should really check its arguments better... --- .../modules/services/monitoring/graphite.nix | 4 ++-- .../modules/services/search/elasticsearch.nix | 12 +++++----- .../system/boot/systemd-unit-options.nix | 24 +++++++++---------- nixos/modules/system/boot/systemd.nix | 8 +++---- nixos/modules/system/etc/etc.nix | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index dc4261bdb09..93673351438 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -32,13 +32,13 @@ in { host = mkOption { description = "Graphite web frontend listen address"; default = "127.0.0.1"; - types = type.uniq types.string; + type = types.uniq types.string; }; port = mkOption { description = "Graphite web frontend port"; default = "8080"; - types = type.uniq types.string; + type = types.uniq types.string; }; }; diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index 3c27c1400f9..e6a2437902c 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -29,31 +29,31 @@ in { host = mkOption { description = "Elasticsearch listen address"; default = "127.0.0.1"; - types = type.uniq types.string; + type = types.uniq types.string; }; port = mkOption { description = "Elasticsearch port to listen for HTTP traffic"; default = "9200"; - types = type.uniq types.string; + type = types.uniq types.string; }; tcp_port = mkOption { description = "Elasticsearch port for the node to node communication"; default = "9300"; - types = type.uniq types.string; + type = types.uniq types.string; }; cluster_name = mkOption { description = "Elasticsearch name that identifies your cluster for auto-discovery"; default = "elasticsearch"; - types = type.uniq types.string; + type = types.uniq types.string; }; extraConf = mkOption { description = "Extra configuration for elasticsearch"; default = ""; - types = type.uniq types.string; + type = types.uniq types.string; example = '' node.name: "elasticsearch" node.master: true @@ -77,7 +77,7 @@ in { type: consolePattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" ''; - types = type.uniq types.string; + type = types.uniq types.string; }; }; diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index dfb9036ab4d..5c1fe34572c 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -8,7 +8,7 @@ rec { enable = mkOption { default = true; - types = types.bool; + type = types.bool; description = '' If set to false, this unit will be a symlink to /dev/null. This is primarily useful to prevent specific @@ -19,13 +19,13 @@ rec { description = mkOption { default = ""; - types = types.uniq types.string; + type = types.uniq types.string; description = "Description of this unit used in systemd messages and progress indicators."; }; requires = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' Start the specified units when this unit is started, and stop this unit when the specified units are stopped or fail. @@ -34,7 +34,7 @@ rec { wants = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' Start the specified units when this unit is started. ''; @@ -42,7 +42,7 @@ rec { after = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' If the specified units are started at the same time as this unit, delay this unit until they have started. @@ -51,7 +51,7 @@ rec { before = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' If the specified units are started at the same time as this unit, delay them until this unit has started. @@ -60,7 +60,7 @@ rec { bindsTo = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' Like ‘requires’, but in addition, if the specified units unexpectedly disappear, this unit will be stopped as well. @@ -69,7 +69,7 @@ rec { partOf = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' If the specified units are stopped or restarted, then this unit is stopped or restarted as well. @@ -78,7 +78,7 @@ rec { conflicts = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' If the specified units are started, then this unit is stopped and vice versa. @@ -87,13 +87,13 @@ rec { requiredBy = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = "Units that require (i.e. depend on and need to go down with) this unit."; }; wantedBy = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = "Units that want (i.e. depend on) this unit."; }; @@ -250,7 +250,7 @@ rec { listenStreams = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; example = [ "0.0.0.0:993" "/run/my-socket" ]; description = '' For each item in this list, a ListenStream diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index a5e1165574c..903ff4119e7 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -389,12 +389,12 @@ in type = types.attrsOf types.optionSet; options = { text = mkOption { - types = types.uniq types.string; + type = types.uniq types.string; description = "Text of this systemd unit."; }; enable = mkOption { default = true; - types = types.bool; + type = types.bool; description = '' If set to false, this unit will be a symlink to /dev/null. This is primarily useful to prevent specific @@ -404,12 +404,12 @@ in }; requiredBy = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = "Units that require (i.e. depend on and need to go down with) this unit."; }; wantedBy = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = "Units that want (i.e. depend on) this unit."; }; }; diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix index 91fcdcf2435..30d0119c293 100644 --- a/nixos/modules/system/etc/etc.nix +++ b/nixos/modules/system/etc/etc.nix @@ -70,7 +70,7 @@ in }; source = mkOption { - types = types.path; + type = types.path; description = "Path of the source file."; }; From c263b5b284cee4d2b658c6acd2942e367ac3f985 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 15:13:51 +0100 Subject: [PATCH 055/179] Show error locations in submodules --- lib/modules.nix | 6 +++--- lib/types.nix | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index f429653d94e..7ad72235994 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -119,7 +119,7 @@ rec { if opt.options ? default && res ? default || opt.options ? example && res ? example || opt.options ? description && res ? description || - opt.options ? merge && res ? merge || + opt.options ? merge && res ? merge || # FIXME: remove merge opt.options ? apply && res ? apply || opt.options ? type && res ? type then @@ -148,13 +148,13 @@ rec { fold (def: res: if opt.type.check def.value then res else throw "The option value `${showOption loc}' in `${def.file}' is not a ${opt.type.name}.") - (opt.type.merge (map (m: m.value) defsFinal)) defsFinal; + (opt.type.merge' { prefix = loc; } (map (m: m.value) defsFinal)) defsFinal; # Finally, apply the ‘apply’ function to the merged # value. This allows options to yield a value computed # from the definitions. value = (opt.apply or id) merged; in opt // - { inherit value; + { value = addErrorContext "while evaluating the option `${showOption loc}':" value; definitions = defsFinal; isDefined = defsFinal != []; }; diff --git a/lib/types.nix b/lib/types.nix index dec9d82d608..f459cda73cb 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -37,6 +37,9 @@ rec { }; + addToPrefix = args: name: args // { prefix = args.prefix ++ [name]; }; + + types = rec { unspecified = mkOptionType { @@ -98,14 +101,15 @@ rec { listOf = elemType: mkOptionType { name = "list of ${elemType.name}s"; check = value: isList value && all elemType.check value; - merge = defs: map (def: elemType.merge [def]) (concatLists defs); + merge' = args: defs: imap (n: def: elemType.merge' (addToPrefix args (toString n)) [def]) (concatLists defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); }; attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; check = x: isAttrs x && all elemType.check (lib.attrValues x); - merge = lib.zipAttrsWith (name: elemType.merge' { inherit name; }); + merge' = args: lib.zipAttrsWith (name: + elemType.merge' (addToPrefix (args // { inherit name; }) name)); getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; @@ -128,7 +132,7 @@ rec { if isList x then listOnly.check x else if isAttrs x then attrOnly.check x else false; - merge = defs: attrOnly.merge (imap convertIfList defs); + merge' = args: defs: attrOnly.merge' args (imap convertIfList defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; @@ -152,19 +156,19 @@ rec { nullOr = elemType: mkOptionType { name = "null or ${elemType.name}"; check = x: builtins.isNull x || elemType.check x; - merge = defs: + merge' = args: defs: if all isNull defs then null else if any isNull defs then throw "Some but not all values are null." - else elemType.merge defs; + else elemType.merge' args defs; getSubOptions = elemType.getSubOptions; }; functionTo = elemType: mkOptionType { name = "function that evaluates to a(n) ${elemType.name}"; check = builtins.isFunction; - merge = fns: - args: elemType.merge (map (fn: fn args) fns); + merge' = args: fns: + fnArgs: elemType.merge' args (map (fn: fn fnArgs) fns); getSubOptions = elemType.getSubOptions; }; @@ -173,13 +177,12 @@ rec { mkOptionType rec { name = "submodule"; check = x: isAttrs x || builtins.isFunction x; - # FIXME: make error messages include the parent attrpath. merge = merge' {}; merge' = args: defs: let coerce = def: if builtins.isFunction def then def else { config = def; }; modules = opts' ++ map coerce defs; - in (evalModules modules args).config; + in (evalModules' args.prefix modules args).config; getSubOptions = prefix: (evalModules' prefix opts' # FIXME: hack to get shit to evaluate. { name = ""; } From f4a418761b481b15900c78b8086e7be58b0afe4e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 15:48:20 +0100 Subject: [PATCH 056/179] Check for undeclared options --- lib/modules.nix | 28 +++++++++++--------- lib/types.nix | 10 +++---- nixos/lib/eval-config.nix | 13 +++++---- nixos/modules/services/misc/nixos-manual.nix | 10 ++++--- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 7ad72235994..076ffdde246 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -6,16 +6,14 @@ rec { /* Evaluate a set of modules. The result is a set of two attributes: ‘options’: the nested set of all option declarations, and ‘config’: the nested set of all option values. */ - evalModules = evalModules' []; - - evalModules' = prefix: modules: args: + evalModules = { modules, prefix ? [], args ? {}, check ? true }: let args' = args // result; closed = closeModules modules args'; # Note: the list of modules is reversed to maintain backward # compatibility with the old module system. Not sure if this is # the most sensible policy. - options = mergeModules prefix (reverseList closed); + options = mergeModules check prefix (reverseList closed); config = yieldConfig options; yieldConfig = mapAttrs (n: v: if isOption v then v.value else yieldConfig v); result = { inherit options config; }; @@ -52,7 +50,7 @@ rec { { inherit file key; imports = m.require or []; options = {}; - config = m; + config = removeAttrs m ["require"]; }; applyIfFunction = f: arg: if builtins.isFunction f then f arg else f; @@ -62,13 +60,19 @@ rec { At the same time, for each option declaration, it will merge the corresponding option definitions in all machines, returning them in the ‘value’ attribute of each option. */ - mergeModules = prefix: modules: - mergeModules' prefix modules + mergeModules = check: prefix: modules: + mergeModules' check prefix modules (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules); - mergeModules' = prefix: options: configs: - let names = concatMap (m: attrNames m.options) options; - in listToAttrs (map (name: { + mergeModules' = check: prefix: options: configs: + let + declaredNames = concatMap (m: attrNames m.options) options; + declaredNames' = listToAttrs (map (n: { name = n; value = 1; }) declaredNames); + checkDefinedNames = res: fold (m: res: fold (n: res: + if hasAttr n declaredNames' then res else + throw "The option `${showOption (prefix ++ [n])}' defined in `${m.file}' does not exist." + ) res (attrNames m.config)) res configs; + in (if check then checkDefinedNames else id) (listToAttrs (map (name: { # We're descending into attribute ‘name’. inherit name; value = @@ -105,8 +109,8 @@ rec { in throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." else - mergeModules' loc decls defns; - }) names); + mergeModules' check loc decls defns; + }) declaredNames)); /* Merge multiple option declarations into a single declaration. In general, there should be only one declaration of each option. diff --git a/lib/types.nix b/lib/types.nix index f459cda73cb..07a6cc69fdc 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -182,11 +182,11 @@ rec { let coerce = def: if builtins.isFunction def then def else { config = def; }; modules = opts' ++ map coerce defs; - in (evalModules' args.prefix modules args).config; - getSubOptions = prefix: (evalModules' prefix opts' - # FIXME: hack to get shit to evaluate. - { name = ""; } - ).options; + in (evalModules { inherit modules args; prefix = args.prefix; }).config; + getSubOptions = prefix: (evalModules + { modules = opts'; inherit prefix; + # FIXME: hack to get shit to evaluate. + args = { name = ""; }; }).options; }; # Obsolete alternative to configOf. It takes its option diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index 119bba78ff1..5d487b91afb 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -7,19 +7,21 @@ , baseModules ? import ../modules/module-list.nix , extraArgs ? {} , modules +, check ? true }: let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in rec { - # These are the NixOS modules that constitute the system configuration. - configComponents = modules ++ baseModules; - # Merge the option definitions in all modules, forming the full - # system configuration. It's not checked for undeclared options. + # system configuration. systemModule = - pkgs.lib.evalModules configComponents extraArgs; + pkgs.lib.evalModules { + modules = modules ++ baseModules; + args = extraArgs; + inherit check; + }; config = systemModule.config; @@ -54,6 +56,7 @@ rec { # define nixpkgs.config, so it's pointless to evaluate them. baseModules = [ ../modules/misc/nixpkgs.nix ]; pkgs = import ./nixpkgs.nix { system = system_; config = {}; }; + check = false; }).config.nixpkgs; in { diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index 66d46d9114a..f67afb747e9 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -16,13 +16,15 @@ let system.nixosRevision = config.system.nixosRevision; }; + eval = evalModules { + modules = [ versionModule ] ++ baseModules; + args = (removeAttrs extraArgs ["config" "options"]) // { modules = [ ]; }; + }; + manual = import ../../../doc/manual { inherit pkgs; revision = config.system.nixosRevision; - options = (evalModules ([ versionModule ] ++ baseModules) - (removeAttrs extraArgs ["config" "options"]) // { - modules = [ ]; - }).options; + options = eval.options; }; entry = "${manual.manual}/share/doc/nixos/manual.html"; From d5047faedef254d01a21618224698c190bb67e5b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 16:14:15 +0100 Subject: [PATCH 057/179] Remove uses of the "merge" option attribute It's redundant because you can (and should) specify an option type, or an apply function. --- lib/options.nix | 3 +++ lib/types.nix | 6 ++++++ nixos/modules/config/nsswitch.nix | 2 +- nixos/modules/hardware/pcmcia.nix | 4 ++-- nixos/modules/misc/assertions.nix | 2 +- nixos/modules/security/apparmor.nix | 3 ++- nixos/modules/services/audio/alsa.nix | 3 ++- nixos/modules/services/hardware/udev.nix | 6 +++--- nixos/modules/services/logging/logstash.nix | 6 +++--- nixos/modules/services/misc/nix-daemon.nix | 2 +- nixos/modules/services/monitoring/smartd.nix | 4 ++-- nixos/modules/services/networking/networkmanager.nix | 4 ++-- nixos/modules/services/system/dbus.nix | 2 +- nixos/modules/services/x11/desktop-managers/default.nix | 2 +- nixos/modules/services/x11/window-managers/default.nix | 2 +- nixos/modules/system/activation/top-level.nix | 2 +- nixos/modules/system/boot/kernel.nix | 2 +- nixos/modules/system/boot/systemd-unit-options.nix | 3 +-- nixos/modules/tasks/filesystems.nix | 3 +-- nixos/modules/tasks/network-interfaces.nix | 2 +- 20 files changed, 36 insertions(+), 27 deletions(-) diff --git a/lib/options.nix b/lib/options.nix index 480837fd1cf..d649d1160a0 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -66,6 +66,9 @@ rec { then head list else throw "Cannot merge values."; + + /* Obsolete, will remove soon. Specify an option type or apply + function instead. */ mergeTypedOption = typeName: predicate: merge: list: if all predicate list then merge list else throw "Expect a ${typeName}."; diff --git a/lib/types.nix b/lib/types.nix index 07a6cc69fdc..3c21e34879c 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -71,6 +71,12 @@ rec { merge = lib.concatStringsSep "\n"; }; + commas = mkOptionType { + name = "string"; + check = builtins.isString; + merge = lib.concatStringsSep ","; + }; + envVar = mkOptionType { name = "environment variable"; inherit (string) check; diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix index ad62b5597be..2e2125d44f7 100644 --- a/nixos/modules/config/nsswitch.nix +++ b/nixos/modules/config/nsswitch.nix @@ -16,6 +16,7 @@ in # NSS modules. Hacky! system.nssModules = mkOption { + type = types.listOf types.path; internal = true; default = []; description = '' @@ -23,7 +24,6 @@ in several DNS resolution methods to be specified via /etc/nsswitch.conf. ''; - merge = mergeListOption; apply = list: { inherit list; diff --git a/nixos/modules/hardware/pcmcia.nix b/nixos/modules/hardware/pcmcia.nix index 0dba59734ca..dea04ac753c 100644 --- a/nixos/modules/hardware/pcmcia.nix +++ b/nixos/modules/hardware/pcmcia.nix @@ -18,16 +18,16 @@ in hardware.pcmcia = { enable = mkOption { + type = types.bool; default = false; - merge = mergeEnableOption; description = '' Enable this option to support PCMCIA card. ''; }; firmware = mkOption { + type = types.listOf types.path; default = []; - merge = mergeListOption; description = '' List of firmware used to handle specific PCMCIA card. ''; diff --git a/nixos/modules/misc/assertions.nix b/nixos/modules/misc/assertions.nix index 229f8f27860..5fb88308b77 100644 --- a/nixos/modules/misc/assertions.nix +++ b/nixos/modules/misc/assertions.nix @@ -15,10 +15,10 @@ in options = { assertions = mkOption { + type = types.listOf types.unspecified; internal = true; default = []; example = [ { assertion = false; message = "you can't enable this for that reason"; } ]; - merge = pkgs.lib.mergeListOption; description = '' This option allows modules to express conditions that must hold for the evaluation of the system configuration to diff --git a/nixos/modules/security/apparmor.nix b/nixos/modules/security/apparmor.nix index d4aa0598dd3..b9f15159002 100644 --- a/nixos/modules/security/apparmor.nix +++ b/nixos/modules/security/apparmor.nix @@ -15,6 +15,7 @@ with pkgs.lib; security.apparmor = { enable = mkOption { + type = types.bool; default = false; description = '' Enable AppArmor application security system. Enable only if @@ -23,8 +24,8 @@ with pkgs.lib; }; profiles = mkOption { + type = types.listOf types.path; default = []; - merge = mergeListOption; description = '' List of file names of AppArmor profiles. ''; diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index 6c53ef46ab9..d021b8bd3ba 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -20,14 +20,15 @@ in sound = { enable = mkOption { + type = types.bool; default = true; description = '' Whether to enable ALSA sound. ''; - merge = mergeEnableOption; }; enableOSSEmulation = mkOption { + type = types.bool; default = true; description = '' Whether to enable ALSA OSS emulation (with certain cards sound mixing may not work!). diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix index 37dba8ce71d..75f01fbc5a9 100644 --- a/nixos/modules/services/hardware/udev.nix +++ b/nixos/modules/services/hardware/udev.nix @@ -126,8 +126,8 @@ in services.udev = { packages = mkOption { + type = types.listOf types.path; default = []; - merge = mergeListOption; description = '' List of packages containing udev rules. All files found in @@ -138,8 +138,8 @@ in }; path = mkOption { + type = types.listOf types.path; default = []; - merge = mergeListOption; description = '' Packages added to the PATH environment variable when executing programs from Udev rules. @@ -162,9 +162,9 @@ in }; hardware.firmware = mkOption { + type = types.listOf types.path; default = []; example = [ "/root/my-firmware" ]; - merge = mergeListOption; description = '' List of directories containing firmware files. Such files will be loaded automatically if the kernel asks for them diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix index 2f0eea50526..79bdf4f7bbc 100644 --- a/nixos/modules/services/logging/logstash.nix +++ b/nixos/modules/services/logging/logstash.nix @@ -99,7 +99,7 @@ in mkHash functions, which take a string representation of a float and an attrset, respectively. ''; - merge = mergeConfigs; + apply = mergeConfigs; }; filterConfig = mkOption { @@ -109,7 +109,7 @@ in representing a logstash configuration's filter section. See inputConfig description for details. ''; - merge = mergeConfigs; + apply = mergeConfigs; }; outputConfig = mkOption { @@ -119,7 +119,7 @@ in representing a logstash configuration's output section. See inputConfig description for details. ''; - merge = mergeConfigs; + apply = mergeConfigs; }; }; }; diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index e98f63f6886..d78c7fe2822 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -56,8 +56,8 @@ in options = { environment.nix = mkOption { + type = types.path; default = pkgs.nix; - merge = mergeOneOption; description = '' This option specifies the Nix package instance to use throughout the system. ''; diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index de07dc0dbaa..b0619a16175 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -20,8 +20,8 @@ let default = ""; example = "-d sat"; type = types.string; - merge = pkgs.lib.concatStringsSep " "; - description = "Options that determine how smartd monitors the device"; + apply = pkgs.lib.concatStringsSep " "; + description = "Options that determine how smartd monitors the device."; }; }; diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix index 1d5682f5f3f..ad6f9858aaf 100644 --- a/nixos/modules/services/networking/networkmanager.nix +++ b/nixos/modules/services/networking/networkmanager.nix @@ -64,8 +64,8 @@ in { networking.networkmanager = { enable = mkOption { + type = types.bool; default = false; - merge = mergeEnableOption; description = '' Whether to use NetworkManager to obtain an IP address and other configuration for all network interfaces that are not manually @@ -76,11 +76,11 @@ in { }; packages = mkOption { + type = types.listOf types.path; default = [ ]; description = '' Extra packages that provide NetworkManager plugins. ''; - merge = mergeListOption; apply = list: [ networkmanager modemmanager wpa_supplicant ] ++ list; }; diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index 196fa40c551..40d0853d19d 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -68,12 +68,12 @@ in services.dbus = { enable = mkOption { + type = types.bool; default = true; description = '' Whether to start the D-Bus message bus daemon, which is required by many other system services and applications. ''; - merge = pkgs.lib.mergeEnableOption; }; packages = mkOption { diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index 0fea74d5ba7..3578d702b28 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -50,10 +50,10 @@ in }; default = mkOption { + type = types.uniq types.string; default = ""; example = "none"; description = "Default desktop manager loaded if none have been chosen."; - merge = mergeOneOption; apply = defaultDM: if defaultDM == "" && cfg.session.list != [] then (head cfg.session.list).name diff --git a/nixos/modules/services/x11/window-managers/default.nix b/nixos/modules/services/x11/window-managers/default.nix index c201b789ae4..e856a9e2079 100644 --- a/nixos/modules/services/x11/window-managers/default.nix +++ b/nixos/modules/services/x11/window-managers/default.nix @@ -40,10 +40,10 @@ in }; default = mkOption { + type = types.uniq types.string; default = "none"; example = "wmii"; description = "Default window manager loaded if none have been chosen."; - merge = mergeOneOption; apply = defaultWM: if any (w: w.name == defaultWM) cfg.session then defaultWM diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index a04914bedaf..7b1c7d611d3 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -172,9 +172,9 @@ in }; system.extraSystemBuilderCmds = mkOption { + type = types.lines; internal = true; default = ""; - merge = concatStringsSep "\n"; description = '' This code will be added to the builder creating the system store path. ''; diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 0a3368ae416..4cea6279e50 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -117,6 +117,7 @@ in }; system.modulesTree = mkOption { + type = types.listOf types.path; internal = true; default = []; description = '' @@ -124,7 +125,6 @@ in built outside of the kernel. Combine these into a single tree of symlinks because modprobe only supports one directory. ''; - merge = mergeListOption; # Convert the list of path to only one path. apply = pkgs.aggregateModules; }; diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index 5c1fe34572c..d18c5d86417 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -319,8 +319,7 @@ rec { options = mkOption { default = ""; example = "noatime"; - type = types.string; - merge = concatStringsSep ","; + type = types.commas; description = "Options used to mount the file system."; }; diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix index 6e3d019ea93..2b4fe582c37 100644 --- a/nixos/modules/tasks/filesystems.nix +++ b/nixos/modules/tasks/filesystems.nix @@ -43,8 +43,7 @@ let options = mkOption { default = "defaults,relatime"; example = "data=journal"; - type = types.string; - merge = pkgs.lib.concatStringsSep ","; + type = types.commas; description = "Options used to mount the file system."; }; diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 0177d6396df..0767c3db1fe 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -220,8 +220,8 @@ in }; networking.useDHCP = mkOption { + type = types.bool; default = true; - merge = mergeEnableOption; description = '' Whether to use DHCP to obtain an IP address and other configuration for all network interfaces that are not manually From 44d6d887390bbf0fd99d2bf95d75e6292357fd50 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 16:24:48 +0100 Subject: [PATCH 058/179] Fix option renaming --- lib/modules.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules.nix b/lib/modules.nix index 076ffdde246..47c7e9bf1ac 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -159,7 +159,7 @@ rec { value = (opt.apply or id) merged; in opt // { value = addErrorContext "while evaluating the option `${showOption loc}':" value; - definitions = defsFinal; + definitions = map (def: def.value) defsFinal; isDefined = defsFinal != []; }; From 259f7a93b1e679b73026352b40029375aa94db7c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 16:28:04 +0100 Subject: [PATCH 059/179] Rename environment.nix -> nix.package --- nixos/modules/config/system-path.nix | 2 +- nixos/modules/installer/cd-dvd/channel.nix | 2 +- nixos/modules/installer/cd-dvd/iso-image.nix | 4 ++-- .../installer/cd-dvd/system-tarball.nix | 4 ++-- .../modules/installer/tools/nixos-rebuild.sh | 2 +- nixos/modules/installer/tools/tools.nix | 4 ++-- nixos/modules/rename.nix | 1 + nixos/modules/services/misc/nix-daemon.nix | 20 +++++++++---------- nixos/modules/services/misc/nix-gc.nix | 2 +- nixos/modules/virtualisation/amazon-image.nix | 4 ++-- nixos/modules/virtualisation/nova-image.nix | 4 ++-- nixos/modules/virtualisation/qemu-vm.nix | 2 +- .../virtualisation/virtualbox-image.nix | 4 ++-- 13 files changed, 28 insertions(+), 27 deletions(-) diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 0610ad54da3..8dd92dd96af 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -14,7 +14,7 @@ let ''; requiredPackages = - [ config.environment.nix + [ config.nix.package pkgs.acl pkgs.attr pkgs.bashInteractive # bash with ncurses support diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix index c6e0f1577bb..bcf3dbb3f73 100644 --- a/nixos/modules/installer/cd-dvd/channel.nix +++ b/nixos/modules/installer/cd-dvd/channel.nix @@ -33,7 +33,7 @@ in if ! [ -e /var/lib/nixos/did-channel-init ]; then echo "unpacking the NixOS/Nixpkgs sources..." mkdir -p /nix/var/nix/profiles/per-user/root - ${config.environment.nix}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \ + ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \ -i ${channelSources} --quiet --option use-substitutes false mkdir -m 0700 -p /root/.nix-defexpr ln -s /nix/var/nix/profiles/per-user/root/channels /root/.nix-defexpr/channels diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index de9728d677c..b803a3f188b 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -298,12 +298,12 @@ in '' # After booting, register the contents of the Nix store on the # CD in the Nix database in the tmpfs. - ${config.environment.nix}/bin/nix-store --load-db < /nix/store/nix-path-registration + ${config.nix.package}/bin/nix-store --load-db < /nix/store/nix-path-registration # nixos-rebuild also requires a "system" profile and an # /etc/NIXOS tag. touch /etc/NIXOS - ${config.environment.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system + ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system ''; # Add vfat support to the initrd to enable people to copy the diff --git a/nixos/modules/installer/cd-dvd/system-tarball.nix b/nixos/modules/installer/cd-dvd/system-tarball.nix index 6bf8eebdac5..8d678fba71f 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball.nix @@ -77,14 +77,14 @@ in # After booting, register the contents of the Nix store on the # CD in the Nix database in the tmpfs. if [ -f /nix-path-registration ]; then - ${config.environment.nix}/bin/nix-store --load-db < /nix-path-registration && + ${config.nix.package}/bin/nix-store --load-db < /nix-path-registration && rm /nix-path-registration fi # nixos-rebuild also requires a "system" profile and an # /etc/NIXOS tag. touch /etc/NIXOS - ${config.environment.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system + ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system ''; }; diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index d655210c90e..0eca902dd74 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -109,7 +109,7 @@ fi # more conservative. if [ "$action" != dry-run -a -n "$buildNix" ]; then echo "building Nix..." >&2 - if ! nix-build '' -A config.environment.nix -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then + if ! nix-build '' -A config.nix.package -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then if ! nix-build '' -A nixFallback -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then nix-build '' -A nixUnstable -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null fi diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 074c77b5146..2c68ec5fe22 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -22,10 +22,10 @@ let src = ./nixos-install.sh; inherit (pkgs) perl pathsFromGraph; - nix = config.environment.nix; + nix = config.nix.package; nixClosure = pkgs.runCommand "closure" - { exportReferencesGraph = ["refs" config.environment.nix]; } + { exportReferencesGraph = ["refs" config.nix.package]; } "cp refs $out"; }; diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 82ba051eebf..0a8383870ee 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -73,6 +73,7 @@ in zipModules ([] # ++ alias [ "services" "xserver" "slim" "theme" ] [ "services" "xserver" "displayManager" "slim" "theme" ] ++ obsolete [ "environment" "extraPackages" ] [ "environment" "systemPackages" ] ++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ] +++ obsolete [ "environment" "nix" ] [ "nix" "package" ] ++ obsolete [ "security" "extraSetuidPrograms" ] [ "security" "setuidPrograms" ] ++ obsolete [ "networking" "enableWLAN" ] [ "networking" "wireless" "enable" ] diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index d78c7fe2822..441b8606b01 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -6,7 +6,7 @@ let cfg = config.nix; - inherit (config.environment) nix; + nix = cfg.package; makeNixBuildUser = nr: { name = "nixbld${toString nr}"; @@ -55,16 +55,16 @@ in options = { - environment.nix = mkOption { - type = types.path; - default = pkgs.nix; - description = '' - This option specifies the Nix package instance to use throughout the system. - ''; - }; - nix = { + package = mkOption { + type = types.path; + default = pkgs.nix; + description = '' + This option specifies the Nix package instance to use throughout the system. + ''; + }; + maxJobs = mkOption { default = 1; example = 2; @@ -302,7 +302,7 @@ in } // optionalAttrs cfg.distributedBuilds { - NIX_BUILD_HOOK = "${config.environment.nix}/libexec/nix/build-remote.pl"; + NIX_BUILD_HOOK = "${nix}/libexec/nix/build-remote.pl"; NIX_REMOTE_SYSTEMS = "/etc/nix/machines"; NIX_CURRENT_LOAD = "/run/nix/current-load"; } diff --git a/nixos/modules/services/misc/nix-gc.nix b/nixos/modules/services/misc/nix-gc.nix index ad6889ce142..0d7bc13b2ee 100644 --- a/nixos/modules/services/misc/nix-gc.nix +++ b/nixos/modules/services/misc/nix-gc.nix @@ -52,7 +52,7 @@ in systemd.services.nix-gc = { description = "Nix Garbage Collector"; - script = "exec ${config.environment.nix}/bin/nix-collect-garbage ${cfg.options}"; + script = "exec ${config.nix.package}/bin/nix-collect-garbage ${cfg.options}"; startAt = optionalString cfg.automatic cfg.dates; }; diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix index 7e04f0d2911..cfc582170e6 100644 --- a/nixos/modules/virtualisation/amazon-image.nix +++ b/nixos/modules/virtualisation/amazon-image.nix @@ -40,10 +40,10 @@ with pkgs.lib; # Register the paths in the Nix database. printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ - chroot /mnt ${config.environment.nix}/bin/nix-store --load-db + chroot /mnt ${config.nix.package}/bin/nix-store --load-db # Create the system profile to allow nixos-rebuild to work. - chroot /mnt ${config.environment.nix}/bin/nix-env \ + chroot /mnt ${config.nix.package}/bin/nix-env \ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} # `nixos-rebuild' requires an /etc/NIXOS. diff --git a/nixos/modules/virtualisation/nova-image.nix b/nixos/modules/virtualisation/nova-image.nix index ab625dba11d..5c9481b7127 100644 --- a/nixos/modules/virtualisation/nova-image.nix +++ b/nixos/modules/virtualisation/nova-image.nix @@ -46,10 +46,10 @@ with pkgs.lib; # Register the paths in the Nix database. printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ - chroot /mnt ${config.environment.nix}/bin/nix-store --load-db + chroot /mnt ${config.nix.package}/bin/nix-store --load-db # Create the system profile to allow nixos-rebuild to work. - chroot /mnt ${config.environment.nix}/bin/nix-env \ + chroot /mnt ${config.nix.package}/bin/nix-env \ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} # `nixos-rebuild' requires an /etc/NIXOS. diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 708b462e0e5..6648b6514d0 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -329,7 +329,7 @@ in boot.postBootCommands = '' if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then - ${config.environment.nix}/bin/nix-store --load-db < ''${BASH_REMATCH[1]} + ${config.nix.package}/bin/nix-store --load-db < ''${BASH_REMATCH[1]} fi ''; diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix index e1b6def8edb..bea6414c450 100644 --- a/nixos/modules/virtualisation/virtualbox-image.nix +++ b/nixos/modules/virtualisation/virtualbox-image.nix @@ -53,10 +53,10 @@ with pkgs.lib; # Register the paths in the Nix database. printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ - chroot /mnt ${config.environment.nix}/bin/nix-store --load-db + chroot /mnt ${config.nix.package}/bin/nix-store --load-db # Create the system profile to allow nixos-rebuild to work. - chroot /mnt ${config.environment.nix}/bin/nix-env \ + chroot /mnt ${config.nix.package}/bin/nix-env \ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} # `nixos-rebuild' requires an /etc/NIXOS. From 9a8516438e93ec61bc37fc6f2e1125df30df2f4b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 17:24:14 +0100 Subject: [PATCH 060/179] Fix NixOps evaluation --- lib/modules.nix | 18 ++++++++++-------- nixos/modules/system/boot/loader/grub/grub.nix | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 47c7e9bf1ac..5c5820e92f4 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -22,35 +22,37 @@ rec { /* Close a set of modules under the ‘imports’ relation. */ closeModules = modules: args: let - toClosureList = parent: imap (n: x: + toClosureList = file: parentKey: imap (n: x: if isAttrs x || builtins.isFunction x then - unifyModuleSyntax parent "anon-${toString n}" (applyIfFunction x args) + unifyModuleSyntax file "${parentKey}:anon-${toString n}" (applyIfFunction x args) else unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args)); in builtins.genericClosure { - startSet = toClosureList unknownModule modules; - operator = m: toClosureList m.file m.imports; + startSet = toClosureList unknownModule "" modules; + operator = m: toClosureList m.file m.key m.imports; }; /* Massage a module into canonical form, that is, a set consisting of ‘options’, ‘config’ and ‘imports’ attributes. */ unifyModuleSyntax = file: key: m: if m ? config || m ? options || m ? imports then - let badAttrs = removeAttrs m ["imports" "options" "config"]; in + let badAttrs = removeAttrs m ["imports" "options" "config" "key"]; in if badAttrs != {} then throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. ${builtins.toXML m} " else - { inherit file key; + { inherit file; + key = m.key or key; imports = m.imports or []; options = m.options or {}; config = m.config or {}; } else - { inherit file key; + { inherit file; + key = m.key or key; imports = m.require or []; options = {}; - config = removeAttrs m ["require"]; + config = removeAttrs m ["key" "require"]; }; applyIfFunction = f: arg: if builtins.isFunction f then f arg else f; diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 955235da70f..31e55b5ef9f 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -236,7 +236,7 @@ in system.build.installBootLoader = if cfg.devices == [] then - throw "You must set the ‘boot.loader.grub.device’ option to make the system bootable." + throw "You must set the option ‘boot.loader.grub.device’ to make the system bootable." else "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " + "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}"; From e28ea1239fe9413bdb59fd323167b7440b75fc0b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 17:37:28 +0100 Subject: [PATCH 061/179] Fix evaluation of environment.variables --- lib/modules.nix | 7 +++++-- nixos/modules/config/shells-environment.nix | 9 +++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 5c5820e92f4..9733929706f 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -143,7 +143,7 @@ rec { let # Process mkOverride properties, adding in the default # value specified in the option declaration (if any). - defsFinal = filterOverrides + defsFinal = filterOverrides' ((if opt ? default then [{ file = head opt.declarations; value = mkOptionDefault opt.default; }] else []) ++ defs); # Type-check the remaining definitions, and merge them if # possible. @@ -229,7 +229,7 @@ rec { Note that "z" has the default priority 100. */ - filterOverrides = defs: + filterOverrides' = defs: let defaultPrio = 100; getPrio = def: if def.value._type or "" == "override" then def.value.priority else defaultPrio; @@ -238,6 +238,9 @@ rec { strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def; in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs; + /* For use in options like environment.variables. */ + filterOverrides = defs: map (def: def.value) (filterOverrides' (map (def: { value = def; }) defs)); + /* Hack for backward compatibility: convert options of type optionSet to configOf. FIXME: remove eventually. */ fixupOptionType = loc: opt: diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix index 5b8b6bc600c..4c40f33532f 100644 --- a/nixos/modules/config/shells-environment.nix +++ b/nixos/modules/config/shells-environment.nix @@ -26,10 +26,11 @@ in type = types.attrsOf (mkOptionType { name = "a string or a list of strings"; merge = xs: - if isList (head xs) then concatLists xs - else if builtins.lessThan 1 (length xs) then abort "variable in ‘environment.variables’ has multiple values" - else if !builtins.isString (head xs) then abort "variable in ‘environment.variables’ does not have a string value" - else head xs; + let xs' = filterOverrides xs; in + if isList (head xs') then concatLists xs' + else if builtins.lessThan 1 (length xs') then abort "variable in ‘environment.variables’ has multiple values" + else if !builtins.isString (head xs') then abort "variable in ‘environment.variables’ does not have a string value" + else head xs'; }); apply = mapAttrs (n: v: if isList v then concatStringsSep ":" v else v); }; From 1e24ce2a9b8cb5976d81ba9ff83f95440703de1a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 17:39:13 +0100 Subject: [PATCH 062/179] Remove debug code --- lib/modules.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules.nix b/lib/modules.nix index 9733929706f..184b21de486 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -39,7 +39,7 @@ rec { if m ? config || m ? options || m ? imports then let badAttrs = removeAttrs m ["imports" "options" "config" "key"]; in if badAttrs != {} then - throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. ${builtins.toXML m} " + throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'." else { inherit file; key = m.key or key; From 136707494062c86d1c7269f9ea363fc267e95b78 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 17:40:36 +0100 Subject: [PATCH 063/179] Allow imports in plain modules --- lib/modules.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 184b21de486..f6b866304d0 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -36,7 +36,7 @@ rec { /* Massage a module into canonical form, that is, a set consisting of ‘options’, ‘config’ and ‘imports’ attributes. */ unifyModuleSyntax = file: key: m: - if m ? config || m ? options || m ? imports then + if m ? config || m ? options then let badAttrs = removeAttrs m ["imports" "options" "config" "key"]; in if badAttrs != {} then throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'." @@ -50,9 +50,9 @@ rec { else { inherit file; key = m.key or key; - imports = m.require or []; + imports = m.require or [] ++ m.imports or []; options = {}; - config = removeAttrs m ["key" "require"]; + config = removeAttrs m ["key" "require" "imports"]; }; applyIfFunction = f: arg: if builtins.isFunction f then f arg else f; From 1b2006270f9e1307f575a9a7bc82b6d4f3c37cec Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 17:46:45 +0100 Subject: [PATCH 064/179] Support mkOverride in non-leaf nodes --- lib/modules.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index f6b866304d0..d141838d466 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -125,7 +125,6 @@ rec { if opt.options ? default && res ? default || opt.options ? example && res ? example || opt.options ? description && res ? description || - opt.options ? merge && res ? merge || # FIXME: remove merge opt.options ? apply && res ? apply || opt.options ? type && res ? type then @@ -185,8 +184,9 @@ rec { concatMap pushDownProperties cfg.contents else if cfg._type or "" == "if" then map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content) + else if cfg._type or "" == "override" then + map (mapAttrs (n: v: mkOverride cfg.priority v)) (pushDownProperties cfg.content) else - # FIXME: handle mkOverride? [ cfg ]; /* Given a config value, expand mkMerge properties, and discharge From 657c8d9ea799f32077b14aefa3b1c9406d5d8aab Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 17:47:13 +0100 Subject: [PATCH 065/179] Hack to work around the lack of isPath --- nixos/modules/profiles/clone-config.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/profiles/clone-config.nix b/nixos/modules/profiles/clone-config.nix index d7190020e7e..04ee76d8d3e 100644 --- a/nixos/modules/profiles/clone-config.nix +++ b/nixos/modules/profiles/clone-config.nix @@ -16,7 +16,8 @@ let # cannot serialized attribute set given in the list of modules (that's why # you should use files). moduleFiles = - filter isPath modules; + # FIXME: use typeOf (Nix 1.6.1). + filter (x: !isAttrs x && !builtins.isFunction x) modules; # Partition module files because between NixOS and non-NixOS files. NixOS # files may change if the repository is updated. From 92ef9d6b4653362dc9d0cbacdec863e7d41674cd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 18:21:53 +0100 Subject: [PATCH 066/179] nixos-rebuild: Ignore failure from get-version-suffix --- nixos/modules/installer/tools/nixos-rebuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index 0eca902dd74..5c89394abce 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -121,7 +121,7 @@ fi # Update the version suffix if we're building from Git (so that # nixos-version shows something useful). if nixpkgs=$(nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then - suffix=$(@shell@ $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}") + suffix=$(@shell@ $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}" || true) if [ -n "$suffix" ]; then echo -n "$suffix" > "$nixpkgs/.version-suffix" || true fi From dbefab9cf42c09444dd2554380104096969c0728 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 19:47:40 +0100 Subject: [PATCH 067/179] Do not allow multiple definitions of IP addresses etc. within an interface --- nixos/modules/tasks/network-interfaces.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 0767c3db1fe..16671cb3743 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -14,14 +14,14 @@ let name = mkOption { example = "eth0"; - type = types.string; + type = types.uniq types.string; description = "Name of the interface."; }; ipAddress = mkOption { default = null; example = "10.0.0.1"; - type = types.nullOr types.string; + type = types.nullOr (types.uniq types.string); description = '' IP address of the interface. Leave empty to configure the interface using DHCP. @@ -41,7 +41,7 @@ let subnetMask = mkOption { default = ""; example = "255.255.255.0"; - type = types.string; + type = types.uniq types.string; description = '' Subnet mask of the interface, specified as a bitmask. This is deprecated; use @@ -52,7 +52,7 @@ let macAddress = mkOption { default = null; example = "00:11:22:33:44:55"; - type = types.nullOr types.string; + type = types.nullOr (types.uniq types.string); description = '' MAC address of the interface. Leave empty to use the default. ''; From 73f32d03758a53ad1baac31795cfd99e325032f3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 19:48:30 +0100 Subject: [PATCH 068/179] Show precise error messages in option merge failures For instance, if time.timeZone is defined multiple times, you now get the error message: error: user-thrown exception: The unique option `time.timeZone' is defined multiple times, in `/etc/nixos/configurations/misc/eelco/x11vnc.nix' and `/etc/nixos/configuration.nix'. while previously you got: error: user-thrown exception: Multiple definitions of string. Only one is allowed for this option. and only an inspection of the stack trace gave a clue as to what option caused the problem. --- lib/modules.nix | 4 +- lib/options.nix | 21 +++--- lib/types.nix | 76 ++++++++++----------- nixos/modules/config/shells-environment.nix | 9 ++- nixos/modules/config/sysctl.nix | 2 +- nixos/modules/misc/nixpkgs.nix | 2 +- 6 files changed, 58 insertions(+), 56 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index d141838d466..d2b74733944 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -128,7 +128,7 @@ rec { opt.options ? apply && res ? apply || opt.options ? type && res ? type then - throw "The option `${showOption loc}' in `${opt.file}' is already declared in ${concatStringsSep " and " (map (d: "`${d}'") res.declarations)}." + throw "The option `${showOption loc}' in `${opt.file}' is already declared in ${showFiles res.declarations}." else opt.options // res // { declarations = [opt.file] ++ res.declarations; @@ -153,7 +153,7 @@ rec { fold (def: res: if opt.type.check def.value then res else throw "The option value `${showOption loc}' in `${def.file}' is not a ${opt.type.name}.") - (opt.type.merge' { prefix = loc; } (map (m: m.value) defsFinal)) defsFinal; + (opt.type.merge { prefix = loc; files = map (m: m.file) defsFinal; } (map (m: m.value) defsFinal)) defsFinal; # Finally, apply the ‘apply’ function to the merged # value. This allows options to yield a value computed # from the definitions. diff --git a/lib/options.nix b/lib/options.nix index d649d1160a0..66957bc7f15 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -35,7 +35,7 @@ rec { addDefaultOptionValues = defs: opts: opts // builtins.listToAttrs (map (defName: { name = defName; - value = + value = let defValue = builtins.getAttr defName defs; optValue = builtins.getAttr defName opts; @@ -49,27 +49,26 @@ rec { else # `defValue' is an attribute set containing options. # So recurse. - if hasAttr defName opts && isAttrs optValue + if hasAttr defName opts && isAttrs optValue then addDefaultOptionValues defValue optValue else addDefaultOptionValues defValue {}; } ) (attrNames defs)); - mergeDefaultOption = list: + mergeDefaultOption = args: list: if length list == 1 then head list - else if all builtins.isFunction list then x: mergeDefaultOption (map (f: f x) list) + else if all builtins.isFunction list then x: mergeDefaultOption args (map (f: f x) list) else if all isList list then concatLists list else if all isAttrs list then fold lib.mergeAttrs {} list else if all builtins.isBool list then fold lib.or false list else if all builtins.isString list then lib.concatStrings list - else if all builtins.isInt list && all (x: x == head list) list - then head list - else throw "Cannot merge values."; + else if all builtins.isInt list && all (x: x == head list) list then head list + else throw "Cannot merge definitions of `${showOption args.prefix}' given in ${showFiles args.files}."; /* Obsolete, will remove soon. Specify an option type or apply function instead. */ - mergeTypedOption = typeName: predicate: merge: list: + mergeTypedOption = typeName: predicate: merge: args: list: if all predicate list then merge list else throw "Expect a ${typeName}."; @@ -82,9 +81,10 @@ rec { (x: if builtins ? isString then builtins.isString x else x + "") lib.concatStrings; - mergeOneOption = list: + mergeOneOption = args: list: if list == [] then abort "This case should never happen." - else if length list != 1 then throw "Multiple definitions. Only one is allowed for this option." + else if length list != 1 then + throw "The unique option `${showOption args.prefix}' is defined multiple times, in ${showFiles args.files}." else head list; @@ -135,6 +135,7 @@ rec { /* Helper functions. */ showOption = concatStringsSep "."; + showFiles = files: concatStringsSep " and " (map (f: "`${f}'") files); unknownModule = ""; } diff --git a/lib/types.nix b/lib/types.nix index 3c21e34879c..34d06a9144f 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -19,27 +19,24 @@ rec { }; - # name (name of the type) - # check (check the config value) - # merge (default merge function) - # getSubOptions (returns sub-options for manual generation) isOptionType = isType "option-type"; mkOptionType = - { name - , check ? (x: true) - , merge ? mergeDefaultOption - , merge' ? args: merge - , getSubOptions ? prefix: {} + { # Human-readable representation of the type. + name + , # Function applied to each definition that should return true if + # its type-correct, false otherwise. + check ? (x: true) + , # Merge a list of definitions together into a single value. + merge ? mergeDefaultOption + , # Return a flat list of sub-options. Used to generate + # documentation. + getSubOptions ? prefix: {} }: - { _type = "option-type"; - inherit name check merge merge' getSubOptions; + inherit name check merge getSubOptions; }; - addToPrefix = args: name: args // { prefix = args.prefix ++ [name]; }; - - types = rec { unspecified = mkOptionType { @@ -49,7 +46,7 @@ rec { bool = mkOptionType { name = "boolean"; check = builtins.isBool; - merge = fold lib.or false; + merge = args: fold lib.or false; }; int = mkOptionType { @@ -60,7 +57,7 @@ rec { string = mkOptionType { name = "string"; check = builtins.isString; - merge = lib.concatStrings; + merge = args: lib.concatStrings; }; # Like ‘string’, but add newlines between every value. Useful for @@ -68,54 +65,56 @@ rec { lines = mkOptionType { name = "string"; check = builtins.isString; - merge = lib.concatStringsSep "\n"; + merge = args: lib.concatStringsSep "\n"; }; commas = mkOptionType { name = "string"; check = builtins.isString; - merge = lib.concatStringsSep ","; + merge = args: lib.concatStringsSep ","; }; envVar = mkOptionType { name = "environment variable"; inherit (string) check; - merge = lib.concatStringsSep ":"; + merge = args: lib.concatStringsSep ":"; }; attrs = mkOptionType { name = "attribute set"; check = isAttrs; - merge = fold lib.mergeAttrs {}; + merge = args: fold lib.mergeAttrs {}; }; # derivation is a reserved keyword. package = mkOptionType { name = "derivation"; check = isDerivation; + merge = mergeOneOption; }; path = mkOptionType { name = "path"; # Hacky: there is no ‘isPath’ primop. check = x: builtins.unsafeDiscardStringContext (builtins.substring 0 1 (toString x)) == "/"; + merge = mergeOneOption; }; # drop this in the future: - list = builtins.trace "types.list is deprecated; use types.listOf instead" types.listOf; + list = builtins.trace "`types.list' is deprecated; use `types.listOf' instead" types.listOf; listOf = elemType: mkOptionType { name = "list of ${elemType.name}s"; check = value: isList value && all elemType.check value; - merge' = args: defs: imap (n: def: elemType.merge' (addToPrefix args (toString n)) [def]) (concatLists defs); + merge = args: defs: imap (n: def: elemType.merge (addToPrefix args (toString n)) [def]) (concatLists defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); }; attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; check = x: isAttrs x && all elemType.check (lib.attrValues x); - merge' = args: lib.zipAttrsWith (name: - elemType.merge' (addToPrefix (args // { inherit name; }) name)); + merge = args: lib.zipAttrsWith (name: + elemType.merge (addToPrefix (args // { inherit name; }) name)); getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; @@ -138,43 +137,39 @@ rec { if isList x then listOnly.check x else if isAttrs x then attrOnly.check x else false; - merge' = args: defs: attrOnly.merge' args (imap convertIfList defs); + merge = args: defs: attrOnly.merge args (imap convertIfList defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; uniq = elemType: mkOptionType { inherit (elemType) name check; - merge = list: - if length list == 1 then - head list - else - throw "Multiple definitions of ${elemType.name}. Only one is allowed for this option."; + merge = mergeOneOption; getSubOptions = elemType.getSubOptions; }; none = elemType: mkOptionType { inherit (elemType) name check; - merge = list: - throw "No definitions are allowed for this option."; + merge = args: list: + throw "No definitions are allowed for the option `${showOption args.prefix}'."; getSubOptions = elemType.getSubOptions; }; nullOr = elemType: mkOptionType { name = "null or ${elemType.name}"; check = x: builtins.isNull x || elemType.check x; - merge' = args: defs: + merge = args: defs: if all isNull defs then null else if any isNull defs then - throw "Some but not all values are null." - else elemType.merge' args defs; + throw "The option `${showOption args.prefix}' is defined both null and not null, in ${showFiles args.files}." + else elemType.merge args defs; getSubOptions = elemType.getSubOptions; }; functionTo = elemType: mkOptionType { name = "function that evaluates to a(n) ${elemType.name}"; check = builtins.isFunction; - merge' = args: fns: - fnArgs: elemType.merge' args (map (fn: fn fnArgs) fns); + merge = args: fns: + fnArgs: elemType.merge args (map (fn: fn fnArgs) fns); getSubOptions = elemType.getSubOptions; }; @@ -183,8 +178,7 @@ rec { mkOptionType rec { name = "submodule"; check = x: isAttrs x || builtins.isFunction x; - merge = merge' {}; - merge' = args: defs: + merge = args: defs: let coerce = def: if builtins.isFunction def then def else { config = def; }; modules = opts' ++ map coerce defs; @@ -204,4 +198,8 @@ rec { }; + + /* Helper function. */ + addToPrefix = args: name: args // { prefix = args.prefix ++ [name]; }; + } diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix index 4c40f33532f..36f8549af8e 100644 --- a/nixos/modules/config/shells-environment.nix +++ b/nixos/modules/config/shells-environment.nix @@ -25,11 +25,14 @@ in ''; type = types.attrsOf (mkOptionType { name = "a string or a list of strings"; - merge = xs: + merge = args: xs: let xs' = filterOverrides xs; in if isList (head xs') then concatLists xs' - else if builtins.lessThan 1 (length xs') then abort "variable in ‘environment.variables’ has multiple values" - else if !builtins.isString (head xs') then abort "variable in ‘environment.variables’ does not have a string value" + else if builtins.lessThan 1 (length xs') then + # Don't show location info here, since it's too general. + throw "The option `${showOption args.prefix}' is defined multiple times." + else if !builtins.isString (head xs') then + throw "The option `${showOption args.prefix}' does not have a string value." else head xs'; }); apply = mapAttrs (n: v: if isList v then concatStringsSep ":" v else v); diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index 6b52fd38fde..a825144e466 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -7,7 +7,7 @@ let sysctlOption = mkOptionType { name = "sysctl option value"; check = x: builtins.isBool x || builtins.isString x || builtins.isInt x; - merge = xs: last xs; # FIXME: hacky way to allow overriding in configuration.nix. + merge = args: xs: last xs; # FIXME: hacky way to allow overriding in configuration.nix. }; in diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 9eba728c339..dfbd98bf6ee 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -26,7 +26,7 @@ let configType = mkOptionType { name = "nixpkgs config"; check = traceValIfNot isConfig; - merge = fold mergeConfig {}; + merge = args: fold mergeConfig {}; }; in From 621f4c42f56c264a3b568b14cdd8cff03067a1c1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 20:00:42 +0100 Subject: [PATCH 069/179] Disable the OpenStack (Nova) module This hasn't been worked on in over two years, so we shouldn't give the impression that it works. --- nixos/modules/module-list.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 62e5b8e49c2..cea57c0068a 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -276,7 +276,7 @@ ./tasks/scsi-link-power-management.nix ./tasks/swraid.nix ./virtualisation/libvirtd.nix - ./virtualisation/nova.nix + #./virtualisation/nova.nix ./virtualisation/virtualbox-guest.nix ./virtualisation/xen-dom0.nix ] From 30a36f9a80b998f7f4bca8e5246c2dfa1946771c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 20:08:28 +0100 Subject: [PATCH 070/179] Remove remaining uses of mkOverrideTemplate --- .../modules/installer/cd-dvd/system-tarball-fuloong2f.nix | 2 +- nixos/modules/installer/cd-dvd/system-tarball-pc.nix | 2 +- .../installer/cd-dvd/system-tarball-sheevaplug.nix | 2 +- nixos/modules/services/x11/desktop-managers/kde4.nix | 2 +- nixos/modules/system/activation/no-clone.nix | 8 +++----- nixos/tests/check-filesystems.nix | 2 +- nixos/tests/installer.nix | 2 +- 7 files changed, 9 insertions(+), 11 deletions(-) diff --git a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix index 85356118ce6..13ed95d4ceb 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix @@ -152,7 +152,7 @@ in # default root password is empty. services.openssh.enable = true; - jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} ""; + jobs.openssh.startOn = pkgs.lib.mkOverride 50 ""; boot.loader.grub.enable = false; boot.loader.generationsDir.enable = false; diff --git a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix index 7619f074b74..b7965fc6e0b 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix @@ -109,7 +109,7 @@ in # not be started by default on the installation CD because the # default root password is empty. services.openssh.enable = true; - jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} ""; + jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 ""; # To be able to use the systemTarball to catch troubles. boot.crashDump = { diff --git a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix index 20fe4de2cd8..7f253d595dc 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix @@ -165,7 +165,7 @@ in # not be started by default on the installation CD because the # default root password is empty. services.openssh.enable = true; - jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} ""; + jobs.openssh.startOn = pkgs.lib.mkOverride 50 ""; # cpufrequtils fails to build on non-pc powerManagement.enable = false; diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix index d1eb1799bc8..079fc054d19 100644 --- a/nixos/modules/services/x11/desktop-managers/kde4.nix +++ b/nixos/modules/services/x11/desktop-managers/kde4.nix @@ -80,7 +80,7 @@ in # overridden by the user's configuration). # !!! doesn't work yet ("Multiple definitions. Only one is allowed # for this option.") - # services.xserver.desktopManager.default = mkOverrideTemplate 900 "kde4"; + # services.xserver.desktopManager.default = mkOverride 900 "kde4"; services.xserver.desktopManager.session = singleton { name = "kde4"; diff --git a/nixos/modules/system/activation/no-clone.nix b/nixos/modules/system/activation/no-clone.nix index f15809e4d8b..c9ab691ce47 100644 --- a/nixos/modules/system/activation/no-clone.nix +++ b/nixos/modules/system/activation/no-clone.nix @@ -1,11 +1,9 @@ -# This configuration is not made to figure inside the module-list.nix to -# allow clone of the first level. {pkgs, ...}: with pkgs.lib; { - boot.loader.grub.device = mkOverrideTemplate 0 {} "nodev"; - nesting.children = mkOverrideTemplate 0 {} []; - nesting.clone = mkOverrideTemplate 0 {} []; + boot.loader.grub.device = mkOverride 0 "nodev"; + nesting.children = mkOverride 0 []; + nesting.clone = mkOverride 0 []; } diff --git a/nixos/tests/check-filesystems.nix b/nixos/tests/check-filesystems.nix index 39e8883ee59..c1dae0ca621 100644 --- a/nixos/tests/check-filesystems.nix +++ b/nixos/tests/check-filesystems.nix @@ -40,7 +40,7 @@ rec { device = "share:/repos2"; fsType = "nfs"; }; - in pkgs.lib.mkOverrideTemplate 50 {} [ + in pkgs.lib.mkOverride 50 [ repos1 repos1 # check remount repos2 # check after remount diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index bebd6c04374..865b21d2444 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -14,7 +14,7 @@ let [ ../modules/installer/cd-dvd/installation-cd-graphical.nix ../modules/testing/test-instrumentation.nix { key = "serial"; - boot.loader.grub.timeout = mkOverrideTemplate 0 {} 0; + boot.loader.grub.timeout = mkOverride 0 0; # The test cannot access the network, so any sources we # need must be included in the ISO. From f8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 21:58:32 +0100 Subject: [PATCH 071/179] Implement services.httpd.virtualHosts using the module system --- .../web-servers/apache-httpd/default.nix | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index e2cfc5cdb26..7688b04f1c1 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -38,21 +38,7 @@ let }; - vhostOptions = import ./per-server-options.nix { - inherit mkOption; - forMainServer = false; - }; - - vhosts = let - makeVirtualHost = cfgIn: - let - # Fill in defaults for missing options. - cfg = addDefaultOptionValues vhostOptions cfgIn; - in cfg; - in map makeVirtualHost mainCfg.virtualHosts; - - - allHosts = [mainCfg] ++ vhosts; + allHosts = [mainCfg] ++ mainCfg.virtualHosts; callSubservices = serverInfo: defs: @@ -86,7 +72,7 @@ let mainSubservices = subservicesFor mainCfg; - allSubservices = mainSubservices ++ concatMap subservicesFor vhosts; + allSubservices = mainSubservices ++ concatMap subservicesFor mainCfg.virtualHosts; # !!! should be in lib @@ -389,7 +375,7 @@ let ${perServerConf false vhost} ''; - in concatMapStrings makeVirtualHost vhosts + in concatMapStrings makeVirtualHost mainCfg.virtualHosts } ''; @@ -428,7 +414,7 @@ in package = mkOption { default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; - example = "pkgs.apacheHttpd_2_4"; + example = "pkgs.apacheHttpd_2_4"; description = " Overridable attribute of the Apache HTTP Server package to use. "; @@ -436,7 +422,7 @@ in configFile = mkOption { default = confFile; - example = ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; + example = literalExample ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; description = " Overridable config file to use for Apache. By default, use the file automatically generated by nixos. @@ -507,6 +493,12 @@ in }; virtualHosts = mkOption { + type = types.listOf (types.submodule ( + { options = import ./per-server-options.nix { + inherit mkOption; + forMainServer = false; + }; + })); default = []; example = [ { hostName = "foo"; From c9dad37f01d138e74d0e72050db6eb6f7d074948 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 22:09:16 +0100 Subject: [PATCH 072/179] Remove obsolete function addDefaultOptionValues --- lib/options.nix | 26 ------------------- .../web-servers/apache-httpd/default.nix | 6 +++-- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/lib/options.nix b/lib/options.nix index 66957bc7f15..2b211478765 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -30,31 +30,6 @@ rec { type = lib.types.bool; }; - # !!! This function will be removed because this can be done with the - # multiple option declarations. - addDefaultOptionValues = defs: opts: opts // - builtins.listToAttrs (map (defName: - { name = defName; - value = - let - defValue = builtins.getAttr defName defs; - optValue = builtins.getAttr defName opts; - in - if isOption defValue - then - # `defValue' is an option. - if hasAttr defName opts - then builtins.getAttr defName opts - else defValue.default - else - # `defValue' is an attribute set containing options. - # So recurse. - if hasAttr defName opts && isAttrs optValue - then addDefaultOptionValues defValue optValue - else addDefaultOptionValues defValue {}; - } - ) (attrNames defs)); - mergeDefaultOption = args: list: if length list == 1 then head list else if all builtins.isFunction list then x: mergeDefaultOption args (map (f: f x) list) @@ -65,7 +40,6 @@ rec { else if all builtins.isInt list && all (x: x == head list) list then head list else throw "Cannot merge definitions of `${showOption args.prefix}' given in ${showFiles args.files}."; - /* Obsolete, will remove soon. Specify an option type or apply function instead. */ mergeTypedOption = typeName: predicate: merge: args: list: diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 7688b04f1c1..4b0a5d6d363 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -47,8 +47,10 @@ let svcFunction = if svc ? function then svc.function else import "${./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix"; - config = addDefaultOptionValues res.options - (if svc ? config then svc.config else svc); + config = (evalModules + { modules = [ { options = res.options; config = svc.config or svc; } ]; + check = false; + }).config; defaults = { extraConfig = ""; extraModules = []; From 3115addf4c47fe6ca572188ec271ca567d505507 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Oct 2013 22:43:29 +0100 Subject: [PATCH 073/179] Fix nixos-option In particular, it no longer produces an "infinite recursion" error when run with no arguments. --- lib/modules.nix | 1 + nixos/default.nix | 6 ++--- nixos/lib/eval-config.nix | 13 ++++------- nixos/modules/installer/tools/nixos-option.sh | 23 +++++++++++-------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index d2b74733944..1163274e6bf 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -160,6 +160,7 @@ rec { value = (opt.apply or id) merged; in opt // { value = addErrorContext "while evaluating the option `${showOption loc}':" value; + files = map (def: def.file) defs; definitions = map (def: def.value) defsFinal; isDefined = defsFinal != []; }; diff --git a/nixos/default.nix b/nixos/default.nix index 88f82a82482..5d69b79e13a 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -9,7 +9,7 @@ let modules = [ configuration ]; }; - inherit (eval) config pkgs; + inherit (eval) pkgs; # This is for `nixos-rebuild build-vm'. vmConfig = (import ./lib/eval-config.nix { @@ -30,9 +30,9 @@ let in { - inherit eval config; + inherit (eval) config options; - system = config.system.build.toplevel; + system = eval.config.system.build.toplevel; vm = vmConfig.system.build.vm; diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index 5d487b91afb..ece78691a84 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -16,14 +16,11 @@ rec { # Merge the option definitions in all modules, forming the full # system configuration. - systemModule = - pkgs.lib.evalModules { - modules = modules ++ baseModules; - args = extraArgs; - inherit check; - }; - - config = systemModule.config; + inherit (pkgs.lib.evalModules { + modules = modules ++ baseModules; + args = extraArgs; + inherit check; + }) config options; # These are the extra arguments passed to every module. In # particular, Nixpkgs is passed through the "pkgs" argument. diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh index 69dd513f95c..60cee2519da 100644 --- a/nixos/modules/installer/tools/nixos-option.sh +++ b/nixos/modules/installer/tools/nixos-option.sh @@ -1,5 +1,7 @@ #! @shell@ -e +# FIXME: rewrite this in a more suitable language. + usage () { exec man nixos-option exit 1 @@ -90,24 +92,25 @@ evalNix(){ } evalAttr(){ - local prefix=$1 - local suffix=$2 - local strict=$3 + local prefix="$1" + local strict="$2" + local suffix="$3" echo "(import {}).$prefix${option:+.$option}${suffix:+.$suffix}" | evalNix ${strict:+--strict} } evalOpt(){ - evalAttr "eval.options" "$@" + evalAttr "options" "" "$@" } evalCfg(){ - evalAttr "config" "$@" + local strict="$1" + evalAttr "config" "$strict" } findSources(){ local suffix=$1 - echo "builtins.map (f: f.source) (import {}).eval.options${option:+.$option}.$suffix" | + echo "(import {}).options${option:+.$option}.$suffix" | evalNix --strict } @@ -143,7 +146,7 @@ let nixos = import {}; nixpkgs = import {}; sources = builtins.map (f: f.source); - opt = reach nixos.eval.options; + opt = reach nixos.options; cfg = reach nixos.config; in @@ -186,7 +189,7 @@ EOF fi if test "$(evalOpt "_type" 2> /dev/null)" = '"option"'; then - $value && evalCfg; + $value && evalCfg 1 if $desc; then $value && echo; @@ -212,14 +215,14 @@ if test "$(evalOpt "_type" 2> /dev/null)" = '"option"'; then nixMap printPath "$(findSources "declarations")" echo "" echo "Defined by:" - nixMap printPath "$(findSources "definitions")" + nixMap printPath "$(findSources "files")" echo "" fi else # echo 1>&2 "Warning: This value is not an option." - result=$(evalCfg) + result=$(evalCfg "") if names=$(attrNames "$result" 2> /dev/null); then echo 1>&2 "This attribute set contains:" escapeQuotes () { eval echo "$1"; } From 760d0a00dc439130b47094bbac5d6e262aa775a8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 01:15:17 +0100 Subject: [PATCH 074/179] Fix mkOverride call --- nixos/modules/installer/cd-dvd/system-tarball-pc.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix index b7965fc6e0b..fcb96f7a24f 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix @@ -109,7 +109,7 @@ in # not be started by default on the installation CD because the # default root password is empty. services.openssh.enable = true; - jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 ""; + jobs.openssh.startOn = pkgs.lib.mkOverride 50 ""; # To be able to use the systemTarball to catch troubles. boot.crashDump = { From 738a6c173a3e1d92d589f5c32ecf793a1c115918 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 01:20:33 +0100 Subject: [PATCH 075/179] Don't copy Nix expressions to the store while processing Apache subservices --- nixos/modules/services/web-servers/apache-httpd/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 4b0a5d6d363..f6d5ac2fa55 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -46,7 +46,7 @@ let let svcFunction = if svc ? function then svc.function - else import "${./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix"; + else import (toString "${toString ./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix"); config = (evalModules { modules = [ { options = res.options; config = svc.config or svc; } ]; check = false; From 98ae32286f91f25005949c3977e52f06d5894645 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 01:26:51 +0100 Subject: [PATCH 076/179] Fix evaluation error in the tomcat test --- .../services/web-servers/apache-httpd/tomcat-connector.nix | 4 ++-- nixos/tests/tomcat.nix | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix b/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix index f12ae842b58..1b754cf025e 100644 --- a/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix +++ b/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix @@ -38,7 +38,7 @@ in JkWorkersFile ${workersProperties} # Where to put jk logs -JkLogFile ${config.logDir}/mod_jk.log +JkLogFile ${serverInfo.serverConfig.logDir}/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info @@ -69,7 +69,7 @@ JkMount /__application__/* loadbalancer # for load balancing to work properly # Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452 -JkShmFile ${config.stateDir}/jk.shm +JkShmFile ${serverInfo.serverConfig.stateDir}/jk.shm # Static files in all Tomcat webapp context directories are served by apache JkAutoAlias /var/tomcat/webapps diff --git a/nixos/tests/tomcat.nix b/nixos/tests/tomcat.nix index c25276aa424..6bc88ec82fa 100644 --- a/nixos/tests/tomcat.nix +++ b/nixos/tests/tomcat.nix @@ -10,10 +10,7 @@ services.httpd.enable = true; services.httpd.adminAddr = "foo@bar.com"; services.httpd.extraSubservices = [ - { serviceType = "tomcat-connector"; - stateDir = "/var/run/httpd"; - logDir = "/var/log/httpd"; - } + { serviceType = "tomcat-connector"; } ]; }; From a976962d6cb87ffb946956fe58a5dfd5742f769e Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 28 Oct 2013 18:22:35 +0100 Subject: [PATCH 077/179] optipng: update to 0.7.4 close #1138. --- pkgs/tools/graphics/optipng/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/graphics/optipng/default.nix b/pkgs/tools/graphics/optipng/default.nix index a7cb20ca1cf..1b2fc6dbb90 100644 --- a/pkgs/tools/graphics/optipng/default.nix +++ b/pkgs/tools/graphics/optipng/default.nix @@ -3,11 +3,11 @@ # This package comes with its own copy of zlib, libpng and pngxtern stdenv.mkDerivation rec { - name = "optipng-0.6.5"; + name = "optipng-0.7.4"; src = fetchurl { url = "mirror://sourceforge/optipng/${name}.tar.gz"; - sha256 = "0i2vpakj60bb0zgy4bynly2mwxiv5fq48yjqjzmrbnqwjh1y5619"; + sha256 = "1zrphbz17rhhfl1l95q5s979rrhifbwczl2xj1fdrnq5jid5s2sj"; }; meta = { From 22ddf66b54396f865ae1c1df6a366640039c20c6 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Tue, 29 Oct 2013 10:56:33 +0400 Subject: [PATCH 078/179] Adding a facility to generate Lisp module definitions from QuickLisp; no sane update facility yet; adding Esrap-PEG as a test --- .../update-walker-service-specific.sh | 5 ++ .../upstream-updater/update-walker.sh | 17 +++- .../from-quicklisp/asdf-description.sh | 16 ++++ .../barebones-quicklisp-expression.sh | 78 +++++++++++++++++++ .../from-quicklisp/quicklisp-beta-env.sh | 16 ++++ .../from-quicklisp/quicklisp-dependencies.sh | 11 +++ .../lisp-modules/from-quicklisp/tmp.nix | 0 .../lisp-modules/lisp-packages.nix | 54 +++++++++++++ 8 files changed, 196 insertions(+), 1 deletion(-) create mode 100755 pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh create mode 100755 pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh create mode 100755 pkgs/development/lisp-modules/from-quicklisp/quicklisp-beta-env.sh create mode 100755 pkgs/development/lisp-modules/from-quicklisp/quicklisp-dependencies.sh create mode 100644 pkgs/development/lisp-modules/from-quicklisp/tmp.nix diff --git a/pkgs/build-support/upstream-updater/update-walker-service-specific.sh b/pkgs/build-support/upstream-updater/update-walker-service-specific.sh index 4f3a7110346..c98880df1a9 100644 --- a/pkgs/build-support/upstream-updater/update-walker-service-specific.sh +++ b/pkgs/build-support/upstream-updater/update-walker-service-specific.sh @@ -7,3 +7,8 @@ SF_redirect () { SF_version_dir () { version_link 'http://sourceforge.net/.+/[0-9.]+/$' } + +GH_latest () { + prefetch_command_rel ../fetchgit/nix-prefetch-git + rev "$(curl "$CURRENT_URL/commits" | grep /commit/ | head -n 1 | xargs basename )" +} diff --git a/pkgs/build-support/upstream-updater/update-walker.sh b/pkgs/build-support/upstream-updater/update-walker.sh index c4dc7713f50..f29add11bb3 100755 --- a/pkgs/build-support/upstream-updater/update-walker.sh +++ b/pkgs/build-support/upstream-updater/update-walker.sh @@ -3,6 +3,8 @@ own_dir="$(cd "$(dirname "$0")"; pwd)" CURRENT_URL= +CURRENT_REV= +PREFETCH_COMMAND= NEED_TO_CHOOSE_URL=1 url () { @@ -118,13 +120,25 @@ ensure_choice () { } } +rev () { + CURRENT_REV="$1" +} + +prefetch_command () { + PREFETCH_COMMAND="$1" +} + +prefetch_command_rel () { + PREFETCH_COMMAND="$(dirname "$0")/$1" +} + ensure_hash () { echo "Ensuring hash. CURRENT_HASH: $CURRENT_HASH" >&2 [ -z "$CURRENT_HASH" ] && hash } hash () { - CURRENT_HASH="$(nix-prefetch-url "$CURRENT_URL")" + CURRENT_HASH="$(${PREFETCH_COMMAND:-nix-prefetch-url} "$CURRENT_URL" $CURRENT_REV)" echo "CURRENT_HASH: $CURRENT_HASH" >&2 } @@ -172,6 +186,7 @@ do_write_expression () { echo "${1} name=\"\${baseName}-\${version}\";" echo "${1} hash=\"$CURRENT_HASH\";" echo "${1} url=\"$CURRENT_URL\";" + [ -n "$CURRENT_REV" ] && echo "${1} rev=\"$CURRENT_REV\";" echo "${1} sha256=\"$CURRENT_HASH\";" echo "$2" } diff --git a/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh b/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh new file mode 100755 index 00000000000..6c240d15c76 --- /dev/null +++ b/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +[ -z "$NIX_QUICKLISP_DIR" ] && { + export NIX_QUICKLISP_DIR="$(mktemp -d --tmpdir nix-quicklisp.XXXXXX)" +} + +[ -f "$NIX_QUICKLISP_DIR/setup.lisp" ] || { + "$(dirname "$0")/quicklisp-beta-env.sh" "$NIX_QUICKLISP_DIR" &> /dev/null < /dev/null +} + +name="$1" + +sbcl --noinform --load "$NIX_QUICKLISP_DIR"/setup.lisp --eval "(ql:quickload :$name)" \ + --eval "(format t \"~a~%\" (or (asdf::system-description (asdf::find-system \"$name\")) \"\"))" \ + --eval '(quit)' --script | + tee /dev/stderr | tail -n 1 diff --git a/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh b/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh new file mode 100755 index 00000000000..61c00eb92ae --- /dev/null +++ b/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh @@ -0,0 +1,78 @@ +#! /bin/sh + +name="$1" + +nix-instantiate "$(dirname "$0")"/../../../../ -A "lispPackages.$name" > /dev/null && exit +[ "$NIX_LISP_PACKAGES_DEFINED" != "${NIX_LISP_PACKAGES_DEFINED/$name/@@}" ] && exit + +NIX_LISP_PACKAGES_DEFINED="$NIX_LISP_PACKAGES_DEFINED $1 " + +[ -z "$NIX_QUICKLISP_DIR" ] && { + export NIX_QUICKLISP_DIR="$(mktemp -d --tmpdir nix-quicklisp.XXXXXX)" +} + +[ -f "$NIX_QUICKLISP_DIR/setup.lisp" ] || { + "$(dirname "$0")/quicklisp-beta-env.sh" "$NIX_QUICKLISP_DIR" &> /dev/null < /dev/null +} + +description="$("$(dirname "$0")/asdf-description.sh" "$name")" +[ -z "$description" ] && { + description="$(curl -L https://github.com/quicklisp/quicklisp-projects/raw/master/"$name"/description.txt)" + [ "$(echo "$description" | wc -l)" -gt 10 ] && description="" +} + +dependencies="$("$(dirname "$0")/quicklisp-dependencies.sh" "$name" | xargs)" +ql_src="$(curl -L https://github.com/quicklisp/quicklisp-projects/raw/master/"$name"/source.txt)" +ql_src_type="${ql_src%% *}" +url="${ql_src##* }" + +[ "$ql_src_type" = git ] && { + fetcher="pkgs.fetchgit" + [ "${url#git://github.com/}" != "$url" ] && { + url="${url/git:/https:}" + url="${url%.git}" + rev=$("$(dirname "$0")/../../../build-support/upstream-updater/urls-from-page.sh" "$url/commits" | grep /commit/ | head -n 1 | xargs basename) + hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev") + version="git-$(date +%Y%m%d)"; + } + [ "${url#git://common-lisp.net/}" != "$url" ] && { + http_repo_url="$url" + http_repo_url="${http_repo_url/git:/http:}" + http_repo_url="${http_repo_url/\/projects\// /r/projects/}" + http_repo_head="$http_repo_url/refs/heads/master" + echo "$http_repo_head" >&2 + rev=$(curl -L "$http_repo_head"); + hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev") + version="git-$(date +%Y%m%d)"; + } +} + +[ "$ql_src_type" = cvs ] && { + fetcher="pkgs.fetchcvs" + date="$(date -d yesterday +%Y-%m-%d)" + version="cvs-$date" + module="${module:-$name}" + hash=$(USE_DATE=1 "$(dirname "$0")/../../../build-support/fetchcvs/nix-prefetch-cvs" "$url" "$module" "$date") + cvsRoot="$url" + unset url +} + +cat << EOF + + $name = buildLispPackage rec { + baseName = "$name"; + version = "${version:-\${Set me //}"; + description = "$description"; + deps = [$dependencies]; + src = ${fetcher:-pkgs.fetchurl} { + ${url:+url = ''$url'';} + sha256 = "${hash:-0000000000000000000000000000000000000000000000000000000000000000}"; + ${rev:+rev = ''$rev'';} + ${date:+date = ''$date'';} + ${module:+module = ''$module'';} + ${cvsRoot:+cvsRoot = ''$cvsRoot'';} + }; + }; +EOF + +for i in $dependencies; do "$0" "$i"; done diff --git a/pkgs/development/lisp-modules/from-quicklisp/quicklisp-beta-env.sh b/pkgs/development/lisp-modules/from-quicklisp/quicklisp-beta-env.sh new file mode 100755 index 00000000000..32fbbe4bb2b --- /dev/null +++ b/pkgs/development/lisp-modules/from-quicklisp/quicklisp-beta-env.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +WORK_DIR=$(mktemp -d "/tmp/ql-venv-XXXXXX") +mkdir -p "${1:-.}" +TARGET="$(cd "${1:-.}"; pwd)" + +curl http://beta.quicklisp.org/quicklisp.lisp > "$WORK_DIR/ql.lisp" + +sbcl --noinform \ + --load "$WORK_DIR/ql.lisp" \ + --eval "(quicklisp-quickstart:install :path \"$TARGET/\")" \ + --eval "(cl-user::quit)" \ + --script + + +rm -rf "$WORK_DIR" diff --git a/pkgs/development/lisp-modules/from-quicklisp/quicklisp-dependencies.sh b/pkgs/development/lisp-modules/from-quicklisp/quicklisp-dependencies.sh new file mode 100755 index 00000000000..24efbdd3e16 --- /dev/null +++ b/pkgs/development/lisp-modules/from-quicklisp/quicklisp-dependencies.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +[ -z "$NIX_QUICKLISP_DIR" ] && { + export NIX_QUICKLISP_DIR="$(mktemp -d --tmpdir nix-quicklisp.XXXXXX)" +} + +[ -f "$NIX_QUICKLISP_DIR/setup.lisp" ] || { + "$(dirname "$0")/quicklisp-beta-env.sh" "$NIX_QUICKLISP_DIR" &> /dev/null < /dev/null +} + +sbcl --noinform --eval "(with-output-to-string (*standard-output*) (load \"$NIX_QUICKLISP_DIR/setup.lisp\"))" --eval "(with-output-to-string (*standard-output*) (with-output-to-string (*error-output*) (with-output-to-string (*trace-output*) (ql:quickload :$1))))" --eval "(format t \"~{~a~%~}\" (mapcar 'ql::name (mapcar 'car (cdr (ql::dependency-tree \"$1\")))))" --eval '(quit)' --script diff --git a/pkgs/development/lisp-modules/from-quicklisp/tmp.nix b/pkgs/development/lisp-modules/from-quicklisp/tmp.nix new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/development/lisp-modules/lisp-packages.nix b/pkgs/development/lisp-modules/lisp-packages.nix index 8eaaf151fa7..015d5fccdc3 100644 --- a/pkgs/development/lisp-modules/lisp-packages.nix +++ b/pkgs/development/lisp-modules/lisp-packages.nix @@ -45,5 +45,59 @@ let lispPackages = rec { }; stumpwm = callPackage ./stumpwm {}; + + alexandria = buildLispPackage rec { + baseName = "alexandria"; + version = "git-20131029"; + description = "Alexandria is a collection of portable public domain utilities."; + deps = []; + src = pkgs.fetchgit { + url = "git://common-lisp.net/projects/alexandria/alexandria.git"; + sha256 = "1d981a243f9d4d3c9fd86cc47698050507ff615b87b9a710449abdb4234e501b"; + rev = ''2b1eb4067fb34bc501e527de75d09166a8ba9ceb''; + }; + }; + + esrap-peg = buildLispPackage rec { + baseName = "esrap-peg"; + version = "git-20131029"; + description = "A wrapper around Esrap to allow generating Esrap grammars from PEG definitions"; + deps = [alexandria cl-unification esrap iterate]; + src = pkgs.fetchgit { + url = "https://github.com/fb08af68/esrap-peg"; + sha256 = "48e616a697aca95e90e55052fdc9a7f96bf29b3208b1b4012fcd3189c2eceeb1"; + rev = ''1f2f21e32e618f71ed664cdc5e7005f8b6b0f7c8''; + + + }; + }; + + cl-unification = buildLispPackage rec { + baseName = "cl-unification"; + version = "cvs-2013-10-28"; + description = ""; + deps = []; + src = pkgs.fetchcvs { + sha256 = "a574b7f9615232366e3e5e7ee400d60dbff23f6d0e1def5a3c77aafdfd786e6a"; + + date = ''2013-10-28''; + module = ''cl-unification''; + cvsRoot = '':pserver:anonymous:anonymous@common-lisp.net:/project/cl-unification/cvsroot''; + }; + }; + + esrap = buildLispPackage rec { + baseName = "esrap"; + version = "git-20131029"; + description = "A Packrat / Parsing Grammar / TDPL parser for Common Lisp."; + deps = [alexandria]; + src = pkgs.fetchgit { + url = "https://github.com/scymtym/esrap"; + sha256 = "c56616ac01be0f69e72902f9fd830a8af2c2fa9018b66747a5da3988ae38817f"; + rev = ''c71933b84e220f21e8a509ec26afe3e3871e2e26''; + + + }; + }; }; in lispPackages From 4ae50cbc1df55ba940fdbb00583dd6dea9a438a2 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Tue, 29 Oct 2013 10:56:54 +0400 Subject: [PATCH 079/179] Adding upstream tracker for quantum minigolf --- pkgs/games/quantumminigolf/default.upstream | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 pkgs/games/quantumminigolf/default.upstream diff --git a/pkgs/games/quantumminigolf/default.upstream b/pkgs/games/quantumminigolf/default.upstream new file mode 100644 index 00000000000..813c3643a3c --- /dev/null +++ b/pkgs/games/quantumminigolf/default.upstream @@ -0,0 +1,4 @@ +url http://sourceforge.net/projects/quantumminigolf/files/quantumminigolf/ +SF_version_dir +version_link '[.]tar[.][^.]+/download$' +SF_redirect From 3bda40c1503d509258c3b8ec07e10295a5e3c53d Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Tue, 29 Oct 2013 11:29:46 +0400 Subject: [PATCH 080/179] A few hooks for easier library handling when CFFI is used --- pkgs/development/lisp-modules/clwrapper/setup-hook.sh | 8 +++++++- pkgs/development/lisp-modules/define-package.nix | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh index 5de43dc0e9a..e5deb47fd5d 100644 --- a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh +++ b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh @@ -25,9 +25,15 @@ setLisp () { fi } +collectNixLispLDLP () { + if echo "$1/lib"/lib*.so* | grep . > /dev/null; then + export NIX_LISP_LD_LIBRARY_PATH="$NIX_LISP_LD_LIBRARY_PATH${NIX_LISP_LD_LIBRARY_PATH:+:}$1/lib" + fi +} + export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF -envHooks=(envHooks[@] addASDFPaths setLisp) +envHooks=(envHooks[@] addASDFPaths setLisp collectNixLispLDLP) mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home" mkdir -p "$HOME"/.cache/common-lisp diff --git a/pkgs/development/lisp-modules/define-package.nix b/pkgs/development/lisp-modules/define-package.nix index 4fe3bb68373..675fc7e7468 100644 --- a/pkgs/development/lisp-modules/define-package.nix +++ b/pkgs/development/lisp-modules/define-package.nix @@ -9,6 +9,10 @@ let echo "export NIX_LISP_COMMAND='$NIX_LISP_COMMAND'" >> "$config_script" echo "export NIX_LISP_ASDF='$NIX_LISP_ASDF'" >> "$config_script" echo "export CL_SOURCE_REGISTRY="\$CL_SOURCE_REGISTRY\''${CL_SOURCE_REGISTRY:+:}"'$CL_SOURCE_REGISTRY:$out/lib/common-lisp/${args.baseName}/'" >> "$config_script" + test -n "$LD_LIBRARY_PATH" && + echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH\''${LD_LIBRARY_PATH:+:}\"'$LD_LIBRARY_PATH'" >> "$config_script" + test -n "$NIX_LISP_LD_LIBRARY_PATH" && + echo "export NIX_LISP_LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\"'$NIX_LISP_LD_LIBRARY_PATH'" >> "$config_script" ''; deployLaunchScript = '' launch_script="$out"/bin/${args.baseName}-lisp-launcher.sh @@ -17,6 +21,7 @@ let chmod a+x "$launch_script" echo "#! /bin/sh" >> "$launch_script" echo "source '$config_script'" >> "$launch_script" + echo "export LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH\"" >> "$launch_script" echo '"${clwrapper}/bin/common-lisp.sh" "$@"' >> "$launch_script" ''; basePackage = { From 789af5fb086e39d269172de26747f456c0dfd628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 29 Oct 2013 09:34:37 +0100 Subject: [PATCH 081/179] libedit: 20100424-3.0 -> 20130712-3.1 --- pkgs/development/libraries/libedit/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/libedit/default.nix b/pkgs/development/libraries/libedit/default.nix index dca4d8efc13..cc5cd0beee9 100644 --- a/pkgs/development/libraries/libedit/default.nix +++ b/pkgs/development/libraries/libedit/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, ncurses, groff }: stdenv.mkDerivation rec { - name = "libedit-20100424-3.0"; + name = "libedit-20130712-3.1"; src = fetchurl { url = "http://www.thrysoee.dk/editline/${name}.tar.gz"; - sha256 = "11hxaq58gym7kqccjhxywjxdibffzg545z1aj997y1dn0rckhav0"; + sha256 = "0dwav34041sariyl00nr106xmn123bnxir4qpn5y47vgssfim6sx"; }; # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. @@ -19,8 +19,9 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ ncurses ]; - meta = { + meta = with stdenv.lib; { homepage = "http://www.thrysoee.dk/editline/"; description = "A port of the NetBSD Editline library (libedit)"; + license = licenses.bsd3; }; } From 3ad84542bfb8f6edc4dbab4a713dbf2fe7f5b9e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 29 Oct 2013 09:35:19 +0100 Subject: [PATCH 082/179] pythonPackages.substanced: specify sha256 --- pkgs/top-level/python-packages.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b0ffa1acf74..5d61a861148 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1821,6 +1821,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { src = fetchgit { inherit rev; url = "https://github.com/Pylons/substanced.git"; + sha256 = "e32ddfba5310a2a9814abb4f6702eded8e7b7ad867d7a7337e8f4e3b3fb8e0b3"; }; buildInputs = [ mock ]; From 60f1afe1995f56246ea132ea06f267b4f70f1c45 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 11:30:36 +0100 Subject: [PATCH 083/179] nix: Update to 1.6.1 --- pkgs/tools/package-management/nix/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index 7b4bb3c6193..9b0b8b3f24e 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -5,11 +5,11 @@ }: stdenv.mkDerivation rec { - name = "nix-1.6"; + name = "nix-1.6.1"; src = fetchurl { url = "http://nixos.org/releases/nix/${name}/${name}.tar.xz"; - sha256 = "2e451a6ad0b43997d8df71d29a7d20ef42f7715fe16efbf4b53bdcdd1d5227fe"; + sha256 = "31d15f99b2405924a4be278334cc973a71999303631e6798c1d294db9be4bf84"; }; nativeBuildInputs = [ perl pkgconfig ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f27e504bb3b..dc46e5c8002 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9996,10 +9996,13 @@ let stateDir = config.nix.stateDir or "/nix/var"; }; + nixUnstable = nixStable; + /* nixUnstable = callPackage ../tools/package-management/nix/unstable.nix { storeDir = config.nix.storeDir or "/nix/store"; stateDir = config.nix.stateDir or "/nix/var"; }; + */ nixops = callPackage ../tools/package-management/nixops { }; From 38df1d24c4cae2dd52bd429cf1a651097e8dea51 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Tue, 29 Oct 2013 12:53:08 +0100 Subject: [PATCH 084/179] nixos: zope2 service: adding clientHome option --- nixos/modules/services/web-servers/zope2.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/web-servers/zope2.nix b/nixos/modules/services/web-servers/zope2.nix index f75b62b219a..576f4b08fb9 100644 --- a/nixos/modules/services/web-servers/zope2.nix +++ b/nixos/modules/services/web-servers/zope2.nix @@ -33,6 +33,11 @@ let description = "The name of the effective user for the Zope process."; }; + clientHome = mkOption { + default = "/var/lib/zope2/${name}"; + type = types.string; + description = "Home directory of zope2 instance."; + }; extra = mkOption { default = '' @@ -152,7 +157,7 @@ in '' %define INSTANCEHOME ${env} instancehome $INSTANCEHOME - %define CLIENTHOME /var/lib/zope2/${name} + %define CLIENTHOME ${opts.clientHome}/${opts.name} clienthome $CLIENTHOME debug-mode off @@ -162,8 +167,8 @@ in zserver-threads ${toString opts.threads} effective-user ${opts.user} - pid-filename /var/lib/zope2/${name}/pid - lock-filename /var/lib/zope2/${name}/lock + pid-filename ${opts.clientHome}/${opts.name}/pid + lock-filename ${opts.clientHome}/${opts.name}/lock python-check-interval 1000 enable-product-installation off @@ -221,7 +226,7 @@ in exec ${ctlScript} "$@" ''; in { - description = "zope2 ${name} instance"; + #description = "${name} instance"; after = [ "network.target" ]; # with RelStorage also add "postgresql.service" wantedBy = [ "multi-user.target" ]; path = opts.packages; @@ -233,8 +238,9 @@ in chown ${opts.user} /var/log/zope2/${name}.log chown ${opts.user} /var/log/zope2/${name}-Z2.log - mkdir -p /var/lib/zope2/${name}/filestorage /var/lib/zope2/${name}/blobstorage - chown ${opts.user} /var/lib/zope2/${name} -R + mkdir -p ${opts.clientHome}/filestorage ${opts.clientHome}/blobstorage + mkdir -p ${opts.clientHome}/${opts.name} + chown ${opts.user} ${opts.clientHome} -R ${ctl} adduser admin admin ''; From f0b7b0af12be7b36add358cd1e24bbca02e57c64 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 13:04:26 +0100 Subject: [PATCH 085/179] wpa_supplicant.nix: Add option types --- nixos/modules/services/networking/wpa_supplicant.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix index dca398dd8be..89c8687403b 100644 --- a/nixos/modules/services/networking/wpa_supplicant.nix +++ b/nixos/modules/services/networking/wpa_supplicant.nix @@ -26,6 +26,7 @@ in networking.wireless = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to start wpa_supplicant to scan for @@ -40,6 +41,7 @@ in }; interfaces = mkOption { + type = types.listOf types.string; default = []; example = [ "wlan0" "wlan1" ]; description = '' @@ -51,12 +53,14 @@ in }; driver = mkOption { + type = types.uniq types.string; default = "nl80211,wext"; description = "Force a specific wpa_supplicant driver."; }; userControlled = { enable = mkOption { + type = types.bool; default = false; description = '' Allow normal users to control wpa_supplicant through wpa_gui or wpa_cli. @@ -70,9 +74,9 @@ in }; group = mkOption { + type = types.uniq types.string; default = "wheel"; example = "network"; - type = types.string; description = "Members of this group can control wpa_supplicant."; }; }; From adc1b38b85857630be32452a2cfd26f39946d497 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 13:04:52 +0100 Subject: [PATCH 086/179] Add a priority level for overrides in VM tests Now that overriding fileSystems in qemu-vm.nix works again, it's important that the VM tests that add additional file systems use the same override priority. Instead of using the same magic constant everywhere, they can now use mkVMOverride. http://hydra.nixos.org/build/6695561 --- lib/modules.nix | 5 +++-- nixos/modules/virtualisation/qemu-vm.nix | 28 ++++++++++++------------ nixos/tests/check-filesystems.nix | 2 +- nixos/tests/nfs.nix | 2 +- nixos/tests/trac.nix | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 1163274e6bf..5f11a98c970 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -284,9 +284,10 @@ rec { inherit priority content; }; - mkOptionDefault = mkOverride 1001; - mkDefault = mkOverride 1000; + mkOptionDefault = mkOverride 1001; # priority of option defaults + mkDefault = mkOverride 1000; # used in config sections of non-user modules to set a default mkForce = mkOverride 50; + mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’ mkFixStrictness = id; # obsolete, no-op diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 6648b6514d0..23b488f9278 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -273,7 +273,7 @@ in config = { - boot.loader.grub.device = mkOverride 50 "/dev/vda"; + boot.loader.grub.device = mkVMOverride "/dev/vda"; boot.initrd.supportedFilesystems = optional cfg.writableStore "unionfs-fuse"; @@ -337,13 +337,13 @@ in virtualisation.qemu.options = [ "-vga std" "-usbdevice tablet" ]; - # Mount the host filesystem via 9P, and bind-mount the Nix store of - # the host into our own filesystem. We use mkOverride to allow this - # module to be applied to "normal" NixOS system configuration, where - # the regular value for the `fileSystems' attribute should be - # disregarded for the purpose of building a VM test image (since - # those filesystems don't exist in the VM). - fileSystems = mkOverride 10 + # Mount the host filesystem via 9P, and bind-mount the Nix store + # of the host into our own filesystem. We use mkVMOverride to + # allow this module to be applied to "normal" NixOS system + # configuration, where the regular value for the `fileSystems' + # attribute should be disregarded for the purpose of building a VM + # test image (since those filesystems don't exist in the VM). + fileSystems = mkVMOverride { "/".device = "/dev/vda"; "/nix/store" = { device = "store"; @@ -371,7 +371,7 @@ in }; }; - swapDevices = mkOverride 50 [ ]; + swapDevices = mkVMOverride [ ]; # Don't run ntpd in the guest. It should get the correct time from KVM. services.ntp.enable = false; @@ -385,10 +385,10 @@ in # When building a regular system configuration, override whatever # video driver the host uses. - services.xserver.videoDriver = mkOverride 50 null; - services.xserver.videoDrivers = mkOverride 50 [ "vesa" ]; - services.xserver.defaultDepth = mkOverride 50 0; - services.xserver.resolutions = mkOverride 50 [ { x = 1024; y = 768; } ]; + services.xserver.videoDriver = mkVMOverride null; + services.xserver.videoDrivers = mkVMOverride [ "vesa" ]; + services.xserver.defaultDepth = mkVMOverride 0; + services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ]; services.xserver.monitorSection = '' # Set a higher refresh rate so that resolutions > 800x600 work. @@ -397,7 +397,7 @@ in ''; # Wireless won't work in the VM. - networking.wireless.enable = mkOverride 50 false; + networking.wireless.enable = mkVMOverride false; system.requiredKernelConfig = with config.lib.kernelConfig; [ (isEnabled "VIRTIO_BLK") diff --git a/nixos/tests/check-filesystems.nix b/nixos/tests/check-filesystems.nix index c1dae0ca621..09401f9a3f4 100644 --- a/nixos/tests/check-filesystems.nix +++ b/nixos/tests/check-filesystems.nix @@ -40,7 +40,7 @@ rec { device = "share:/repos2"; fsType = "nfs"; }; - in pkgs.lib.mkOverride 50 [ + in pkgs.lib.mkVMOverride [ repos1 repos1 # check remount repos2 # check after remount diff --git a/nixos/tests/nfs.nix b/nixos/tests/nfs.nix index ee65c298dd0..51abf57e1b7 100644 --- a/nixos/tests/nfs.nix +++ b/nixos/tests/nfs.nix @@ -6,7 +6,7 @@ let client = { config, pkgs, ... }: - { fileSystems = pkgs.lib.mkOverride 50 + { fileSystems = pkgs.lib.mkVMOverride [ { mountPoint = "/data"; device = "server:${if version == 4 then "/" else "/data"}"; fsType = "nfs"; diff --git a/nixos/tests/trac.nix b/nixos/tests/trac.nix index 72442c885ac..e0d256f5701 100644 --- a/nixos/tests/trac.nix +++ b/nixos/tests/trac.nix @@ -27,7 +27,7 @@ webserver = { config, pkgs, ... }: - { fileSystems = pkgs.lib.mkOverride 50 + { fileSystems = pkgs.lib.mkVMOverride [ { mountPoint = "/repos"; device = "storage:/repos"; fsType = "nfs"; From 976355f63d41d252153f96f5d229feff7fd98a9b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 13:12:18 +0100 Subject: [PATCH 087/179] Drop the EFI installer tests from the release-critical builds for now They fail randomly due to a hard-coded 30-second timeout in udev waiting for /dev/sda1 to appear: systemd-udevd[1151]: worker [1168] /devices/pci0000:00/0000:00:04.0/host2/target2:0:0/2:0:0:0/block/sda/sda1 timeout; kill it systemd-udevd[1151]: seq 1059 '/devices/pci0000:00/0000:00:04.0/host2/target2:0:0/2:0:0:0/block/sda/sda1' killed Hopefully we can use virtio in the future for the EFI tests. http://hydra.nixos.org/build/6695897 --- nixos/release-combined.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index 6866c709dd4..e7b31383bd5 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -43,7 +43,7 @@ in rec { (all nixos.iso_graphical) (all nixos.ova) - (all nixos.tests.efi-installer.simple) + #(all nixos.tests.efi-installer.simple) (all nixos.tests.firefox) (all nixos.tests.firewall) (all nixos.tests.installer.grub1) From 473a870a64ba6d979ee4f46576c6476cb0d898a7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 13:31:01 +0100 Subject: [PATCH 088/179] nixos-rebuild build-vm: Ignore the user's LUKS devices --- nixos/modules/virtualisation/qemu-vm.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 23b488f9278..2218e1045eb 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -372,6 +372,7 @@ in }; swapDevices = mkVMOverride [ ]; + boot.initrd.luks.devices = mkVMOverride []; # Don't run ntpd in the guest. It should get the correct time from KVM. services.ntp.enable = false; From 69513d148006b6deedebe9c7c27a1a16449275c1 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Tue, 29 Oct 2013 13:18:16 +0100 Subject: [PATCH 089/179] linux: Update to 3.2.52 --- pkgs/os-specific/linux/kernel/linux-3.2.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/linux-3.2.nix b/pkgs/os-specific/linux/kernel/linux-3.2.nix index 46c9108ec08..ae065499c65 100644 --- a/pkgs/os-specific/linux/kernel/linux-3.2.nix +++ b/pkgs/os-specific/linux/kernel/linux-3.2.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, ... } @ args: import ./generic.nix (args // rec { - version = "3.2.51"; + version = "3.2.52"; src = fetchurl { url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz"; - sha256 = "1x1yk07ihfbrhsycmd44h9fn6ajg6akwgsxxdi2rk5cs8g706s63"; + sha256 = "1wpr5xs6vg0xjlzrlbkv7bjvv34psw57crkdh4lybghi4rgrmkzl"; }; features.iwlwifi = true; From 57e9fd8bcf486a6abf4a84f62a5350eb94d6fd0d Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Tue, 29 Oct 2013 13:18:44 +0100 Subject: [PATCH 090/179] grsecurity: Update to 2.9.1-3.2.52-201310271550 --- pkgs/os-specific/linux/kernel/patches.nix | 10 +++++----- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index 5bda5b1f263..613f40c6fc9 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -131,13 +131,13 @@ rec { patch = ./mips-ext3-n32.patch; }; - grsecurity_2_9_1_3_2_51 = - { name = "grsecurity-2.9.1-3.2.51"; + grsecurity_2_9_1_3_2_52 = + { name = "grsecurity-2.9.1-3.2.52"; patch = fetchurl { - url = http://grsecurity.net/stable/grsecurity-2.9.1-3.2.51-201309281102.patch; - sha256 = "0mwwdmccihzhl25c9q92x0k33c5kxbz6mikid9diramvki7sk0l8"; + url = http://grsecurity.net/stable/grsecurity-2.9.1-3.2.52-201310271550.patch; + sha256 = "08y4y323y2lfvdj67gmg3ca8gaf3snhr3pyrmgvj877avaz0475m"; }; - # The grsec kernel patch seems to include the apparmor patches as of 2.9.1-3.2.51 + # The grsec kernel patch seems to include the apparmor patches as of 2.9.1-3.2.52 features.apparmor = true; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dc46e5c8002..223f346cb12 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6607,7 +6607,7 @@ let # config options you need (e.g. by overriding extraConfig). See list of options here: # https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options linux_3_2_grsecurity = lowPrio (lib.overrideDerivation (linux_3_2.override (args: { - kernelPatches = args.kernelPatches ++ [ kernelPatches.grsecurity_2_9_1_3_2_51 ]; + kernelPatches = args.kernelPatches ++ [ kernelPatches.grsecurity_2_9_1_3_2_52 ]; })) (args: { # Install gcc plugins. These are needed for compiling dependant packages. postInstall = '' From 0afdb1e933b2089e7cf00df4ef1646d639f70d81 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 13:45:30 +0100 Subject: [PATCH 091/179] Add option type "str" for unique strings An annoying and dangerous property of "types.string" is that it merges multiple definitions by concatenating them, which almost never produces a sensible result. (Those options for which it does make sense typically should use "types.lines" instead, and things only work because the option definitions already end in a newline.) Of course, you can use "types.uniq types.string", but that's rather verbose, and inconsistent with other basic types like "types.int". Changing the behaviour of "types.string" to be unique by default is not an option, given the large number of options that use it. So instead, we now have "types.str", which is equivalent to "types.uniq types.string". --- lib/types.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/types.nix b/lib/types.nix index 34d06a9144f..8deb379c25a 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -54,6 +54,14 @@ rec { check = builtins.isInt; }; + str = mkOptionType { + name = "string"; + check = builtins.isString; + merge = mergeOneOption; + }; + + # Deprecated; should not be used because it quietly concatenates + # strings, which is usually not what you want. string = mkOptionType { name = "string"; check = builtins.isString; From 985f1f2d8a51c06c7c57d1009dc3589589c8c342 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 14:03:39 +0100 Subject: [PATCH 092/179] Give types to the Apache httpd options --- .../web-servers/apache-httpd/default.nix | 83 +++++++++++-------- .../apache-httpd/per-server-options.nix | 82 +++++++++--------- 2 files changed, 90 insertions(+), 75 deletions(-) diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index f6d5ac2fa55..e9cf9ae5e3e 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -30,7 +30,7 @@ let # Admin address: inherit from the main server if not specified for # a virtual host. - adminAddr = if cfg.adminAddr != "" then cfg.adminAddr else mainCfg.adminAddr; + adminAddr = if cfg.adminAddr != null then cfg.adminAddr else mainCfg.adminAddr; vhostConfig = cfg; serverConfig = mainCfg; @@ -217,7 +217,7 @@ let ${concatMapStrings (alias: "ServerAlias ${alias}\n") cfg.serverAliases} - ${if cfg.sslServerCert != "" then '' + ${if cfg.sslServerCert != null then '' SSLCertificateFile ${cfg.sslServerCert} SSLCertificateKeyFile ${cfg.sslServerKey} '' else ""} @@ -229,7 +229,7 @@ let SSLEngine off '' else ""} - ${if isMainServer || cfg.adminAddr != "" then '' + ${if isMainServer || cfg.adminAddr != null then '' ServerAdmin ${cfg.adminAddr} '' else ""} @@ -260,7 +260,7 @@ let '' else ""} - ${if cfg.globalRedirect != "" then '' + ${if cfg.globalRedirect != null then '' RedirectPermanent / ${cfg.globalRedirect} '' else ""} @@ -408,96 +408,104 @@ in services.httpd = { enable = mkOption { + type = types.bool; default = false; - description = " - Whether to enable the Apache httpd server. - "; + description = "Whether to enable the Apache HTTP Server."; }; package = mkOption { + type = types.path; default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; example = "pkgs.apacheHttpd_2_4"; - description = " + description = '' Overridable attribute of the Apache HTTP Server package to use. - "; + ''; }; configFile = mkOption { + type = types.path; default = confFile; example = literalExample ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; - description = " - Overridable config file to use for Apache. By default, use the - file automatically generated by nixos. - "; + description = '' + Override the configuration file used by Apache. By default, + NixOS generates one automatically. + ''; }; extraConfig = mkOption { + type = types.lines; default = ""; - description = " - These configuration lines will be appended to the Apache config - file. Note that this mechanism may not work when - is overridden. - "; + description = '' + Cnfiguration lines appended to the generated Apache + configuration file. Note that this mechanism may not work + when is overridden. + ''; }; extraModules = mkOption { + type = types.listOf types.unspecified; default = []; example = [ "proxy_connect" { name = "php5"; path = "${php}/modules/libphp5.so"; } ]; description = '' - Specifies additional Apache modules. These can be specified - as a string in the case of modules distributed with Apache, - or as an attribute set specifying the + Additional Apache modules to be used. These can be + specified as a string in the case of modules distributed + with Apache, or as an attribute set specifying the name and path of the module. ''; }; logPerVirtualHost = mkOption { + type = types.bool; default = false; - description = " + description = '' If enabled, each virtual host gets its own access_log and error_log, namely suffixed by the of the virtual host. - "; + ''; }; user = mkOption { + type = types.str; default = "wwwrun"; - description = " + description = '' User account under which httpd runs. The account is created automatically if it doesn't exist. - "; + ''; }; group = mkOption { + type = types.str; default = "wwwrun"; - description = " + description = '' Group under which httpd runs. The account is created automatically if it doesn't exist. - "; + ''; }; logDir = mkOption { + type = types.path; default = "/var/log/httpd"; - description = " + description = '' Directory for Apache's log files. It is created automatically. - "; + ''; }; stateDir = mkOption { - default = "/var/run/httpd"; - description = " + type = types.path; + default = "/run/httpd"; + description = '' Directory for Apache's transient runtime state (such as PID files). It is created automatically. Note that the default, - /var/run/httpd, is deleted at boot time. - "; + /run/httpd, is deleted at boot time. + ''; }; virtualHosts = mkOption { type = types.listOf (types.submodule ( { options = import ./per-server-options.nix { - inherit mkOption; + inherit pkgs; forMainServer = false; }; })); @@ -519,6 +527,7 @@ in }; phpOptions = mkOption { + type = types.lines; default = ""; example = '' @@ -529,9 +538,9 @@ in }; multiProcessingModule = mkOption { + type = types.str; default = "prefork"; example = "worker"; - type = types.uniq types.string; description = '' Multi-processing module to be used by Apache. Available @@ -546,12 +555,14 @@ in }; maxClients = mkOption { + type = types.int; default = 150; example = 8; description = "Maximum number of httpd processes (prefork)"; }; maxRequestsPerChild = mkOption { + type = types.int; default = 0; example = 500; description = @@ -561,7 +572,7 @@ in # Include the options shared between the main server and virtual hosts. // (import ./per-server-options.nix { - inherit mkOption; + inherit pkgs; forMainServer = true; }); diff --git a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix index a5227bae2d4..53f34e28c27 100644 --- a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix +++ b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix @@ -3,38 +3,40 @@ # has additional options that affect the web server as a whole, like # the user/group to run under.) -{forMainServer, mkOption}: +{ forMainServer, pkgs }: + +with pkgs.lib; { hostName = mkOption { + type = types.str; default = "localhost"; - description = " - Canonical hostname for the server. - "; + description = "Canonical hostname for the server."; }; serverAliases = mkOption { + type = types.listOf types.str; default = []; example = ["www.example.org" "www.example.org:8080" "example.org"]; - description = " + description = '' Additional names of virtual hosts served by this virtual host configuration. - "; + ''; }; port = mkOption { + type = types.int; default = 0; - description = " + description = '' Port for the server. 0 means use the default port: 80 for http and 443 for https (i.e. when enableSSL is set). - "; + ''; }; enableSSL = mkOption { + type = types.bool; default = false; - description = " - Whether to enable SSL (https) support. - "; + description = "Whether to enable SSL (https) support."; }; # Note: sslServerCert and sslServerKey can be left empty, but this @@ -42,62 +44,62 @@ # main server). sslServerCert = mkOption { - default = ""; + type = types.nullOr types.path; + default = null; example = "/var/host.cert"; - description = " - Path to server SSL certificate. - "; + description = "Path to server SSL certificate."; }; sslServerKey = mkOption { - default = ""; + type = types.path; example = "/var/host.key"; - description = " - Path to server SSL certificate key. - "; + description = "Path to server SSL certificate key."; }; adminAddr = mkOption ({ + type = types.nullOr types.str; example = "admin@example.org"; - description = " - E-mail address of the server administrator. - "; - } // (if forMainServer then {} else {default = "";})); + description = "E-mail address of the server administrator."; + } // (if forMainServer then {} else {default = null;})); documentRoot = mkOption { + type = types.nullOr types.path; default = null; example = "/data/webserver/docs"; - description = " + description = '' The path of Apache's document root directory. If left undefined, an empty directory in the Nix store will be used as root. - "; + ''; }; servedDirs = mkOption { + type = types.listOf types.attrs; default = []; example = [ { urlPath = "/nix"; dir = "/home/eelco/Dev/nix-homepage"; } ]; - description = " + description = '' This option provides a simple way to serve static directories. - "; + ''; }; servedFiles = mkOption { + type = types.listOf types.attrs; default = []; example = [ { urlPath = "/foo/bar.png"; dir = "/home/eelco/some-file.png"; } ]; - description = " + description = '' This option provides a simple way to serve individual, static files. - "; + ''; }; extraConfig = mkOption { + type = types.lines; default = ""; example = '' @@ -105,37 +107,39 @@ AllowOverride All ''; - description = " + description = '' These lines go to httpd.conf verbatim. They will go after directories and directory aliases defined by default. - "; + ''; }; extraSubservices = mkOption { + type = types.listOf types.unspecified; default = []; - description = " - Extra subservices to enable in the webserver. - "; + description = "Extra subservices to enable in the webserver."; }; enableUserDir = mkOption { + type = types.bool; default = false; - description = " + description = '' Whether to enable serving ~/public_html as /~username. - "; + ''; }; globalRedirect = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; example = http://newserver.example.org/; - description = " + description = '' If set, all requests for this host are redirected permanently to the given URL. - "; + ''; }; logFormat = mkOption { + type = types.str; default = "common"; example = "combined"; description = " From 9143910139b367bd8ee06d588aae396c7c721a52 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 14:15:33 +0100 Subject: [PATCH 093/179] Support module keys that are paths --- lib/modules.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 5f11a98c970..f96013f3042 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -42,14 +42,14 @@ rec { throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'." else { inherit file; - key = m.key or key; + key = toString m.key or key; imports = m.imports or []; options = m.options or {}; config = m.config or {}; } else { inherit file; - key = m.key or key; + key = toString m.key or key; imports = m.require or [] ++ m.imports or []; options = {}; config = removeAttrs m ["key" "require" "imports"]; From be33a681777a76efe180de4888e1642987a4b24d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 14:23:10 +0100 Subject: [PATCH 094/179] Add fixMergeModules back in NixOps uses it. --- lib/modules.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/modules.nix b/lib/modules.nix index f96013f3042..e4ec3c3479c 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -294,4 +294,8 @@ rec { # FIXME: Add mkOrder back in. It's not currently used anywhere in # NixOS, but it should be useful. + + /* Compatibility. */ + fixMergeModules = modules: args: evalModules { inherit modules args; }; + } From 85b69834e702b4eaa182c25b80dffc9367c0775b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 14:34:39 +0100 Subject: [PATCH 095/179] fixMergeModules shouldn't check whether options are declared --- lib/modules.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules.nix b/lib/modules.nix index e4ec3c3479c..a537fd0b6cb 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -296,6 +296,6 @@ rec { /* Compatibility. */ - fixMergeModules = modules: args: evalModules { inherit modules args; }; + fixMergeModules = modules: args: evalModules { inherit modules args; check = false; }; } From db5c6917f31a736766eeb2388d1f90d494b44d6f Mon Sep 17 00:00:00 2001 From: "Jason \\\"Don\\\" O'Conal" Date: Mon, 28 Oct 2013 21:14:12 +0000 Subject: [PATCH 096/179] vimPlugins.ipython: add expression close #1141 --- pkgs/misc/vim-plugins/default.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix index b17b8490a0b..01ce5f423c3 100644 --- a/pkgs/misc/vim-plugins/default.nix +++ b/pkgs/misc/vim-plugins/default.nix @@ -197,6 +197,23 @@ in rec }; }; + ipython = simpleDerivation { + name = "vim-ipython-ff8f88f3fe518851a91dc88aaa5a75f8f352a960"; + src = fetchurl { + url = "https://github.com/ivanov/vim-ipython/archive/ff8f88f3fe518851a91dc88aaa5a75f8f352a960.tar.gz"; + sha256 = "0hlx526dm8amrvh41kwnmgvvdzs6sh5yc5sfq4nk1zjkfcp1ah5j"; + }; + path = "ipython"; + meta = with stdenv.lib; { + description = "A two-way integration between vim and iPython"; + homepage = https://github.com/ivanov/vim-ipython; + repositories.git = https://github.com/ivanov/vim-ipython.git; + license = licenses.publicDomain; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; + }; + }; + taglist = simpleDerivation { name = "vim-taglist-4.6"; meta = with stdenv.lib; { From 562b453b9399634011cc61f225569e713f8e5e60 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Tue, 29 Oct 2013 15:55:25 +0100 Subject: [PATCH 097/179] nixos: haproxy module --- nixos/modules/misc/ids.nix | 2 + nixos/modules/module-list.nix | 1 + nixos/modules/services/networking/haproxy.nix | 87 +++++++++++++++++++ pkgs/tools/networking/haproxy/default.nix | 2 +- 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/services/networking/haproxy.nix diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 66f04668a70..9dc9b49b9e3 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -103,6 +103,7 @@ zope2 = 94; firebird = 95; redis = 96; + haproxy = 97; # When adding a uid, make sure it doesn't match an existing gid. @@ -189,6 +190,7 @@ quassel = 89; amule = 90; minidlna = 91; + haproxy = 92; # When adding a gid, make sure it doesn't match an existing uid. diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index cea57c0068a..b0126b721db 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -156,6 +156,7 @@ ./services/networking/dnsmasq.nix ./services/networking/ejabberd.nix ./services/networking/firewall.nix + ./services/networking/haproxy.nix ./services/networking/tcpcrypt.nix ./services/networking/flashpolicyd.nix ./services/networking/freenet.nix diff --git a/nixos/modules/services/networking/haproxy.nix b/nixos/modules/services/networking/haproxy.nix new file mode 100644 index 00000000000..c8345a528a7 --- /dev/null +++ b/nixos/modules/services/networking/haproxy.nix @@ -0,0 +1,87 @@ +{ config, pkgs, ...}: +let + cfg = config.services.haproxy; + haproxyCfg = pkgs.writeText "haproxy.conf" cfg.config; +in +with pkgs.lib; +{ + options = { + services.haproxy = { + + enable = mkOption { + default = false; + description = " + Enable the HAProxy. + "; + }; + + config = mkOption { + default = + '' + global + log 127.0.0.1 local6 + maxconn 24000 + daemon + nbproc 1 + + defaults + mode http + option httpclose + + # Remove requests from the queue if people press stop button + option abortonclose + + # Try to connect this many times on failure + retries 3 + + # If a client is bound to a particular backend but it goes down, + # send them to a different one + option redispatch + + monitor-uri /haproxy-ping + + timeout connect 7s + timeout queue 300s + timeout client 300s + timeout server 300s + + # Enable status page at this URL, on the port HAProxy is bound to + stats enable + stats uri /haproxy-status + stats refresh 5s + stats realm Haproxy statistics + ''; + description = " + Default configuration. + "; + }; + + }; + + }; + + config = mkIf cfg.enable { + + systemd.services.haproxy = { + description = "HAProxy"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "forking"; + PIDFile = "/var/run/haproxy.pid"; + ExecStartPre = "${pkgs.haproxy}/sbin/haproxy -c -q -f ${haproxyCfg}"; + ExecStart = "${pkgs.haproxy}/sbin/haproxy -D -f ${haproxyCfg} -p /var/run/haproxy.pid"; + ExecReload = "-${pkgs.bash}/bin/bash -c \"exec ${pkgs.haproxy}/sbin/haproxy -D -f ${haproxyCfg} -p /var/run/haproxy.pid -sf $MAINPID\""; + }; + }; + + environment.systemPackages = [ pkgs.haproxy ]; + + users.extraUsers.haproxy = { + group = "haproxy"; + uid = config.ids.uids.haproxy; + }; + + users.extraGroups.haproxy.gid = config.ids.uids.haproxy; + }; +} diff --git a/pkgs/tools/networking/haproxy/default.nix b/pkgs/tools/networking/haproxy/default.nix index 3946f1eef0f..e4a32e14260 100644 --- a/pkgs/tools/networking/haproxy/default.nix +++ b/pkgs/tools/networking/haproxy/default.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation rec { version = "1.4.24"; name = "haproxy-${version}"; - + src = fetchurl { url = "http://haproxy.1wt.eu/download/1.4/src/${name}.tar.gz"; sha256 = "1vy7jz7l8qdd6ah3y65zarz9x9pf3bs02icxnrckpgh1s3s2h2b8"; From c407db6316fc3f7b5986b879d62e2a57f26d3407 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 14:55:33 +0100 Subject: [PATCH 098/179] Manual: Render null values --- nixos/doc/manual/options-to-docbook.xsl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index 73c905fbca1..791455fafbd 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -94,6 +94,11 @@ + + null + + + "" From 89b1dd8ddec8ee50630855fc8a63835754f23e54 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 16:14:58 +0100 Subject: [PATCH 099/179] Fix environment.checkConfigurationOptions This requires delaying the declaredness check until later, otherwise we get an infinite recursion querying environment.checkConfigurationOptions. --- lib/modules.nix | 41 ++++++++++++++++++++++++--------------- nixos/lib/eval-config.nix | 2 +- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index a537fd0b6cb..6f56d174397 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -13,9 +13,24 @@ rec { # Note: the list of modules is reversed to maintain backward # compatibility with the old module system. Not sure if this is # the most sensible policy. - options = mergeModules check prefix (reverseList closed); - config = yieldConfig options; - yieldConfig = mapAttrs (n: v: if isOption v then v.value else yieldConfig v); + options = mergeModules prefix (reverseList closed); + # Traverse options and extract the option values into the final + # config set. At the same time, check whether all option + # definitions have matching declarations. + config = yieldConfig [] options; + yieldConfig = prefix: set: + let res = removeAttrs (mapAttrs (n: v: + if isOption v then v.value + else yieldConfig (prefix ++ [n]) v) set) ["_definedNames"]; + in + if check && set ? _definedNames then + fold (m: res: + fold (name: res: + if hasAttr name set then res else throw "The option `${showOption (prefix ++ [name])}' defined in `${m.file}' does not exist.") + res m.names) + res set._definedNames + else + res; result = { inherit options config; }; in result; @@ -62,19 +77,12 @@ rec { At the same time, for each option declaration, it will merge the corresponding option definitions in all machines, returning them in the ‘value’ attribute of each option. */ - mergeModules = check: prefix: modules: - mergeModules' check prefix modules + mergeModules = prefix: modules: + mergeModules' prefix modules (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules); - mergeModules' = check: prefix: options: configs: - let - declaredNames = concatMap (m: attrNames m.options) options; - declaredNames' = listToAttrs (map (n: { name = n; value = 1; }) declaredNames); - checkDefinedNames = res: fold (m: res: fold (n: res: - if hasAttr n declaredNames' then res else - throw "The option `${showOption (prefix ++ [n])}' defined in `${m.file}' does not exist." - ) res (attrNames m.config)) res configs; - in (if check then checkDefinedNames else id) (listToAttrs (map (name: { + mergeModules' = prefix: options: configs: + listToAttrs (map (name: { # We're descending into attribute ‘name’. inherit name; value = @@ -111,8 +119,9 @@ rec { in throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." else - mergeModules' check loc decls defns; - }) declaredNames)); + mergeModules' loc decls defns; + }) (concatMap (m: attrNames m.options) options)) + // { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; }; /* Merge multiple option declarations into a single declaration. In general, there should be only one declaration of each option. diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index ece78691a84..5e1ce69158f 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -19,7 +19,7 @@ rec { inherit (pkgs.lib.evalModules { modules = modules ++ baseModules; args = extraArgs; - inherit check; + check = check && options.environment.checkConfigurationOptions.value; }) config options; # These are the extra arguments passed to every module. In From b04081467979fe670409b087d0ddf345d7d0b98f Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Tue, 29 Oct 2013 16:23:24 +0100 Subject: [PATCH 100/179] changes in: redshift, geoclue, libsoup - added support for geoclue for redshift - package geoclue 2.0.0 (as geoclue2) - package libsoup 2.44.1 (as libsoup_2_40) --- pkgs/applications/misc/redshift/default.nix | 6 ++-- pkgs/development/libraries/geoclue/2.0.nix | 30 +++++++++++++++++++ pkgs/development/libraries/libsoup/2.40.nix | 32 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 12 +++++--- 4 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 pkgs/development/libraries/geoclue/2.0.nix create mode 100644 pkgs/development/libraries/libsoup/2.40.nix diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix index ce7506672a5..3bed6e1a2d7 100644 --- a/pkgs/applications/misc/redshift/default.nix +++ b/pkgs/applications/misc/redshift/default.nix @@ -1,6 +1,6 @@ { fetchurl, stdenv, libX11, libXrandr, libXxf86vm, libxcb, pkgconfig, python , randrproto, xcbutil, xf86vidmodeproto, autoconf, automake, gettext, glib -, GConf, dbus, dbus_glib, makeWrapper, gtk, pygtk, pyxdg }: +, GConf, dbus, dbus_glib, makeWrapper, gtk, pygtk, pyxdg, geoclue }: stdenv.mkDerivation rec { version = "1.8"; @@ -13,9 +13,7 @@ stdenv.mkDerivation rec { buildInputs = [ libX11 libXrandr libXxf86vm libxcb pkgconfig python randrproto xcbutil xf86vidmodeproto autoconf automake gettext glib GConf dbus dbus_glib - makeWrapper gtk pygtk pyxdg - # TODO: - # geoclue + makeWrapper gtk pygtk pyxdg geoclue ]; preConfigure = '' diff --git a/pkgs/development/libraries/geoclue/2.0.nix b/pkgs/development/libraries/geoclue/2.0.nix new file mode 100644 index 00000000000..d799dfb6027 --- /dev/null +++ b/pkgs/development/libraries/geoclue/2.0.nix @@ -0,0 +1,30 @@ +{ fetchurl, stdenv, intltool, pkgconfig, glib, json_glib, libsoup, geoip +, dbus, dbus_glib +}: + +stdenv.mkDerivation rec { + name = "geoclue-2.0.0"; + + src = fetchurl { + url = "http://www.freedesktop.org/software/geoclue/releases/2.0/${name}.tar.xz"; + sha256 = "18b7ikdcw2rm04gzw82216shp5m9pghvnsddw233s5jswn2g30ja"; + }; + + buildInputs = + [ intltool pkgconfig glib json_glib libsoup geoip + dbus dbus_glib + ]; + + preConfigure = '' + substituteInPlace configure --replace "-Werror" "" + ''; + + propagatedBuildInputs = [ dbus dbus_glib glib ]; + + meta = { + description = "Geolocation framework and some data providers"; + maintainers = with stdenv.lib.maintainers; [ raskin garbas ]; + platforms = stdenv.lib.platforms.linux; + license = stdenv.lib.licenses.lgpl2; + }; +} diff --git a/pkgs/development/libraries/libsoup/2.40.nix b/pkgs/development/libraries/libsoup/2.40.nix new file mode 100644 index 00000000000..ca37ceb941c --- /dev/null +++ b/pkgs/development/libraries/libsoup/2.40.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchurl, pkgconfig, glib, libxml2, sqlite, intltool, python +, gnomeSupport ? true, libgnome_keyring, glib_networking +}: + +stdenv.mkDerivation { + name = "libsoup-2.44.1"; + + src = fetchurl { + url = mirror://gnome/sources/libsoup/2.44/libsoup-2.44.1.tar.xz; + sha256 = "07acjwvik3gagcsdjzi85g44ga4pd3nh4ww6722bfzjzvlqw6cn5"; + }; + + + preConfigure = '' + substituteInPlace libsoup/tld-parser.py \ + --replace "!/usr/bin/env python" "!${python}/bin/${python.executable}" + ''; + buildInputs = [ pkgconfig intltool python ]; + nativeBuildInputs = [ pkgconfig ]; + propagatedBuildInputs = [ glib libxml2 sqlite ] + ++ stdenv.lib.optionals gnomeSupport [ libgnome_keyring ]; + passthru.propagatedUserEnvPackages = [ glib_networking ]; + + # glib_networking is a runtime dependency, not a compile-time dependency + configureFlags = "--disable-tls-check"; + + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-lintl"; + + meta = { +# inherit (glib.meta) maintainers platforms; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 223f346cb12..9317e48658c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4158,6 +4158,10 @@ let geoclue = callPackage ../development/libraries/geoclue {}; + geoclue2 = callPackage ../development/libraries/geoclue/2.0.nix { + libsoup = libsoup_2_40; + }; + geoip = builderDefsPackage ../development/libraries/geoip { inherit zlib; }; @@ -5002,6 +5006,7 @@ let libsodium = callPackage ../development/libraries/libsodium { }; libsoup = callPackage ../development/libraries/libsoup { }; + libsoup_2_40 = callPackage ../development/libraries/libsoup/2.40.nix { }; libssh = callPackage ../development/libraries/libssh { }; @@ -5750,8 +5755,7 @@ let inherit (gnome) gtkdoc libsoup; inherit pkgconfig libtool intltool autoconf automake gperf bison flex libjpeg libpng libtiff libxml2 libxslt sqlite icu curl - which libproxy geoclue enchant python ruby perl - mesa xlibs; + which libproxy geoclue enchant python ruby perl mesa xlibs; inherit gstreamer gst_plugins_base gst_ffmpeg gst_plugins_good; }; @@ -5761,8 +5765,7 @@ let inherit (gnome) gtkdoc libsoup; inherit pkgconfig libtool intltool autoconf automake gperf bison flex libjpeg libpng libtiff libxml2 libxslt sqlite icu curl - which libproxy geoclue enchant python ruby perl - mesa xlibs; + which libproxy geoclue enchant python ruby perl mesa xlibs; inherit gstreamer gst_plugins_base gst_ffmpeg gst_plugins_good; }; @@ -9616,6 +9619,7 @@ let xf86vidmodeproto; inherit (gnome) GConf; inherit (pythonPackages) pyxdg; + geoclue = geoclue2; }; oxygen_gtk = callPackage ../misc/themes/gtk2/oxygen-gtk { }; From b64f43cdbd5bb5c9586b299d257aa4e17417a998 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 16:52:04 +0100 Subject: [PATCH 101/179] Manual: Don't show "Default: none" --- nixos/doc/manual/options-to-docbook.xsl | 26 ++++++++----------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index 791455fafbd..c44a8575978 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -36,23 +36,15 @@ select="attr[@name = 'description']/string/@value" /> - - Default: - - - - - - - - - none - - - + + + Default: + + + + - Example: @@ -61,9 +53,7 @@ - - - + From 60c4c468f17900e1aaaec82a404ebefe082e5f24 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 16:52:40 +0100 Subject: [PATCH 102/179] Manual: Render strings containing special characters as indented strings --- nixos/doc/manual/options-to-docbook.xsl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index c44a8575978..05a891f8ac0 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -90,8 +90,14 @@ - - "" + + + '''' + + + "" + + From bfaa6b73527340ffabe24b2073909247174033cb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 16:54:03 +0100 Subject: [PATCH 103/179] Manual: Escape $ --- nixos/doc/manual/options-to-docbook.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index 05a891f8ac0..02524d8f981 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -95,7 +95,7 @@ '''' - "" + "" From 0695b68c8c3411fdb1ab1bad3b94b19d7ed33f25 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 17:29:37 +0100 Subject: [PATCH 104/179] Manual: Render multi-line strings properly --- nixos/doc/manual/options-to-docbook.xsl | 18 ++++++++++++++++-- nixos/modules/services/misc/nix-daemon.nix | 4 ++-- nixos/modules/services/networking/dhcpd.nix | 18 +++++++++--------- .../services/x11/hardware/synaptics.nix | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index 02524d8f981..f4bdc6288b1 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -40,7 +40,7 @@ Default: - + @@ -53,7 +53,7 @@ - + @@ -84,6 +84,20 @@ + + + + +'' +'' + + + + + + + + null diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 441b8606b01..6971fe496b2 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -99,10 +99,10 @@ in extraOptions = mkOption { default = ""; - example = " + example = '' gc-keep-outputs = true gc-keep-derivations = true - "; + ''; description = "Additional text appended to nix.conf."; }; diff --git a/nixos/modules/services/networking/dhcpd.nix b/nixos/modules/services/networking/dhcpd.nix index 43e0843cb97..5b2058e4e12 100644 --- a/nixos/modules/services/networking/dhcpd.nix +++ b/nixos/modules/services/networking/dhcpd.nix @@ -15,7 +15,7 @@ let authoritative; ddns-update-style ad-hoc; log-facility local1; # see dhcpd.nix - + ${cfg.extraConfig} ${pkgs.lib.concatMapStrings @@ -30,13 +30,13 @@ let ''; in - + { ###### interface options = { - + services.dhcpd = { enable = mkOption { @@ -48,16 +48,16 @@ in extraConfig = mkOption { default = ""; - example = " + example = '' option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.5; option domain-name-servers 130.161.158.4, 130.161.33.17, 130.161.180.1; - option domain-name \"example.org\"; + option domain-name "example.org"; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.100 192.168.1.200; } - "; + ''; description = " Extra text to be appended to the DHCP server configuration file. Currently, you almost certainly need to specify @@ -100,9 +100,9 @@ in }; }; - + }; - + ###### implementation @@ -127,5 +127,5 @@ in }; }; - + } diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix index d16142a5fdf..5884e9aa31c 100644 --- a/nixos/modules/services/x11/hardware/synaptics.nix +++ b/nixos/modules/services/x11/hardware/synaptics.nix @@ -74,7 +74,7 @@ let cfg = config.services.xserver.synaptics; in example = '' Option "RTCornerButton" "2" Option "RBCornerButton" "3" - ''; + ''; description = '' Additional options for synaptics touchpad driver. ''; From 1d104c792beff1eff7228d636ba149ed27325aa1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 17:34:43 +0100 Subject: [PATCH 105/179] Remove the dhclient module It's no longer used by NixOS (replaced by dhcpcd). --- nixos/modules/module-list.nix | 1 - .../modules/services/networking/dhclient.nix | 111 ------------------ nixos/modules/services/networking/dhcpcd.nix | 2 +- nixos/modules/services/networking/ifplugd.nix | 14 +-- nixos/modules/tasks/network-interfaces.nix | 2 +- 5 files changed, 9 insertions(+), 121 deletions(-) delete mode 100644 nixos/modules/services/networking/dhclient.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b0126b721db..8b76e1f21cb 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -150,7 +150,6 @@ ./services/networking/cntlm.nix ./services/networking/chrony.nix ./services/networking/ddclient.nix - #./services/networking/dhclient.nix ./services/networking/dhcpcd.nix ./services/networking/dhcpd.nix ./services/networking/dnsmasq.nix diff --git a/nixos/modules/services/networking/dhclient.nix b/nixos/modules/services/networking/dhclient.nix deleted file mode 100644 index 1e343443899..00000000000 --- a/nixos/modules/services/networking/dhclient.nix +++ /dev/null @@ -1,111 +0,0 @@ -{ config, pkgs, ... }: - -with pkgs.lib; - -let - - inherit (pkgs) nettools dhcp lib; - - # Don't start dhclient on explicitly configured interfaces or on - # interfaces that are part of a bridge. - ignoredInterfaces = - map (i: i.name) (lib.filter (i: i ? ipAddress && i.ipAddress != "" ) config.networking.interfaces) - ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges)); - - stateDir = "/var/lib/dhcp"; # Don't use /var/state/dhcp; not FHS-compliant. - - dhclientExitHooks = pkgs.writeText "dhclient-exit-hooks" - '' - #echo "$reason" >> /tmp/dhcp-exit - #echo "$exit_status" >> /tmp/dhcp-exit - - if test "$reason" = BOUND -o "$reason" = REBOOT; then - # Restart ntpd. (The "ip-up" event below will trigger the - # restart.) We need to restart it to make sure that it will - # actually do something: if ntpd cannot resolve the server - # hostnames in its config file, then it will never do - # anything ever again ("couldn't resolve ..., giving up on - # it"), so we silently lose time synchronisation. - ${config.system.build.upstart}/sbin/initctl stop ntpd - - ${config.system.build.upstart}/sbin/initctl emit -n ip-up - fi - - if test "$reason" = EXPIRE -o "$reason" = RELEASE; then - ${config.system.build.upstart}/sbin/initctl emit -n ip-down - fi - ''; - -in - -{ - - ###### implementation - - config = mkIf config.networking.useDHCP { - - # dhclient barfs if /proc/net/if_inet6 doesn't exist. - boot.kernelModules = [ "ipv6" ]; - - jobs.dhclient = - { startOn = "started network-interfaces"; - stopOn = "stopping network-interfaces"; - - path = [ dhcp ]; - - script = - '' - # Determine the interface on which to start dhclient. - interfaces= - - for i in $(cd /sys/class/net && ls -d *); do - # Only run dhclient on interfaces of type ARPHRD_ETHER - # (1), i.e. Ethernet. Ignore peth* devices; on Xen, - # they're renamed physical Ethernet cards used for - # bridging. Likewise for vif* and tap* (Xen) and - # virbr* and vnet* (libvirt). - if [ "$(cat /sys/class/net/$i/type)" = 1 ]; then - if ! for j in ${toString ignoredInterfaces}; do echo $j; done | grep -F -x -q "$i" && - ! echo "$i" | grep -x -q "peth.*\|vif.*\|tap.*\|virbr.*\|vnet.*"; - then - echo "Running dhclient on $i" - interfaces="$interfaces $i" - fi - fi - done - - if test -z "$interfaces"; then - echo 'No interfaces on which to start dhclient!' - exit 1 - fi - - mkdir -m 755 -p ${stateDir} - - exec dhclient -d $interfaces -e "PATH=$PATH" -lf ${stateDir}/dhclient.leases -sf ${dhcp}/sbin/dhclient-script - ''; - }; - - environment.systemPackages = [dhcp]; - - environment.etc = - [ # Dhclient hooks for emitting ip-up/ip-down events. - { source = dhclientExitHooks; - target = "dhclient-exit-hooks"; - } - ]; - - powerManagement.resumeCommands = - '' - ${config.system.build.upstart}/sbin/restart dhclient - ''; - - networking.interfaceMonitor.commands = - '' - if [ "$status" = up ]; then - ${config.system.build.upstart}/sbin/restart dhclient - fi - ''; - - }; - -} diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix index 48803511a5e..07b5606eaca 100644 --- a/nixos/modules/services/networking/dhcpcd.nix +++ b/nixos/modules/services/networking/dhcpcd.nix @@ -6,7 +6,7 @@ let inherit (pkgs) dhcpcd; - # Don't start dhclient on explicitly configured interfaces or on + # Don't start dhcpcd on explicitly configured interfaces or on # interfaces that are part of a bridge. ignoredInterfaces = map (i: i.name) (filter (i: i.ipAddress != null) (attrValues config.networking.interfaces)) diff --git a/nixos/modules/services/networking/ifplugd.nix b/nixos/modules/services/networking/ifplugd.nix index df50e9807a9..4e939d60354 100644 --- a/nixos/modules/services/networking/ifplugd.nix +++ b/nixos/modules/services/networking/ifplugd.nix @@ -9,10 +9,7 @@ let cfg = config.networking.interfaceMonitor; # The ifplugd action script, which is called whenever the link - # status changes (i.e., a cable is plugged in or unplugged). We do - # nothing when a cable is unplugged. When a cable is plugged in, we - # restart dhclient, which will hopefully give us a new IP address - # if appropriate. + # status changes (i.e., a cable is plugged in or unplugged). plugScript = pkgs.writeScript "ifplugd.action" '' #! ${pkgs.stdenv.shell} @@ -30,17 +27,19 @@ in options = { networking.interfaceMonitor.enable = mkOption { + type = types.bool; default = false; description = '' If true, monitor Ethernet interfaces for cables being plugged in or unplugged. When this occurs, the - dhclient service is restarted to - automatically obtain a new IP address. This is useful for - roaming users (laptops). + commands specified in + are + executed. ''; }; networking.interfaceMonitor.beep = mkOption { + type = types.bool; default = false; description = '' If true, beep when an Ethernet cable is @@ -49,6 +48,7 @@ in }; networking.interfaceMonitor.commands = mkOption { + type = types.lines; default = ""; description = '' Shell commands to be executed when the link status of an diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 16671cb3743..796da3020ed 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -427,7 +427,7 @@ in # Set the host and domain names in the activation script. Don't # clear it if it's not configured in the NixOS configuration, - # since it may have been set by dhclient in the meantime. + # since it may have been set by dhcpcd in the meantime. system.activationScripts.hostname = optionalString (config.networking.hostName != "") '' hostname "${config.networking.hostName}" From 9726dded2745e98387b5472119fd67202bf4c8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 29 Oct 2013 17:35:17 +0100 Subject: [PATCH 106/179] openssh: build on unix platforms --- pkgs/tools/networking/openssh/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/networking/openssh/default.nix b/pkgs/tools/networking/openssh/default.nix index 6d3120e7b99..35586031ef5 100644 --- a/pkgs/tools/networking/openssh/default.nix +++ b/pkgs/tools/networking/openssh/default.nix @@ -71,7 +71,7 @@ stdenv.mkDerivation rec { homepage = http://www.openssh.org/; description = "An implementation of the SSH protocol"; license = "bsd"; - platforms = stdenv.lib.platforms.linux; + platforms = stdenv.lib.platforms.unix; maintainers = stdenv.lib.maintainers.eelco; }; } From 972d9974c6f729bb59b064c0fd10834823ffe541 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 21:15:11 +0100 Subject: [PATCH 107/179] Decrease verbosity of VirtualBox image generation --- nixos/modules/virtualisation/virtualbox-image.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix index bea6414c450..beed36b6a51 100644 --- a/nixos/modules/virtualisation/virtualbox-image.nix +++ b/nixos/modules/virtualisation/virtualbox-image.nix @@ -49,7 +49,7 @@ with pkgs.lib; echo "filling Nix store..." mkdir -p /mnt/nix/store set -f - cp -prvd $storePaths /mnt/nix/store/ + cp -prd $storePaths /mnt/nix/store/ # Register the paths in the Nix database. printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ From 4c9349a2c1cf5d4ca247fd23c2bbda84f4b91c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chadda=C3=AF=20Fouch=C3=A9?= Date: Tue, 29 Oct 2013 23:18:53 +0100 Subject: [PATCH 108/179] Adding KVIrc : a IRC Client for Qt and KDE. in kde4.kvirc --- .../networking/irc/kvirc/default.nix | 24 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 pkgs/applications/networking/irc/kvirc/default.nix diff --git a/pkgs/applications/networking/irc/kvirc/default.nix b/pkgs/applications/networking/irc/kvirc/default.nix new file mode 100644 index 00000000000..3494168497f --- /dev/null +++ b/pkgs/applications/networking/irc/kvirc/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchurl, cmake, qt4, perl, gettext, kdelibs, openssl, zlib}: + +let + pn = "kvirc"; + v = "4.2.0"; +in + +stdenv.mkDerivation { + name = "${pn}-${v}"; + + src = fetchurl { + url = "ftp://ftp.kvirc.de/pub/${pn}/${v}/source/${pn}-${v}.tar.bz2"; + sha256 = "9a547d52d804e39c9635c8dc58bccaf4d34341ef16a9a652a5eb5568d4d762cb"; + }; + + buildInputs = [ cmake qt4 perl gettext kdelibs openssl zlib ]; + + meta = with stdenv.lib; { + description = "Graphic IRC client with Qt"; + license = "GPL"; + homepage = http://www.kvirc.net/; + platforms = with stdenv.lib.platforms; linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9317e48658c..d29b77e3866 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9557,6 +9557,8 @@ let konversation = callPackage ../applications/networking/irc/konversation { }; + kvirc = callPackage ../applications/networking/irc/kvirc { }; + krename = callPackage ../applications/misc/krename { }; krusader = callPackage ../applications/misc/krusader { }; From 8150f1a36222bfd93e8bd42a94a6839794599d43 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 Oct 2013 23:47:09 +0100 Subject: [PATCH 109/179] firefox: Update to 25.0 --- pkgs/applications/networking/browsers/firefox/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/browsers/firefox/default.nix b/pkgs/applications/networking/browsers/firefox/default.nix index 8375bcdad3d..45606c9af82 100644 --- a/pkgs/applications/networking/browsers/firefox/default.nix +++ b/pkgs/applications/networking/browsers/firefox/default.nix @@ -18,9 +18,9 @@ assert stdenv.gcc ? libc && stdenv.gcc.libc != null; let optional = stdenv.lib.optional; in rec { - firefoxVersion = "24.0"; + firefoxVersion = "25.0"; - xulVersion = "24.0"; # this attribute is used by other packages + xulVersion = "25.0"; # this attribute is used by other packages src = fetchurl { @@ -28,9 +28,9 @@ in rec { # It is better to use this url for official releases, to take load off Mozilla's ftp server. "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2" # Fall back to this url for versions not available at releases.mozilla.org. - "ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2" + "http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2" ]; - sha1 = "8scch0gr59j86vp9c1v0yx6mq1pkwcvg"; + sha1 = "854722e283659d2b6b2eacd38f757b3c5b63a448"; }; commonConfigureFlags = From 52d529011884d65e13364c5ebb85b4e39fcf47bb Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Wed, 30 Oct 2013 13:03:47 +0400 Subject: [PATCH 110/179] Update SlimerJS --- pkgs/development/tools/slimerjs/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/slimerjs/default.nix b/pkgs/development/tools/slimerjs/default.nix index 23aae157f09..ad60186804c 100644 --- a/pkgs/development/tools/slimerjs/default.nix +++ b/pkgs/development/tools/slimerjs/default.nix @@ -3,11 +3,11 @@ let s = # Generated upstream information rec { baseName="slimerjs"; - version="0.8.3"; + version="0.8.4"; name="${baseName}-${version}"; - hash="07gwiay2pbzyscn8gnwb8i92xffjahhinlswc1z4h8dbjk837d8h"; - url="http://download.slimerjs.org/v0.8/slimerjs-0.8.3.zip"; - sha256="07gwiay2pbzyscn8gnwb8i92xffjahhinlswc1z4h8dbjk837d8h"; + hash="12hv126i304y3lr8z420vpdlrks1qzz0zwfi5yishdfiasdl5pyd"; + url="http://download.slimerjs.org/v0.8/slimerjs-0.8.4.zip"; + sha256="12hv126i304y3lr8z420vpdlrks1qzz0zwfi5yishdfiasdl5pyd"; }; buildInputs = [ unzip From 1d9632cac851fe20ce70fa14bfbc232800753a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chadda=C3=AF=20Fouch=C3=A9?= Date: Wed, 30 Oct 2013 10:53:34 +0100 Subject: [PATCH 111/179] Adjust kvirc/default.nix to better use stdenv.lib --- pkgs/applications/networking/irc/kvirc/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/irc/kvirc/default.nix b/pkgs/applications/networking/irc/kvirc/default.nix index 3494168497f..0cf04a9431a 100644 --- a/pkgs/applications/networking/irc/kvirc/default.nix +++ b/pkgs/applications/networking/irc/kvirc/default.nix @@ -17,8 +17,8 @@ stdenv.mkDerivation { meta = with stdenv.lib; { description = "Graphic IRC client with Qt"; - license = "GPL"; + license = licences.gpl3; homepage = http://www.kvirc.net/; - platforms = with stdenv.lib.platforms; linux; + platforms = platforms.linux; }; } From 5fe82bafac6f6a674fb45da3ba56953cd03783d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chadda=C3=AF=20Fouch=C3=A9?= Date: Wed, 30 Oct 2013 10:55:40 +0100 Subject: [PATCH 112/179] Ooops licences replaced by licenses --- pkgs/applications/networking/irc/kvirc/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/networking/irc/kvirc/default.nix b/pkgs/applications/networking/irc/kvirc/default.nix index 0cf04a9431a..f4b451e66e0 100644 --- a/pkgs/applications/networking/irc/kvirc/default.nix +++ b/pkgs/applications/networking/irc/kvirc/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { meta = with stdenv.lib; { description = "Graphic IRC client with Qt"; - license = licences.gpl3; + license = licenses.gpl3; homepage = http://www.kvirc.net/; platforms = platforms.linux; }; From 24f0eccaa8848c4bbd3db3be6d8af0f3669f46f7 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 28 Oct 2013 18:32:23 +0100 Subject: [PATCH 113/179] Add pngquant, it converts 24/32-bit RGBA PNGs to 8-bit palette with alpha channel preserved. --- pkgs/tools/graphics/pngquant/default.nix | 26 ++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/tools/graphics/pngquant/default.nix diff --git a/pkgs/tools/graphics/pngquant/default.nix b/pkgs/tools/graphics/pngquant/default.nix new file mode 100644 index 00000000000..560352c481e --- /dev/null +++ b/pkgs/tools/graphics/pngquant/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchgit, libpng }: + +stdenv.mkDerivation rec { + name = "pngquant-${version}"; + version = "2.0.1"; + + src = fetchgit { + url = https://github.com/pornel/pngquant.git; + rev = "refs/tags/${version}"; + sha256 = "00mrv9wgxbwy517l8i4n7n3jpzirjdgi0zass3wj29i7xyipwlhf"; + }; + + buildInputs = [ libpng ]; + + preInstall = '' + mkdir -p $out/bin + export PREFIX=$out + ''; + + meta = with stdenv.lib; { + homepage = https://github.com/pornel/pngquant; + description = "pngquant converts 24/32-bit RGBA PNGs to 8-bit palette with alpha channel preserved"; + platforms = platforms.all; + license = licenses.bsd2; # Not exactly bsd2, but alike + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7b274c4043b..5f8616096df 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1596,6 +1596,8 @@ let libpng = libpng12; }; + pngquant = callPackage ../tools/graphics/pngquant { }; + podiff = callPackage ../tools/text/podiff { }; poedit = callPackage ../tools/text/poedit { }; From 11fd5db060df751eeb66761077fcfad27c01a297 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Wed, 30 Oct 2013 10:28:05 +0100 Subject: [PATCH 114/179] Add gitflow A collection of Git extensions to provide high-level repository operations for Vincent Driessen's branching model --- .../git-and-tools/default.nix | 2 ++ .../git-and-tools/gitflow/default.nix | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 pkgs/applications/version-management/git-and-tools/gitflow/default.nix diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix index d53ca7a0135..af1ab52c04d 100644 --- a/pkgs/applications/version-management/git-and-tools/default.nix +++ b/pkgs/applications/version-management/git-and-tools/default.nix @@ -90,4 +90,6 @@ rec { svn2git_kde = callPackage ./svn2git-kde { }; darcsToGit = callPackage ./darcs-to-git { }; + + gitflow = callPackage ./gitflow { }; } diff --git a/pkgs/applications/version-management/git-and-tools/gitflow/default.nix b/pkgs/applications/version-management/git-and-tools/gitflow/default.nix new file mode 100644 index 00000000000..26a7826d4f0 --- /dev/null +++ b/pkgs/applications/version-management/git-and-tools/gitflow/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + name = "gitflow-${version}"; + version = "1.6.1"; + + src = fetchurl { + url = "https://github.com/petervanderdoes/gitflow/archive/${version}.tar.gz"; + sha256 = "1f4879ahi8diddn7qvhr0dkj96gh527xnfihbf1ha83fn9cvvcls"; + }; + + preBuild = '' + makeFlagsArray+=(prefix="$out") + ''; + + meta = with stdenv.lib; { + homepage = https://github.com/petervanderdoes/gitflow; + description = "A collection of Git extensions to provide high-level repository operations for Vincent Driessen's branching model"; + license = licenses.bsd2; + platforms = platforms.all; + maintainers = [ maintainers.offline ]; + }; +} From 09fa7304ae740f2e2003db6bd186e0de1ced604e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Wed, 30 Oct 2013 11:40:53 +0100 Subject: [PATCH 115/179] ninka: update to 1.1 and refactor --- pkgs/development/tools/misc/ninka/default.nix | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/pkgs/development/tools/misc/ninka/default.nix b/pkgs/development/tools/misc/ninka/default.nix index 1cb491df8d1..a5410204340 100644 --- a/pkgs/development/tools/misc/ninka/default.nix +++ b/pkgs/development/tools/misc/ninka/default.nix @@ -1,41 +1,34 @@ -{stdenv, fetchgit, perl}: +{ stdenv, fetchurl, perl }: assert stdenv ? glibc; -let - rev = "7a9a5c48ede207eec881"; -in -stdenv.mkDerivation { - name = "ninka-"+rev; - src = fetchgit { - url = http://github.com/dmgerman/ninka.git; - inherit rev; - sha256 = "3e877fadf074b9c5abfe36ff10b7e332423d1d4c5b17accc5586c7cffdb2c7dd"; +stdenv.mkDerivation rec { + name = "ninka-${version}"; + version = "1.1"; + + src = fetchurl { + url = "https://github.com/dmgerman/ninka/archive/${version}.tar.gz"; + sha256 = "1cvbsmanw3i9igiafpx0ghg658c37riw56mjk5vsgpmnn3flvhib"; }; buildInputs = [ perl ]; buildPhase = '' - cd comments - tar xfvz comments.tar.gz cd comments sed -i -e "s|/usr/local/bin|$out/bin|g" -e "s|/usr/local/man|$out/share/man|g" Makefile make ''; installPhase = '' - cd ../.. - mkdir -p $out/bin - cp ninka.pl $out/bin - cp -av {extComments,splitter,filter,senttok,matcher} $out/bin - - cd comments/comments mkdir -p $out/{bin,share/man/man1} make install + + cp -a ../{ninka.pl,extComments,splitter,filter,senttok,matcher} $out/bin ''; meta = { - license = "AGPLv3+"; description = "A sentence based license detector"; + homepage = "http://ninka.turingmachine.org/"; + license = "AGPLv3+"; }; } From a59079065689e42913d39ba6776e12989f96127a Mon Sep 17 00:00:00 2001 From: "Jason \\\"Don\\\" O'Conal" Date: Fri, 25 Oct 2013 11:23:48 +0000 Subject: [PATCH 116/179] pythonPackages.faker, pythonPackages.fake_factory: add expressions close #1125 --- pkgs/top-level/python-packages.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 77db61778c2..00036663b85 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1402,6 +1402,36 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; }; + faker = buildPythonPackage rec { + name = "faker-0.0.4"; + src = fetchurl { + url = https://pypi.python.org/packages/source/F/Faker/Faker-0.0.4.tar.gz; + sha256 = "09q5jna3j8di0gw5yjx0dvlndkrk2x9vvqzwyfsvg3nlp8h38js1"; + }; + buildInputs = [ nose ]; + meta = with stdenv.lib; { + description = "A Python library for generating fake user data."; + homepage = http://pypi.python.org/pypi/Faker; + license = licenses.mit; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; + }; + }; + + fake_factory = buildPythonPackage rec { + name = "fake-factory-0.2"; + src = fetchurl { + url = https://pypi.python.org/packages/source/f/fake-factory/fake-factory-0.2.tar.gz; + sha256 = "0qdmk8p4anrj9mf95dh9v7bkhv1pz69hvhlw380kj4iz7b44b6zn"; + }; + meta = with stdenv.lib; { + description = "A Python package that generates fake data for you."; + homepage = https://pypi.python.org/pypi/fake-factory; + license = licenses.mit; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; + }; + }; fabric = buildPythonPackage rec { name = "fabric-1.6.1"; From 5a2011e0c346ef86b44a5e8cde3c7968337dc44c Mon Sep 17 00:00:00 2001 From: "Jason \"Don\" O'Conal" Date: Thu, 10 Oct 2013 03:36:43 +0000 Subject: [PATCH 117/179] googleMusicmanager: add expression close #1056 --- .../audio/google-musicmanager/default.nix | 57 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 59 insertions(+) create mode 100644 pkgs/applications/audio/google-musicmanager/default.nix diff --git a/pkgs/applications/audio/google-musicmanager/default.nix b/pkgs/applications/audio/google-musicmanager/default.nix new file mode 100644 index 00000000000..8cff94c25d9 --- /dev/null +++ b/pkgs/applications/audio/google-musicmanager/default.nix @@ -0,0 +1,57 @@ +{ stdenv, fetchurl, readline, patchelf, ncurses, qt48, libidn, expat, flac +, libvorbis }: + +assert stdenv.system == "x86_64-linux" || stdenv.system == "1686-linux"; + +stdenv.mkDerivation rec { + debversion = "beta_1.0.84.1107-r0"; + version = "1.0.84.1107-beta-r0"; # friendly to nix-env version sorting algo + product = "google-musicmanager"; + name = "${product}-${version}"; + + # When looking for newer versions, since google doesn't let you list their repo dirs, + # curl http://dl.google.com/linux/musicmanager/deb/dists/stable/Release + # fetch an appropriate packages file eg main/binary-amd64/Packages + # which will contain the links to all available *.debs for the arch. + + src = if stdenv.system == "x86_64-linux" + then fetchurl { + url = "http://dl.google.com/linux/musicmanager/deb/pool/main/g/${product}-beta/${product}-${debversion}_amd64.deb"; + sha256 = "0irlrspw508b1s9i5d1mddpp2x9w1ny3svf27gxf8pmwbiyd1cyi"; + } + else fetchurl { + url = "http://dl.google.com/linux/musicmanager/deb/pool/main/g/${product}-beta/${product}-${debversion}_i386.deb"; + sha256 = "13pfsjvaygap6axrlbfhyk1h8377xmwi47x4af6j57qq6z7329rg"; + }; + + unpackPhase = '' + ar vx ${src} + tar -xvf data.tar.lzma + ''; + + buildInputs = [ patchelf ]; + + buildPhase = '' + patchelf \ + --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ + --set-rpath "$out/opt/google/musicmanager:${readline}/lib:${ncurses}/lib:${stdenv.gcc.libc}/lib:${qt48}/lib:${stdenv.gcc.gcc}/lib:${libidn}/lib:${expat}/lib:${flac}/lib:${libvorbis}/lib" opt/google/musicmanager/MusicManager + ''; + + dontPatchELF = true; + dontStrip = true; + + installPhase = '' + mkdir -p "$out" + cp -r opt "$out" + mkdir "$out/bin" + ln -s "$out/opt/google/musicmanager/google-musicmanager" "$out/bin" + ''; + + meta = with stdenv.lib; { + description = "Uploads music from your computer to Google Play"; + homepage = "https://support.google.com/googleplay/answer/1229970"; + license = licenses.unfree; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 548e0e601c8..c1cd75a31c5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7788,6 +7788,8 @@ let goldendict = callPackage ../applications/misc/goldendict { }; + google-musicmanager = callPackage ../applications/audio/google-musicmanager { }; + gpicview = callPackage ../applications/graphics/gpicview { }; grass = import ../applications/misc/grass { From 162b874469935923dec02cc9a6b5f58b1c8267a8 Mon Sep 17 00:00:00 2001 From: Arvin Moezzi Date: Sun, 27 Oct 2013 11:46:41 +0100 Subject: [PATCH 118/179] calibre: upgrade 1.5.0 -> 1.8.0 from #1144 --- pkgs/applications/misc/calibre/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 76930646310..58b316db585 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -4,11 +4,11 @@ }: stdenv.mkDerivation rec { - name = "calibre-1.5.0"; + name = "calibre-1.8.0"; src = fetchurl { url = "mirror://sourceforge/calibre/${name}.tar.xz"; - sha256 = "17jpzj47120ghm584hxl526jdkh9whxrrqfdyn0gv0pb9kag1spn"; + sha256 = "1883fcf679d4a9c2c94adec94cbb0cdf1b110007bf3e4b7dacd7ef552c11902b"; }; inherit python; From 862e3dd977cdd853c3ab3202ab1b73561f8a3ea1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 11:02:04 +0100 Subject: [PATCH 119/179] Substitute "types.uniq types.string" -> "types.str" --- nixos/doc/manual/development.xml | 2 +- nixos/modules/config/i18n.nix | 2 +- nixos/modules/config/swap.nix | 4 ++-- nixos/modules/config/timezone.nix | 2 +- nixos/modules/config/users-groups.nix | 12 ++++++------ nixos/modules/misc/version.nix | 10 +++++----- nixos/modules/security/pam.nix | 2 +- nixos/modules/services/audio/fuppes.nix | 10 +++++----- nixos/modules/services/logging/logcheck.nix | 18 +++++++++--------- nixos/modules/services/logging/syslogd.nix | 2 +- nixos/modules/services/mail/freepops.nix | 8 ++++---- nixos/modules/services/misc/nix-gc.nix | 4 ++-- nixos/modules/services/monitoring/dd-agent.nix | 2 +- nixos/modules/services/monitoring/graphite.nix | 6 +++--- nixos/modules/services/monitoring/statsd.nix | 8 ++++---- nixos/modules/services/monitoring/ups.nix | 8 ++++---- .../services/networking/avahi-daemon.nix | 2 +- nixos/modules/services/networking/cntlm.nix | 2 +- nixos/modules/services/networking/iodined.nix | 6 +++--- .../services/networking/wpa_supplicant.nix | 4 ++-- .../modules/services/search/elasticsearch.nix | 12 ++++++------ .../services/web-servers/lighttpd/default.nix | 2 +- .../services/web-servers/lighttpd/gitweb.nix | 4 ++-- .../services/x11/desktop-managers/default.nix | 2 +- .../services/x11/display-managers/default.nix | 2 +- .../services/x11/window-managers/default.nix | 2 +- nixos/modules/system/activation/top-level.nix | 2 +- nixos/modules/system/boot/loader/grub/grub.nix | 4 ++-- nixos/modules/system/boot/stage-2.nix | 6 +++--- .../system/boot/systemd-unit-options.nix | 16 ++++++++-------- nixos/modules/system/boot/systemd.nix | 10 +++++----- nixos/modules/tasks/cpu-freq.nix | 2 +- nixos/modules/tasks/filesystems.nix | 4 ++-- nixos/modules/tasks/network-interfaces.nix | 10 +++++----- .../tasks/scsi-link-power-management.nix | 2 +- 35 files changed, 97 insertions(+), 97 deletions(-) diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml index 775143cc835..b7b232fa8ef 100644 --- a/nixos/doc/manual/development.xml +++ b/nixos/doc/manual/development.xml @@ -265,7 +265,7 @@ in period = mkOption { default = "15 02 * * *"; - type = with types; uniq string; + type = types.str; description = '' This option defines (in the format used by cron) when the locate database is updated. diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index c3e39717258..5570bb1adf6 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -55,7 +55,7 @@ in description = " The keyboard mapping table for the virtual consoles. "; - type = types.uniq types.string; + type = types.str; }; }; diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix index fb171050d3e..65d7722abfa 100644 --- a/nixos/modules/config/swap.nix +++ b/nixos/modules/config/swap.nix @@ -34,13 +34,13 @@ with utils; device = mkOption { example = "/dev/sda3"; - type = types.uniq types.string; + type = types.str; description = "Path of the device."; }; label = mkOption { example = "swap"; - type = types.uniq types.string; + type = types.str; description = '' Label of the device. Can be used instead of device. ''; diff --git a/nixos/modules/config/timezone.nix b/nixos/modules/config/timezone.nix index e185584846a..07a76d9ad1f 100644 --- a/nixos/modules/config/timezone.nix +++ b/nixos/modules/config/timezone.nix @@ -9,7 +9,7 @@ with pkgs.lib; timeZone = mkOption { default = "CET"; - type = with types; uniq string; + type = types.str; example = "America/New_York"; description = "The time zone used when displaying times and dates."; }; diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index 5f32dc350df..383f87120e0 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -12,12 +12,12 @@ let options = { name = mkOption { - type = with types; uniq string; + type = types.str; description = "The name of the user account. If undefined, the name of the attribute set will be used."; }; description = mkOption { - type = with types; uniq string; + type = types.str; default = ""; description = "A short description of the user account."; }; @@ -29,7 +29,7 @@ let }; group = mkOption { - type = with types; uniq string; + type = types.str; default = "nogroup"; description = "The user's primary group."; }; @@ -41,13 +41,13 @@ let }; home = mkOption { - type = with types; uniq string; + type = types.str; default = "/var/empty"; description = "The user's home directory."; }; shell = mkOption { - type = with types; uniq string; + type = types.str; default = "/run/current-system/sw/sbin/nologin"; description = "The path to the user's shell."; }; @@ -107,7 +107,7 @@ let options = { name = mkOption { - type = with types; uniq string; + type = types.str; description = "The name of the group. If undefined, the name of the attribute set will be used."; }; diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 5ab24686152..86898bbb379 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -8,31 +8,31 @@ with pkgs.lib; system.nixosVersion = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; description = "NixOS version."; }; system.nixosVersionSuffix = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; description = "NixOS version suffix."; }; system.nixosRevision = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; description = "NixOS Git revision hash."; }; system.nixosCodeName = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; description = "NixOS release code name."; }; system.defaultChannel = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; default = https://nixos.org/channels/nixos-unstable; description = "Default NixOS channel to which the root user is subscribed."; }; diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix index 1081b41299d..69a1972e9e7 100644 --- a/nixos/modules/security/pam.nix +++ b/nixos/modules/security/pam.nix @@ -13,7 +13,7 @@ let name = mkOption { example = "sshd"; - type = types.uniq types.string; + type = types.str; description = "Name of the PAM service."; }; diff --git a/nixos/modules/services/audio/fuppes.nix b/nixos/modules/services/audio/fuppes.nix index 9c8849e525b..3eb0732bae2 100644 --- a/nixos/modules/services/audio/fuppes.nix +++ b/nixos/modules/services/audio/fuppes.nix @@ -21,7 +21,7 @@ with pkgs.lib; name = mkOption { example = "Media Center"; - type = with types; uniq string; + type = types.str; description = '' Enables Fuppes (UPnP A/V Media Server). Can be used to watch photos, video and listen to music from a phone/tv connected to the @@ -41,7 +41,7 @@ with pkgs.lib; file = mkOption { default = "/var/log/fuppes.log"; - type = with types; uniq string; + type = types.str; description = '' File which will contains the log produced by the daemon. ''; @@ -50,7 +50,7 @@ with pkgs.lib; config = mkOption { example = "/etc/fuppes/fuppes.cfg"; - type = with types; uniq string; + type = types.str; description = '' Mutable configuration file which can be edited with the web interface. Due to possible modification, double quote the full @@ -69,7 +69,7 @@ with pkgs.lib; database = mkOption { default = "/var/lib/fuppes/fuppes.db"; - type = with types; uniq string; + type = types.str; description = '' Database file which index all shared files. ''; @@ -88,7 +88,7 @@ with pkgs.lib; user = mkOption { default = "root"; # The default is not secure. example = "fuppes"; - type = with types; uniq string; + type = types.str; description = '' Name of the user which own the configuration files and under which the fuppes daemon will be executed. diff --git a/nixos/modules/services/logging/logcheck.nix b/nixos/modules/services/logging/logcheck.nix index 23f21b6a754..2a6a6516f48 100644 --- a/nixos/modules/services/logging/logcheck.nix +++ b/nixos/modules/services/logging/logcheck.nix @@ -52,7 +52,7 @@ let levelOption = mkOption { default = "server"; - type = types.uniq types.string; + type = types.str; description = '' Set the logcheck level. Either "workstation", "server", or "paranoid". ''; @@ -63,7 +63,7 @@ let regex = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = '' Regex specifying which log lines to ignore. ''; @@ -73,7 +73,7 @@ let ignoreCronOptions = { user = mkOption { default = "root"; - type = types.uniq types.string; + type = types.str; description = '' User that runs the cronjob. ''; @@ -81,7 +81,7 @@ let cmdline = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = '' Command line for the cron job. Will be turned into a regex for the logcheck ignore rule. ''; @@ -89,7 +89,7 @@ let timeArgs = mkOption { default = null; - type = types.nullOr (types.uniq types.string); + type = types.nullOr (types.str); example = "02 06 * * *"; description = '' "min hr dom mon dow" crontab time args, to auto-create a cronjob too. @@ -112,7 +112,7 @@ in user = mkOption { default = "logcheck"; - type = types.uniq types.string; + type = types.str; description = '' Username for the logcheck user. ''; @@ -121,7 +121,7 @@ in timeOfDay = mkOption { default = "*"; example = "6"; - type = types.uniq types.string; + type = types.str; description = '' Time of day to run logcheck. A logcheck will be scheduled at xx:02 each day. Leave default (*) to run every hour. Of course when nothing special was logged, @@ -132,7 +132,7 @@ in mailTo = mkOption { default = "root"; example = "you@domain.com"; - type = types.uniq types.string; + type = types.str; description = '' Email address to send reports to. ''; @@ -140,7 +140,7 @@ in level = mkOption { default = "server"; - type = types.uniq types.string; + type = types.str; description = '' Set the logcheck level. Either "workstation", "server", or "paranoid". ''; diff --git a/nixos/modules/services/logging/syslogd.nix b/nixos/modules/services/logging/syslogd.nix index 24cd5c1567e..c1a66aaa3cc 100644 --- a/nixos/modules/services/logging/syslogd.nix +++ b/nixos/modules/services/logging/syslogd.nix @@ -46,7 +46,7 @@ in }; tty = mkOption { - type = types.uniq types.string; + type = types.str; default = "tty10"; description = '' The tty device on which syslogd will print important log diff --git a/nixos/modules/services/mail/freepops.nix b/nixos/modules/services/mail/freepops.nix index 8f6e9382607..79f211ad86e 100644 --- a/nixos/modules/services/mail/freepops.nix +++ b/nixos/modules/services/mail/freepops.nix @@ -35,7 +35,7 @@ in bind = mkOption { default = "0.0.0.0"; - type = with types; uniq string; + type = types.str; description = '' Bind over an IPv4 address instead of any. ''; @@ -44,7 +44,7 @@ in logFile = mkOption { default = "/var/log/freepopsd"; example = "syslog"; - type = with types; uniq string; + type = types.str; description = '' Filename of the log file or syslog to rely on the logging daemon. ''; @@ -53,7 +53,7 @@ in suid = { user = mkOption { default = "nobody"; - type = with types; uniq string; + type = types.str; description = '' User name under which freepopsd will be after binding the port. ''; @@ -61,7 +61,7 @@ in group = mkOption { default = "nogroup"; - type = with types; uniq string; + type = types.str; description = '' Group under which freepopsd will be after binding the port. ''; diff --git a/nixos/modules/services/misc/nix-gc.nix b/nixos/modules/services/misc/nix-gc.nix index 0d7bc13b2ee..fa20e0956f5 100644 --- a/nixos/modules/services/misc/nix-gc.nix +++ b/nixos/modules/services/misc/nix-gc.nix @@ -22,7 +22,7 @@ in dates = mkOption { default = "03:15"; - type = types.uniq types.string; + type = types.str; description = '' Specification (in the format described by systemd.time @@ -34,7 +34,7 @@ in options = mkOption { default = ""; example = "--max-freed $((64 * 1024**3))"; - type = types.uniq types.string; + type = types.str; description = '' Options given to nix-collect-garbage when the garbage collector is run automatically. diff --git a/nixos/modules/services/monitoring/dd-agent.nix b/nixos/modules/services/monitoring/dd-agent.nix index ef658523c1f..f99114ac9ad 100644 --- a/nixos/modules/services/monitoring/dd-agent.nix +++ b/nixos/modules/services/monitoring/dd-agent.nix @@ -26,7 +26,7 @@ in { example = "ae0aa6a8f08efa988ba0a17578f009ab"; - type = types.uniq types.string; + type = types.str; }; hostname = mkOption { diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index 93673351438..08e6ef662cc 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -32,13 +32,13 @@ in { host = mkOption { description = "Graphite web frontend listen address"; default = "127.0.0.1"; - type = types.uniq types.string; + type = types.str; }; port = mkOption { description = "Graphite web frontend port"; default = "8080"; - type = types.uniq types.string; + type = types.str; }; }; @@ -56,7 +56,7 @@ in { LOG_UPDATES = False LOG_CACHE_HITS = False ''; - type = types.uniq types.string; + type = types.str; }; enableCache = mkOption { diff --git a/nixos/modules/services/monitoring/statsd.nix b/nixos/modules/services/monitoring/statsd.nix index 120c8860d57..979debefdd9 100644 --- a/nixos/modules/services/monitoring/statsd.nix +++ b/nixos/modules/services/monitoring/statsd.nix @@ -36,7 +36,7 @@ in host = mkOption { description = "Address that statsd listens on over UDP"; default = "127.0.0.1"; - type = types.uniq types.string; + type = types.str; }; port = mkOption { @@ -48,7 +48,7 @@ in mgmt_address = mkOption { description = "Address to run managment TCP interface on"; default = "127.0.0.1"; - type = types.uniq types.string; + type = types.str; }; mgmt_port = mkOption { @@ -65,7 +65,7 @@ in graphiteHost = mkOption { description = "Hostname or IP of Graphite server"; default = "127.0.0.1"; - type = types.uniq types.string; + type = types.str; }; graphitePort = mkOption { @@ -77,7 +77,7 @@ in extraConfig = mkOption { default = ""; description = "Extra configuration options for statsd"; - type = types.uniq types.string; + type = types.str; }; }; diff --git a/nixos/modules/services/monitoring/ups.nix b/nixos/modules/services/monitoring/ups.nix index a7b72e53f0a..c00f4bad935 100644 --- a/nixos/modules/services/monitoring/ups.nix +++ b/nixos/modules/services/monitoring/ups.nix @@ -15,7 +15,7 @@ let # This can be infered from the UPS model by looking at # /nix/store/nut/share/driver.list driver = mkOption { - type = types.uniq types.string; + type = types.str; description = '' Specify the program to run to talk to this UPS. apcsmart, bestups, and sec are some examples. @@ -23,7 +23,7 @@ let }; port = mkOption { - type = types.uniq types.string; + type = types.str; description = '' The serial port to which your UPS is connected. /dev/ttyS0 is usually the first port on Linux boxes, for example. @@ -115,7 +115,7 @@ in # This option is not used yet. mode = mkOption { default = "standalone"; - type = types.uniq types.string; + type = types.str; description = '' The MODE determines which part of the NUT is to be started, and which configuration files must be modified. @@ -142,7 +142,7 @@ in schedulerRules = mkOption { example = "/etc/nixos/upssched.conf"; - type = types.uniq types.string; + type = types.str; description = '' File which contains the rules to handle UPS events. ''; diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix index 3603d677837..effd1a62bd9 100644 --- a/nixos/modules/services/networking/avahi-daemon.nix +++ b/nixos/modules/services/networking/avahi-daemon.nix @@ -50,7 +50,7 @@ in }; hostName = mkOption { - type = types.uniq types.string; + type = types.str; description = ''Host name advertised on the LAN.''; }; diff --git a/nixos/modules/services/networking/cntlm.nix b/nixos/modules/services/networking/cntlm.nix index bfe7209b991..96396878afc 100644 --- a/nixos/modules/services/networking/cntlm.nix +++ b/nixos/modules/services/networking/cntlm.nix @@ -39,7 +39,7 @@ in }; netbios_hostname = mkOption { - type = types.uniq types.string; + type = types.str; description = '' The hostname of your machine. ''; diff --git a/nixos/modules/services/networking/iodined.nix b/nixos/modules/services/networking/iodined.nix index 1b3473ee0ee..cd150fe63fd 100644 --- a/nixos/modules/services/networking/iodined.nix +++ b/nixos/modules/services/networking/iodined.nix @@ -32,21 +32,21 @@ in }; ip = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Assigned ip address or ip range"; example = "172.16.10.1/24"; }; domain = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Domain or subdomain of which nameservers point to us"; example = "tunnel.mydomain.com"; }; extraConfig = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Additional command line parameters"; example = "-P mysecurepassword -l 192.168.1.10 -p 23"; diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix index 89c8687403b..5e5f81ed5a0 100644 --- a/nixos/modules/services/networking/wpa_supplicant.nix +++ b/nixos/modules/services/networking/wpa_supplicant.nix @@ -53,7 +53,7 @@ in }; driver = mkOption { - type = types.uniq types.string; + type = types.str; default = "nl80211,wext"; description = "Force a specific wpa_supplicant driver."; }; @@ -74,7 +74,7 @@ in }; group = mkOption { - type = types.uniq types.string; + type = types.str; default = "wheel"; example = "network"; description = "Members of this group can control wpa_supplicant."; diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index e6a2437902c..9d345e30361 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -29,31 +29,31 @@ in { host = mkOption { description = "Elasticsearch listen address"; default = "127.0.0.1"; - type = types.uniq types.string; + type = types.str; }; port = mkOption { description = "Elasticsearch port to listen for HTTP traffic"; default = "9200"; - type = types.uniq types.string; + type = types.str; }; tcp_port = mkOption { description = "Elasticsearch port for the node to node communication"; default = "9300"; - type = types.uniq types.string; + type = types.str; }; cluster_name = mkOption { description = "Elasticsearch name that identifies your cluster for auto-discovery"; default = "elasticsearch"; - type = types.uniq types.string; + type = types.str; }; extraConf = mkOption { description = "Extra configuration for elasticsearch"; default = ""; - type = types.uniq types.string; + type = types.str; example = '' node.name: "elasticsearch" node.master: true @@ -77,7 +77,7 @@ in { type: consolePattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" ''; - type = types.uniq types.string; + type = types.str; }; }; diff --git a/nixos/modules/services/web-servers/lighttpd/default.nix b/nixos/modules/services/web-servers/lighttpd/default.nix index f9e40fc4b54..4cc34c65d84 100644 --- a/nixos/modules/services/web-servers/lighttpd/default.nix +++ b/nixos/modules/services/web-servers/lighttpd/default.nix @@ -102,7 +102,7 @@ in document-root = mkOption { default = "/srv/www"; - type = types.uniq types.string; + type = types.str; description = '' Document-root of the web server. Must be readable by the "lighttpd" user. ''; diff --git a/nixos/modules/services/web-servers/lighttpd/gitweb.nix b/nixos/modules/services/web-servers/lighttpd/gitweb.nix index d759d8144b6..f02bd4db264 100644 --- a/nixos/modules/services/web-servers/lighttpd/gitweb.nix +++ b/nixos/modules/services/web-servers/lighttpd/gitweb.nix @@ -25,7 +25,7 @@ in projectroot = mkOption { default = "/srv/git"; - type = types.uniq types.string; + type = types.str; description = '' Path to git projects (bare repositories) that should be served by gitweb. Must not end with a slash. @@ -34,7 +34,7 @@ in extraConfig = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = '' Verbatim configuration text appended to the generated gitweb.conf file. ''; diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index 3578d702b28..7bb2d769780 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -50,7 +50,7 @@ in }; default = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; example = "none"; description = "Default desktop manager loaded if none have been chosen."; diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 91de910662f..65b634f9482 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -249,7 +249,7 @@ in }; execCmd = mkOption { - type = types.uniq types.string; + type = types.str; example = "${pkgs.slim}/bin/slim"; description = "Command to start the display manager."; }; diff --git a/nixos/modules/services/x11/window-managers/default.nix b/nixos/modules/services/x11/window-managers/default.nix index e856a9e2079..fa06c4be264 100644 --- a/nixos/modules/services/x11/window-managers/default.nix +++ b/nixos/modules/services/x11/window-managers/default.nix @@ -40,7 +40,7 @@ in }; default = mkOption { - type = types.uniq types.string; + type = types.str; default = "none"; example = "wmii"; description = "Default window manager loaded if none have been chosen."; diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 7b1c7d611d3..06b857297ac 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -155,7 +155,7 @@ in system.boot.loader.kernelFile = mkOption { internal = true; default = pkgs.stdenv.platform.kernelTarget; - type = types.uniq types.string; + type = types.str; description = '' Name of the kernel file to be passed to the bootloader. ''; diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 31e55b5ef9f..947328c2ff6 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -65,7 +65,7 @@ in device = mkOption { default = ""; example = "/dev/hda"; - type = types.uniq types.string; + type = types.str; description = '' The device on which the GRUB boot loader will be installed. The special value nodev means that a GRUB @@ -89,7 +89,7 @@ in configurationName = mkOption { default = ""; example = "Stable 2.6.21"; - type = types.uniq types.string; + type = types.str; description = '' GRUB entry name instead of default. ''; diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix index ff17535e418..0af4c9f7a58 100644 --- a/nixos/modules/system/boot/stage-2.nix +++ b/nixos/modules/system/boot/stage-2.nix @@ -52,7 +52,7 @@ in devSize = mkOption { default = "5%"; example = "32m"; - type = types.uniq types.string; + type = types.str; description = '' Size limit for the /dev tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax. @@ -62,7 +62,7 @@ in devShmSize = mkOption { default = "50%"; example = "256m"; - type = types.uniq types.string; + type = types.str; description = '' Size limit for the /dev/shm tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax. @@ -72,7 +72,7 @@ in runSize = mkOption { default = "25%"; example = "256m"; - type = types.uniq types.string; + type = types.str; description = '' Size limit for the /run tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax. diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index d18c5d86417..ac9e636fe1e 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -19,7 +19,7 @@ rec { description = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = "Description of this unit used in systemd messages and progress indicators."; }; @@ -167,13 +167,13 @@ rec { }; script = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Shell commands executed as the service's main process."; }; scriptArgs = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Arguments passed to the main process script."; }; @@ -230,7 +230,7 @@ rec { }; startAt = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; example = "Sun 14:00:00"; description = '' @@ -296,13 +296,13 @@ rec { what = mkOption { example = "/dev/sda1"; - type = types.uniq types.string; + type = types.str; description = "Absolute path of device node, file or other resource. (Mandatory)"; }; where = mkOption { example = "/mnt"; - type = types.uniq types.string; + type = types.str; description = '' Absolute path of a directory of the mount point. Will be created if it doesn't exist. (Mandatory) @@ -312,7 +312,7 @@ rec { type = mkOption { default = ""; example = "ext4"; - type = types.uniq types.string; + type = types.str; description = "File system type."; }; @@ -340,7 +340,7 @@ rec { where = mkOption { example = "/mnt"; - type = types.uniq types.string; + type = types.str; description = '' Absolute path of a directory of the mount point. Will be created if it doesn't exist. (Mandatory) diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 903ff4119e7..c1fb2c45165 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -389,7 +389,7 @@ in type = types.attrsOf types.optionSet; options = { text = mkOption { - type = types.uniq types.string; + type = types.str; description = "Text of this systemd unit."; }; enable = mkOption { @@ -473,7 +473,7 @@ in systemd.defaultUnit = mkOption { default = "multi-user.target"; - type = types.uniq types.string; + type = types.str; description = "Default unit started when the system boots."; }; @@ -488,13 +488,13 @@ in services.journald.console = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = "If non-empty, write log messages to the specified TTY device."; }; services.journald.rateLimitInterval = mkOption { default = "10s"; - type = types.uniq types.string; + type = types.str; description = '' Configures the rate limiting interval that is applied to all messages generated on the system. This rate limiting is applied @@ -518,7 +518,7 @@ in services.logind.extraConfig = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; example = "HandleLidSwitch=ignore"; description = '' Extra config options for systemd-logind. See man logind.conf for diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix index 3b21d831087..8f441aa134d 100644 --- a/nixos/modules/tasks/cpu-freq.nix +++ b/nixos/modules/tasks/cpu-freq.nix @@ -10,7 +10,7 @@ with pkgs.lib; powerManagement.cpuFreqGovernor = mkOption { default = ""; example = "ondemand"; - type = types.uniq types.string; + type = types.str; description = '' Configure the governor used to regulate the frequence of the available CPUs. By default, the kernel configures the diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix index 2b4fe582c37..3f484045ed4 100644 --- a/nixos/modules/tasks/filesystems.nix +++ b/nixos/modules/tasks/filesystems.nix @@ -15,7 +15,7 @@ let mountPoint = mkOption { example = "/mnt/usb"; - type = types.uniq types.string; + type = types.str; description = "Location of the mounted the file system."; }; @@ -36,7 +36,7 @@ let fsType = mkOption { default = "auto"; example = "ext3"; - type = types.uniq types.string; + type = types.str; description = "Type of the file system."; }; diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 796da3020ed..d8522b6abba 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -14,14 +14,14 @@ let name = mkOption { example = "eth0"; - type = types.uniq types.string; + type = types.str; description = "Name of the interface."; }; ipAddress = mkOption { default = null; example = "10.0.0.1"; - type = types.nullOr (types.uniq types.string); + type = types.nullOr (types.str); description = '' IP address of the interface. Leave empty to configure the interface using DHCP. @@ -41,7 +41,7 @@ let subnetMask = mkOption { default = ""; example = "255.255.255.0"; - type = types.uniq types.string; + type = types.str; description = '' Subnet mask of the interface, specified as a bitmask. This is deprecated; use @@ -52,7 +52,7 @@ let macAddress = mkOption { default = null; example = "00:11:22:33:44:55"; - type = types.nullOr (types.uniq types.string); + type = types.nullOr (types.str); description = '' MAC address of the interface. Leave empty to use the default. ''; @@ -72,7 +72,7 @@ let virtualOwner = mkOption { default = "root"; - type = types.uniq types.string; + type = types.str; description = '' In case of a virtual device, the user who owns it. ''; diff --git a/nixos/modules/tasks/scsi-link-power-management.nix b/nixos/modules/tasks/scsi-link-power-management.nix index 4ab67aee395..4927952080f 100644 --- a/nixos/modules/tasks/scsi-link-power-management.nix +++ b/nixos/modules/tasks/scsi-link-power-management.nix @@ -10,7 +10,7 @@ with pkgs.lib; powerManagement.scsiLinkPolicy = mkOption { default = ""; example = "min_power"; - type = types.uniq types.string; + type = types.str; description = '' Configure the SCSI link power management policy. By default, the kernel configures "max_performance". From ac68d326b96b9529ffed2a0100f0d56739cefb96 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 11:02:55 +0100 Subject: [PATCH 120/179] Manual: Fix -I flag --- nixos/doc/manual/development.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml index b7b232fa8ef..13568868802 100644 --- a/nixos/doc/manual/development.xml +++ b/nixos/doc/manual/development.xml @@ -42,7 +42,7 @@ need to tell nixos-rebuild about them using the flag: -$ nixos-rebuild switch -I /my/sources/nixpkgs +$ nixos-rebuild switch -I nixpkgs=/my/sources/nixpkgs From c7f7ceefd68e3f0204377c5818539bec35330765 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 12:10:40 +0100 Subject: [PATCH 121/179] Export only the files of the active definitions --- lib/modules.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 6f56d174397..11a2f64799f 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -153,6 +153,7 @@ rec { # value specified in the option declaration (if any). defsFinal = filterOverrides' ((if opt ? default then [{ file = head opt.declarations; value = mkOptionDefault opt.default; }] else []) ++ defs); + files = map (def: def.file) defsFinal; # Type-check the remaining definitions, and merge them if # possible. merged = @@ -162,16 +163,16 @@ rec { fold (def: res: if opt.type.check def.value then res else throw "The option value `${showOption loc}' in `${def.file}' is not a ${opt.type.name}.") - (opt.type.merge { prefix = loc; files = map (m: m.file) defsFinal; } (map (m: m.value) defsFinal)) defsFinal; + (opt.type.merge { prefix = loc; inherit files; } (map (m: m.value) defsFinal)) defsFinal; # Finally, apply the ‘apply’ function to the merged # value. This allows options to yield a value computed # from the definitions. value = (opt.apply or id) merged; in opt // { value = addErrorContext "while evaluating the option `${showOption loc}':" value; - files = map (def: def.file) defs; definitions = map (def: def.value) defsFinal; isDefined = defsFinal != []; + inherit files; }; /* Given a config set, expand mkMerge properties, and push down the From 4680af6a9334297885a96ba464d58316587a87fd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 14:18:41 +0100 Subject: [PATCH 122/179] Add some option types --- nixos/modules/config/system-path.nix | 2 ++ nixos/modules/system/boot/loader/grub/grub.nix | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 8dd92dd96af..932e4ccca05 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -60,6 +60,7 @@ in environment = { systemPackages = mkOption { + type = types.listOf types.path; default = []; example = "[ pkgs.icecat3 pkgs.thunderbird ]"; description = '' @@ -74,6 +75,7 @@ in }; pathsToLink = mkOption { + type = types.listOf types.str; # Note: We need `/lib' to be among `pathsToLink' for NSS modules # to work. default = []; diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 947328c2ff6..e18a1d4c112 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -247,7 +247,7 @@ in # set at once. system.boot.loader.id = "grub"; - environment.systemPackages = [ grub ]; + environment.systemPackages = optional (grub != null) grub; boot.loader.grub.extraPrepareConfig = concatStrings (mapAttrsToList (n: v: '' From 800f9c203728ee84d50181af6fa34ac9e5c04e73 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 14:21:41 +0100 Subject: [PATCH 123/179] Show correct position info for errors in submodules E.g. The unique option `fileSystems./.device' is defined multiple times, in `/etc/nixos/configuration.nix' and `/etc/nixos/foo.nix'. This requires passing file/value tuples to the merge functions. --- lib/modules.nix | 19 ++-- lib/options.nix | 31 +++--- lib/types.nix | 107 +++++++++----------- nixos/modules/config/shells-environment.nix | 20 ++-- nixos/modules/config/sysctl.nix | 2 +- nixos/modules/misc/nixpkgs.nix | 2 +- 6 files changed, 88 insertions(+), 93 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 11a2f64799f..040ccf68214 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -17,7 +17,7 @@ rec { # Traverse options and extract the option values into the final # config set. At the same time, check whether all option # definitions have matching declarations. - config = yieldConfig [] options; + config = yieldConfig prefix options; yieldConfig = prefix: set: let res = removeAttrs (mapAttrs (n: v: if isOption v then v.value @@ -52,22 +52,22 @@ rec { of ‘options’, ‘config’ and ‘imports’ attributes. */ unifyModuleSyntax = file: key: m: if m ? config || m ? options then - let badAttrs = removeAttrs m ["imports" "options" "config" "key"]; in + let badAttrs = removeAttrs m ["imports" "options" "config" "key" "_file"]; in if badAttrs != {} then throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'." else - { inherit file; + { file = m._file or file; key = toString m.key or key; imports = m.imports or []; options = m.options or {}; config = m.config or {}; } else - { inherit file; + { file = m._file or file; key = toString m.key or key; imports = m.require or [] ++ m.imports or []; options = {}; - config = removeAttrs m ["key" "require" "imports"]; + config = removeAttrs m ["key" "_file" "require" "imports"]; }; applyIfFunction = f: arg: if builtins.isFunction f then f arg else f; @@ -151,7 +151,7 @@ rec { let # Process mkOverride properties, adding in the default # value specified in the option declaration (if any). - defsFinal = filterOverrides' + defsFinal = filterOverrides ((if opt ? default then [{ file = head opt.declarations; value = mkOptionDefault opt.default; }] else []) ++ defs); files = map (def: def.file) defsFinal; # Type-check the remaining definitions, and merge them if @@ -163,7 +163,7 @@ rec { fold (def: res: if opt.type.check def.value then res else throw "The option value `${showOption loc}' in `${def.file}' is not a ${opt.type.name}.") - (opt.type.merge { prefix = loc; inherit files; } (map (m: m.value) defsFinal)) defsFinal; + (opt.type.merge loc defsFinal) defsFinal; # Finally, apply the ‘apply’ function to the merged # value. This allows options to yield a value computed # from the definitions. @@ -240,7 +240,7 @@ rec { Note that "z" has the default priority 100. */ - filterOverrides' = defs: + filterOverrides = defs: let defaultPrio = 100; getPrio = def: if def.value._type or "" == "override" then def.value.priority else defaultPrio; @@ -249,9 +249,6 @@ rec { strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def; in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs; - /* For use in options like environment.variables. */ - filterOverrides = defs: map (def: def.value) (filterOverrides' (map (def: { value = def; }) defs)); - /* Hack for backward compatibility: convert options of type optionSet to configOf. FIXME: remove eventually. */ fixupOptionType = loc: opt: diff --git a/lib/options.nix b/lib/options.nix index 2b211478765..5a05775e8c2 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -30,36 +30,39 @@ rec { type = lib.types.bool; }; - mergeDefaultOption = args: list: + mergeDefaultOption = loc: defs: + let list = getValues defs; in if length list == 1 then head list - else if all builtins.isFunction list then x: mergeDefaultOption args (map (f: f x) list) + else if all builtins.isFunction list then x: mergeDefaultOption loc (map (f: f x) list) else if all isList list then concatLists list else if all isAttrs list then fold lib.mergeAttrs {} list else if all builtins.isBool list then fold lib.or false list else if all builtins.isString list then lib.concatStrings list else if all builtins.isInt list && all (x: x == head list) list then head list - else throw "Cannot merge definitions of `${showOption args.prefix}' given in ${showFiles args.files}."; + else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}."; /* Obsolete, will remove soon. Specify an option type or apply function instead. */ - mergeTypedOption = typeName: predicate: merge: args: list: - if all predicate list then merge list - else throw "Expect a ${typeName}."; + mergeTypedOption = typeName: predicate: merge: loc: list: + let list' = map (x: x.value) list; in + if all predicate list then merge list' + else throw "Expected a ${typeName}."; mergeEnableOption = mergeTypedOption "boolean" (x: true == x || false == x) (fold lib.or false); mergeListOption = mergeTypedOption "list" isList concatLists; - mergeStringOption = mergeTypedOption "string" - (x: if builtins ? isString then builtins.isString x else x + "") - lib.concatStrings; + mergeStringOption = mergeTypedOption "string" builtins.isString lib.concatStrings; - mergeOneOption = args: list: - if list == [] then abort "This case should never happen." - else if length list != 1 then - throw "The unique option `${showOption args.prefix}' is defined multiple times, in ${showFiles args.files}." - else head list; + mergeOneOption = loc: defs: + if defs == [] then abort "This case should never happen." + else if length defs != 1 then + throw "The unique option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}." + else (head defs).value; + + getValues = map (x: x.value); + getFiles = map (x: x.file); # Generate documentation template from the list of option declaration like diff --git a/lib/types.nix b/lib/types.nix index 8deb379c25a..cf8eef00833 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -27,6 +27,11 @@ rec { # its type-correct, false otherwise. check ? (x: true) , # Merge a list of definitions together into a single value. + # This function is called with two arguments: the location of + # the option in the configuration as a list of strings + # (e.g. ["boot" "loader "grub" "enable"]), and a list of + # definition values and locations (e.g. [ { file = "/foo.nix"; + # value = 1; } { file = "/bar.nix"; value = 2 } ]). merge ? mergeDefaultOption , # Return a flat list of sub-options. Used to generate # documentation. @@ -46,12 +51,13 @@ rec { bool = mkOptionType { name = "boolean"; check = builtins.isBool; - merge = args: fold lib.or false; + merge = loc: fold (x: lib.or x.value) false; }; int = mkOptionType { name = "integer"; check = builtins.isInt; + merge = mergeOneOption; }; str = mkOptionType { @@ -60,38 +66,26 @@ rec { merge = mergeOneOption; }; + # Merge multiple definitions by concatenating them (with the given + # separator between the values). + separatedString = sep: mkOptionType { + name = "string"; + check = builtins.isString; + merge = loc: defs: lib.concatStringsSep sep (getValues defs); + }; + + lines = separatedString "\n"; + commas = separatedString ","; + envVar = separatedString ":"; + # Deprecated; should not be used because it quietly concatenates # strings, which is usually not what you want. - string = mkOptionType { - name = "string"; - check = builtins.isString; - merge = args: lib.concatStrings; - }; - - # Like ‘string’, but add newlines between every value. Useful for - # configuration file contents. - lines = mkOptionType { - name = "string"; - check = builtins.isString; - merge = args: lib.concatStringsSep "\n"; - }; - - commas = mkOptionType { - name = "string"; - check = builtins.isString; - merge = args: lib.concatStringsSep ","; - }; - - envVar = mkOptionType { - name = "environment variable"; - inherit (string) check; - merge = args: lib.concatStringsSep ":"; - }; + string = separatedString ""; attrs = mkOptionType { name = "attribute set"; check = isAttrs; - merge = args: fold lib.mergeAttrs {}; + merge = loc: fold (def: lib.mergeAttrs def.value) {}; }; # derivation is a reserved keyword. @@ -114,15 +108,21 @@ rec { listOf = elemType: mkOptionType { name = "list of ${elemType.name}s"; check = value: isList value && all elemType.check value; - merge = args: defs: imap (n: def: elemType.merge (addToPrefix args (toString n)) [def]) (concatLists defs); + merge = loc: defs: + concatLists (imap (n: def: imap (m: def': + elemType.merge (loc ++ ["[${toString n}-${toString m}]"]) + [{ inherit (def) file; value = def'; }]) def.value) defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); }; attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; check = x: isAttrs x && all elemType.check (lib.attrValues x); - merge = args: lib.zipAttrsWith (name: - elemType.merge (addToPrefix (args // { inherit name; }) name)); + merge = loc: defs: + zipAttrsWith (name: elemType.merge (loc ++ [name])) + # Push down position info. + (map (def: listToAttrs (mapAttrsToList (n: def': + { name = n; value = { inherit (def) file; value = def'; }; }) def.value)) defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; @@ -130,22 +130,25 @@ rec { loaOf = elemType: let convertIfList = defIdx: def: - if isList def then - listToAttrs ( - flip imap def (elemIdx: elem: - { name = "unnamed-${toString defIdx}.${toString elemIdx}"; value = elem; })) + if isList def.value then + { inherit (def) file; + value = listToAttrs ( + imap (elemIdx: elem: + { name = "unnamed-${toString defIdx}.${toString elemIdx}"; + value = elem; + }) def.value); + } else def; listOnly = listOf elemType; attrOnly = attrsOf elemType; - in mkOptionType { name = "list or attribute set of ${elemType.name}s"; check = x: if isList x then listOnly.check x else if isAttrs x then attrOnly.check x else false; - merge = args: defs: attrOnly.merge args (imap convertIfList defs); + merge = loc: defs: attrOnly.merge loc (imap convertIfList defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; @@ -155,29 +158,23 @@ rec { getSubOptions = elemType.getSubOptions; }; - none = elemType: mkOptionType { - inherit (elemType) name check; - merge = args: list: - throw "No definitions are allowed for the option `${showOption args.prefix}'."; - getSubOptions = elemType.getSubOptions; - }; - nullOr = elemType: mkOptionType { name = "null or ${elemType.name}"; check = x: builtins.isNull x || elemType.check x; - merge = args: defs: - if all isNull defs then null - else if any isNull defs then - throw "The option `${showOption args.prefix}' is defined both null and not null, in ${showFiles args.files}." - else elemType.merge args defs; + merge = loc: defs: + let nrNulls = count (def: isNull def.value) 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)}." + else elemType.merge loc defs; getSubOptions = elemType.getSubOptions; }; functionTo = elemType: mkOptionType { name = "function that evaluates to a(n) ${elemType.name}"; check = builtins.isFunction; - merge = args: fns: - fnArgs: elemType.merge args (map (fn: fn fnArgs) fns); + merge = loc: defs: + fnArgs: elemType.merge loc (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs); getSubOptions = elemType.getSubOptions; }; @@ -186,11 +183,11 @@ rec { mkOptionType rec { name = "submodule"; check = x: isAttrs x || builtins.isFunction x; - merge = args: defs: + merge = loc: defs: let coerce = def: if builtins.isFunction def then def else { config = def; }; - modules = opts' ++ map coerce defs; - in (evalModules { inherit modules args; prefix = args.prefix; }).config; + modules = opts' ++ map (def: { _file = def.file; imports = [(coerce def.value)]; }) defs; + in (evalModules { inherit modules; args.name = last loc; prefix = loc; }).config; getSubOptions = prefix: (evalModules { modules = opts'; inherit prefix; # FIXME: hack to get shit to evaluate. @@ -206,8 +203,4 @@ rec { }; - - /* Helper function. */ - addToPrefix = args: name: args // { prefix = args.prefix ++ [name]; }; - } diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix index 36f8549af8e..e3fbdd7aaec 100644 --- a/nixos/modules/config/shells-environment.nix +++ b/nixos/modules/config/shells-environment.nix @@ -25,15 +25,17 @@ in ''; type = types.attrsOf (mkOptionType { name = "a string or a list of strings"; - merge = args: xs: - let xs' = filterOverrides xs; in - if isList (head xs') then concatLists xs' - else if builtins.lessThan 1 (length xs') then - # Don't show location info here, since it's too general. - throw "The option `${showOption args.prefix}' is defined multiple times." - else if !builtins.isString (head xs') then - throw "The option `${showOption args.prefix}' does not have a string value." - else head xs'; + merge = loc: defs: + let + defs' = filterOverrides defs; + res = (head defs').value; + in + if isList res then concatLists (getValues defs') + else if builtins.lessThan 1 (length defs') then + throw "The option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}." + else if !builtins.isString res then + throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}." + else res; }); apply = mapAttrs (n: v: if isList v then concatStringsSep ":" v else v); }; diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index a825144e466..31441bad615 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -7,7 +7,7 @@ let sysctlOption = mkOptionType { name = "sysctl option value"; check = x: builtins.isBool x || builtins.isString x || builtins.isInt x; - merge = args: xs: last xs; # FIXME: hacky way to allow overriding in configuration.nix. + merge = args: defs: (last defs).value; # FIXME: hacky way to allow overriding in configuration.nix. }; in diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index dfbd98bf6ee..239da2859e9 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -26,7 +26,7 @@ let configType = mkOptionType { name = "nixpkgs config"; check = traceValIfNot isConfig; - merge = args: fold mergeConfig {}; + merge = args: fold (def: mergeConfig def.value) {}; }; in From e3e3666e24e2387503e89c3f8c53cdde54987a76 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 14:53:06 +0100 Subject: [PATCH 124/179] smartd.nix: Fix broken option type --- nixos/modules/services/monitoring/smartd.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index b0619a16175..512e639721e 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -12,15 +12,14 @@ let device = mkOption { example = "/dev/sda"; - type = types.string; + type = types.str; description = "Location of the device."; }; options = mkOption { default = ""; example = "-d sat"; - type = types.string; - apply = pkgs.lib.concatStringsSep " "; + type = types.separatedString " "; description = "Options that determine how smartd monitors the device."; }; }; From c2f35087d22d1064cc260152777b6802ab272618 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Sun, 27 Oct 2013 04:17:23 -0500 Subject: [PATCH 125/179] Add ZFS dependencies to the initrd so that the zpool command works. Remove unneeded zfs mount, since zpool automatically mounts everything. Close #1128. --- nixos/modules/tasks/filesystems/zfs.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index c1955b14691..efd546f3baa 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -55,11 +55,12 @@ in cp -v ${kernel.zfs}/sbin/zfs $out/bin cp -v ${kernel.zfs}/sbin/zdb $out/bin cp -v ${kernel.zfs}/sbin/zpool $out/bin + cp -pdv ${kernel.zfs}/lib/lib*.so* $out/lib + cp -pdv ${pkgs.zlib}/lib/lib*.so* $out/lib ''; postDeviceCommands = '' zpool import -f -a -d /dev - zfs mount -a ''; }; From df548ffc9e9038705323876beb026a68855d162f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 15:29:50 +0100 Subject: [PATCH 126/179] Remove unused Xfce files --- pkgs/desktops/xfce/4_08.nix | 37 -------------------------- pkgs/desktops/xfce/4_10.nix | 35 ------------------------ pkgs/desktops/xfce/core/xfce-utils.nix | 20 -------------- 3 files changed, 92 deletions(-) delete mode 100644 pkgs/desktops/xfce/4_08.nix delete mode 100644 pkgs/desktops/xfce/4_10.nix delete mode 100644 pkgs/desktops/xfce/core/xfce-utils.nix diff --git a/pkgs/desktops/xfce/4_08.nix b/pkgs/desktops/xfce/4_08.nix deleted file mode 100644 index d29e3ac51ef..00000000000 --- a/pkgs/desktops/xfce/4_08.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ pkgs, newScope }: let - -common = (import ./common.nix) { inherit pkgs newScope xfce_self; }; -callPackage = common.callPackage; - -xfce_self = common.xfce_common // rec { # the lines are very long but it seems better than the even-odd line approach - - #### CORE - - exo = callPackage ./core/exo.nix { v= "0.6.2"; h= "0f8zh5y057l7xffskjvky6k88hrnz6jyk35mvlfpmx26anlgd77l"; }; - libxfce4ui = callPackage ./core/libxfce4ui.nix { v= "4.8.1"; h= "0mlrcr8rqmv047xrb2dbh7f4knsppb1anx2b05s015h6v8lyvjrr"; }; - libxfce4util = callPackage ./core/libxfce4util.nix { v= "4.8.2"; h= "05n8586h2fwkibfld5fm4ygx1w66jnbqqb3li0ardjvm2n24k885"; }; - libxfcegui4 = callPackage ./core/libxfcegui4.nix { v= "4.8.1"; h= "0hr4h6a9p6w3qw1976p8v9c9pwhd9zhrjlbaph0p7nyz7j1836ih"; }; - thunar = callPackage ./core/thunar.nix { v= "1.2.3"; h= "19mczys6xr683r68g3s2njrrmnk1p73zypvwrhajw859c6nsjsp6"; }; - xfce4panel = callPackage ./core/xfce4-panel.nix { v= "4.8.6"; h= "00zdkg1jg4n2n109nxan8ji2m06r9mc4lnlrvb55xvj229m2dwb6"; }; - xfce4session = callPackage ./core/xfce4-session.nix { v= "4.8.2"; h= "1l608kik98jxbjl73waf8515hzji06lr80qmky2qlnp0b6js5g1i"; }; - xfce4settings = callPackage ./core/xfce4-settings.nix { v= "4.8.3"; h= "0bmw0s6jp2ws4n0f3387zwsyv46b0w89m6r70yb7wrqy9r3wqy6q"; }; - xfceutils = callPackage ./core/xfce-utils.nix { v= "4.8.3"; h= "09mr0amp2f632q9i3vykaa0x5nrfihfm9v5nxsx9vch8wvbp0l03"; }; - xfconf = callPackage ./core/xfconf.nix { v= "4.8.1"; h= "1jwkb73xcgqfly449jwbn2afiyx50p150z60x19bicps75sp6q4q"; }; - xfdesktop = callPackage ./core/xfdesktop.nix { v= "4.8.3"; h= "097lc9djmay0jyyl42jmvcfda75ndp265nzn0aa3hv795bsn1175"; }; - xfwm4 = callPackage ./core/xfwm4.nix { v= "4.8.3"; h= "0zi2g1d2jdgw5armlk9xjh4ykmydy266gdba86nmhy951gm8n3hb"; }; - - xfce4_appfinder = callPackage ./core/xfce4-appfinder.nix { v= "4.8.0"; h= "0zy7i9x4qjchmyb8nfpb7m2ply5n2aq35p9wrhb8lpz4am1ihx7x"; }; - - #### APPLICATIONS - - terminal = null; # newer versions don't build with 4.8 - - # versions > 0.3* don't build with xfce-4.8.* - ristretto = callPackage ./applications/ristretto.nix { v= "0.3.7"; h= "19mzy159j4qhd7pd1b83gimxfdg3mwdab9lq9kk505d21r7iqc9b"; }; - - xfce4mixer = callPackage ./applications/xfce4-mixer.nix { v= "4.8.0"; h= "1aqgjxvck6hx26sk3n4n5avhv02vs523mfclcvjb3xnks3yli7wz"; }; - -}; # xfce_self - -in xfce_self - diff --git a/pkgs/desktops/xfce/4_10.nix b/pkgs/desktops/xfce/4_10.nix deleted file mode 100644 index 3f846198e3f..00000000000 --- a/pkgs/desktops/xfce/4_10.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ pkgs, newScope }: let - -common = (import ./common.nix) { inherit pkgs newScope xfce_self; }; -callPackage = common.callPackage; - -xfce_self = common.xfce_common // rec { # the lines are very long but it seems better than the even-odd line approach - - #### CORE - - exo = callPackage ./core/exo.nix { v= "0.10.2"; h= "1kknxiz703q4snmry65ajm26jwjslbgpzdal6bd090m3z25q51dk"; }; - libxfce4ui = callPackage ./core/libxfce4ui.nix { v= "4.10.0"; h= "1qm31s6568cz4c8rl9fsfq0xmf7pldxm0ki62gx1cpybihlgmfd2"; }; - libxfce4util = callPackage ./core/libxfce4util.nix { v= "4.10.0"; h= "13k0wwbbqvdmbj4xmk4nxdlgvrdgr5y6r3dk380mzfw053hzwy89"; }; - libxfcegui4 = callPackage ./core/libxfcegui4.nix { v= "4.10.0"; h= "0cs5im0ib0cmr1lhr5765yliqjfyxvk4kwy8h1l8bn3mj6bzk0ib"; }; - thunar = callPackage ./core/thunar.nix { v= "1.6.2"; h= "11dx38rvkfbp91pxrprymxhimsm90gvizp277x9s5rwnwcm1ggbx"; }; - xfce4panel = callPackage ./core/xfce4-panel.nix { v= "4.10.0"; h= "1f8903nx6ivzircl8d8s9zna4vjgfy0qhjk5d2x19g9bmycgj89k"; }; - xfce4session = callPackage ./core/xfce4-session.nix { v= "4.10.0"; h= "1kj65jkjhd0ysf0yxsf88wzpyv6n8i8qgd3gb502hf1x9jksk2mv"; }; - xfce4settings = callPackage ./core/xfce4-settings.nix { v= "4.10.0"; h= "0zppq747z9lrxyv5zrrvpalq7hb3gfhy9p7qbldisgv7m6dz0hq8"; }; - xfceutils = null; # removed in 4.10 - xfconf = callPackage ./core/xfconf.nix { v= "4.10.0"; h= "0xh520z0qh0ib0ijgnyrgii9h5d4pc53n6mx1chhyzfc86j1jlhp"; }; - xfdesktop = callPackage ./core/xfdesktop.nix { v= "4.10.0"; h= "0yrddj1lgk3xn4w340y89z7x2isks72ia36pka08kk2x8gpfcyl9"; }; - xfwm4 = callPackage ./core/xfwm4.nix { v= "4.10.0"; h= "170zzs7adj47srsi2cl723w9pl8k8awd7w1bpzxby7hj92zmf8s9"; }; - - xfce4_appfinder = callPackage ./core/xfce4-appfinder.nix { v= "4.9.4"; h= "12lgrbd1n50w9n8xkpai98s2aw8vmjasrgypc57sp0x0qafsqaxq"; }; - - #### APPLICATIONS - - ristretto = callPackage ./applications/ristretto.nix { v= "0.6.3"; h= "0y9d8w1plwp4vmxs44y8k8x15i0k0xln89k6jndhv6lf57g1cs1b"; }; - terminal = xfce4terminal; # it has changed its name - xfce4mixer = callPackage ./applications/xfce4-mixer.nix { v= "4.10.0"; h= "1pnsd00583l7p5d80rxbh58brzy3jnccwikbbbm730a33c08kid8"; }; - xfce4terminal = callPackage ./applications/terminal.nix { v= "0.6.1"; h= "1j6lpkq952mrl5p24y88f89wn9g0namvywhma639xxsswlkn8d31"; }; - -}; - -in xfce_self - diff --git a/pkgs/desktops/xfce/core/xfce-utils.nix b/pkgs/desktops/xfce/core/xfce-utils.nix deleted file mode 100644 index 625780adb31..00000000000 --- a/pkgs/desktops/xfce/core/xfce-utils.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ v, h, stdenv, fetchXfce, pkgconfig, intltool, gtk, libxfce4util, libxfce4ui, dbus_glib }: - -stdenv.mkDerivation rec { - name = "xfce-utils-${v}"; - src = fetchXfce.core name h; - - configureFlags = "--with-xsession-prefix=$(out)/share/xsessions --with-vendor-info=NixOS.org"; - - buildInputs = [ pkgconfig intltool gtk libxfce4util libxfce4ui dbus_glib ]; - - preFixup = "rm $out/share/icons/hicolor/icon-theme.cache"; - - meta = { - homepage = http://www.xfce.org/projects/xfce-utils; - description = "Utilities and scripts for Xfce"; - license = "GPLv2+"; - platforms = stdenv.lib.platforms.linux; - maintainers = [ stdenv.lib.maintainers.eelco ]; - }; -} From db2a9afb75abc50497fcde61470c2b83795e4669 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 15:31:09 +0100 Subject: [PATCH 127/179] Remove obsolete xfceutils attribute --- nixos/modules/services/x11/desktop-managers/xfce.nix | 1 - pkgs/desktops/xfce/default.nix | 1 - 2 files changed, 2 deletions(-) diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix index f5d544ad046..d7621c82d12 100644 --- a/nixos/modules/services/x11/desktop-managers/xfce.nix +++ b/nixos/modules/services/x11/desktop-managers/xfce.nix @@ -60,7 +60,6 @@ in pkgs.xfce.xfce4session pkgs.xfce.xfce4settings pkgs.xfce.xfce4mixer - pkgs.xfce.xfceutils pkgs.xfce.xfconf pkgs.xfce.xfdesktop pkgs.xfce.xfwm4 diff --git a/pkgs/desktops/xfce/default.nix b/pkgs/desktops/xfce/default.nix index a6107d0a870..f812336ee7f 100644 --- a/pkgs/desktops/xfce/default.nix +++ b/pkgs/desktops/xfce/default.nix @@ -30,7 +30,6 @@ xfce_self = rec { # the lines are very long but it seems better than the even-od xfce4session = callPackage ./core/xfce4-session.nix { }; xfce4settings = callPackage ./core/xfce4-settings.nix { }; xfce4_power_manager = callPackage ./core/xfce4-power-manager.nix { }; - xfceutils = null; # removed in 4.10 xfconf = callPackage ./core/xfconf.nix { }; xfdesktop = callPackage ./core/xfdesktop.nix { }; xfwm4 = callPackage ./core/xfwm4.nix { }; From 70a2c545274cda238c5eda28b60cfa9dbc6f7ed6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 15:33:20 +0100 Subject: [PATCH 128/179] Strictly check the arguments to mkOption And fix various instances of bad arguments. --- lib/options.nix | 23 ++++++++-------- lib/types.nix | 3 +++ nixos/modules/config/fonts/fontconfig.nix | 1 + nixos/modules/services/games/ghost-one.nix | 3 ++- nixos/modules/services/networking/bitlbee.nix | 2 +- .../modules/services/networking/minidlna.nix | 2 +- .../modules/services/networking/ssh/sshd.nix | 2 +- .../system/boot/systemd-unit-options.nix | 26 ++++++++++--------- nixos/modules/system/upstart/upstart.nix | 22 +++++++--------- 9 files changed, 45 insertions(+), 39 deletions(-) diff --git a/lib/options.nix b/lib/options.nix index 5a05775e8c2..d1a161cf763 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -11,17 +11,18 @@ with import ./strings.nix; rec { isOption = lib.isType "option"; - mkOption = attrs: attrs // { - _type = "option"; - # name (this is the name of the attributem it is automatically generated by the traversal) - # default (value used when no definition exists) - # example (documentation) - # description (documentation) - # type (option type, provide a default merge function and ensure type correctness) - # merge (function used to merge definitions into one definition: [ /type/ ] -> /type/) - # apply (convert the option value to ease the manipulation of the option result) - # options (set of sub-options declarations & definitions) - }; + mkOption = + { default ? null # Default value used when no definition is given in the configuration. + , defaultText ? null # Textual representation of the default, for in the manual. + , example ? null # Example value used in the manual. + , description ? null # String describing the option. + , type ? null # Option type, providing type-checking and value merging. + , apply ? null # Function that converts the option value to something else. + , internal ? null # Whether the option is for NixOS developers only. + , visible ? null # Whether the option shows up in the manual. + , options ? null # Obsolete, used by types.optionSet. + } @ attrs: + attrs // { _type = "option"; }; mkEnableOption = name: mkOption { default = false; diff --git a/lib/types.nix b/lib/types.nix index cf8eef00833..2b3aa23df2f 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -201,6 +201,9 @@ rec { name = /* builtins.trace "types.optionSet is deprecated; use types.submodule instead" */ "option set"; }; + # Augment the given type with an additional type check function. + addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; }; + }; } diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index 6e0fdaf4b74..987bb1088c0 100644 --- a/nixos/modules/config/fonts/fontconfig.nix +++ b/nixos/modules/config/fonts/fontconfig.nix @@ -9,6 +9,7 @@ with pkgs.lib; fonts = { enableFontConfig = mkOption { # !!! should be enableFontconfig + type = types.bool; default = true; description = '' If enabled, a Fontconfig configuration file will be built diff --git a/nixos/modules/services/games/ghost-one.nix b/nixos/modules/services/games/ghost-one.nix index 815118be1c6..92c9112eeb6 100644 --- a/nixos/modules/services/games/ghost-one.nix +++ b/nixos/modules/services/games/ghost-one.nix @@ -21,7 +21,8 @@ in language = mkOption { default = "English"; - check = lang: elem lang [ "English" "Spanish" "Russian" "Serbian" "Turkish" ]; + type = types.addCheck types.str + (lang: elem lang [ "English" "Spanish" "Russian" "Serbian" "Turkish" ]); description = "The language of bot messages: English, Spanish, Russian, Serbian or Turkish."; }; diff --git a/nixos/modules/services/networking/bitlbee.nix b/nixos/modules/services/networking/bitlbee.nix index 82e875f5aae..fe37e8ea012 100644 --- a/nixos/modules/services/networking/bitlbee.nix +++ b/nixos/modules/services/networking/bitlbee.nix @@ -64,7 +64,7 @@ in authMode = mkOption { default = "Open"; - check = authModeCheck; + type = types.addCheck types.str authModeCheck; description = '' The following authentication modes are available: Open -- Accept connections from anyone, use NickServ for user authentication. diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix index ea5bc8514f1..e31d77f13fe 100644 --- a/nixos/modules/services/networking/minidlna.nix +++ b/nixos/modules/services/networking/minidlna.nix @@ -32,7 +32,7 @@ in services.minidlna.mediaDirs = mkOption { type = types.listOf types.string; default = []; - examples = [ "/data/media" "V,/home/alice/video" ]; + example = [ "/data/media" "V,/home/alice/video" ]; description = '' Directories to be scanned for media files. The prefixes diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index f5670ccdcbf..360c745f362 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -102,7 +102,7 @@ in permitRootLogin = mkOption { default = "without-password"; - check = permitRootLoginCheck; + type = types.addCheck types.str permitRootLoginCheck; description = '' Whether the root user can login using ssh. Valid values are yes, without-password, diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index ac9e636fe1e..a1faea886f9 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -2,7 +2,19 @@ with pkgs.lib; -rec { +let + + checkService = v: + let assertValueOneOf = name: values: attr: + let val = getAttr name attr; + in optional ( hasAttr name attr && !elem val values) "Systemd service field `${name}' cannot have value `${val}'."; + checkType = assertValueOneOf "Type" ["simple" "forking" "oneshot" "dbus" "notify" "idle"]; + checkRestart = assertValueOneOf "Restart" ["no" "on-success" "on-failure" "on-abort" "always"]; + errors = concatMap (c: c v) [checkType checkRestart]; + in if errors == [] then true + else builtins.trace (concatStringsSep "\n" errors) false; + +in rec { unitOptions = { @@ -147,23 +159,13 @@ rec { { StartLimitInterval = 10; RestartSec = 5; }; - type = types.attrs; + type = types.addCheck types.attrs checkService; description = '' Each attribute in this set specifies an option in the [Service] section of the unit. See systemd.service 5 for details. ''; - - check = v: - let assertValueOneOf = name: values: attr: - let val = getAttr name attr; - in optional ( hasAttr name attr && !elem val values) "${name} ${val} not known to systemd"; - checkType = assertValueOneOf "Type" ["simple" "forking" "oneshot" "dbus" "notify" "idle"]; - checkRestart = assertValueOneOf "Restart" ["no" "on-success" "on-failure" "on-abort" "always"]; - errors = concatMap (c: c v) [checkType checkRestart]; - in if errors == [] then true - else builtins.trace (concatStringsSep "\n" errors) false; }; script = mkOption { diff --git a/nixos/modules/system/upstart/upstart.nix b/nixos/modules/system/upstart/upstart.nix index 58523652864..464041ebe6b 100644 --- a/nixos/modules/system/upstart/upstart.nix +++ b/nixos/modules/system/upstart/upstart.nix @@ -104,7 +104,7 @@ let name = mkOption { # !!! The type should ensure that this could be a filename. - type = types.string; + type = types.str; example = "sshd"; description = '' Name of the Upstart job. @@ -113,7 +113,7 @@ let startOn = mkOption { # !!! Re-enable this once we're on Upstart >= 0.6. - #type = types.string; + #type = types.str; default = ""; description = '' The Upstart event that triggers this job to be started. @@ -122,7 +122,7 @@ let }; stopOn = mkOption { - type = types.string; + type = types.str; default = "starting shutdown"; description = '' The Upstart event that triggers this job to be stopped. @@ -130,7 +130,7 @@ let }; postStart = mkOption { - type = types.string; + type = types.lines; default = ""; description = '' Shell commands executed after the job is started (i.e. after @@ -140,7 +140,7 @@ let }; preStop = mkOption { - type = types.string; + type = types.lines; default = ""; description = '' Shell commands executed before the job is stopped @@ -150,7 +150,7 @@ let }; postStop = mkOption { - type = types.string; + type = types.lines; default = ""; description = '' Shell commands executed after the job has stopped @@ -159,7 +159,7 @@ let }; exec = mkOption { - type = types.string; + type = types.str; default = ""; description = '' Command to start the job's main process. If empty, the @@ -189,7 +189,7 @@ let }; daemonType = mkOption { - type = types.string; + type = types.str; default = "none"; description = '' Determines how Upstart detects when a daemon should be @@ -203,8 +203,7 @@ let }; setuid = mkOption { - type = types.string; - check = userExists; + type = types.addCheck types.str userExists; default = ""; description = '' Run the daemon as a different user. @@ -212,8 +211,7 @@ let }; setgid = mkOption { - type = types.string; - check = groupExists; + type = types.addCheck types.str groupExists; default = ""; description = '' Run the daemon as a different group. From e4ebc0336781901fea0718071a659fa5163cbc63 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Wed, 30 Oct 2013 09:54:40 +0100 Subject: [PATCH 129/179] znc: add support for modules, add fish and push module Close #1148. --- pkgs/applications/networking/znc/default.nix | 1 + pkgs/applications/networking/znc/modules.nix | 56 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++ 3 files changed, 61 insertions(+) create mode 100644 pkgs/applications/networking/znc/modules.nix diff --git a/pkgs/applications/networking/znc/default.nix b/pkgs/applications/networking/znc/default.nix index 13c3977a979..a43d8fa9d11 100644 --- a/pkgs/applications/networking/znc/default.nix +++ b/pkgs/applications/networking/znc/default.nix @@ -29,5 +29,6 @@ stdenv.mkDerivation rec { homepage = http://wiki.znc.in/ZNC; maintainers = [ stdenv.lib.maintainers.viric ]; license = "ASL2.0"; + platforms = stdenv.lib.platforms.unix; }; } diff --git a/pkgs/applications/networking/znc/modules.nix b/pkgs/applications/networking/znc/modules.nix new file mode 100644 index 00000000000..ba6d36a3c76 --- /dev/null +++ b/pkgs/applications/networking/znc/modules.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchurl, fetchgit, znc }: + +let + + zncDerivation = a@{ + name, src, module_name, + buildPhase ? "${znc}/bin/znc-buildmod ${module_name}.cpp", + installPhase ? "install -D ${module_name}.so $out/lib/znc/${module_name}.so", ... + } : stdenv.mkDerivation (a // { + inherit buildPhase; + inherit installPhase; + + meta.platforms = stdenv.lib.platforms.unix; + passthru.module_name = module_name; + }); + +in rec { + + push = zncDerivation rec { + name = "znc-push-${version}"; + version = "1.0.0"; + module_name = "push"; + + src = fetchurl { + url = "https://github.com/jreese/znc-push/archive/v${version}.tar.gz"; + sha256 = "1v9a16b1d8mfzhddf4drh6rbxa0szr842g7614r8ninmc0gi7a2v"; + }; + + meta = { + description = "Push notification service module for ZNC"; + homepage = https://github.com/jreese/znc-push; + repositories.git = https://github.com/jreese/znc-push.git; + license = stdenv.lib.license.mit; + maintainers = [ stdenv.lib.maintainers.offline ]; + }; + }; + + fish = zncDerivation rec { + name = "znc-fish-8e1f150fda"; + module_name = "fish"; + + src = fetchgit { + url = meta.repositories.git; + rev = "8e1f150fdaf18dc33e023795584dec8255e6614e"; + sha256 = "0vpk4336c191irl3g7wibblnbqf3903hjrci4gs0qgg1wvj7fw66"; + }; + + meta = { + description = "ZNC FiSH module"; + homepage = https://github.com/dctrwatson/znc-fish; + repositories.git = https://github.com/dctrwatson/znc-fish.git; + maintainers = [ stdenv.lib.maintainers.offline ]; + }; + }; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 532ffc1871f..3d47bb70037 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10258,6 +10258,10 @@ let znc = callPackage ../applications/networking/znc { }; + zncModules = recurseIntoAttrs ( + callPackage ../applications/networking/znc/modules.nix { } + ); + zsnes = callPackage_i686 ../misc/emulators/zsnes { libpng = libpng12; }; From 383bb29d234d3466e0b5decc3d4f31d5a06645ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20Pag=C3=A8s?= Date: Thu, 24 Oct 2013 12:44:03 +0200 Subject: [PATCH 130/179] Add qpid v0.24 It includes both the broker and the C++ client lib. I had to do some hacks to prevent the installer from putting thins outside $out. Close #1134. --- pkgs/servers/amqp/qpid-cpp/default.nix | 37 ++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 39 insertions(+) create mode 100644 pkgs/servers/amqp/qpid-cpp/default.nix diff --git a/pkgs/servers/amqp/qpid-cpp/default.nix b/pkgs/servers/amqp/qpid-cpp/default.nix new file mode 100644 index 00000000000..9fc3520002c --- /dev/null +++ b/pkgs/servers/amqp/qpid-cpp/default.nix @@ -0,0 +1,37 @@ +{ stdenv, fetchurl, cmake, python, boost, libuuid }: + +stdenv.mkDerivation rec { + name = "${project}-cpp-${version}"; + + project = "qpid"; + version = "0.24"; + + src = fetchurl { + url = "mirror://apache/${project}/${version}/${name}.tar.gz"; + sha256 = "08nfks5jjipy5i4b6mz62ijrz5ryq32c478ix7l3fzmaim3cy8b8"; + }; + + buildInputs = [ cmake python boost libuuid ]; + + # workaround this + #/nix/store/n38ns73bm4iv62fihd9ih5b39w54yyaf-boost-1.54.0/include/boost/ptr_container/detail/map_iterator.hpp:52:48: + #error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] + cmakeFlags = "-DENABLE_WARNINGS=OFF"; + + # the subdir managementgen wants to install python stuff in ${python} and + # the installation tries to create some folders in /var + patchPhase = '' + sed -i '/managementgen/d' CMakeLists.txt + sed -i '/ENV/d' src/CMakeLists.txt + ''; + + meta = { + homepage = http://qpid.apache.org; + repositories.git = git://git.apache.org/qpid.git; + repositories.svn = http://svn.apache.org/repos/asf/qpid; + description = "An AMQP message broker and a C++ messaging API"; + license = stdenv.lib.licenses.asl20; + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.page ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3d47bb70037..39dbeae6df4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6295,6 +6295,8 @@ let inherit xmpppy python makeWrapper fetchcvs; }; + qpid-cpp = callPackage ../servers/amqp/qpid-cpp { }; + rabbitmq_server = callPackage ../servers/amqp/rabbitmq-server { }; radius = callPackage ../servers/radius { }; From d7d3c8fd828cf6aba4d511be1927458507422a67 Mon Sep 17 00:00:00 2001 From: Vladimir Still Date: Wed, 30 Oct 2013 19:00:09 +0200 Subject: [PATCH 131/179] sqliteodbc: update to 0.995, add more metadata close #1122 --- .../libraries/unixODBCDrivers/default.nix | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/pkgs/development/libraries/unixODBCDrivers/default.nix b/pkgs/development/libraries/unixODBCDrivers/default.nix index 421843b2737..47925520ab4 100644 --- a/pkgs/development/libraries/unixODBCDrivers/default.nix +++ b/pkgs/development/libraries/unixODBCDrivers/default.nix @@ -78,19 +78,29 @@ args : with args; "FileUsage = 3\n "; }; sqlite = rec { - deriv = stdenv.mkDerivation { - name = "sqlite-connector-odbc-3.51.12"; + deriv = let version = "0.995"; in + stdenv.mkDerivation { + name = "sqlite-connector-odbc-${version}"; + src = fetchurl { - url = http://www.ch-werner.de/sqliteodbc/sqliteodbc-0.70.tar.gz; - sha256 = "0ysyqdqkxqcqxrxgi15cbrzia9z6yalim5c88faad85bwanx4db8"; + url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz"; + sha256 = "1r97fw6xy5w2f8c0ii7blfqfi6salvd3k8wnxpx9wqc1gxk8jnyy"; }; + + buildInputs = [ sqlite ]; + configureFlags = "--with-sqlite3=${sqlite} --with-odbc=${unixODBC}"; - postInstall = ''mkdir lib; mv $out/* lib; mv lib $out''; - buildInputs = [libtool zlib sqlite]; + + postInstall = '' + mkdir -p $out/lib + ''; + meta = { - description = "sqlite odbc connector, install using configuration.nix"; - homepage = http://www.ch-werner.de/sqliteodbc/html/index.html; - license = "BSD"; + description = "ODBC driver for SQLite"; + homepage = http://www.ch-werner.de/sqliteodbc; + license = stdenv.lib.licenses.bsd2; + platforms = stdenv.lib.platforms.linux; + maintainers = with stdenv.lib.maintainers; [ vlstill ]; }; }; ini = From 58f520601c3696c03edbaf04969f1ca7bf3028bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Wed, 30 Oct 2013 18:14:56 +0100 Subject: [PATCH 132/179] pythonPackages.substanced: correct sha256 --- pkgs/top-level/python-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 00036663b85..3dc6a36bb7e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1851,7 +1851,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { src = fetchgit { inherit rev; url = "https://github.com/Pylons/substanced.git"; - sha256 = "e32ddfba5310a2a9814abb4f6702eded8e7b7ad867d7a7337e8f4e3b3fb8e0b3"; + sha256 = "eded6468563328af37a07aeb88ef81ed78ccaff2ab687cac34ad2b36e19abcb4"; }; buildInputs = [ mock ]; From 0f8b1b1a5c52a8171d9028e1df74949aea264c72 Mon Sep 17 00:00:00 2001 From: Eric Kow Date: Wed, 30 Oct 2013 16:12:55 +0000 Subject: [PATCH 133/179] libusb1: avoid -lgcc_s on darwin close #1151 --- pkgs/development/libraries/libusb1/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix index d4504a26b7f..9a6a303fe32 100644 --- a/pkgs/development/libraries/libusb1/default.nix +++ b/pkgs/development/libraries/libusb1/default.nix @@ -11,7 +11,7 @@ stdenv.mkDerivation rec { buildInputs = [ pkgconfig ]; propagatedBuildInputs = stdenv.lib.optional (stdenv.isLinux) udev; - NIX_LDFLAGS = "-lgcc_s"; + NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s"; meta = { homepage = http://www.libusb.org; From be5d3a59dd3684ffabf456728938ed0f6f3df59c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 16:19:07 +0100 Subject: [PATCH 134/179] Clean up some option examples --- lib/options.nix | 3 +- nixos/doc/manual/options-to-docbook.xsl | 9 +-- nixos/modules/misc/nixpkgs.nix | 6 +- nixos/modules/services/networking/openvpn.nix | 58 +++++++++---------- .../web-servers/apache-httpd/default.nix | 2 +- .../services/x11/display-managers/default.nix | 21 +++---- .../modules/system/boot/loader/grub/grub.nix | 2 +- nixos/modules/system/etc/etc.nix | 5 +- 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/lib/options.nix b/lib/options.nix index d1a161cf763..63798c4faa3 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -98,7 +98,8 @@ rec { representation of derivations is very large (on the order of megabytes) and is not actually used by the manual generator. */ scrubOptionValue = x: - if isDerivation x then { type = "derivation"; drvPath = x.name; outPath = x.name; name = x.name; } + if isDerivation x then + { type = "derivation"; drvPath = x.name; outPath = x.name; name = x.name; } else if isList x then map scrubOptionValue x else if isAttrs x then mapAttrs (n: v: scrubOptionValue v) (removeAttrs x ["_args"]) else x; diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index f4bdc6288b1..6d11ad7a6c4 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -157,14 +157,7 @@ - - - (download of ) - - - (build of ) - - + (build of ) diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 239da2859e9..1d9b89a0b0f 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -59,7 +59,7 @@ in }; nixpkgs.system = mkOption { - default = pkgs.stdenv.system; + type = types.str; description = '' Specifies the Nix platform type for which NixOS should be built. If unset, it defaults to the platform type of your host system @@ -70,4 +70,8 @@ in }; }; + + config = { + nixpkgs.system = pkgs.stdenv.system; + }; } diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix index 8cc19506e21..400cb74f7d9 100644 --- a/nixos/modules/services/networking/openvpn.nix +++ b/nixos/modules/services/networking/openvpn.nix @@ -75,36 +75,36 @@ in services.openvpn.servers = mkOption { default = {}; - example = { + example = literalExample '' + { + server = { + config = ''' + # Simplest server configuration: http://openvpn.net/index.php/documentation/miscellaneous/static-key-mini-howto.html. + # server : + dev tun + ifconfig 10.8.0.1 10.8.0.2 + secret /root/static.key + '''; + up = "ip route add ..."; + down = "ip route del ..."; + }; - server = { - config = '' - # Simplest server configuration: http://openvpn.net/index.php/documentation/miscellaneous/static-key-mini-howto.html. - # server : - dev tun - ifconfig 10.8.0.1 10.8.0.2 - secret /root/static.key - ''; - up = "ip route add ..."; - down = "ip route del ..."; - }; - - client = { - config = '' - client - remote vpn.example.org - dev tun - proto tcp-client - port 8080 - ca /root/.vpn/ca.crt - cert /root/.vpn/alice.crt - key /root/.vpn/alice.key - ''; - up = "echo nameserver $nameserver | ${pkgs.openresolv}/sbin/resolvconf -m 0 -a $dev"; - down = "${pkgs.openresolv}/sbin/resolvconf -d $dev"; - }; - - }; + client = { + config = ''' + client + remote vpn.example.org + dev tun + proto tcp-client + port 8080 + ca /root/.vpn/ca.crt + cert /root/.vpn/alice.crt + key /root/.vpn/alice.key + '''; + up = "echo nameserver $nameserver | ''${pkgs.openresolv}/sbin/resolvconf -m 0 -a $dev"; + down = "''${pkgs.openresolv}/sbin/resolvconf -d $dev"; + }; + } + ''; description = '' Each attribute of this option defines an Upstart job to run an diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index e9cf9ae5e3e..d21b6da0e77 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -445,7 +445,7 @@ in extraModules = mkOption { type = types.listOf types.unspecified; default = []; - example = [ "proxy_connect" { name = "php5"; path = "${php}/modules/libphp5.so"; } ]; + example = literalExample ''[ "proxy_connect" { name = "php5"; path = "''${php}/modules/libphp5.so"; } ]''; description = '' Additional Apache modules to be used. These can be specified as a string in the case of modules distributed diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 65b634f9482..0910708002b 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -204,16 +204,17 @@ in session = mkOption { default = []; - example = [ - { - manage = "desktop"; - name = "xterm"; - start = " - ${pkgs.xterm}/bin/xterm -ls & - waitPID=$! - "; - } - ]; + example = literalExample + '' + [ { manage = "desktop"; + name = "xterm"; + start = ''' + ''${pkgs.xterm}/bin/xterm -ls & + waitPID=$! + '''; + } + ] + ''; description = '' List of sessions supported with the command used to start each session. Each session script can set the diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index e18a1d4c112..56cb7cbeaa6 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -156,7 +156,7 @@ in extraFiles = mkOption { default = {}; example = literalExample '' - { "memtest.bin" = "${pkgs.memtest86plus}/memtest.bin"; } + { "memtest.bin" = "''${pkgs.memtest86plus}/memtest.bin"; } ''; description = '' A set of files to be copied to /boot. diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix index 30d0119c293..b22259b6d63 100644 --- a/nixos/modules/system/etc/etc.nix +++ b/nixos/modules/system/etc/etc.nix @@ -32,13 +32,14 @@ in environment.etc = mkOption { type = types.loaOf types.optionSet; default = {}; - example = + example = literalExample '' { hosts = { source = "/nix/store/.../etc/dir/file.conf.example"; mode = "0440"; }; "default/useradd".text = "GROUP=100 ..."; - }; + } + ''; description = '' Set of files that have to be linked in /etc. ''; From d882e1966251880240599d3c1b31e060661506ee Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 17:28:12 +0100 Subject: [PATCH 135/179] Shut up "failed to resume" warning if there is no resume device --- nixos/modules/system/boot/stage-1-init.sh | 2 +- nixos/modules/system/boot/stage-1.nix | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index e3e07c08580..1f65026b5de 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -168,7 +168,7 @@ if test -e /sys/power/tuxonice/resume; then fi fi -if test -e /sys/power/resume -a -e /sys/power/disk; then +if test -n "@resumeDevice@" -a -e /sys/power/resume -a -e /sys/power/disk; then echo "@resumeDevice@" > /sys/power/resume 2> /dev/null || echo "failed to resume..." echo shutdown > /sys/power/disk fi diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 3836d639513..71dc29feb2a 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -229,12 +229,14 @@ in options = { boot.resumeDevice = mkOption { - default = ""; - example = "0:0"; - description = " - Device for manual resume attempt during boot. Looks like - major:minor. ls -l /dev/SWAP_PARTION shows them. - "; + type = types.nullOr types.str; + default = null; + example = "8:2"; + description = '' + Device for manual resume attempt during boot, specified using + the device's major and minor number as + major:minor. + ''; }; boot.initrd.checkJournalingFS = mkOption { From 408b8b5725c3e6fff75aef772da248d3e95ff414 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 17:37:45 +0100 Subject: [PATCH 136/179] Add lots of missing option types --- nixos/modules/config/gnu.nix | 1 + nixos/modules/config/i18n.nix | 17 ++++++---- nixos/modules/config/networking.nix | 2 ++ nixos/modules/config/no-x-libs.nix | 8 +++-- nixos/modules/config/power-management.nix | 4 +++ nixos/modules/config/pulseaudio.nix | 12 ++++--- nixos/modules/config/users-groups.nix | 4 +-- nixos/modules/hardware/all-firmware.nix | 10 +++--- nixos/modules/hardware/pcmcia.nix | 2 +- nixos/modules/misc/check-config.nix | 8 +++-- nixos/modules/misc/crashdump.nix | 3 +- nixos/modules/misc/ids.nix | 2 ++ nixos/modules/misc/locate.nix | 5 +-- nixos/modules/misc/passthru.nix | 1 + nixos/modules/programs/shadow.nix | 2 +- nixos/modules/programs/ssh.nix | 8 +++-- nixos/modules/rename.nix | 1 + nixos/modules/security/pam.nix | 2 +- nixos/modules/security/pam_usb.nix | 1 + nixos/modules/security/polkit.nix | 3 ++ nixos/modules/security/rngd.nix | 1 + nixos/modules/security/rtkit.nix | 1 + nixos/modules/security/setuid-wrappers.nix | 5 +++ nixos/modules/security/sudo.nix | 3 ++ .../modules/services/databases/postgresql.nix | 17 +++++++--- nixos/modules/services/hardware/acpid.nix | 4 +++ nixos/modules/services/hardware/bluetooth.nix | 1 + nixos/modules/services/hardware/sane.nix | 27 ++++++++------- nixos/modules/services/hardware/udev.nix | 1 + nixos/modules/services/hardware/udisks.nix | 1 + nixos/modules/services/hardware/udisks2.nix | 1 + nixos/modules/services/hardware/upower.nix | 1 + nixos/modules/services/logging/syslogd.nix | 4 +-- nixos/modules/services/misc/nix-daemon.nix | 32 +++++++++++------- nixos/modules/services/misc/nixos-manual.nix | 4 ++- nixos/modules/services/misc/rogue.nix | 2 ++ .../modules/services/networking/firewall.nix | 6 ++++ nixos/modules/services/networking/nat.nix | 11 ++++--- nixos/modules/services/networking/rpcbind.nix | 1 + .../modules/services/networking/ssh/sshd.nix | 15 +++++++-- nixos/modules/services/printing/cupsd.nix | 11 +++++-- nixos/modules/services/scheduling/atd.nix | 11 ++++--- nixos/modules/services/scheduling/cron.nix | 22 ++++++++----- nixos/modules/services/scheduling/fcron.nix | 17 +++++++--- nixos/modules/services/system/dbus.nix | 1 + nixos/modules/services/system/nscd.nix | 1 + nixos/modules/services/ttys/agetty.nix | 2 ++ nixos/modules/services/ttys/gpm.nix | 2 ++ .../services/x11/desktop-managers/default.nix | 5 +-- .../services/x11/desktop-managers/kde4.nix | 4 +-- .../services/x11/desktop-managers/xfce.nix | 2 +- .../services/x11/display-managers/default.nix | 7 +++- .../services/x11/display-managers/kdm.nix | 9 +++-- .../services/x11/display-managers/slim.nix | 19 +++++++---- .../services/x11/window-managers/default.nix | 1 + nixos/modules/services/x11/xfs.nix | 13 +++++--- nixos/modules/services/x11/xserver.nix | 33 +++++++++++++++++-- nixos/modules/system/activation/top-level.nix | 4 +-- nixos/modules/system/boot/kernel.nix | 25 +++++--------- .../modules/system/boot/loader/grub/grub.nix | 2 +- nixos/modules/system/boot/modprobe.nix | 1 + nixos/modules/system/boot/stage-1.nix | 28 ++++++++-------- nixos/modules/system/boot/stage-2.nix | 6 ++-- nixos/modules/system/etc/etc.nix | 4 ++- nixos/modules/tasks/cpu-freq.nix | 6 ++-- nixos/tests/bittorrent.nix | 2 +- nixos/tests/nat.nix | 2 +- 67 files changed, 320 insertions(+), 154 deletions(-) diff --git a/nixos/modules/config/gnu.nix b/nixos/modules/config/gnu.nix index 1a69083a206..6f5d2950463 100644 --- a/nixos/modules/config/gnu.nix +++ b/nixos/modules/config/gnu.nix @@ -5,6 +5,7 @@ with pkgs.lib; { options = { gnu = mkOption { + type = types.bool; default = false; description = '' When enabled, GNU software is chosen by default whenever a there is diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 5570bb1adf6..56d541cb9b3 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -18,16 +18,18 @@ in i18n = { defaultLocale = mkOption { + type = types.str; default = "en_US.UTF-8"; example = "nl_NL.UTF-8"; - description = " + description = '' The default locale. It determines the language for program messages, the format for dates and times, sort order, and so on. It also determines the character set, such as UTF-8. - "; + ''; }; supportedLocales = mkOption { + type = types.listOf types.str; default = ["all"]; example = ["en_US.UTF-8/UTF-8" "nl_NL.UTF-8/UTF-8" "nl_NL/ISO-8859-1"]; description = '' @@ -40,22 +42,23 @@ in }; consoleFont = mkOption { + type = types.str; default = "lat9w-16"; example = "LatArCyrHeb-16"; - description = " + description = '' The font used for the virtual consoles. Leave empty to use whatever the setfont program considers the default font. - "; + ''; }; consoleKeyMap = mkOption { + type = types.str; default = "us"; example = "fr"; - description = " + description = '' The keyboard mapping table for the virtual consoles. - "; - type = types.str; + ''; }; }; diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix index f1bdfd01b24..9ac68b42819 100644 --- a/nixos/modules/config/networking.nix +++ b/nixos/modules/config/networking.nix @@ -15,6 +15,7 @@ in options = { networking.extraHosts = pkgs.lib.mkOption { + type = types.lines; default = ""; example = "192.168.0.1 lanlocalhost"; description = '' @@ -23,6 +24,7 @@ in }; networking.dnsSingleRequest = pkgs.lib.mkOption { + type = types.bool; default = false; description = '' Recent versions of glibc will issue both ipv4 (A) and ipv6 (AAAA) diff --git a/nixos/modules/config/no-x-libs.nix b/nixos/modules/config/no-x-libs.nix index 77890b49c67..ec7bf3fea7b 100644 --- a/nixos/modules/config/no-x-libs.nix +++ b/nixos/modules/config/no-x-libs.nix @@ -1,10 +1,12 @@ { config, pkgs, ... }: +with pkgs.lib; + { options = { - environment.noXlibs = pkgs.lib.mkOption { + environment.noXlibs = mkOption { + type = types.bool; default = false; - example = true; description = '' Switch off the options in the default configuration that require X libraries. Currently this includes: ssh X11 forwarding, dbus, fonts.enableCoreFonts, @@ -13,7 +15,7 @@ }; }; - config = pkgs.lib.mkIf config.environment.noXlibs { + config = mkIf config.environment.noXlibs { programs.ssh.setXAuthLocation = false; fonts = { enableCoreFonts = false; diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix index fec2c886818..7299136235e 100644 --- a/nixos/modules/config/power-management.nix +++ b/nixos/modules/config/power-management.nix @@ -17,6 +17,7 @@ in powerManagement = { enable = mkOption { + type = types.bool; default = true; description = '' @@ -26,11 +27,13 @@ in }; resumeCommands = mkOption { + type = types.lines; default = ""; description = "Commands executed after the system resumes from suspend-to-RAM."; }; powerUpCommands = mkOption { + type = types.lines; default = ""; example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; description = @@ -42,6 +45,7 @@ in }; powerDownCommands = mkOption { + type = types.lines; default = ""; example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; description = diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix index 26060f5b2d1..7a6cc542273 100644 --- a/nixos/modules/config/pulseaudio.nix +++ b/nixos/modules/config/pulseaudio.nix @@ -46,6 +46,7 @@ in { hardware.pulseaudio = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the PulseAudio sound server. @@ -72,12 +73,13 @@ in { The path to the configuration the PulseAudio server should use. By default, the "default.pa" configuration from the PulseAudio distribution is used. - ''; + ''; }; - + package = mkOption { + type = types.path; default = pulseaudio; - example = "pulseaudio.override { jackaudioSupport = true; }"; + example = literalExample "pulseaudio.override { jackaudioSupport = true; }"; description = '' The PulseAudio derivation to use. This can be used to enable features (such as JACK support) that are not enabled in the @@ -125,9 +127,9 @@ in { description = "PulseAudio system service user"; home = pulseRuntimePath; }; - + users.extraGroups.pulse.gid = gid; - + systemd.services.pulseaudio = { description = "PulseAudio system-wide server"; wantedBy = [ "sound.target" ]; diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index 383f87120e0..d2eca7c3dcd 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -35,7 +35,7 @@ let }; extraGroups = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = "The user's auxiliary groups."; }; @@ -65,7 +65,7 @@ let }; password = mkOption { - type = with types; uniq (nullOr string); + type = with types; uniq (nullOr str); default = null; description = "The user's password. If undefined, no password is set for the user. Warning: do not set confidential information here because this data would be readable by all. This option should only be used for public account such as guest."; }; diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 16b6a862593..027dd827b4d 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -1,4 +1,6 @@ -{pkgs, config, ...}: +{ config, pkgs, ... }: + +with pkgs.lib; { @@ -6,9 +8,9 @@ options = { - hardware.enableAllFirmware = pkgs.lib.mkOption { + hardware.enableAllFirmware = mkOption { default = false; - type = pkgs.lib.types.bool; + type = types.bool; description = '' Turn on this option if you want to enable all the firmware shipped with Debian/Ubuntu. ''; @@ -19,7 +21,7 @@ ###### implementation - config = pkgs.lib.mkIf config.hardware.enableAllFirmware { + config = mkIf config.hardware.enableAllFirmware { hardware.firmware = [ "${pkgs.firmwareLinuxNonfree}/lib/firmware" ]; }; diff --git a/nixos/modules/hardware/pcmcia.nix b/nixos/modules/hardware/pcmcia.nix index dea04ac753c..20684656750 100644 --- a/nixos/modules/hardware/pcmcia.nix +++ b/nixos/modules/hardware/pcmcia.nix @@ -36,7 +36,7 @@ in config = mkOption { default = null; description = '' - Path to the configuration file which map the memory, irq + Path to the configuration file which maps the memory, IRQs and ports used by the PCMCIA hardware. ''; }; diff --git a/nixos/modules/misc/check-config.nix b/nixos/modules/misc/check-config.nix index 28f36ad9ae5..f759c88d3a1 100644 --- a/nixos/modules/misc/check-config.nix +++ b/nixos/modules/misc/check-config.nix @@ -1,10 +1,12 @@ -{pkgs, ...}: +{ pkgs, ... }: + +with pkgs.lib; { options = { - environment.checkConfigurationOptions = pkgs.lib.mkOption { + environment.checkConfigurationOptions = mkOption { + type = types.bool; default = true; - example = false; description = '' Whether to check the validity of the entire configuration. ''; diff --git a/nixos/modules/misc/crashdump.nix b/nixos/modules/misc/crashdump.nix index 6e6bc9dec0f..6e71baa9a43 100644 --- a/nixos/modules/misc/crashdump.nix +++ b/nixos/modules/misc/crashdump.nix @@ -14,8 +14,8 @@ in boot = { crashDump = { enable = mkOption { + type = types.bool; default = false; - example = true; description = '' If enabled, NixOS will set up a kernel that will boot on crash, and leave the user to a stage1 debug1devices @@ -35,6 +35,7 @@ in ''; }; kernelParams = mkOption { + type = types.listOf types.str; default = [ "debug1devices" ]; description = '' Parameters that will be passed to the kernel kexec-ed on crash. diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 9dc9b49b9e3..e3edc9dda6b 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -7,12 +7,14 @@ options = { ids.uids = pkgs.lib.mkOption { + internal = true; description = '' The user IDs used in NixOS. ''; }; ids.gids = pkgs.lib.mkOption { + internal = true; description = '' The group IDs used in NixOS. ''; diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix index 02b1ed7b63d..b6408be5844 100644 --- a/nixos/modules/misc/locate.nix +++ b/nixos/modules/misc/locate.nix @@ -17,8 +17,8 @@ in services.locate = { enable = mkOption { + type = types.bool; default = false; - example = true; description = '' If enabled, NixOS will periodically update the database of files used by the locate command. @@ -26,11 +26,12 @@ in }; 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. + The default is to update at 02:15 at night every day. ''; }; diff --git a/nixos/modules/misc/passthru.nix b/nixos/modules/misc/passthru.nix index f68adc5e843..b65f20d62f2 100644 --- a/nixos/modules/misc/passthru.nix +++ b/nixos/modules/misc/passthru.nix @@ -6,6 +6,7 @@ { options = { passthru = pkgs.lib.mkOption { + visible = false; description = '' This attribute set will be exported as a system attribute. You can put whatever you want here. diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix index 36c915f755f..9e46ab8b298 100644 --- a/nixos/modules/programs/shadow.nix +++ b/nixos/modules/programs/shadow.nix @@ -48,7 +48,7 @@ in Rather, it should be the path of a symlink that points to the actual shell in the Nix store. ''; - type = types.uniq types.path; + type = types.path; }; }; diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix index 64bf2508316..a66679dff90 100644 --- a/nixos/modules/programs/ssh.nix +++ b/nixos/modules/programs/ssh.nix @@ -16,6 +16,7 @@ in programs.ssh = { forwardX11 = mkOption { + type = types.bool; default = false; description = '' Whether to request X11 forwarding on outgoing connections by default. @@ -29,18 +30,21 @@ in }; setXAuthLocation = mkOption { + type = types.bool; default = true; description = '' Whether to set the path to xauth for X11-forwarded connections. - Pulls in X11 dependency. + This causes a dependency on X11 packages. ''; }; extraConfig = mkOption { + type = types.lines; default = ""; description = '' Extra configuration text appended to ssh_config. - See the ssh_config(5) man page for help. + See ssh_config5 + for help. ''; }; }; diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 0a8383870ee..4f924b82a9d 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -93,6 +93,7 @@ in zipModules ([] ++ obsolete [ "boot" "grubSplashImage" ] [ "boot" "loader" "grub" "splashImage" ] ++ obsolete [ "boot" "initrd" "extraKernelModules" ] [ "boot" "initrd" "kernelModules" ] +++ obsolete [ "boot" "extraKernelParams" ] [ "boot" "kernelParams" ] # OpenSSH ++ obsolete [ "services" "sshd" "ports" ] [ "services" "openssh" "ports" ] diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix index 69a1972e9e7..93d12d292e4 100644 --- a/nixos/modules/security/pam.nix +++ b/nixos/modules/security/pam.nix @@ -133,7 +133,7 @@ let }; text = mkOption { - type = types.nullOr types.string; + type = types.nullOr types.lines; description = "Contents of the PAM service file."; }; diff --git a/nixos/modules/security/pam_usb.nix b/nixos/modules/security/pam_usb.nix index 2bd3069ddb1..4cc99995fbc 100644 --- a/nixos/modules/security/pam_usb.nix +++ b/nixos/modules/security/pam_usb.nix @@ -17,6 +17,7 @@ in security.pam.usb = { enable = mkOption { + type = types.bool; default = false; description = '' Enable USB login for all login systems that support it. For diff --git a/nixos/modules/security/polkit.nix b/nixos/modules/security/polkit.nix index 8b04f4043bc..cafa9f82d5e 100644 --- a/nixos/modules/security/polkit.nix +++ b/nixos/modules/security/polkit.nix @@ -13,11 +13,13 @@ in options = { security.polkit.enable = mkOption { + type = types.bool; default = true; description = "Whether to enable PolKit."; }; security.polkit.permissions = mkOption { + type = types.lines; default = ""; example = '' @@ -49,6 +51,7 @@ in }; security.polkit.adminIdentities = mkOption { + type = types.str; default = "unix-user:0;unix-group:wheel"; example = ""; description = diff --git a/nixos/modules/security/rngd.nix b/nixos/modules/security/rngd.nix index dd251fe69d3..720ac02f2e8 100644 --- a/nixos/modules/security/rngd.nix +++ b/nixos/modules/security/rngd.nix @@ -5,6 +5,7 @@ with pkgs.lib; { options = { security.rngd.enable = mkOption { + type = types.bool; default = true; description = '' Whether to enable the rng daemon, which adds entropy from diff --git a/nixos/modules/security/rtkit.nix b/nixos/modules/security/rtkit.nix index e47e7baa2b8..164ad9b3aa7 100644 --- a/nixos/modules/security/rtkit.nix +++ b/nixos/modules/security/rtkit.nix @@ -10,6 +10,7 @@ with pkgs.lib; options = { security.rtkit.enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the RealtimeKit system service, which hands diff --git a/nixos/modules/security/setuid-wrappers.nix b/nixos/modules/security/setuid-wrappers.nix index e75679e5ff6..62df85816e5 100644 --- a/nixos/modules/security/setuid-wrappers.nix +++ b/nixos/modules/security/setuid-wrappers.nix @@ -25,7 +25,9 @@ in options = { security.setuidPrograms = mkOption { + type = types.listOf types.str; default = []; + example = ["passwd"]; description = '' The Nix store cannot contain setuid/setgid programs directly. For this reason, NixOS can automatically generate wrapper @@ -36,6 +38,7 @@ in }; security.setuidOwners = mkOption { + type = types.listOf types.attrs; default = []; example = [ { program = "sendmail"; @@ -53,6 +56,8 @@ in }; security.wrapperDir = mkOption { + internal = true; + type = types.path; default = "/var/setuid-wrappers"; description = '' This option defines the path to the setuid wrappers. It diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix index 77251780198..215a8ecd601 100644 --- a/nixos/modules/security/sudo.nix +++ b/nixos/modules/security/sudo.nix @@ -17,6 +17,7 @@ in options = { security.sudo.enable = mkOption { + type = types.bool; default = true; description = '' @@ -26,6 +27,7 @@ in }; security.sudo.wheelNeedsPassword = mkOption { + type = types.bool; default = true; description = '' @@ -35,6 +37,7 @@ in }; security.sudo.configFile = mkOption { + type = types.lines; # Note: if syntax errors are detected in this file, the NixOS # configuration will fail to build. description = diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix index 1c43dad1d50..73447e3cf0d 100644 --- a/nixos/modules/services/databases/postgresql.nix +++ b/nixos/modules/services/databases/postgresql.nix @@ -46,6 +46,7 @@ in services.postgresql = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to run PostgreSQL. @@ -53,6 +54,7 @@ in }; package = mkOption { + type = types.path; example = literalExample "pkgs.postgresql92"; description = '' PostgreSQL package to use. @@ -60,6 +62,7 @@ in }; port = mkOption { + type = types.int; default = "5432"; description = '' Port for PostgreSQL. @@ -67,6 +70,7 @@ in }; dataDir = mkOption { + type = types.path; default = "/var/db/postgresql"; description = '' Data directory for PostgreSQL. @@ -74,6 +78,7 @@ in }; authentication = mkOption { + type = types.lines; default = ""; description = '' Defines how users authenticate themselves to the server. @@ -81,6 +86,7 @@ in }; identMap = mkOption { + type = types.lines; default = ""; description = '' Defines the mapping from system users to database users. @@ -88,14 +94,15 @@ in }; initialScript = mkOption { - default = null; type = types.nullOr types.path; + default = null; description = '' A file containing SQL statements to execute on first startup. ''; }; enableTCPIP = mkOption { + type = types.bool; default = false; description = '' Whether to run PostgreSQL with -i flag to enable TCP/IP connections. @@ -103,8 +110,9 @@ in }; extraPlugins = mkOption { + type = types.listOf types.path; default = []; - example = "pkgs.postgis"; # of course don't use a string here! + example = literalExample "pkgs.postgis"; description = '' When this list contains elements a new store path is created. PostgreSQL and the elments are symlinked into it. Then pg_config, @@ -118,15 +126,16 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = "Additional text to be appended to postgresql.conf."; }; recoveryConfig = mkOption { + type = types.nullOr types.lines; default = null; - type = types.nullOr types.string; description = '' - Values to put into recovery.conf file. + Contents of the recovery.conf file. ''; }; }; diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix index 6a595f8306b..adba6394dcf 100644 --- a/nixos/modules/services/hardware/acpid.nix +++ b/nixos/modules/services/hardware/acpid.nix @@ -66,21 +66,25 @@ in services.acpid = { enable = mkOption { + type = types.bool; default = false; description = "Whether to enable the ACPI daemon."; }; powerEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on a button/power.* event."; }; lidEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on a button/lid.* event."; }; acEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on an ac_adapter.* event."; }; diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix index 6bc0ad0bf77..b0714a3ce80 100644 --- a/nixos/modules/services/hardware/bluetooth.nix +++ b/nixos/modules/services/hardware/bluetooth.nix @@ -9,6 +9,7 @@ with pkgs.lib; options = { hardware.bluetooth.enable = mkOption { + type = types.bool; default = false; description = "Whether to enable support for Bluetooth."; }; diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix index 905445f22c1..5979feb8240 100644 --- a/nixos/modules/services/hardware/sane.nix +++ b/nixos/modules/services/hardware/sane.nix @@ -2,6 +2,12 @@ with pkgs.lib; +let + + pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends; + +in + { ###### interface @@ -9,11 +15,13 @@ with pkgs.lib; options = { hardware.sane.enable = mkOption { + type = types.bool; default = false; description = "Enable support for SANE scanners."; }; hardware.sane.snapshot = mkOption { + type = types.bool; default = false; description = "Use a development snapshot of SANE scanner drivers."; }; @@ -23,18 +31,13 @@ with pkgs.lib; ###### implementation - config = let pkg = if config.hardware.sane.snapshot - then pkgs.saneBackendsGit - else pkgs.saneBackends; - in mkIf config.hardware.sane.enable { - environment.systemPackages = [ pkg ]; - services.udev.packages = [ pkg ]; - - users.extraGroups = singleton { - name = "scanner"; - gid = config.ids.gids.scanner; - }; + config = mkIf config.hardware.sane.enable { - }; + environment.systemPackages = [ pkg ]; + services.udev.packages = [ pkg ]; + + users.extraGroups."scanner".gid = config.ids.gids.scanner; + + }; } diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix index 75f01fbc5a9..516569c0280 100644 --- a/nixos/modules/services/hardware/udev.nix +++ b/nixos/modules/services/hardware/udev.nix @@ -114,6 +114,7 @@ in options = { boot.hardwareScan = mkOption { + type = types.bool; default = true; description = '' Whether to try to load kernel modules for all detected hardware. diff --git a/nixos/modules/services/hardware/udisks.nix b/nixos/modules/services/hardware/udisks.nix index 1ba17c589d2..531ee192573 100644 --- a/nixos/modules/services/hardware/udisks.nix +++ b/nixos/modules/services/hardware/udisks.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.udisks = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Udisks, a DBus service that allows diff --git a/nixos/modules/services/hardware/udisks2.nix b/nixos/modules/services/hardware/udisks2.nix index eae4172ccb3..178ec379ff1 100644 --- a/nixos/modules/services/hardware/udisks2.nix +++ b/nixos/modules/services/hardware/udisks2.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.udisks2 = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Udisks, a DBus service that allows diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix index 5d1658adb75..4a9b13d4aa0 100644 --- a/nixos/modules/services/hardware/upower.nix +++ b/nixos/modules/services/hardware/upower.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.upower = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Upower, a DBus service that provides power diff --git a/nixos/modules/services/logging/syslogd.nix b/nixos/modules/services/logging/syslogd.nix index c1a66aaa3cc..36a0ace927a 100644 --- a/nixos/modules/services/logging/syslogd.nix +++ b/nixos/modules/services/logging/syslogd.nix @@ -55,7 +55,7 @@ in }; defaultConfig = mkOption { - type = types.string; + type = types.lines; default = defaultConf; description = '' The default syslog.conf file configures a @@ -73,7 +73,7 @@ in }; extraConfig = mkOption { - type = types.string; + type = types.lines; default = ""; example = "news.* -/var/log/news"; description = '' diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 6971fe496b2..1707828d0db 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -66,8 +66,9 @@ in }; maxJobs = mkOption { + type = types.int; default = 1; - example = 2; + example = 64; description = " This option defines the maximum number of jobs that Nix will try to build in parallel. The default is 1. You should generally @@ -77,8 +78,8 @@ in }; useChroot = mkOption { + type = types.bool; default = false; - example = true; description = " If set, Nix will perform builds in a chroot-environment that it will set up automatically for each build. This prevents @@ -88,6 +89,7 @@ in }; chrootDirs = mkOption { + type = types.listOf types.str; default = []; example = [ "/dev" "/proc" ]; description = @@ -98,6 +100,7 @@ in }; extraOptions = mkOption { + type = types.lines; default = ""; example = '' gc-keep-outputs = true @@ -107,6 +110,7 @@ in }; distributedBuilds = mkOption { + type = types.bool; default = false; description = '' Whether to distribute builds to the machines listed in @@ -115,22 +119,25 @@ in }; daemonNiceLevel = mkOption { + type = types.int; default = 0; - description = " + description = '' Nix daemon process priority. This priority propagates to build processes. 0 is the default Unix process priority, 20 is the lowest. - "; + ''; }; daemonIONiceLevel = mkOption { + type = types.int; default = 0; - description = " + description = '' Nix daemon process I/O priority. This priority propagates to build processes. 0 is the default Unix process I/O priority, 7 is the lowest. - "; + ''; }; buildMachines = mkOption { + type = types.listOf types.attrs; default = []; example = [ { hostName = "voila.labs.cs.uu.nl"; @@ -176,24 +183,26 @@ in }; proxy = mkOption { + type = types.str; default = ""; - description = " + description = '' This option specifies the proxy to use for fetchurl. The real effect is just exporting http_proxy, https_proxy and ftp_proxy with that value. - "; + ''; example = "http://127.0.0.1:3128"; }; # Environment variables for running Nix. envVars = mkOption { + type = types.attrs; internal = true; default = {}; - type = types.attrs; description = "Environment variables used by Nix."; }; nrBuildUsers = mkOption { + type = types.int; default = 10; description = '' Number of nixbld user accounts created to @@ -204,6 +213,7 @@ in }; readOnlyStore = mkOption { + type = types.bool; default = true; description = '' If set, NixOS will enforce the immutability of the Nix store @@ -214,8 +224,8 @@ in }; binaryCaches = mkOption { + type = types.listOf types.str; default = [ http://cache.nixos.org/ ]; - type = types.listOf types.string; description = '' List of binary cache URLs used to obtain pre-built binaries of Nix packages. @@ -223,9 +233,9 @@ in }; trustedBinaryCaches = mkOption { + type = types.listOf types.str; default = [ ]; example = [ http://hydra.nixos.org/ ]; - type = types.listOf types.string; description = '' List of binary cache URLs that non-root users can use (in addition to those specified using diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index f67afb747e9..885b8fa2d0c 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -53,14 +53,15 @@ in options = { services.nixosManual.enable = mkOption { - default = true; type = types.bool; + default = true; description = '' Whether to build the NixOS manual pages. ''; }; services.nixosManual.showManual = mkOption { + type = types.bool; default = false; description = '' Whether to show the NixOS manual on one of the virtual @@ -76,6 +77,7 @@ in }; services.nixosManual.browser = mkOption { + type = types.path; default = "${pkgs.w3m}/bin/w3m"; description = '' Browser used to show the manual. diff --git a/nixos/modules/services/misc/rogue.nix b/nixos/modules/services/misc/rogue.nix index 94fa8850750..de25cc0fb98 100644 --- a/nixos/modules/services/misc/rogue.nix +++ b/nixos/modules/services/misc/rogue.nix @@ -17,6 +17,7 @@ in options = { services.rogue.enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the Rogue game on one of the virtual @@ -25,6 +26,7 @@ in }; services.rogue.tty = mkOption { + type = types.str; default = "tty9"; description = '' Virtual console on which to run Rogue. diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix index b24ac2d7032..4ed859c2e7e 100644 --- a/nixos/modules/services/networking/firewall.nix +++ b/nixos/modules/services/networking/firewall.nix @@ -53,6 +53,7 @@ in options = { networking.firewall.enable = mkOption { + type = types.bool; default = false; description = '' @@ -64,6 +65,7 @@ in }; networking.firewall.logRefusedConnections = mkOption { + type = types.bool; default = true; description = '' @@ -72,6 +74,7 @@ in }; networking.firewall.logRefusedPackets = mkOption { + type = types.bool; default = false; description = '' @@ -82,6 +85,7 @@ in }; networking.firewall.logRefusedUnicastsOnly = mkOption { + type = types.bool; default = true; description = '' @@ -93,6 +97,7 @@ in }; networking.firewall.rejectPackets = mkOption { + type = types.bool; default = false; description = '' @@ -193,6 +198,7 @@ in }; networking.firewall.extraCommands = mkOption { + type = types.lines; default = ""; example = "iptables -A INPUT -p icmp -j ACCEPT"; description = diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix index 9d62a764f06..ce28f018828 100644 --- a/nixos/modules/services/networking/nat.nix +++ b/nixos/modules/services/networking/nat.nix @@ -19,6 +19,7 @@ in options = { networking.nat.enable = mkOption { + type = types.bool; default = false; description = '' @@ -27,6 +28,7 @@ in }; networking.nat.internalIPs = mkOption { + type = types.listOf types.str; example = [ "192.168.1.0/24" ] ; description = '' @@ -34,12 +36,10 @@ in coming from these networks and destined for the external interface will be rewritten. ''; - # Backward compatibility: this used to be a single range instead - # of a list. - apply = x: if isList x then x else [x]; }; networking.nat.externalInterface = mkOption { + type = types.str; example = "eth1"; description = '' @@ -48,7 +48,8 @@ in }; networking.nat.externalIP = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; example = "203.0.113.123"; description = '' @@ -86,7 +87,7 @@ in '' iptables -t nat -A POSTROUTING \ -s ${network} -o ${cfg.externalInterface} \ - ${if cfg.externalIP == "" + ${if cfg.externalIP == null then "-j MASQUERADE" else "-j SNAT --to-source ${cfg.externalIP}"} '' diff --git a/nixos/modules/services/networking/rpcbind.nix b/nixos/modules/services/networking/rpcbind.nix index 00c958c5a4a..c966f85e260 100644 --- a/nixos/modules/services/networking/rpcbind.nix +++ b/nixos/modules/services/networking/rpcbind.nix @@ -40,6 +40,7 @@ in services.rpcbind = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable `rpcbind', an ONC RPC directory service diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 360c745f362..48eddb3b2f6 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -27,7 +27,7 @@ let openssh.authorizedKeys = { keys = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = '' A list of verbatim OpenSSH public keys that should be added to the @@ -39,6 +39,7 @@ let }; keyFiles = mkOption { + type = types.listOf types.str; default = []; description = '' A list of files each containing one OpenSSH public key that should be @@ -77,6 +78,7 @@ in services.openssh = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the OpenSSH secure shell daemon, which @@ -85,6 +87,7 @@ in }; forwardX11 = mkOption { + type = types.bool; default = cfgc.setXAuthLocation; description = '' Whether to allow X11 connections to be forwarded. @@ -92,6 +95,7 @@ in }; allowSFTP = mkOption { + type = types.bool; default = true; description = '' Whether to enable the SFTP subsystem in the SSH daemon. This @@ -112,6 +116,7 @@ in }; gatewayPorts = mkOption { + type = types.str; default = "no"; description = '' Specifies whether remote hosts are allowed to connect to @@ -122,6 +127,7 @@ in }; ports = mkOption { + type = types.listOf types.int; default = [22]; description = '' Specifies on which ports the SSH daemon listens. @@ -129,6 +135,7 @@ in }; passwordAuthentication = mkOption { + type = types.bool; default = true; description = '' Specifies whether password authentication is allowed. @@ -136,6 +143,7 @@ in }; challengeResponseAuthentication = mkOption { + type = types.bool; default = true; description = '' Specifies whether challenge/response authentication is allowed. @@ -143,6 +151,7 @@ in }; hostKeys = mkOption { + type = types.listOf types.attrs; default = [ { path = "/etc/ssh/ssh_host_dsa_key"; type = "dsa"; @@ -163,11 +172,13 @@ in }; authorizedKeysFiles = mkOption { + type = types.listOf types.str; default = []; description = "Files from with authorized keys are read."; }; extraConfig = mkOption { + type = types.lines; default = ""; description = "Verbatim contents of sshd_config."; }; @@ -202,7 +213,7 @@ in The path to the public key file for the host. The public key file is read at build time and saved in the Nix store. You can fetch a public key file from a running SSH server - with the ssh-keyscan command. + with the ssh-keyscan command. ''; }; }; diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index 1c3dc9d90b1..951cef3eac0 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -49,6 +49,7 @@ in services.printing = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable printing support through the CUPS daemon. @@ -56,6 +57,8 @@ in }; bindirCmds = mkOption { + type = types.lines; + internal = true; default = ""; description = '' Additional commands executed while creating the directory @@ -64,6 +67,7 @@ in }; cupsdConf = mkOption { + type = types.lines; default = ""; example = '' @@ -77,13 +81,16 @@ in }; drivers = mkOption { - example = [ pkgs.splix ]; + type = types.listOf types.path; + example = literalExample "[ pkgs.splix ]"; description = '' - CUPS drivers (CUPS, gs and samba are added unconditionally). + CUPS drivers to use. Drivers provided by CUPS, Ghostscript + and Samba are added unconditionally. ''; }; tempDir = mkOption { + type = types.path; default = "/tmp"; example = "/tmp/cups"; description = '' diff --git a/nixos/modules/services/scheduling/atd.nix b/nixos/modules/services/scheduling/atd.nix index 8c96252668e..c516c5889f1 100644 --- a/nixos/modules/services/scheduling/atd.nix +++ b/nixos/modules/services/scheduling/atd.nix @@ -17,18 +17,21 @@ in options = { services.atd.enable = mkOption { + type = types.bool; default = false; description = '' - Whether to enable the `at' daemon, a command scheduler. + Whether to enable the at daemon, a command scheduler. ''; }; services.atd.allowEveryone = mkOption { + type = types.bool; default = false; description = '' - Whether to make /var/spool/at{jobs,spool} writeable - by everyone (and sticky). This is normally not needed since - the `at' commands are setuid/setgid `atd'. + Whether to make /var/spool/at{jobs,spool} + writeable by everyone (and sticky). This is normally not + needed since the at commands are + setuid/setgid atd. ''; }; diff --git a/nixos/modules/services/scheduling/cron.nix b/nixos/modules/services/scheduling/cron.nix index e14f03fb1e8..44ed1ba5a07 100644 --- a/nixos/modules/services/scheduling/cron.nix +++ b/nixos/modules/services/scheduling/cron.nix @@ -11,7 +11,9 @@ let '' SHELL=${pkgs.bash}/bin/bash PATH=${config.system.path}/bin:${config.system.path}/sbin - MAILTO="${config.services.cron.mailto}" + ${optionalString (config.services.cron.mailto != null) '' + MAILTO="${config.services.cron.mailto}" + ''} NIX_CONF_DIR=/etc/nix ${pkgs.lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)} ''; @@ -34,21 +36,25 @@ in services.cron = { enable = mkOption { + type = types.bool; default = true; - description = "Whether to enable the `vixie cron' daemon."; + description = "Whether to enable the Vixie cron daemon."; }; mailto = mkOption { - default = ""; - description = " The job output will be mailed to this email address. "; + type = types.nullOr types.str; + default = null; + description = "Email address to which job output will be mailed."; }; systemCronJobs = mkOption { + type = types.listOf types.str; default = []; - example = [ - "* * * * * test ls -l / > /tmp/cronout 2>&1" - "* * * * * eelco echo Hello World > /home/eelco/cronout" - ]; + example = literalExample '' + [ "* * * * * test ls -l / > /tmp/cronout 2>&1" + "* * * * * eelco echo Hello World > /home/eelco/cronout" + ] + ''; description = '' A list of Cron jobs to be appended to the system-wide crontab. See the manual page for crontab for the expected diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix index 95ff918eb6d..0c0811ca6e0 100644 --- a/nixos/modules/services/scheduling/fcron.nix +++ b/nixos/modules/services/scheduling/fcron.nix @@ -6,7 +6,7 @@ let cfg = config.services.fcron; - queuelen = if cfg.queuelen == "" then "" else "-q ${toString cfg.queuelen}"; + queuelen = if cfg.queuelen == null then "" else "-q ${toString cfg.queuelen}"; systemCronJobs = '' @@ -34,33 +34,40 @@ in services.fcron = { enable = mkOption { + type = types.bool; default = false; - description = "Whether to enable the `fcron' daemon."; + description = "Whether to enable the fcron daemon."; }; allow = mkOption { + type = types.listOf types.str; default = [ "all" ]; description = '' - Users allowed to use fcrontab and fcrondyn (one name per line, "all" for everyone). + Users allowed to use fcrontab and fcrondyn (one name per + line, all for everyone). ''; }; deny = mkOption { + type = types.listOf types.str; default = []; description = "Users forbidden from using fcron."; }; maxSerialJobs = mkOption { + type = types.int; default = 1; description = "Maximum number of serial jobs which can run simultaneously."; }; queuelen = mkOption { - default = ""; - description = "Number of jobs the serial queue and the lavg queue can contain - empty to net set this number (-q)"; + type = types.nullOr types.int; + default = null; + description = "Number of jobs the serial queue and the lavg queue can contain."; }; systab = mkOption { + type = types.lines; default = ""; description = ''The "system" crontab contents.''; }; diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index 40d0853d19d..cb5110f6feb 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -77,6 +77,7 @@ in }; packages = mkOption { + type = types.listOf types.path; default = []; description = '' Packages whose D-Bus configuration files should be included in diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix index e8534b12043..b817b1df779 100644 --- a/nixos/modules/services/system/nscd.nix +++ b/nixos/modules/services/system/nscd.nix @@ -19,6 +19,7 @@ in services.nscd = { enable = mkOption { + type = types.bool; default = true; description = "Whether to enable the Name Service Cache Daemon."; }; diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix index 850f558e4cb..ae4fa87d4b7 100644 --- a/nixos/modules/services/ttys/agetty.nix +++ b/nixos/modules/services/ttys/agetty.nix @@ -11,6 +11,7 @@ with pkgs.lib; services.mingetty = { greetingLine = mkOption { + type = types.str; default = ''<<< Welcome to NixOS ${config.system.nixosVersion} (\m) - \l >>>''; description = '' Welcome line printed by mingetty. @@ -18,6 +19,7 @@ with pkgs.lib; }; helpLine = mkOption { + type = types.lines; default = ""; description = '' Help line printed by mingetty below the welcome line. diff --git a/nixos/modules/services/ttys/gpm.nix b/nixos/modules/services/ttys/gpm.nix index 6a425cf327f..74cee67aeae 100644 --- a/nixos/modules/services/ttys/gpm.nix +++ b/nixos/modules/services/ttys/gpm.nix @@ -17,6 +17,7 @@ in services.gpm = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable GPM, the General Purpose Mouse daemon, @@ -25,6 +26,7 @@ in }; protocol = mkOption { + type = types.str; default = "ps/2"; description = "Mouse protocol to use."; }; diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index 7bb2d769780..4bf1e33a295 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -24,17 +24,18 @@ in services.xserver.desktopManager = { session = mkOption { + internal = true; default = []; example = singleton { name = "kde"; bgSupport = true; start = "..."; }; - description = " + description = '' Internal option used to add some common line to desktop manager scripts before forwarding the value to the displayManager. - "; + ''; apply = list: { list = map (d: d // { manage = "desktop"; diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix index 079fc054d19..108b52bb951 100644 --- a/nixos/modules/services/x11/desktop-managers/kde4.nix +++ b/nixos/modules/services/x11/desktop-managers/kde4.nix @@ -51,13 +51,13 @@ in services.xserver.desktopManager.kde4 = { enable = mkOption { + type = types.bool; default = false; - example = true; description = "Enable the KDE 4 desktop environment."; }; phononBackends = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = ["gstreamer"]; example = ["gstreamer" "vlc"]; description = "Which phonon multimedia backend kde should use"; diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix index d7621c82d12..8199829ef90 100644 --- a/nixos/modules/services/x11/desktop-managers/xfce.nix +++ b/nixos/modules/services/x11/desktop-managers/xfce.nix @@ -13,8 +13,8 @@ in options = { services.xserver.desktopManager.xfce.enable = mkOption { + type = types.bool; default = false; - example = true; description = "Enable the Xfce desktop environment."; }; diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 0910708002b..c4fce3706dc 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -166,16 +166,19 @@ in services.xserver.displayManager = { xauthBin = mkOption { + internal = true; default = "${xorg.xauth}/bin/xauth"; description = "Path to the xauth program used by display managers."; }; xserverBin = mkOption { + type = types.path; default = "${xorg.xorgserver}/bin/X"; description = "Path to the X server used by display managers."; }; xserverArgs = mkOption { + type = types.listOf types.str; default = []; example = [ "-ac" "-logverbose" "-nolisten tcp" ]; description = "List of arguments for the X server."; @@ -183,16 +186,17 @@ in }; sessionCommands = mkOption { + type = types.lines; default = ""; example = '' xmessage "Hello World!" & ''; - type = types.string; description = "Shell commands executed just before the window or desktop manager is started."; }; desktopManagerHandlesLidAndPower = mkOption { + type = types.bool; default = true; description = '' Whether the display manager should prevent systemd from handling @@ -256,6 +260,7 @@ in }; environment = mkOption { + type = types.attrsOf types.unspecified; default = {}; example = { SLIM_CFGFILE = /etc/slim.conf; }; description = "Additional environment variables needed by the display manager."; diff --git a/nixos/modules/services/x11/display-managers/kdm.nix b/nixos/modules/services/x11/display-managers/kdm.nix index 2e84adcb4ce..c51e7edfddf 100644 --- a/nixos/modules/services/x11/display-managers/kdm.nix +++ b/nixos/modules/services/x11/display-managers/kdm.nix @@ -40,7 +40,7 @@ let [X-*-Greeter] HiddenUsers=root,nixbld1,nixbld2,nixbld3,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9,nixbld10 PluginsLogin=${kdebase_workspace}/lib/kde4/kgreet_classic.so - ${optionalString (cfg.themeDirectory != "") + ${optionalString (cfg.themeDirectory != null) '' UseTheme=true Theme=${cfg.themeDirectory} @@ -78,6 +78,7 @@ in services.xserver.displayManager.kdm = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the KDE display manager. @@ -85,6 +86,7 @@ in }; enableXDMCP = mkOption { + type = types.bool; default = false; description = '' Whether to enable XDMCP, which allows remote logins. @@ -92,7 +94,8 @@ in }; themeDirectory = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; description = '' The path to a KDM theme directory. This theme will be used by the KDM greeter. @@ -100,6 +103,7 @@ in }; setupScript = mkOption { + type = types.lines; default = ""; description = '' The path to a KDM setup script. This script is run as root just @@ -109,6 +113,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = '' Options appended to kdmrc, the diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix index 01c9fa96c8c..35834ef3764 100644 --- a/nixos/modules/services/x11/display-managers/slim.nix +++ b/nixos/modules/services/x11/display-managers/slim.nix @@ -16,7 +16,7 @@ let login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session" halt_cmd ${config.systemd.package}/sbin/shutdown -h now reboot_cmd ${config.systemd.package}/sbin/shutdown -r now - ${optionalString (cfg.defaultUser != "") ("default_user " + cfg.defaultUser)} + ${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)} ${optionalString cfg.autoLogin "auto_login yes"} ''; @@ -45,6 +45,7 @@ in services.xserver.displayManager.slim = { enable = mkOption { + type = types.bool; default = config.services.xserver.enable; description = '' Whether to enable SLiM as the display manager. @@ -52,11 +53,14 @@ in }; theme = mkOption { + type = types.nullOr types.path; default = null; - example = pkgs.fetchurl { - url = http://download.berlios.de/slim/slim-wave.tar.gz; - sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy"; - }; + example = literalExample '' + pkgs.fetchurl { + url = http://download.berlios.de/slim/slim-wave.tar.gz; + sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy"; + } + ''; description = '' The theme for the SLiM login manager. If not specified, SLiM's default theme is used. See xorg.conf). @@ -299,12 +317,14 @@ in }; deviceSection = mkOption { + type = types.lines; default = ""; example = "VideoRAM 131072"; description = "Contents of the first Device section of the X server configuration file."; }; screenSection = mkOption { + type = types.lines; default = ""; example = '' Option "RandRRotation" "on" @@ -313,6 +333,7 @@ in }; monitorSection = mkOption { + type = types.lines; default = ""; example = "HorizSync 28-49"; description = "Contents of the first Monitor section of the X server configuration file."; @@ -334,6 +355,7 @@ in }; moduleSection = mkOption { + type = types.lines; default = ""; example = '' @@ -344,6 +366,7 @@ in }; serverLayoutSection = mkOption { + type = types.lines; default = ""; example = '' @@ -353,36 +376,40 @@ in }; extraDisplaySettings = mkOption { + type = types.lines; default = ""; example = "Virtual 2048 2048"; description = "Lines to be added to every Display subsection of the Screen section."; }; defaultDepth = mkOption { + type = types.int; default = 0; example = 8; description = "Default colour depth."; }; useXFS = mkOption { + # FIXME: what's the type of this option? default = false; example = "unix/:7100"; description = "Determines how to connect to the X Font Server."; }; tty = mkOption { + type = types.int; default = 7; - example = 9; description = "Virtual console for the X server."; }; display = mkOption { + type = types.int; default = 0; - example = 1; description = "Display number for the X server."; }; virtualScreen = mkOption { + type = types.nullOr types.attrs; default = null; example = { x = 2048; y = 2048; }; description = '' diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 06b857297ac..6fd8bf241f5 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -92,8 +92,7 @@ let systemd = config.systemd.package; inherit children; - kernelParams = - config.boot.kernelParams ++ config.boot.extraKernelParams; + kernelParams = config.boot.kernelParams; installBootLoader = config.system.build.installBootLoader or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true"; @@ -162,6 +161,7 @@ in }; system.copySystemConfiguration = mkOption { + type = types.bool; default = false; description = '' If enabled, copies the NixOS configuration file diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 4cea6279e50..006909fbd0c 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -24,7 +24,7 @@ in # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. defaultText = "pkgs.linuxPackages"; - example = "pkgs.linuxPackages_2_6_25"; + example = literalExample "pkgs.linuxPackages_2_6_25"; description = '' This option allows you to override the Linux kernel used by NixOS. Since things like external kernel module packages are @@ -40,18 +40,9 @@ in }; boot.kernelParams = mkOption { + type = types.listOf types.str; default = [ ]; - description = '' - The kernel parameters. If you want to add additional - parameters, it's best to set - . - ''; - }; - - boot.extraKernelParams = mkOption { - default = [ ]; - example = [ "boot.trace" ]; - description = "Additional user-defined kernel parameters."; + description = "Parameters added to the kernel command line."; }; boot.consoleLogLevel = mkOption { @@ -65,6 +56,7 @@ in }; boot.vesa = mkOption { + type = types.bool; default = false; description = '' Whether to activate VESA video mode on boot. @@ -72,13 +64,14 @@ in }; boot.extraModulePackages = mkOption { + type = types.listOf types.path; default = []; - # !!! example = [pkgs.nvidia_x11]; + example = literalExample "[ pkgs.linuxPackages.nvidia_x11 ]"; description = "A list of additional packages supplying kernel modules."; }; boot.kernelModules = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = '' The set of kernel modules to be loaded in the second stage of @@ -90,7 +83,7 @@ in }; boot.initrd.availableKernelModules = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; example = [ "sata_nv" "ext3" ]; description = '' @@ -111,7 +104,7 @@ in }; boot.initrd.kernelModules = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = "List of modules that are always loaded by the initrd."; }; diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 56cb7cbeaa6..8b3923e30a0 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -78,7 +78,7 @@ in devices = mkOption { default = []; example = [ "/dev/hda" ]; - type = types.listOf types.string; + type = types.listOf types.str; description = '' The devices on which the boot loader, GRUB, will be installed. Can be used instead of device to diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix index 8b2762e2526..39928da8d19 100644 --- a/nixos/modules/system/boot/modprobe.nix +++ b/nixos/modules/system/boot/modprobe.nix @@ -36,6 +36,7 @@ with pkgs.lib; }; boot.blacklistedKernelModules = mkOption { + type = types.listOf types.str; default = []; example = [ "cirrusfb" "i2c_piix4" ]; description = '' diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 71dc29feb2a..b2b66280372 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -243,39 +243,39 @@ in default = true; type = types.bool; description = '' - Whether to run fsck on journaling filesystems such as ext3. + Whether to run fsck on journaling filesystems such as ext3. ''; }; boot.initrd.mdadmConf = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' - Contents of /etc/mdadm.conf at initrd. + Contents of /etc/mdadm.conf in stage 1. ''; }; boot.initrd.preLVMCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' - Shell commands to be executed immediately before lvm discovery. + Shell commands to be executed immediately before LVM discovery. ''; }; boot.initrd.postDeviceCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed immediately after stage 1 of the boot has loaded kernel modules and created device nodes in - /dev. + /dev. ''; }; boot.initrd.postMountCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed immediately after the stage 1 filesystems have been mounted. @@ -285,7 +285,7 @@ in boot.initrd.extraUtilsCommands = mkOption { internal = true; default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed in the builder of the extra-utils derivation. This can be used to provide @@ -296,7 +296,7 @@ in boot.initrd.extraUtilsCommandsTest = mkOption { internal = true; default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed in the builder of the extra-utils derivation after patchelf has done its @@ -306,12 +306,10 @@ in }; boot.initrd.compressor = mkOption { + internal = true; default = "gzip -9"; - - type = types.string; - - description = "The compressor to use on the initrd"; - + type = types.str; + description = "The compressor to use on the initrd image."; example = "xz"; }; diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix index 0af4c9f7a58..aa0d7e0c138 100644 --- a/nixos/modules/system/boot/stage-2.nix +++ b/nixos/modules/system/boot/stage-2.nix @@ -43,7 +43,7 @@ in postBootCommands = mkOption { default = ""; example = "rm -f /var/log/messages"; - type = types.string; + type = types.lines; description = '' Shell commands to be executed just before systemd is started. ''; @@ -80,10 +80,10 @@ in }; cleanTmpDir = mkOption { + type = types.bool; default = false; - example = true; description = '' - Delete all files in /tmp/ during boot. + Whether to delete all files in /tmp during boot. ''; }; diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix index b22259b6d63..a8f0a59b6fa 100644 --- a/nixos/modules/system/etc/etc.nix +++ b/nixos/modules/system/etc/etc.nix @@ -57,6 +57,7 @@ in }; target = mkOption { + type = types.str; description = '' Name of symlink (relative to /etc). Defaults to the attribute @@ -66,7 +67,7 @@ in text = mkOption { default = null; - type = types.nullOr types.string; + type = types.nullOr types.lines; description = "Text of the file."; }; @@ -76,6 +77,7 @@ in }; mode = mkOption { + type = types.str; default = "symlink"; example = "0600"; description = '' diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix index 8f441aa134d..ce36a8bab09 100644 --- a/nixos/modules/tasks/cpu-freq.nix +++ b/nixos/modules/tasks/cpu-freq.nix @@ -8,9 +8,9 @@ with pkgs.lib; options = { powerManagement.cpuFreqGovernor = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; example = "ondemand"; - type = types.str; description = '' Configure the governor used to regulate the frequence of the available CPUs. By default, the kernel configures the @@ -23,7 +23,7 @@ with pkgs.lib; ###### implementation - config = mkIf (config.powerManagement.cpuFreqGovernor != "") { + config = mkIf (config.powerManagement.cpuFreqGovernor != null) { environment.systemPackages = [ pkgs.cpufrequtils ]; diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix index 180da8267e0..6e67edb0b82 100644 --- a/nixos/tests/bittorrent.nix +++ b/nixos/tests/bittorrent.nix @@ -40,7 +40,7 @@ in { environment.systemPackages = [ pkgs.miniupnpd ]; virtualisation.vlans = [ 1 2 ]; networking.nat.enable = true; - networking.nat.internalIPs = "192.168.2.0/24"; + networking.nat.internalIPs = [ "192.168.2.0/24" ]; networking.nat.externalInterface = "eth1"; }; diff --git a/nixos/tests/nat.nix b/nixos/tests/nat.nix index 55d87ed4fa1..a13714d60a9 100644 --- a/nixos/tests/nat.nix +++ b/nixos/tests/nat.nix @@ -20,7 +20,7 @@ { config, pkgs, ... }: { virtualisation.vlans = [ 2 1 ]; networking.nat.enable = true; - networking.nat.internalIPs = "192.168.1.0/24"; + networking.nat.internalIPs = [ "192.168.1.0/24" ]; networking.nat.externalInterface = "eth1"; }; From 7d5152964cf85a698d48deea67a2e830f2e8ad24 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 17:52:35 +0100 Subject: [PATCH 137/179] Drop environment.x11Packages It doesn't do anything useful compared to environment.systemPackages. --- nixos/modules/rename.nix | 4 +--- .../services/x11/desktop-managers/default.nix | 2 +- .../services/x11/window-managers/awesome.nix | 2 +- nixos/modules/services/x11/window-managers/i3.nix | 6 +++--- .../modules/services/x11/window-managers/icewm.nix | 2 +- .../services/x11/window-managers/openbox.nix | 2 +- nixos/modules/services/x11/window-managers/twm.nix | 2 +- nixos/modules/services/x11/xserver.nix | 13 +------------ 8 files changed, 10 insertions(+), 23 deletions(-) diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 4f924b82a9d..ae3c9faeea6 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -69,9 +69,7 @@ let in zipModules ([] -# usage example: -# ++ alias [ "services" "xserver" "slim" "theme" ] [ "services" "xserver" "displayManager" "slim" "theme" ] -++ obsolete [ "environment" "extraPackages" ] [ "environment" "systemPackages" ] +++ obsolete [ "environment" "x11Packages" ] [ "environment" "systemPackages" ] ++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ] ++ obsolete [ "environment" "nix" ] [ "nix" "package" ] diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index 4bf1e33a295..ab3ced4c9e2 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -70,7 +70,7 @@ in config = { services.xserver.displayManager.session = cfg.session.list; - environment.x11Packages = + environment.systemPackages = mkIf cfg.session.needBGPackages [ pkgs.feh ]; }; } diff --git a/nixos/modules/services/x11/window-managers/awesome.nix b/nixos/modules/services/x11/window-managers/awesome.nix index 880ebf1eca6..1c61419a44c 100644 --- a/nixos/modules/services/x11/window-managers/awesome.nix +++ b/nixos/modules/services/x11/window-managers/awesome.nix @@ -35,7 +35,7 @@ in ''; }; - environment.x11Packages = [ pkgs.awesome ]; + environment.systemPackages = [ pkgs.awesome ]; }; diff --git a/nixos/modules/services/x11/window-managers/i3.nix b/nixos/modules/services/x11/window-managers/i3.nix index 6777a95ddc8..e53d86187ae 100644 --- a/nixos/modules/services/x11/window-managers/i3.nix +++ b/nixos/modules/services/x11/window-managers/i3.nix @@ -30,14 +30,14 @@ in services.xserver.windowManager = { session = [{ name = "i3"; - start = " + start = '' ${pkgs.i3}/bin/i3 ${optionalString (cfg.configFile != null) "-c \"${cfg.configFile}\"" } & waitPID=$! - "; + ''; }]; }; - environment.x11Packages = [ pkgs.i3 ]; + environment.systemPackages = [ pkgs.i3 ]; }; } diff --git a/nixos/modules/services/x11/window-managers/icewm.nix b/nixos/modules/services/x11/window-managers/icewm.nix index 9da4a415fad..b7da4051c14 100644 --- a/nixos/modules/services/x11/window-managers/icewm.nix +++ b/nixos/modules/services/x11/window-managers/icewm.nix @@ -35,7 +35,7 @@ in ''; }; - environment.x11Packages = [ pkgs.icewm ]; + environment.systemPackages = [ pkgs.icewm ]; }; diff --git a/nixos/modules/services/x11/window-managers/openbox.nix b/nixos/modules/services/x11/window-managers/openbox.nix index ae34a938c4a..46b1945d33e 100644 --- a/nixos/modules/services/x11/window-managers/openbox.nix +++ b/nixos/modules/services/x11/window-managers/openbox.nix @@ -25,6 +25,6 @@ in "; }]; }; - environment.x11Packages = [ pkgs.openbox ]; + environment.systemPackages = [ pkgs.openbox ]; }; } diff --git a/nixos/modules/services/x11/window-managers/twm.nix b/nixos/modules/services/x11/window-managers/twm.nix index c1a99b97566..d80ffe4942f 100644 --- a/nixos/modules/services/x11/window-managers/twm.nix +++ b/nixos/modules/services/x11/window-managers/twm.nix @@ -35,7 +35,7 @@ in ''; }; - environment.x11Packages = [ pkgs.xorg.twm ]; + environment.systemPackages = [ pkgs.xorg.twm ]; }; diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 89b6d21ebef..caa0839dbb7 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -419,15 +419,6 @@ in }; - environment.x11Packages = mkOption { - default = []; - type = types.listOf types.package; - description = '' - List of packages added to the system when the X server is - activated (). - ''; - }; - }; @@ -477,7 +468,7 @@ in } ]); - environment.x11Packages = + environment.systemPackages = [ xorg.xorgserver xorg.xrandr xorg.xrdb @@ -498,8 +489,6 @@ in ++ optional (elem "virtualbox" driverNames) xorg.xrefresh ++ optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11; - environment.systemPackages = config.environment.x11Packages; - environment.pathsToLink = [ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ]; From c7171b2c8fc5671cdc989c88aa8f959dac836a98 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 18:16:30 +0100 Subject: [PATCH 138/179] Comment out nixos-gui It hasn't built in over 2 years. --- nixos/modules/installer/tools/tools.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 2c68ec5fe22..41c562a6f46 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -52,6 +52,7 @@ let inherit (config.system) nixosVersion nixosCodeName; }; + /* nixos-gui = pkgs.xulrunnerWrapper { launcher = "nixos-gui"; application = pkgs.stdenv.mkDerivation { @@ -71,10 +72,12 @@ let }; }; }; + */ in { + /* options = { installer.enableGraphicalTools = pkgs.lib.mkOption { @@ -87,6 +90,7 @@ in }; }; + */ config = { environment.systemPackages = @@ -96,7 +100,7 @@ in nixos-generate-config nixos-option nixos-version - ] ++ pkgs.lib.optional cfg.enableGraphicalTools nixos-gui; + ]; system.build = { inherit nixos-install nixos-generate-config nixos-option; From 244cf195c88acff952ff0304c8e48a109f4b6754 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 18:30:23 +0100 Subject: [PATCH 139/179] Use the "assertions" option instead of mkAssert --- .../services/databases/4store-endpoint.nix | 17 ++++++----- nixos/modules/services/databases/4store.nix | 17 ++++++----- .../modules/services/networking/openfire.nix | 12 ++++---- nixos/modules/services/security/tor.nix | 18 ++++++------ nixos/modules/services/x11/xserver.nix | 28 ++++++++++--------- 5 files changed, 52 insertions(+), 40 deletions(-) diff --git a/nixos/modules/services/databases/4store-endpoint.nix b/nixos/modules/services/databases/4store-endpoint.nix index 7b03b4d8f1d..7872ea2dc6a 100644 --- a/nixos/modules/services/databases/4store-endpoint.nix +++ b/nixos/modules/services/databases/4store-endpoint.nix @@ -24,12 +24,12 @@ with pkgs.lib; }; listenAddress = mkOption { - default = null; + default = null; description = "IP address to listen on."; }; port = mkOption { - default = 8080; + default = 8080; description = "port to listen on."; }; @@ -45,9 +45,12 @@ with pkgs.lib; ###### implementation - config = mkIf cfg.enable ( - mkAssert (cfg.enable -> cfg.database != "") - "Must specify database name" { + config = mkIf cfg.enable { + + assertions = singleton + { assertion = cfg.enable -> cfg.database != ""; + message = "Must specify 4Store database name"; + }; users.extraUsers = singleton { name = endpointUser; @@ -63,10 +66,10 @@ with pkgs.lib; startOn = "filesystem"; exec = '' - ${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}' + ${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}' ''; }; - }); + }; } diff --git a/nixos/modules/services/databases/4store.nix b/nixos/modules/services/databases/4store.nix index 14990e92ea3..412d14b050c 100644 --- a/nixos/modules/services/databases/4store.nix +++ b/nixos/modules/services/databases/4store.nix @@ -36,9 +36,12 @@ with pkgs.lib; ###### implementation - config = mkIf cfg.enable ( - mkAssert (cfg.enable -> cfg.database != "") - "Must specify database name" { + config = mkIf cfg.enable { + + assertions = singleton + { assertion = cfg.enable -> cfg.database != ""; + message = "Must specify 4Store database name."; + }; users.extraUsers = singleton { name = fourStoreUser; @@ -56,16 +59,16 @@ with pkgs.lib; preStart = '' mkdir -p ${stateDir}/ chown ${fourStoreUser} ${stateDir} - if ! test -e "${stateDir}/${cfg.database}"; then - ${run} -c '${pkgs.rdf4store}/bin/4s-backend-setup ${cfg.database}' + if ! test -e "${stateDir}/${cfg.database}"; then + ${run} -c '${pkgs.rdf4store}/bin/4s-backend-setup ${cfg.database}' fi ''; exec = '' - ${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}' + ${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}' ''; }; - }); + }; } diff --git a/nixos/modules/services/networking/openfire.nix b/nixos/modules/services/networking/openfire.nix index d5c18c0675c..b2efb5e9c12 100644 --- a/nixos/modules/services/networking/openfire.nix +++ b/nixos/modules/services/networking/openfire.nix @@ -40,10 +40,12 @@ in ###### implementation - config = mkIf config.services.openfire.enable ( - mkAssert (!(config.services.openfire.usePostgreSQL -> config.services.postgresql.enable)) " - openfire assertion failed - " { + config = mkIf config.services.openfire.enable { + + assertions = singleton + { assertion = !(config.services.openfire.usePostgreSQL -> config.services.postgresql.enable); + message = "OpenFire assertion failed."; + }; jobs.openfire = { description = "OpenFire XMPP server"; @@ -65,6 +67,6 @@ in ''; # */ }; - }); + }; } diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix index 2dafb4595c6..e70eb8511a6 100644 --- a/nixos/modules/services/security/tor.nix +++ b/nixos/modules/services/security/tor.nix @@ -53,9 +53,9 @@ in ''; }; - socksListenAddressFaster = mkOption { + socksListenAddressFaster = mkOption { default = "127.0.0.1:9063"; - description = '' + description = '' Same as socksListenAddress but uses weaker circuit isolation to provide performance suitable for a web browser. ''; @@ -227,10 +227,12 @@ in ###### implementation - config = mkIf (cfg.client.enable || cfg.relay.enable) ( - mkAssert (cfg.relay.enable -> !(cfg.relay.isBridge && cfg.relay.isExit)) " - Can't be both an exit and a bridge relay at the same time - " { + config = mkIf (cfg.client.enable || cfg.relay.enable) { + + assertions = singleton + { assertion = cfg.relay.enable -> !(cfg.relay.isBridge && cfg.relay.isExit); + message = "Can't be both an exit and a bridge relay at the same time"; + }; users.extraUsers = singleton { name = torUser; @@ -270,7 +272,7 @@ in '' + optionalString cfg.client.enable '' SOCKSPort ${cfg.client.socksListenAddress} IsolateDestAddr - SOCKSPort ${cfg.client.socksListenAddressFaster} + SOCKSPort ${cfg.client.socksListenAddressFaster} ${opt "SocksPolicy" cfg.client.socksPolicy} '' + optionalString cfg.relay.enable '' @@ -316,6 +318,6 @@ in # Extra config goes here ''; - }); + }; } diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index caa0839dbb7..da94f7cad53 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -108,17 +108,6 @@ let ''; # */ }; - - checkAgent = mkAssert (!(cfg.startOpenSSHAgent && cfg.startGnuPGAgent)) - '' - The OpenSSH agent and GnuPG agent cannot be started both. - Choose between `startOpenSSHAgent' and `startGnuPGAgent'. - ''; - - checkPolkit = mkAssert config.security.polkit.enable - "X11 requires Polkit to be enabled (‘security.polkit.enable = true’)."; - - in { @@ -425,7 +414,20 @@ in ###### implementation - config = mkIf cfg.enable (checkAgent (checkPolkit { + config = mkIf cfg.enable { + + assertions = + [ { assertion = !(cfg.startOpenSSHAgent && cfg.startGnuPGAgent); + message = + '' + The OpenSSH agent and GnuPG agent cannot be started both. + Choose between `startOpenSSHAgent' and `startGnuPGAgent'. + ''; + } + { assertion = config.security.polkit.enable; + message = "X11 requires Polkit to be enabled (‘security.polkit.enable = true’)."; + } + ]; boot.extraModulePackages = optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11 ++ @@ -669,7 +671,7 @@ in ${xrandrMonitorSections} ''; - })); + }; } From f3cdf9b47739d0018b2a022b3fdea1b940094803 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 18:36:16 +0100 Subject: [PATCH 140/179] Make update-mime-database less verbose --- nixos/modules/config/system-path.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 932e4ccca05..2f61947c3bc 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -124,7 +124,7 @@ in postBuild = '' if [ -x $out/bin/update-mime-database -a -w $out/share/mime/packages ]; then - $out/bin/update-mime-database -V $out/share/mime + XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null fi if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then From a61b800da50ca3106a5e7ffe1d808f3023d337b8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 19:12:25 +0100 Subject: [PATCH 141/179] Fix backward compatibility with Nix < 1.6 "with" used to be less lazy, so don't rely on that. Also don't use the "<" operator. --- lib/modules.nix | 10 +++++++--- lib/types.nix | 25 +++++++++++++------------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 040ccf68214..071809daa58 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1,5 +1,9 @@ -with import ./.. {}; -with lib; +with import ./lists.nix; +with import ./trivial.nix; +with import ./attrsets.nix; +with import ./options.nix; +with import ./debug.nix; +with import ./types.nix; rec { @@ -244,7 +248,7 @@ rec { let defaultPrio = 100; getPrio = def: if def.value._type or "" == "override" then def.value.priority else defaultPrio; - min = x: y: if x < y then x else y; + min = x: y: if builtins.lessThan x y then x else y; highestPrio = fold (def: prio: min (getPrio def) prio) 9999 defs; strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def; in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs; diff --git a/lib/types.nix b/lib/types.nix index 2b3aa23df2f..09b29a762e1 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -1,13 +1,11 @@ # Definitions related to run-time type checking. Used in particular # to type-check NixOS configurations. -let lib = import ./default.nix; in - -with lib.lists; -with lib.attrsets; -with lib.options; -with lib.trivial; -with lib.modules; +with import ./lists.nix; +with import ./attrsets.nix; +with import ./options.nix; +with import ./trivial.nix; +with import ./strings.nix; rec { @@ -51,7 +49,7 @@ rec { bool = mkOptionType { name = "boolean"; check = builtins.isBool; - merge = loc: fold (x: lib.or x.value) false; + merge = loc: fold (x: y: x.value || y) false; }; int = mkOptionType { @@ -71,7 +69,7 @@ rec { separatedString = sep: mkOptionType { name = "string"; check = builtins.isString; - merge = loc: defs: lib.concatStringsSep sep (getValues defs); + merge = loc: defs: concatStringsSep sep (getValues defs); }; lines = separatedString "\n"; @@ -85,7 +83,7 @@ rec { attrs = mkOptionType { name = "attribute set"; check = isAttrs; - merge = loc: fold (def: lib.mergeAttrs def.value) {}; + merge = loc: fold (def: mergeAttrs def.value) {}; }; # derivation is a reserved keyword. @@ -117,7 +115,7 @@ rec { attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; - check = x: isAttrs x && all elemType.check (lib.attrValues x); + check = x: isAttrs x && all elemType.check (attrValues x); merge = loc: defs: zipAttrsWith (name: elemType.merge (loc ++ [name])) # Push down position info. @@ -179,7 +177,10 @@ rec { }; submodule = opts: - let opts' = toList opts; in + let + opts' = toList opts; + inherit (import ./modules.nix) evalModules; + in mkOptionType rec { name = "submodule"; check = x: isAttrs x || builtins.isFunction x; From 6e062f14347169385688f686d46a4fa23631731a Mon Sep 17 00:00:00 2001 From: Pascal Wittmann Date: Wed, 30 Oct 2013 21:59:27 +0100 Subject: [PATCH 142/179] Agda: update to 2.3.2.2. This update also fixes the build errors on hydra that were caused by an incompatible version of haskell-src-ext. Close #1153. --- pkgs/development/libraries/haskell/Agda/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/Agda/default.nix b/pkgs/development/libraries/haskell/Agda/default.nix index 64c9d9d51e5..749802f95b2 100644 --- a/pkgs/development/libraries/haskell/Agda/default.nix +++ b/pkgs/development/libraries/haskell/Agda/default.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "Agda"; - version = "2.3.2.1"; - sha256 = "1dlf0cs913ma8wjvra8x6p0lwi1pk7ynbdq4lxgbdfgqkbnh43kr"; + version = "2.3.2.2"; + sha256 = "0zr2rg2yvq6pqg69c6h7hqqpc5nj8prfhcvj5p2alkby0vs110qc"; isLibrary = true; isExecutable = true; buildDepends = [ From 92e3206c2ae8219415978dbf1bfc6d35604d17ae Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Thu, 31 Oct 2013 02:59:45 +0400 Subject: [PATCH 143/179] Updating SlimerJS to Git version for compatibility with fresh xulrunner --- .../update-walker-service-specific.sh | 4 ++- .../upstream-updater/update-walker.sh | 3 ++- pkgs/development/tools/slimerjs/default.nix | 26 ++++++++++++------- .../tools/slimerjs/default.upstream.git | 3 +++ 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 pkgs/development/tools/slimerjs/default.upstream.git diff --git a/pkgs/build-support/upstream-updater/update-walker-service-specific.sh b/pkgs/build-support/upstream-updater/update-walker-service-specific.sh index c98880df1a9..a979e24edf2 100644 --- a/pkgs/build-support/upstream-updater/update-walker-service-specific.sh +++ b/pkgs/build-support/upstream-updater/update-walker-service-specific.sh @@ -10,5 +10,7 @@ SF_version_dir () { GH_latest () { prefetch_command_rel ../fetchgit/nix-prefetch-git - rev "$(curl "$CURRENT_URL/commits" | grep /commit/ | head -n 1 | xargs basename )" + revision "$("$(dirname "$0")/urls-from-page.sh" "$CURRENT_URL/commits" | grep /commit/ | head -n 1 | xargs basename )" + version '.*' "git-$(date +%Y-%m-%d)" + NEED_TO_CHOOSE_URL= } diff --git a/pkgs/build-support/upstream-updater/update-walker.sh b/pkgs/build-support/upstream-updater/update-walker.sh index f29add11bb3..5743a289a4c 100755 --- a/pkgs/build-support/upstream-updater/update-walker.sh +++ b/pkgs/build-support/upstream-updater/update-walker.sh @@ -120,8 +120,9 @@ ensure_choice () { } } -rev () { +revision () { CURRENT_REV="$1" + echo "CURRENT_REV: $CURRENT_REV" } prefetch_command () { diff --git a/pkgs/development/tools/slimerjs/default.nix b/pkgs/development/tools/slimerjs/default.nix index ad60186804c..0fe10a0003a 100644 --- a/pkgs/development/tools/slimerjs/default.nix +++ b/pkgs/development/tools/slimerjs/default.nix @@ -1,28 +1,36 @@ -{stdenv, fetchurl, unzip, xulrunner, bash}: +{stdenv, fetchurl, fetchgit, zip, unzip, xulrunner, bash}: let s = # Generated upstream information rec { baseName="slimerjs"; - version="0.8.4"; + version="git-2013-10-31"; name="${baseName}-${version}"; - hash="12hv126i304y3lr8z420vpdlrks1qzz0zwfi5yishdfiasdl5pyd"; - url="http://download.slimerjs.org/v0.8/slimerjs-0.8.4.zip"; - sha256="12hv126i304y3lr8z420vpdlrks1qzz0zwfi5yishdfiasdl5pyd"; + hash="643a9d2f97f238bbd9debb17c010946d507a3b740079d9398939e7fdd70256b9"; + url="https://github.com/laurentj/slimerjs"; + rev="fdeb7364d3e29b47391ed0651176c1aedcb5277f"; + sha256="643a9d2f97f238bbd9debb17c010946d507a3b740079d9398939e7fdd70256b9"; }; buildInputs = [ - unzip + unzip zip ]; in stdenv.mkDerivation { inherit (s) name version; inherit buildInputs; - src = fetchurl { - inherit (s) url sha256; + # src = fetchurl { + # inherit (s) url sha256; + # }; + src = fetchgit { + inherit (s) url sha256 rev; }; + preConfigure = '' + test -d src && cd src + test -f omni.ja || zip omni.ja -r */ + ''; installPhase = '' mkdir -p "$out"/{bin,share/doc/slimerjs,lib/slimerjs} cp LICENSE README* "$out/share/doc/slimerjs" - cp * "$out/lib/slimerjs" + cp -r * "$out/lib/slimerjs" echo '#!${bash}/bin/bash' >> "$out/bin/slimerjs" echo 'export SLIMERJSLAUNCHER=${xulrunner}/bin/xulrunner' >> "$out/bin/slimerjs" echo "'$out/lib/slimerjs/slimerjs' \"\$@\"" >> "$out/bin/slimerjs" diff --git a/pkgs/development/tools/slimerjs/default.upstream.git b/pkgs/development/tools/slimerjs/default.upstream.git new file mode 100644 index 00000000000..3066d5de829 --- /dev/null +++ b/pkgs/development/tools/slimerjs/default.upstream.git @@ -0,0 +1,3 @@ +url https://github.com/laurentj/slimerjs +target default.nix +GH_latest From d9ba4378751f32f6ab5b31640cf3967a5efb43aa Mon Sep 17 00:00:00 2001 From: Domen Kozar Date: Thu, 31 Oct 2013 00:43:32 +0100 Subject: [PATCH 144/179] libedit: add FreeBSD support --- .../development/libraries/libedit/default.nix | 3 +++ .../libraries/libedit/freebsd.patch | 13 ++++++++++++ .../libraries/libedit/freebsd_weak_ref.patch | 20 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 pkgs/development/libraries/libedit/freebsd.patch create mode 100644 pkgs/development/libraries/libedit/freebsd_weak_ref.patch diff --git a/pkgs/development/libraries/libedit/default.nix b/pkgs/development/libraries/libedit/default.nix index cc5cd0beee9..1382af16484 100644 --- a/pkgs/development/libraries/libedit/default.nix +++ b/pkgs/development/libraries/libedit/default.nix @@ -15,6 +15,9 @@ stdenv.mkDerivation rec { sed -i s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc ''; + # taken from gentoo http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libedit/files/ + patches = [ ./freebsd.patch ./freebsd_weak_ref.patch ]; + configureFlags = "--enable-widec"; propagatedBuildInputs = [ ncurses ]; diff --git a/pkgs/development/libraries/libedit/freebsd.patch b/pkgs/development/libraries/libedit/freebsd.patch new file mode 100644 index 00000000000..e230a76d709 --- /dev/null +++ b/pkgs/development/libraries/libedit/freebsd.patch @@ -0,0 +1,13 @@ +diff --git a/src/chartype.h b/src/chartype.h +index c35825c..be5aac0 100644 +--- a/src/chartype.h ++++ b/src/chartype.h +@@ -44,7 +44,7 @@ + * supports non-BMP code points without requiring UTF-16, but nothing + * seems to actually advertise this properly, despite Unicode 3.1 having + * been around since 2001... */ +-#if !defined(__NetBSD__) && !defined(__sun) && !(defined(__APPLE__) && defined(__MACH__)) ++#if !defined(__NetBSD__) && !defined(__sun) && !(defined(__APPLE__) && defined(__MACH__)) && !defined(__DragonFly__) && !defined(__FreeBSD__) + #ifndef __STDC_ISO_10646__ + /* In many places it is assumed that the first 127 code points are ASCII + * compatible, so ensure wchar_t indeed does ISO 10646 and not some other diff --git a/pkgs/development/libraries/libedit/freebsd_weak_ref.patch b/pkgs/development/libraries/libedit/freebsd_weak_ref.patch new file mode 100644 index 00000000000..a4399593d63 --- /dev/null +++ b/pkgs/development/libraries/libedit/freebsd_weak_ref.patch @@ -0,0 +1,20 @@ +--- libedit-20110709-3.0/src/vi.c.old 2011-07-11 18:21:16.000000000 +0000 ++++ libedit-20110709-3.0/src/vi.c 2011-07-11 18:24:29.000000000 +0000 +@@ -918,7 +918,7 @@ + * NB: posix implies that we should enter insert mode, however + * this is against historical precedent... + */ +-#ifdef __weak_reference ++#if defined(__weak_reference) && defined(__NetBSD__) + __weakref_visible char *my_get_alias_text(const char *) + __weak_reference(get_alias_text); + #endif +@@ -926,7 +926,7 @@ + /*ARGSUSED*/ + vi_alias(EditLine *el, Int c) + { +-#ifdef __weak_reference ++#if defined(__weak_reference) && defined(__NetBSD__) + char alias_name[3]; + char *alias_text; + From a840dae93519d15cf15578f455545189695f016f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 08:41:51 +0100 Subject: [PATCH 145/179] Improve description of the users.extraUsers.*.description option Fixes NixOS/nixos#278. --- nixos/modules/config/users-groups.nix | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index d2eca7c3dcd..fb8b0229c1d 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -19,7 +19,12 @@ let description = mkOption { type = types.str; default = ""; - description = "A short description of the user account."; + example = "Alice Q. User"; + description = '' + A short description of the user account, typically the + user's full name. This is actually the “GECOS” or “comment” + field in /etc/passwd. + ''; }; uid = mkOption { @@ -67,7 +72,13 @@ let password = mkOption { type = with types; uniq (nullOr str); default = null; - description = "The user's password. If undefined, no password is set for the user. Warning: do not set confidential information here because this data would be readable by all. This option should only be used for public account such as guest."; + description = '' + The user's password. If undefined, no password is set for + the user. Warning: do not set confidential information here + because it is world-readable in the Nix store. This option + should only be used for public accounts such as + guest. + ''; }; isSystemUser = mkOption { @@ -79,11 +90,11 @@ let createUser = mkOption { type = types.bool; default = true; - description = " + description = '' Indicates if the user should be created automatically as a local user. Set this to false if the user for instance is an LDAP user. NixOS will then not modify any of the basic properties for the user account. - "; + ''; }; isAlias = mkOption { @@ -149,13 +160,12 @@ in example = { alice = { uid = 1234; - description = "Alice"; + description = "Alice Q. User"; home = "/home/alice"; createHome = true; group = "users"; extraGroups = ["wheel"]; shell = "/bin/sh"; - password = "foobar"; }; }; description = '' From 7083607e1280ea3f75f97f72f8dce8eee91f94fe Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 08:48:57 +0100 Subject: [PATCH 146/179] Generate manual for i686-linux as well as x86_64-linux --- nixos/release-combined.nix | 2 +- nixos/release.nix | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index e7b31383bd5..fbbbd2de123 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -37,7 +37,7 @@ in rec { constituents = let all = x: [ x.x86_64-linux x.i686-linux ]; in [ nixos.channel - nixos.manual + (all nixos.manual) (all nixos.iso_minimal) (all nixos.iso_graphical) diff --git a/nixos/release.nix b/nixos/release.nix index 866a992f79a..1ffb334d90a 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -12,8 +12,12 @@ let systems = [ "x86_64-linux" "i686-linux" ]; + forAllSystems = pkgs.lib.genAttrs systems; + pkgs = import nixpkgs { system = "x86_64-linux"; }; + lib = pkgs.lib; + versionModule = { system.nixosVersionSuffix = versionSuffix; @@ -109,23 +113,23 @@ in rec { }; - manual = iso_minimal.x86_64-linux.config.system.build.manual.manual; - manpages = iso_minimal.x86_64-linux.config.system.build.manual.manpages; + manual = forAllSystems (system: (builtins.getAttr system iso_minimal).config.system.build.manual.manual); + manpages = forAllSystems (system: (builtins.getAttr system iso_minimal).config.system.build.manual.manpages); - iso_minimal = pkgs.lib.genAttrs systems (system: makeIso { + iso_minimal = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-minimal.nix; type = "minimal"; inherit system; }); - iso_minimal_new_kernel = pkgs.lib.genAttrs systems (system: makeIso { + iso_minimal_new_kernel = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix; type = "minimal-new-kernel"; inherit system; }); - iso_graphical = pkgs.lib.genAttrs systems (system: makeIso { + iso_graphical = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-graphical.nix; type = "graphical"; inherit system; @@ -133,7 +137,7 @@ in rec { # A variant with a more recent (but possibly less stable) kernel # that might support more hardware. - iso_new_kernel = pkgs.lib.genAttrs systems (system: makeIso { + iso_new_kernel = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-new-kernel.nix; type = "new-kernel"; inherit system; @@ -141,7 +145,7 @@ in rec { # A variant with efi booting support. Once cd-minimal has a newer kernel, # this should be enabled by default. - iso_efi = pkgs.lib.genAttrs systems (system: makeIso { + iso_efi = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-efi.nix; type = "efi"; maintainers = [ "shlevy" ]; @@ -150,7 +154,7 @@ in rec { # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). - ova = pkgs.lib.genAttrs systems (system: + ova = forAllSystems (system: with import nixpkgs { inherit system; }; @@ -186,7 +190,7 @@ in rec { # boot that system from uboot (like for the sheevaplug). # The pc variant helps preparing the expression for the system tarball # in a machine faster than the sheevpalug - system_tarball_pc = pkgs.lib.genAttrs systems (system: makeSystemTarball { + system_tarball_pc = forAllSystems (system: makeSystemTarball { module = ./modules/installer/cd-dvd/system-tarball-pc.nix; inherit system; }); @@ -211,7 +215,7 @@ in rec { # Run the tests in ./tests/default.nix for each platform. You can # run a test by doing e.g. "nix-build -A tests.login.x86_64-linux". tests = - with pkgs.lib; + with lib; let testsFor = system: mapAttrsRecursiveCond (x: !x ? test) (n: v: listToAttrs [(nameValuePair system v.test)]) From 90d80c3d354ebbaf4450734b0baae4438a947afd Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:33 +0100 Subject: [PATCH 147/179] haskell-OpenGL: update 2.9.x branch to version 2.9.1.0 --- .../libraries/haskell/OpenGL/{2.9.0.0.nix => 2.9.1.0.nix} | 4 ++-- pkgs/top-level/haskell-packages.nix | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) rename pkgs/development/libraries/haskell/OpenGL/{2.9.0.0.nix => 2.9.1.0.nix} (84%) diff --git a/pkgs/development/libraries/haskell/OpenGL/2.9.0.0.nix b/pkgs/development/libraries/haskell/OpenGL/2.9.1.0.nix similarity index 84% rename from pkgs/development/libraries/haskell/OpenGL/2.9.0.0.nix rename to pkgs/development/libraries/haskell/OpenGL/2.9.1.0.nix index 869ca71dfb6..6f79b5c7a06 100644 --- a/pkgs/development/libraries/haskell/OpenGL/2.9.0.0.nix +++ b/pkgs/development/libraries/haskell/OpenGL/2.9.1.0.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "OpenGL"; - version = "2.9.0.0"; - sha256 = "0likrpzlzis8fk11g7mjn102y6y6k2w8bkybqqhhmfls7ccgpvhp"; + version = "2.9.1.0"; + sha256 = "09xzjaa9qyh7bfsnq226v9zi6lhnalhmlqlca3808hgax8ijwhp3"; buildDepends = [ GLURaw OpenGLRaw text ]; extraLibraries = [ libX11 mesa ]; meta = { diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 708041317e7..b8903d7c038 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -153,7 +153,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x HUnit = self.HUnit_1_2_5_2; mtl = self.mtl_2_1_2; network = self.network_2_4_2_0; - OpenGL = self.OpenGL_2_8_0_0; + OpenGL = self.OpenGL_2_9_1_0; OpenGLRaw = self.OpenGLRaw_1_4_0_0; parallel = self.parallel_3_2_0_3; parsec = self.parsec_3_1_3; @@ -1098,7 +1098,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x OpenGL = self.OpenGL_2_8_0_0; }; GLUT_2_5_0_1 = callPackage ../development/libraries/haskell/GLUT/2.5.0.1.nix { - OpenGL = self.OpenGL_2_9_0_0; + OpenGL = self.OpenGL_2_9_0_1; }; GLUT = self.GLUT_2_5_0_1; @@ -1608,8 +1608,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x OpenGL_2_4_0_2 = callPackage ../development/libraries/haskell/OpenGL/2.4.0.2.nix {}; OpenGL_2_6_0_1 = callPackage ../development/libraries/haskell/OpenGL/2.6.0.1.nix {}; OpenGL_2_8_0_0 = callPackage ../development/libraries/haskell/OpenGL/2.8.0.0.nix {}; - OpenGL_2_9_0_0 = callPackage ../development/libraries/haskell/OpenGL/2.9.0.0.nix {}; - OpenGL = self.OpenGL_2_9_0_0; + OpenGL_2_9_0_1 = callPackage ../development/libraries/haskell/OpenGL/2.9.1.0.nix {}; + OpenGL = self.OpenGL_2_9_1_0; OpenGLRaw_1_3_0_0 = callPackage ../development/libraries/haskell/OpenGLRaw/1.3.0.0.nix {}; OpenGLRaw_1_4_0_0 = callPackage ../development/libraries/haskell/OpenGLRaw/1.4.0.0.nix {}; From 793be25a9a88325d0f2ef2e5b9890b77f3a0d6af Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:44 +0100 Subject: [PATCH 148/179] haskell-gloss: update to version 1.8.1.1 --- pkgs/development/libraries/haskell/gloss/default.nix | 4 ++-- pkgs/top-level/haskell-packages.nix | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/haskell/gloss/default.nix b/pkgs/development/libraries/haskell/gloss/default.nix index f397a60017f..0f0777909e8 100644 --- a/pkgs/development/libraries/haskell/gloss/default.nix +++ b/pkgs/development/libraries/haskell/gloss/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "gloss"; - version = "1.8.0.1"; - sha256 = "17nnmv84pjls1my58yzifbin3pxcnlbpkprglad707rr4lrkkjvv"; + version = "1.8.1.1"; + sha256 = "135rrgzx4xq8279zbsl4538hjn8np4g6409fgva2cb9shw8z5pmj"; buildDepends = [ bmp GLUT OpenGL ]; jailbreak = true; meta = { diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index b8903d7c038..ba6d3409416 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1074,10 +1074,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x GlomeVec = callPackage ../development/libraries/haskell/GlomeVec {}; - gloss = callPackage ../development/libraries/haskell/gloss { - OpenGL = self.OpenGL_2_6_0_1; - GLUT = self.GLUT_2_3_1_0; - }; + gloss = callPackage ../development/libraries/haskell/gloss {}; glpkHs = callPackage ../development/libraries/haskell/glpk-hs {}; From 893282109e63805a06518a9e75b90a666702dcc1 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:52 +0100 Subject: [PATCH 149/179] haskell-xmobar: update to version 0.19 --- pkgs/applications/misc/xmobar/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/xmobar/default.nix b/pkgs/applications/misc/xmobar/default.nix index 42d11308267..273998dde5d 100644 --- a/pkgs/applications/misc/xmobar/default.nix +++ b/pkgs/applications/misc/xmobar/default.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "xmobar"; - version = "0.18"; - sha256 = "08kk0yjx51vjrvvvd34hv8v80dsh8kjv150qf413ikaff0i28v7w"; + version = "0.19"; + sha256 = "1lwbww9vpqscip16lqiax2qvfyksxms5xx4n0s61mzw7v61hyxq2"; isLibrary = false; isExecutable = true; buildDepends = [ From aa3fad72ad201fe18ccf0c4096180e6768030379 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:52 +0100 Subject: [PATCH 150/179] haskell-HDBC-postgresql: update to version 2.3.2.2 --- pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix b/pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix index b66ed3ce28f..94fcd71adbd 100644 --- a/pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix +++ b/pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "HDBC-postgresql"; - version = "2.3.2.1"; - sha256 = "1ji10w4d91dp3ci7pn1jd8nb3wasszwlsy1lfbb4mqnr15c9vnpb"; + version = "2.3.2.2"; + sha256 = "0x42lf429dxjkz22jn5fybimlixxs20zq01ap40344qlwh01hd90"; isLibrary = true; isExecutable = true; buildDepends = [ convertible HDBC mtl parsec time utf8String ]; From 29054f9a87ccb8dfc6445410beb6b2b0cd852b54 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:52 +0100 Subject: [PATCH 151/179] haskell-blaze-builder: update to version 0.3.2.0 --- pkgs/development/libraries/haskell/blaze-builder/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/blaze-builder/default.nix b/pkgs/development/libraries/haskell/blaze-builder/default.nix index 816537b1ab6..7c2ee140c1a 100644 --- a/pkgs/development/libraries/haskell/blaze-builder/default.nix +++ b/pkgs/development/libraries/haskell/blaze-builder/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "blaze-builder"; - version = "0.3.1.1"; - sha256 = "1pnw5kjpyxf3mh72cb9a0f1qwpq3a2bkgqp1j3ny8l6nmzw0c9d1"; + version = "0.3.2.0"; + sha256 = "169q318jxhk7rmb8r679zhcdcmcca87d55341cnzajmc0580n6ih"; buildDepends = [ text ]; meta = { homepage = "http://github.com/meiersi/blaze-builder"; From 56dfdba91b4f484777725d87b3eec19dd0914104 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 152/179] haskell-constraints: update to version 0.3.4.2 --- pkgs/development/libraries/haskell/constraints/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/constraints/default.nix b/pkgs/development/libraries/haskell/constraints/default.nix index e57b4e6c085..1e0dc901aaf 100644 --- a/pkgs/development/libraries/haskell/constraints/default.nix +++ b/pkgs/development/libraries/haskell/constraints/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "constraints"; - version = "0.3.4.1"; - sha256 = "13jxh2cgcfyiqhx7j5063k8k60wz9h4hd5lf2mw2skbcryg6csmb"; + version = "0.3.4.2"; + sha256 = "14bfar4d44yl9zxgqxj4p67ag2ndprm602l4pinfjk0ywbh63fwq"; buildDepends = [ newtype ]; meta = { homepage = "http://github.com/ekmett/constraints/"; From 436885b067bda461323eb0600e9bcf969ea5c471 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 153/179] haskell-fclabels: update to version 2.0.0.2 --- pkgs/development/libraries/haskell/fclabels/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/fclabels/default.nix b/pkgs/development/libraries/haskell/fclabels/default.nix index cea3302cf58..162b83733b1 100644 --- a/pkgs/development/libraries/haskell/fclabels/default.nix +++ b/pkgs/development/libraries/haskell/fclabels/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "fclabels"; - version = "2.0"; - sha256 = "1zh8hr0nq7vnp0q5yf0qd4sbxpaq67l15gs1rvssxfj6n738kngq"; + version = "2.0.0.2"; + sha256 = "1c706v10g4av7jxiw3x4n1hg9h7sbwcnrj676b1q0rcb3pd32kz6"; buildDepends = [ mtl transformers ]; meta = { homepage = "https://github.com/sebastiaanvisser/fclabels"; From ece9b2152242e42db98cd46fba48d2b58c380155 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 154/179] haskell-feed: update to version 0.3.9.2 --- pkgs/development/libraries/haskell/feed/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/haskell/feed/default.nix b/pkgs/development/libraries/haskell/feed/default.nix index a2c1ccde86b..817276497da 100644 --- a/pkgs/development/libraries/haskell/feed/default.nix +++ b/pkgs/development/libraries/haskell/feed/default.nix @@ -1,10 +1,10 @@ -{ cabal, utf8String, xml }: +{ cabal, time, utf8String, xml }: cabal.mkDerivation (self: { pname = "feed"; - version = "0.3.9.1"; - sha256 = "1c7dj9w9qj8408qql1kfq8m28fwvfd7bpgkj32lmk5x9qm5iz04k"; - buildDepends = [ utf8String xml ]; + version = "0.3.9.2"; + sha256 = "05sg2ly1pvni3sfv03rbf60vdjkrfa0f9mmc1dm1hrmp638j67gg"; + buildDepends = [ time utf8String xml ]; meta = { homepage = "https://github.com/sof/feed"; description = "Interfacing with RSS (v 0.9x, 2.x, 1.0) + Atom feeds."; From f7ea8a57df5a2004f31fa70a80236c3ceaee965e Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 155/179] haskell-hexpat: update to version 0.20.4 --- .../development/libraries/haskell/hexpat/default.nix | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/haskell/hexpat/default.nix b/pkgs/development/libraries/haskell/hexpat/default.nix index 5a656bc19c7..03aa9c16ed2 100644 --- a/pkgs/development/libraries/haskell/hexpat/default.nix +++ b/pkgs/development/libraries/haskell/hexpat/default.nix @@ -1,14 +1,10 @@ -{ cabal, deepseq, extensibleExceptions, List, text, transformers -, utf8String -}: +{ cabal, deepseq, List, text, transformers, utf8String }: cabal.mkDerivation (self: { pname = "hexpat"; - version = "0.20.3"; - sha256 = "13dh0cvcmp6yi4nncsn6q9pkisld9xvz6j4xabng5ax67vdgdvrs"; - buildDepends = [ - deepseq extensibleExceptions List text transformers utf8String - ]; + version = "0.20.4"; + sha256 = "09ixvwgrr1046v806d23ngdhc8xqkf0yadzlbwxcy228ka13xwdw"; + buildDepends = [ deepseq List text transformers utf8String ]; meta = { homepage = "http://haskell.org/haskellwiki/Hexpat/"; description = "XML parser/formatter based on expat"; From e0c633a402980092682130961bcb23b3d3478f72 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 156/179] haskell-hslua: update to version 0.3.8 --- pkgs/development/libraries/haskell/hslua/default.nix | 8 +++++--- pkgs/top-level/haskell-packages.nix | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/haskell/hslua/default.nix b/pkgs/development/libraries/haskell/hslua/default.nix index 11740095284..0cdd309d81b 100644 --- a/pkgs/development/libraries/haskell/hslua/default.nix +++ b/pkgs/development/libraries/haskell/hslua/default.nix @@ -1,10 +1,12 @@ -{ cabal, mtl }: +{ cabal, lua, mtl }: cabal.mkDerivation (self: { pname = "hslua"; - version = "0.3.7"; - sha256 = "1q5s2b7x9idvdvp31yl86mmy476gfq6rg8f0r8faqxrm45jwgv2q"; + version = "0.3.8"; + sha256 = "1yb23cyb3wj70z8lvk6w2sn13kc17v53fd8m587kb4fpqzpdz44d"; buildDepends = [ mtl ]; + pkgconfigDepends = [ lua ]; + configureFlags = "-fsystem-lua"; meta = { description = "A Lua language interpreter embedding in Haskell"; license = self.stdenv.lib.licenses.bsd3; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index ba6d3409416..d23df701745 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1256,7 +1256,9 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x hsemail = callPackage ../development/libraries/haskell/hsemail {}; - hslua = callPackage ../development/libraries/haskell/hslua {}; + hslua = callPackage ../development/libraries/haskell/hslua { + lua = pkgs.lua5_1; + }; HSH = callPackage ../development/libraries/haskell/HSH {}; From df12cd8a7b809fd01c2f5c328e31d5f9971dfcb3 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 157/179] haskell-intervals: update to version 0.3 --- pkgs/development/libraries/haskell/intervals/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/haskell/intervals/default.nix b/pkgs/development/libraries/haskell/intervals/default.nix index 9a270574570..788962412d7 100644 --- a/pkgs/development/libraries/haskell/intervals/default.nix +++ b/pkgs/development/libraries/haskell/intervals/default.nix @@ -1,10 +1,9 @@ -{ cabal, numericExtras }: +{ cabal }: cabal.mkDerivation (self: { pname = "intervals"; - version = "0.2.2.1"; - sha256 = "0kbsms3742ppmzbmrfp94aq4wvwrayx5ppsyk7pd1mj7y47aay0f"; - buildDepends = [ numericExtras ]; + version = "0.3"; + sha256 = "1k8dhhwa6y5hrkm9np9x953bdn3pgk5c2lkl3zgrrmrwmd075422"; meta = { homepage = "http://github.com/ekmett/intervals"; description = "Interval Arithmetic"; From 7399dba2178c7c0c0cf730f4b1a256346c156c0b Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 158/179] haskell-pipes-parse: update to version 2.0.1 --- pkgs/development/libraries/haskell/pipes-parse/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/pipes-parse/default.nix b/pkgs/development/libraries/haskell/pipes-parse/default.nix index 2584e001c4f..33892ef8fc6 100644 --- a/pkgs/development/libraries/haskell/pipes-parse/default.nix +++ b/pkgs/development/libraries/haskell/pipes-parse/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "pipes-parse"; - version = "2.0.0"; - sha256 = "092y0a4lvll451gnbz6ddrqgh22bd69wi00c0zd8s0hmf2f53y0s"; + version = "2.0.1"; + sha256 = "04sqjdmgkgk5qva0gyrblhdvmljgmci2yzzw7y17pmnwxwdja4f0"; buildDepends = [ free pipes transformers ]; meta = { description = "Parsing infrastructure for the pipes ecosystem"; From 4bf277e39bea2c89ee3d809f6649257a1c20c576 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 159/179] haskell-postgresql-simple: update to version 0.3.9.1 --- .../libraries/haskell/postgresql-simple/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/haskell/postgresql-simple/default.nix b/pkgs/development/libraries/haskell/postgresql-simple/default.nix index a6412006e8f..4203c0cd84c 100644 --- a/pkgs/development/libraries/haskell/postgresql-simple/default.nix +++ b/pkgs/development/libraries/haskell/postgresql-simple/default.nix @@ -1,15 +1,15 @@ { cabal, aeson, attoparsec, base16Bytestring, blazeBuilder , blazeTextual, cryptohash, HUnit, postgresqlLibpq, text, time -, transformers, vector +, transformers, uuid, vector }: cabal.mkDerivation (self: { pname = "postgresql-simple"; - version = "0.3.8.0"; - sha256 = "1p1cxp7mjrxyxxqrq2skm3kqrnmb3k6fb8kwr2aj9cnbqfhwl1qf"; + version = "0.3.9.1"; + sha256 = "0byzlmcbwlycvlk35w0gdp5x7860jcc589ypbdx0vm08aq5vz87v"; buildDepends = [ aeson attoparsec blazeBuilder blazeTextual postgresqlLibpq text - time transformers vector + time transformers uuid vector ]; testDepends = [ base16Bytestring cryptohash HUnit text time vector From 7deb37d1f9dc6f4d6c5796e3ba4f61b2823b9e74 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:53 +0100 Subject: [PATCH 160/179] haskell-symbol: update to version 0.2.0 --- pkgs/development/libraries/haskell/symbol/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/symbol/default.nix b/pkgs/development/libraries/haskell/symbol/default.nix index e92c2ec03ad..7b1c2d3821c 100644 --- a/pkgs/development/libraries/haskell/symbol/default.nix +++ b/pkgs/development/libraries/haskell/symbol/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "symbol"; - version = "0.1.4"; - sha256 = "00318syprv1ixfbr4v7xq86z10f0psxk0b8kaxvawvacm8hp61bn"; + version = "0.2.0"; + sha256 = "13vr6j3wkxbdbd27xklnidfkpkjwl0kldf69z470bm5indvaaxfd"; buildDepends = [ deepseq syb ]; jailbreak = true; meta = { From 7337c675dfff584015fbdbc6f556c0cd6bc77d6e Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:54 +0100 Subject: [PATCH 161/179] haskell-uuid: update to version 1.3.3 --- pkgs/development/libraries/haskell/uuid/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/haskell/uuid/default.nix b/pkgs/development/libraries/haskell/uuid/default.nix index 2160d22607b..a38a108bc03 100644 --- a/pkgs/development/libraries/haskell/uuid/default.nix +++ b/pkgs/development/libraries/haskell/uuid/default.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "uuid"; - version = "1.3.2"; - sha256 = "0kwrb200i41l8ipgwviv934sa2ic2hqvlpj72pmkw4ba50viyc8m"; + version = "1.3.3"; + sha256 = "12sfspmrnpqbwwscv3w41pkkdbfvy1aaa84y7is0d3ffk5rll80m"; buildDepends = [ binary cryptohash deepseq hashable networkInfo random time ]; From 86443f4efde456ae3d3f82b26aa36d073f36f8e2 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 30 Oct 2013 14:05:54 +0100 Subject: [PATCH 162/179] haskell-cabal2nix: update to version 1.55 --- pkgs/development/tools/haskell/cabal2nix/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/haskell/cabal2nix/default.nix b/pkgs/development/tools/haskell/cabal2nix/default.nix index 4e2bbf63b31..cc44268f3a3 100644 --- a/pkgs/development/tools/haskell/cabal2nix/default.nix +++ b/pkgs/development/tools/haskell/cabal2nix/default.nix @@ -3,8 +3,8 @@ cabal.mkDerivation (self: { pname = "cabal2nix"; - version = "1.54"; - sha256 = "169syf99gs0gj44hcnpgx0xvrmz5mq70hb6bq6ydma9ivjvz2jg4"; + version = "1.55"; + sha256 = "0rda8g595pr7vlhzyflw9kz6fw1iz76yimbl1zizgrnpnq3h11w3"; isLibrary = false; isExecutable = true; buildDepends = [ Cabal filepath hackageDb HTTP mtl regexPosix ]; From 456d8ec52b640ff67c88d04c89ea59836953b38f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 13:18:00 +0100 Subject: [PATCH 163/179] Clean up Synergy option descriptions a bit --- nixos/modules/services/misc/synergy.nix | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/nixos/modules/services/misc/synergy.nix b/nixos/modules/services/misc/synergy.nix index 91c0acb0bc2..63e7c7667e5 100644 --- a/nixos/modules/services/misc/synergy.nix +++ b/nixos/modules/services/misc/synergy.nix @@ -22,58 +22,56 @@ in enable = mkOption { default = false; description = " - Whether to enable the synergy client (receive keyboard and mouse events from a synergy server) + Whether to enable the Synergy client (receive keyboard and mouse events from a Synergy server). "; }; screenName = mkOption { default = ""; - description = " - use screen-name instead the hostname to identify + description = '' + Use the given name instead of the hostname to identify ourselves to the server. - "; + ''; }; serverAddress = mkOption { - description = " + description = '' The server address is of the form: [hostname][:port]. The hostname must be the address or hostname of the server. The port overrides the default port, 24800. - "; + ''; }; autoStart = mkOption { default = true; type = types.bool; - description = "Whether synergy-client should be started automatically."; + description = "Whether the Synergy client should be started automatically."; }; }; server = { enable = mkOption { default = false; - description = " - Whether to enable the synergy server (send keyboard and mouse events) - "; + description = '' + Whether to enable the Synergy server (send keyboard and mouse events). + ''; }; configFile = mkOption { default = "/etc/synergy-server.conf"; - description = " - The synergy server configuration file. open upstart-jobs/synergy.nix to see an example - "; + description = "The Synergy server configuration file."; }; screenName = mkOption { default = ""; - description = " - use screen-name instead the hostname to identify + description = '' + Use the given name instead of the hostname to identify this screen in the configuration. - "; + ''; }; address = mkOption { default = ""; - description = "listen for clients on the given address"; + description = "Address on which to listen for clients."; }; autoStart = mkOption { default = true; type = types.bool; - description = "Whether synergy-server should be started automatically."; + description = "Whether the Synergy server should be started automatically."; }; }; }; From c1159edc65989d6b33aa68e0822ec6e388576b8e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 13:26:06 +0100 Subject: [PATCH 164/179] Remove remaining references to Upstart --- .../modules/services/networking/firewall.nix | 7 ++---- .../services/networking/gogoclient.nix | 23 ++++++++---------- nixos/modules/services/networking/openvpn.nix | 8 +++---- .../system/activation/activation-script.nix | 12 ++-------- nixos/modules/system/activation/top-level.nix | 15 +++--------- nixos/modules/system/upstart/upstart.nix | 24 ++++++++++++------- nixos/modules/virtualisation/ec2-data.nix | 4 ++-- nixos/modules/virtualisation/libvirtd.nix | 5 +--- 8 files changed, 39 insertions(+), 59 deletions(-) diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix index 4ed859c2e7e..3c0c51e6ec8 100644 --- a/nixos/modules/services/networking/firewall.nix +++ b/nixos/modules/services/networking/firewall.nix @@ -215,11 +215,8 @@ in ###### implementation - # !!! Maybe if `enable' is false, the firewall should still be built - # but not started by default. However, currently nixos-rebuild - # doesn't deal with such Upstart jobs properly (it starts them if - # they are changed, regardless of whether the start condition - # holds). + # FIXME: Maybe if `enable' is false, the firewall should still be + # built but not started by default? config = mkIf cfg.enable { networking.firewall.trustedInterfaces = [ "lo" ]; diff --git a/nixos/modules/services/networking/gogoclient.nix b/nixos/modules/services/networking/gogoclient.nix index 07c35e3cb3d..3b92eb8b06b 100644 --- a/nixos/modules/services/networking/gogoclient.nix +++ b/nixos/modules/services/networking/gogoclient.nix @@ -15,38 +15,35 @@ in default = false; type = types.bool; description = '' - Enable the gogoclient ipv6 tunnel. + Enable the gogoCLIENT IPv6 tunnel. ''; }; autorun = mkOption { default = true; - description = " - Switch to false to create upstart-job and configuration, - but not run it automatically - "; + description = '' + Whether to automatically start the tunnel. + ''; }; username = mkOption { default = ""; - description = " + description = '' Your Gateway6 login name, if any. - "; + ''; }; password = mkOption { default = ""; type = types.string; - description = " - Path to a file (as a string), containing your gogonet password, if any. - "; + description = '' + Path to a file (as a string), containing your gogoNET password, if any. + ''; }; server = mkOption { default = "anonymous.freenet6.net"; example = "broker.freenet6.net"; - description = " - Used Gateway6 server. - "; + description = "The Gateway6 server to be used."; }; }; }; diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix index 400cb74f7d9..292d45f4347 100644 --- a/nixos/modules/services/networking/openvpn.nix +++ b/nixos/modules/services/networking/openvpn.nix @@ -107,10 +107,10 @@ in ''; description = '' - Each attribute of this option defines an Upstart job to run an - OpenVPN instance. These can be OpenVPN servers or clients. - The name of each Upstart job is - openvpn-name, + Each attribute of this option defines a systemd service that + runs an OpenVPN instance. These can be OpenVPN servers or + clients. The name of each systemd service is + openvpn-name.service, where name is the corresponding attribute name. ''; diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix index b502484a520..e012c977164 100644 --- a/nixos/modules/system/activation/activation-script.nix +++ b/nixos/modules/system/activation/activation-script.nix @@ -116,18 +116,10 @@ in mkdir -m 0755 -p /var/run/nix/current-load # for distributed builds mkdir -m 0700 -p /var/run/nix/remote-stores - # Directory holding symlinks to currently running Upstart - # jobs. Used to determine which jobs need to be restarted - # when switching to a new configuration. - mkdir -m 0700 -p /var/run/upstart-jobs - mkdir -m 0755 -p /var/log - touch /var/log/wtmp # must exist - chmod 644 /var/log/wtmp - - touch /var/log/lastlog - chmod 644 /var/log/lastlog + touch /var/log/wtmp /var/log/lastlog # must exist + chmod 644 /var/log/wtmp /var/log/lastlog mkdir -m 1777 -p /var/tmp diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 6fd8bf241f5..ada96131675 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -80,9 +80,9 @@ let # Putting it all together. This builds a store path containing # symlinks to the various parts of the built configuration (the - # kernel, the Upstart services, the init scripts, etc.) as well as a - # script `switch-to-configuration' that activates the configuration - # and makes it bootable. + # kernel, systemd units, init scripts, etc.) as well as a script + # `switch-to-configuration' that activates the configuration and + # makes it bootable. system = pkgs.stdenv.mkDerivation { name = "nixos-${config.system.nixosVersion}"; preferLocalBuild = true; @@ -99,15 +99,6 @@ let activationScript = config.system.activationScripts.script; nixosVersion = config.system.nixosVersion; - jobs = map (j: j.name) (attrValues config.jobs); - - # Pass the names of all Upstart tasks to the activation script. - tasks = attrValues (mapAttrs (n: v: if v.task then ["[${v.name}]=1"] else []) config.jobs); - - # Pass the names of all Upstart jobs that shouldn't be restarted - # to the activation script. - noRestartIfChanged = attrValues (mapAttrs (n: v: if v.restartIfChanged then [] else ["[${v.name}]=1"]) config.jobs); - configurationName = config.boot.loader.grub.configurationName; # Needed by switch-to-configuration. diff --git a/nixos/modules/system/upstart/upstart.nix b/nixos/modules/system/upstart/upstart.nix index 464041ebe6b..aa5c8dfe64b 100644 --- a/nixos/modules/system/upstart/upstart.nix +++ b/nixos/modules/system/upstart/upstart.nix @@ -107,17 +107,18 @@ let type = types.str; example = "sshd"; description = '' - Name of the Upstart job. + Name of the job, mapped to the systemd unit + name.service. ''; }; startOn = mkOption { - # !!! Re-enable this once we're on Upstart >= 0.6. #type = types.str; default = ""; description = '' - The Upstart event that triggers this job to be started. - If empty, the job will not start automatically. + The Upstart event that triggers this job to be started. Some + are mapped to systemd dependencies; otherwise you will get a + warning. If empty, the job will not start automatically. ''; }; @@ -125,7 +126,7 @@ let type = types.str; default = "starting shutdown"; description = '' - The Upstart event that triggers this job to be stopped. + Ignored; this was the Upstart event that triggers this job to be stopped. ''; }; @@ -144,7 +145,7 @@ let default = ""; description = '' Shell commands executed before the job is stopped - (i.e. before Upstart kills the job's main process). This can + (i.e. before systemd kills the job's main process). This can be used to cleanly shut down a daemon. ''; }; @@ -192,7 +193,7 @@ let type = types.str; default = "none"; description = '' - Determines how Upstart detects when a daemon should be + Determines how systemd detects when a daemon should be considered “running”. The value none means that the daemon is considered ready immediately. The value fork means that the daemon will fork once. @@ -261,8 +262,13 @@ in jobs = mkOption { default = {}; description = '' - This option defines the system jobs started and managed by the - Upstart daemon. + This option is a legacy method to define system services, + dating from the era where NixOS used Upstart instead of + systemd. You should use + instead. Services defined using are + mapped automatically to , but + may not work perfectly; in particular, most + conditions are not supported. ''; type = types.loaOf types.optionSet; options = [ jobOptions upstartJob ]; diff --git a/nixos/modules/virtualisation/ec2-data.nix b/nixos/modules/virtualisation/ec2-data.nix index fccf45e0e19..5133a98cd96 100644 --- a/nixos/modules/virtualisation/ec2-data.nix +++ b/nixos/modules/virtualisation/ec2-data.nix @@ -1,5 +1,5 @@ -# This module defines an Upstart job that obtains the SSH key and host -# name of virtual machines running on Amazon EC2, Eucalyptus and +# This module defines a systemd service that obtains the SSH key and +# host name of virtual machines running on Amazon EC2, Eucalyptus and # OpenStack Compute (Nova). { config, pkgs, ... }: diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix index 280143d4e3f..d3884a503bc 100644 --- a/nixos/modules/virtualisation/libvirtd.nix +++ b/nixos/modules/virtualisation/libvirtd.nix @@ -1,4 +1,4 @@ -# Upstart jobs for libvirtd. +# Systemd services for libvirtd. { config, pkgs, ... }: @@ -122,9 +122,6 @@ in wants = [ "libvirtd.service" ]; after = [ "libvirtd.service" ]; - # We want to suspend VMs only on shutdown, but Upstart is broken. - #stopOn = ""; - restartIfChanged = false; path = [ pkgs.gettext pkgs.libvirt pkgs.gawk ]; From 4ccd9fdace7d086476a4a9499a6966e5cdc743cc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 13:28:29 +0100 Subject: [PATCH 165/179] Remove unused file --- nixos/modules/installer/cd-dvd/live-dvd.nix | 78 --------------------- 1 file changed, 78 deletions(-) delete mode 100644 nixos/modules/installer/cd-dvd/live-dvd.nix diff --git a/nixos/modules/installer/cd-dvd/live-dvd.nix b/nixos/modules/installer/cd-dvd/live-dvd.nix deleted file mode 100644 index e57be6d442e..00000000000 --- a/nixos/modules/installer/cd-dvd/live-dvd.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ ./installation-cd-base.nix ]; - - # Build the build-time dependencies of this configuration on the DVD - # to speed up installation. - isoImage.storeContents = [ config.system.build.toplevel.drvPath ]; - - # Include lots of packages. - environment.systemPackages = - [ pkgs.utillinuxCurses - pkgs.upstartJobControl - pkgs.iproute - pkgs.bc - pkgs.fuse - pkgs.zsh - pkgs.sqlite - pkgs.gnupg - pkgs.manpages - pkgs.pinentry - pkgs.screen - pkgs.patch - pkgs.which - pkgs.diffutils - pkgs.file - pkgs.irssi - pkgs.mcabber - pkgs.mutt - pkgs.emacs - pkgs.vimHugeX - pkgs.bvi - pkgs.ddrescue - pkgs.cdrkit - pkgs.btrfsProgs - pkgs.xfsprogs - pkgs.jfsutils - pkgs.jfsrec - pkgs.ntfs3g - pkgs.subversion16 - pkgs.monotone - pkgs.git - pkgs.darcs - pkgs.mercurial - pkgs.bazaar - pkgs.cvs - pkgs.pciutils - pkgs.hddtemp - pkgs.sdparm - pkgs.hdparm - pkgs.usbutils - pkgs.openssh - pkgs.lftp - pkgs.w3m - pkgs.openssl - pkgs.ncat - pkgs.lynx - pkgs.wget - pkgs.elinks - pkgs.socat - pkgs.squid - pkgs.unrar - pkgs.zip - pkgs.unzip - pkgs.lzma - pkgs.cabextract - pkgs.cpio - pkgs.lsof - pkgs.ltrace - pkgs.perl - pkgs.python - pkgs.ruby - pkgs.guile - pkgs.clisp - pkgs.tcl - ]; - -} From ee438d62669ebe7a8daaa18eb289405f903a8d56 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 13:46:35 +0100 Subject: [PATCH 166/179] Manual: Mention other ways to get NixOS --- nixos/doc/manual/installation.xml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/nixos/doc/manual/installation.xml b/nixos/doc/manual/installation.xml index d274cfc6908..9dcf9f82463 100644 --- a/nixos/doc/manual/installation.xml +++ b/nixos/doc/manual/installation.xml @@ -18,6 +18,33 @@ details, see the NixOS Wiki. +As an alternative to installing NixOS yourself, you can get a +running NixOS system through several other means: + + + + Using virtual appliances in Open Virtualization Format (OVF) + that can be imported into VirtualBox. These are available from + the NixOS + homepage. + + + Using AMIs for Amazon’s EC2. To find one for your region + and instance type, please refer to the list + of most recent AMIs. + + + Using NixOps, the NixOS-based cloud deployment tool, which + allows you to provision VirtualBox and EC2 NixOS instances from + declarative specifications. Check out the NixOps + homepage for details. + + + + + From ca912c79d9ea12d321bb5556067a167ff4fff155 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 14:38:29 +0100 Subject: [PATCH 167/179] Manual: Document how to use NixOS channels --- nixos/doc/manual/installation.xml | 173 +++++++++++++++++++++--------- 1 file changed, 121 insertions(+), 52 deletions(-) diff --git a/nixos/doc/manual/installation.xml b/nixos/doc/manual/installation.xml index 9dcf9f82463..0bf92b7d5bc 100644 --- a/nixos/doc/manual/installation.xml +++ b/nixos/doc/manual/installation.xml @@ -89,9 +89,14 @@ running NixOS system through several other means: For initialising Ext4 partitions: mkfs.ext4. It is recommended that you assign a unique symbolic label to the file system using the option - . This will - make the file system configuration independent from device - changes. + , since this + makes the file system configuration independent from device + changes. For example: + + +$ mkfs.ext4 -L nixos /dev/sda1 + + For creating swap partitions: mkswap. Again it’s recommended to assign a @@ -124,6 +129,12 @@ $ mount /dev/disk/by-label/nixos /mnt + If your machine has a limited amount of memory, you + may want to activate swap devices now (swapon + device). The installer (or + rather, the build actions that it may spawn) may need quite a bit of + RAM, depending on your configuration. + You now need to create a file @@ -188,28 +199,16 @@ $ nano /mnt/etc/nixos/configuration.nix - If your machine has a limited amount of memory, you - may want to activate swap devices now (swapon - device). The installer (or - rather, the build actions that it may spawn) may need quite a bit of - RAM, depending on your configuration. - - - Do the installation: $ nixos-install - Cross fingers. + Cross fingers. If this fails due to a temporary problem (such as + a network issue while downloading binaries from the NixOS binary + cache), you can just re-run nixos-install. + Otherwise, fix your configuration.nix and + then re-run nixos-install. If everything went well: @@ -221,7 +220,7 @@ $ reboot You should now be able to boot into the installed NixOS. - The Grub boot menu shows a list of available + The GRUB boot menu shows a list of available configurations (initially just one). Every time you change the NixOS configuration (see ), a new item appears in the menu. @@ -256,20 +255,20 @@ $ nix-env -i w3m - shows a typical sequence -of commands for installing NixOS on an empty hard drive (here -/dev/sda). shows a -corresponding configuration Nix expression. +To summarise, shows a +typical sequence of commands for installing NixOS on an empty hard +drive (here /dev/sda). shows a corresponding configuration Nix expression. Commands for installing NixOS on <filename>/dev/sda</filename> -$ fdisk /dev/sda (or whatever device you want to install on) -$ mkfs.ext4 -L nixos /dev/sda1 (idem) -$ mkswap -L swap /dev/sda2 (idem) -$ mount LABEL=nixos /mnt -$ nixos-generate-config +$ fdisk /dev/sda # (or whatever device you want to install on) +$ mkfs.ext4 -L nixos /dev/sda1 +$ mkswap -L swap /dev/sda2 +$ swapon /dev/sda2 +$ mount /dev/disk/by-label/nixos /mnt +$ nixos-generate-config --root /mnt $ nano /mnt/etc/nixos/configuration.nix -(in particular, set the fileSystems and swapDevices options) $ nixos-install $ reboot @@ -284,14 +283,12 @@ $ reboot boot.loader.grub.device = "/dev/sda"; - # Note: setting fileSystems and swapDevices is generally not - # necessary, since nixos-generate-config has set them automatically - # in hardware-configuration.nix. - fileSystems."/".device = "/dev/disk/by-label/nixos"; - - swapDevices = - [ { device = "/dev/disk/by-label/swap"; } ]; + # Note: setting fileSystems is generally not + # necessary, since nixos-generate-config figures them out + # automatically in hardware-configuration.nix. + #fileSystems."/".device = "/dev/disk/by-label/nixos"; + # Enable the OpenSSH server. services.sshd.enable = true; } @@ -317,6 +314,10 @@ to build the new configuration, make it the default configuration for booting, and try to realise the configuration in the running system (e.g., by restarting system services). +These commands must be executed as root, so you should +either run them from a root shell or by prefixing them with +sudo -i. + You can also do @@ -336,6 +337,18 @@ to build the configuration and make it the boot default, but not switch to it now (so it will only take effect after the next reboot). +You can make your configuration show up in a different submenu +of the GRUB 2 boot screen by giving it a different profile +name, e.g. + + +$ nixos-rebuild switch -p test + +which causes the new configuration (and previous ones created using +-p test) to show up in the GRUB submenu “NixOS - +Profile 'test'”. This can be useful to separate test configurations +from “stable” configurations. + Finally, you can do @@ -346,7 +359,7 @@ whether everything compiles cleanly. If you have a machine that supports hardware virtualisation, you can also test the new configuration in a sandbox by building and -running a virtual machine that contains the +running a QEMU virtual machine that contains the desired configuration. Just do @@ -361,7 +374,6 @@ available. -
@@ -369,28 +381,85 @@ available. Upgrading NixOS The best way to keep your NixOS installation up to date is to -use the nixos-unstable channel. (A channel is a +use one of the NixOS channels. A channel is a Nix mechanism for distributing Nix expressions and associated -binaries.) The NixOS channel is updated automatically from NixOS’s -Git repository after running certain tests and building most -packages. +binaries. The NixOS channels are updated automatically from NixOS’s +Git repository after certain tests have passed and all packages have +been built. These channels are: -NixOS automatically subscribes you to the NixOS channel. If for -some reason this is not the case, just do + + + Stable channels, such as nixos-13.10. + These only get conservative bug fixes and package upgrades. For + instance, a channel update may cause the Linux kernel on your + system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but + not from 3.4.x to + 3.11.x (a major change that has the + potential to break things). + + + The unstable channel, nixos-unstable. + This corresponds to NixOS’s main development branch, and may thus + see radical changes between channel updates. It’s not recommended + for production systems. + + + +To see what channels are available, go to . (Note that the URIs of the +various channels redirect to a directory that contains the channel’s +latest version and includes ISO images and VirtualBox +appliances.) + +When you first install NixOS, you’re automatically subscribed to +the NixOS channel that corresponds to your installation source. For +instance, if you installed from a 13.10 ISO, you will be subscribed to +the nixos-13.10 channel. To see which NixOS +channel you’re subscribed to, run the following as root: -$ nix-channel --add http://nixos.org/channels/nixos-unstable +$ nix-channel --list | grep nixos +nixos https://nixos.org/channels/nixos-unstable -You can then upgrade NixOS to the latest version in the channel by -running +To switch to a different NixOS channel, do -$ nix-channel --update nixos +$ nix-channel --add http://nixos.org/channels/channel-name nixos -and running the nixos-rebuild command as described -in . +(Be sure to include the nixos parameter at the +end.) For instance, to use the NixOS 13.10 stable channel: + + +$ nix-channel --add http://nixos.org/channels/nixos-13.10 nixos + + +But it you want to live on the bleeding edge: + + +$ nix-channel --add http://nixos.org/channels/nixos-unstable nixos + + + + +You can then upgrade NixOS to the latest version in your chosen +channel by running + + +$ nixos-rebuild switch --upgrade + + +which is equivalent to the more verbose nix-channel --update +nixos; nixos-rebuild switch. + +It is generally safe to switch back and forth between +channels. The only exception is that a newer NixOS may also have a +newer Nix version, which may involve an upgrade of Nix’s database +schema. This cannot be undone easily, so in that case you will not be +able to go back to your original channel.
From 599c32fdba02c89f2577078fb2a9926fcb594f57 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 18:10:07 +0100 Subject: [PATCH 168/179] Document the NixOS configuration syntax ...without telling people to read the Nix manual first. --- nixos/doc/manual/configuration.xml | 697 ++++++++++++++++++++++++++++- nixos/doc/manual/installation.xml | 2 + 2 files changed, 696 insertions(+), 3 deletions(-) diff --git a/nixos/doc/manual/configuration.xml b/nixos/doc/manual/configuration.xml index b0b1da71184..eb7894f157c 100644 --- a/nixos/doc/manual/configuration.xml +++ b/nixos/doc/manual/configuration.xml @@ -7,7 +7,7 @@ This chapter describes how to configure various aspects of a NixOS machine through the configuration file /etc/nixos/configuration.nix. As described in -, changes to that file only take +, changes to this file only take effect after you run nixos-rebuild. @@ -15,7 +15,698 @@ effect after you run nixos-rebuild.
Configuration syntax -TODO +
The basics + +The NixOS configuration file +/etc/nixos/configuration.nix is actually a +Nix expression, which is the Nix package +manager’s purely functional language for describing how to build +packages and configurations. This means you have all the expressive +power of that language at your disposal, including the ability to +abstract over common patterns, which is very useful when managing +complex systems. The syntax and semantics of the Nix language are +fully described in the Nix +manual, but here we give a short overview of the most important +constructs useful in NixOS configuration files. + +The NixOS configuration file generally looks like this: + + +{ config, pkgs, ... }: + +{ option definitions +} + + +The first line ({ config, pkgs, ... }:) denotes +that this is actually a function that takes at least the two arguments + config and pkgs. (These are +explained later.) The function returns a set of +option definitions ({ ... }). These definitions have the +form name = +value, where +name is the name of an option and +value is its value. For example, + + +{ config, pkgs, ... }: + +{ services.httpd.enable = true; + services.httpd.adminAddr = "alice@example.org"; + services.httpd.documentRoot = "/webroot"; +} + + +defines a configuration with three option definitions that together +enable the Apache HTTP Server with /webroot as +the document root. + +Sets can be nested, and in fact dots in option names are +shorthand for defining a set containing another set. For instance, + defines a set named +services that contains a set named +httpd, which in turn contains an option definition +named enable with value true. +This means that the example above can also be written as: + + +{ config, pkgs, ... }: + +{ services = { + httpd = { + enable = true; + adminAddr = "alice@example.org"; + documentRoot = "/webroot"; + }; + }; +} + + +which may be more convenient if you have lots of option definitions +that share the same prefix (such as +services.httpd). + +NixOS checks your option definitions for correctness. For +instance, if you try to define an option that doesn’t exist (that is, +doesn’t have a corresponding option declaration), +nixos-rebuild will give an error like: + +The option `services.httpd.enabl' defined in `/etc/nixos/configuration.nix' does not exist. + +Likewise, values in option definitions must have a correct type. For +instance, must be a Boolean +(true or false). Trying to give +it a value of another type, such as a string, will cause an error: + +The option value `services.httpd.enable' in `/etc/nixos/configuration.nix' is not a boolean. + + + + +Options have various types of values. The most important are: + + + + Strings + + Strings are enclosed in double quotes, e.g. + + +networking.hostName = "dexter"; + + + Special characters can be escaped by prefixing them with a + backslash (e.g. \"). + + Multi-line strings can be enclosed in double + single quotes, e.g. + + +networking.extraHosts = + '' + 127.0.0.2 other-localhost + 10.0.0.1 server + ''; + + + The main difference is that preceding whitespace is + automatically stripped from each line, and that characters like + " and \ are not special + (making it more convenient for including things like shell + code). + + + + + Booleans + + These can be true or + false, e.g. + + +networking.firewall.enable = true; +networking.firewall.allowPing = false; + + + + + + + Integers + + For example, + + +boot.kernel.sysctl."net.ipv4.tcp_keepalive_time" = 60; + + + (Note that here the attribute name + net.ipv4.tcp_keepalive_time is enclosed in + quotes to prevent it from being interpreted as a set named + net containing a set named + ipv4, and so on. This is because it’s not a + NixOS option but the literal name of a Linux kernel + setting.) + + + + + Sets + + Sets were introduced above. They are name/value pairs + enclosed in braces, as in the option definition + + +fileSystems."/boot" = + { device = "/dev/sda1"; + fsType = "ext4"; + options = "rw,data=ordered,relatime"; + }; + + + + + + + Lists + + The important thing to note about lists is that list + elements are separated by whitespace, like this: + + +boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ]; + + + List elements can be any other type, e.g. sets: + + +swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; + + + + + + + Packages + + Usually, the packages you need are already part of the Nix + Packages collection, which is a set that can be accessed through + the function argument pkgs. Typical uses: + + +environment.systemPackages = + [ pkgs.thunderbird + pkgs.emacs + ]; + +postgresql.package = pkgs.postgresql90; + + + The latter option definition changes the default PostgreSQL + package used by NixOS’s PostgreSQL service to 9.0. For more + information on packages, including how to add new ones, see + . + + + + + + + +
+ + +
Abstractions + +If you find yourself repeating yourself over and over, it’s time +to abstract. Take, for instance, this Apache HTTP Server configuration: + + +{ + services.httpd.virtualHosts = + [ { hostName = "example.org"; + documentRoot = "/webroot"; + adminAddr = "alice@example.org"; + enableUserDir = true; + } + { hostName = "example.org"; + documentRoot = "/webroot"; + adminAddr = "alice@example.org"; + enableUserDir = true; + enableSSL = true; + sslServerCert = "/root/ssl-example-org.crt"; + sslServerKey = "/root/ssl-example-org.key"; + } + ]; +} + + +It defines two virtual hosts with nearly identical configuration; the +only difference is that the second one has SSL enabled. To prevent +this duplication, we can use a let: + + +let + exampleOrgCommon = + { hostName = "example.org"; + documentRoot = "/webroot"; + adminAddr = "alice@example.org"; + enableUserDir = true; + }; +in +{ + services.httpd.virtualHosts = + [ exampleOrgCommon + (exampleOrgCommon // { + enableSSL = true; + sslServerCert = "/root/ssl-example-org.crt"; + sslServerKey = "/root/ssl-example-org.key"; + }) + ]; +} + + +The let exampleOrgCommon = +... defines a variable named +exampleOrgCommon. The // +operator merges two attribute sets, so the configuration of the second +virtual host is the set exampleOrgCommon extended +with the SSL options. + +You can write a let wherever an expression is +allowed. Thus, you also could have written: + + +{ + services.httpd.virtualHosts = + let exampleOrgCommon = ...; in + [ exampleOrgCommon + (exampleOrgCommon // { ... }) + ]; +} + + +but not { let exampleOrgCommon = +...; in ...; +} since attributes (as opposed to attribute values) are not +expressions. + +Functions provide another method of +abstraction. For instance, suppose that we want to generate lots of +different virtual hosts, all with identical configuration except for +the host name. This can be done as follows: + + +{ + services.httpd.virtualHosts = + let + makeVirtualHost = name: + { hostName = name; + documentRoot = "/webroot"; + adminAddr = "alice@example.org"; + }; + in + [ (makeVirtualHost "example.org") + (makeVirtualHost "example.com") + (makeVirtualHost "example.gov") + (makeVirtualHost "example.nl") + ]; +} + + +Here, makeVirtualHost is a function that takes a +single argument name and returns the configuration +for a virtual host. That function is then called for several names to +produce the list of virtual host configurations. + +We can further improve on this by using the function +map, which applies another function to every +element in a list: + + +{ + services.httpd.virtualHosts = + let + makeVirtualHost = ...; + in map makeVirtualHost + [ "example.org" "example.com" "example.gov" "example.nl" ]; +} + + +(The function map is called a +higher-order function because it takes another +function as an argument.) + +What if you need more than one argument, for instance, if we +want to use a different documentRoot for each +virtual host? Then we can make makeVirtualHost a +function that takes a set as its argument, like this: + + +{ + services.httpd.virtualHosts = + let + makeVirtualHost = { name, root }: + { hostName = name; + documentRoot = root; + adminAddr = "alice@example.org"; + }; + in map makeVirtualHost + [ { name = "example.org"; root = "/sites/example.org"; } + { name = "example.com"; root = "/sites/example.com"; } + { name = "example.gov"; root = "/sites/example.gov"; } + { name = "example.nl"; root = "/sites/example.nl"; } + ]; +} + + +But in this case (where every root is a subdirectory of +/sites named after the virtual host), it would +have been shorter to define makeVirtualHost as + +makeVirtualHost = name: + { hostName = name; + documentRoot = "/sites/${name}"; + adminAddr = "alice@example.org"; + }; + + +Here, the construct +${...} allows the result +of an expression to be spliced into a string. + +
+ + +
Modularity + +The NixOS configuration mechanism is modular. If your +configuration.nix becomes too big, you can split +it into multiple files. Likewise, if you have multiple NixOS +configurations (e.g. for different computers) with some commonality, +you can move the common configuration into a shared file. + +Modules have exactly the same syntax as +configuration.nix. In fact, +configuration.nix is itself a module. You can +use other modules by including them from +configuration.nix, e.g.: + + +{ config, pkgs, ... }: + +{ imports = [ ./vpn.nix ./kde.nix ]; + services.httpd.enable = true; + environment.systemPackages = [ pkgs.emacs ]; + ... +} + + +Here, we include two modules from the same directory, +vpn.nix and kde.nix. The +latter might look like this: + + +{ config, pkgs, ... }: + +{ services.xserver.enable = true; + services.xserver.displayManager.kdm.enable = true; + services.xserver.desktopManager.kde4.enable = true; + environment.systemPackages = [ pkgs.kde4.kscreensaver ]; +} + + +Note that both configuration.nix and +kde.nix define the option +. When multiple modules +define an option, NixOS will try to merge the +definitions. In the case of +, that’s easy: the lists of +packages can simply be concatenated. For other types of options, a +merge may not be possible: for instance, if two modules define +, +nixos-rebuild will give an error: + + +The unique option `services.httpd.adminAddr' is defined multiple times, in `/etc/nixos/httpd.nix' and `/etc/nixos/configuration.nix'. + + +When that happens, it’s possible to force one definition take +precedence over the others: + + +services.httpd.adminAddr = mkForce "bob@example.org"; + + + + +When using multiple modules, you may need to access +configuration values defined in other modules. This is what the +config function argument is for: it contains the +complete, merged system configuration. That is, +config is the result of combining the +configurations returned by every moduleIf you’re +wondering how it’s possible that the (indirect) +result of a function is passed as an +input to that same function: that’s because Nix +is a “lazy” language — it only computes values when they are needed. +This works as long as no individual configuration value depends on +itself.. For example, here is a module that adds +some packages to only if + is set to +true somewhere else: + + +{ config, pkgs, ... }: + +{ environment.systemPackages = + if config.services.xserver.enable then + [ pkgs.firefox + pkgs.thunderbird + ] + else + [ ]; +} + + + + +With multiple modules, it may not be obvious what the final +value of a configuration option is. The command + allows you to find out: + + +$ nixos-option services.xserver.enable +true + +$ nixos-option boot.kernelModules +[ "tun" "ipv6" "loop" ... ] + + +Interactive exploration of the configuration is possible using +nix-repl, +a read-eval-print loop for Nix expressions. It’s not installed by +default; run nix-env -i nix-repl to get it. A +typical use: + + +$ nix-repl '<nixos>' + +nix-repl> config.networking.hostName +"mandark" + +nix-repl> map (x: x.hostName) config.services.httpd.virtualHosts +[ "example.org" "example.gov" ] + + + + +
+ + +
Syntax summary + +Below is a summary of the most important syntactic constructs in +the Nix expression language. It’s not complete. In particular, there +are many other built-in functions. See the Nix +manual for the rest. + + + + + + + + Example + Description + + + + + + Basic values + + + "Hello world" + A string + + + "${pkgs.bash}/bin/sh" + A string containing an expression (expands to "/nix/store/hash-bash-version/bin/sh") + + + true, false + Booleans + + + 123 + An integer + + + ./foo.png + A path (relative to the containing Nix expression) + + + + Compound values + + + { x = 1; y = 2; } + An set with attributes names x and y + + + { foo.bar = 1; } + A nested set, equivalent to { foo = { bar = 1; }; } + + + rec { x = "bla"; y = x + "bar"; } + A recursive set, equivalent to { x = "foo"; y = "foobar"; } + + + [ "foo" "bar" ] + A list with two elements + + + + Operators + + + "foo" + "bar" + String concatenation + + + 1 + 2 + Integer addition + + + "foo" == "f" + "oo" + Equality test (evaluates to true) + + + "foo" != "bar" + Inequality test (evaluates to true) + + + !true + Boolean negation + + + { x = 1; y = 2; }.x + Attribute selection (evaluates to 1) + + + { x = 1; y = 2; }.z or 3 + Attribute selection with default (evaluates to 3) + + + { x = 1; y = 2; } // { z = 3; } + Merge two sets (attributes in the right-hand set taking precedence) + + + + Control structures + + + if 1 + 1 == 2 then "yes!" else "no!" + Conditional expression + + + assert 1 + 1 == 2; "yes!" + Assertion check (evaluates to "yes!") + + + let x = "foo"; y = "bar"; in x + y + Variable definition + + + + Functions (lambdas) + + + x: x + 1 + A function that expects an integer and returns it increased by 1 + + + (x: x + 1) 100 + A function call (evaluates to 101) + + + let inc = x: x + 1; in inc (inc (inc 100)) + A function bound to a variable and subsequently called by name (evaluates to 103) + + + { x, y }: x + y + A function that expects a set with required attributes + x and y and concatenates + them + + + { x, y ? "bar" }: x + y + A function that expects a set with required attribute + x and optional y, using + "bar" as default value for + y + + + { x, y, ... }: x + y + A function that expects a set with required attributes + x and y and ignores any + other attributes + + + { x, y } @ args: x + y + A function that expects a set with required attributes + x and y, and binds the + whole set to args + + + + Built-in functions + + + import ./foo.nix + Load and return Nix expression in given file + + + map (x: x + x) [ 1 2 3 ] + Apply a function to every element of a list (evaluates to [ 2 4 6 ]) + + + + + + + +
+
@@ -170,7 +861,7 @@ recursion.) -
Adding custom packages +
Adding custom packages It’s possible that a package you need is not available in NixOS. In that case, you can do two things. First, you can clone the Nixpkgs diff --git a/nixos/doc/manual/installation.xml b/nixos/doc/manual/installation.xml index 0bf92b7d5bc..ba9bfcc652b 100644 --- a/nixos/doc/manual/installation.xml +++ b/nixos/doc/manual/installation.xml @@ -275,6 +275,8 @@ $ reboot NixOS configuration +{ config, pkgs, ... }: + { imports = [ # Include the results of the hardware scan. From 987641d6edc3a5961dead5ee696c1a1a5ff71ee9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 18:43:15 +0100 Subject: [PATCH 169/179] Fix mkForce example --- nixos/doc/manual/configuration.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/doc/manual/configuration.xml b/nixos/doc/manual/configuration.xml index eb7894f157c..cfd4a76290b 100644 --- a/nixos/doc/manual/configuration.xml +++ b/nixos/doc/manual/configuration.xml @@ -456,7 +456,7 @@ When that happens, it’s possible to force one definition take precedence over the others: -services.httpd.adminAddr = mkForce "bob@example.org"; +services.httpd.adminAddr = pkgs.lib.mkForce "bob@example.org"; From 8e6abe49cdafad942e63db24d29dd99dc26162fb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 18:49:04 +0100 Subject: [PATCH 170/179] Manual tweaks --- nixos/doc/manual/configuration.xml | 5 +++++ nixos/doc/manual/installation.xml | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/configuration.xml b/nixos/doc/manual/configuration.xml index cfd4a76290b..a8bda210dcf 100644 --- a/nixos/doc/manual/configuration.xml +++ b/nixos/doc/manual/configuration.xml @@ -641,6 +641,11 @@ manual for the rest. let x = "foo"; y = "bar"; in x + y Variable definition + + with pkgs.lib; head [ 1 2 3 ] + Add all attributes from the given set to the scope + (evaluates to 1) + Functions (lambdas) diff --git a/nixos/doc/manual/installation.xml b/nixos/doc/manual/installation.xml index ba9bfcc652b..88ef589dd06 100644 --- a/nixos/doc/manual/installation.xml +++ b/nixos/doc/manual/installation.xml @@ -398,7 +398,8 @@ been built. These channels are: system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but not from 3.4.x to 3.11.x (a major change that has the - potential to break things). + potential to break things). Stable channels are generally + maintained until the next stable branch is created. The unstable channel, Date: Thu, 31 Oct 2013 20:52:40 +0100 Subject: [PATCH 171/179] Manual: Don't tell users to delete ~/.nix-defexpr/channels That breaks nix-channel, obviously. --- nixos/doc/manual/development.xml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml index 13568868802..d1b81b7497b 100644 --- a/nixos/doc/manual/development.xml +++ b/nixos/doc/manual/development.xml @@ -3,7 +3,7 @@ Development -This chapter has some random notes on hacking on +This chapter describes how you can modify and extend NixOS. @@ -11,7 +11,7 @@ NixOS.
-Hacking on NixOS +Getting the sources By default, NixOS’s nixos-rebuild command uses the NixOS and Nixpkgs sources provided by the @@ -34,12 +34,13 @@ $ git clone git://github.com/NixOS/nixpkgs.git This will check out the latest NixOS sources to -/my/sources/nixpkgs/nixos and -the Nixpkgs sources to +/my/sources/nixpkgs/nixos +and the Nixpkgs sources to /my/sources/nixpkgs. -If you want to rebuild your system using your (modified) sources, you -need to tell nixos-rebuild about them using the - flag: +(The NixOS source tree lives in a subdirectory of the Nixpkgs +repository.) If you want to rebuild your system using your (modified) +sources, you need to tell nixos-rebuild about them +using the flag: $ nixos-rebuild switch -I nixpkgs=/my/sources/nixpkgs @@ -47,24 +48,26 @@ $ nixos-rebuild switch -I nixpkgs=/my/sources/nixpkgs -nixos-rebuild affects only the system profile. -To install packages to your user profile from expressions in -/my/sources, use -nix-env -f /my/sources/nixpkgs, -or change the default by replacing the symlink in +If you want nix-env to use the expressions in +/my/sources, use nix-env -f +/my/sources/nixpkgs, or change +the default by adding a symlink in ~/.nix-defexpr: -$ rm -f ~/.nix-defexpr/channels $ ln -s /my/sources/nixpkgs ~/.nix-defexpr/nixpkgs - +You may want to delete the symlink +~/.nix-defexpr/channels_root to prevent root’s +NixOS channel from clashing with your own tree. +
From 8d09a99a3ad3d18408ac78282efd801be17d0e00 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 22:04:26 +0100 Subject: [PATCH 172/179] Propagate the stableBranch argument --- nixos/release-combined.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index fbbbd2de123..dccc3acbf46 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -1,5 +1,6 @@ { nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; } , officialRelease ? false +, stableBranch ? false }: let @@ -17,7 +18,7 @@ let in rec { nixos = removeMaintainers (import ./release.nix { - inherit officialRelease; + inherit officialRelease stableBranch; nixpkgs = nixpkgsSrc; }); From 4d15ad22a2c7b54fe377cddc69fbeca9a4c20fc1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 31 Oct 2013 23:01:07 +0100 Subject: [PATCH 173/179] Manual: Expand the Development chapter --- nixos/doc/manual/configuration.xml | 2 +- nixos/doc/manual/development.xml | 884 +++++++++++++++--------- nixos/modules/installer/tools/tools.nix | 2 +- nixos/modules/misc/version.nix | 21 +- 4 files changed, 579 insertions(+), 330 deletions(-) diff --git a/nixos/doc/manual/configuration.xml b/nixos/doc/manual/configuration.xml index a8bda210dcf..9bca53ae904 100644 --- a/nixos/doc/manual/configuration.xml +++ b/nixos/doc/manual/configuration.xml @@ -1012,7 +1012,7 @@ manpage or the Nix manual.
-
User management +
User management NixOS supports both declarative and imperative styles of user management. In the declarative style, users are specified in diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml index d1b81b7497b..6bbccac6e5c 100644 --- a/nixos/doc/manual/development.xml +++ b/nixos/doc/manual/development.xml @@ -76,190 +76,132 @@ in nixos/ as packages.
-Extending NixOS +Writing NixOS modules -NixOS is based on a modular system for declarative configuration. - This system combines multiple modules to produce one - configuration. One of the module which compose your computer - configuration is /etc/nixos/configuration.nix. Other - modules are available under NixOS modules - directory +NixOS has a modular system for declarative configuration. This +system combines multiple modules to produce the +full system configuration. One of the modules that constitute the +configuration is /etc/nixos/configuration.nix. +Most of the others live in the nixos/modules +subdirectory of the Nixpkgs tree. -A module is a file which handles one specific part of the - configuration. This part of the configuration could correspond to - hardware, a service, network settings, or preferences. A module - configuration does not have to handle everything from scratch, it can base - its configuration on other configurations provided by other modules. Thus - a module can define options to setup its - configuration, and it can also declare options to be - fed by other modules. +Each NixOS module is a file that handles one logical aspect of +the configuration, such as a specific kind of hardware, a service, or +network settings. A module configuration does not have to handle +everything from scratch; it can use the functionality provided by +other modules for its implementation. Thus a module can +declare options that can be used by other +modules, and conversely can define options +provided by other modules in its own implementation. For example, the +module pam.nix +declares the option that allows +other modules (e.g. sshd.nix) +to define PAM services; and it defines the option + (declared by etc.nix) +to cause files to be created in +/etc/pam.d. - +In , we saw the following structure +of NixOS modules: -A module is a file which contains a Nix - expression. This expression should be either an expression which gets - evaluated into an attribute set or a function which returns an attribute - set. + +{ config, pkgs, ... }: -When the expression is a function, it should expect only one argument - which is an attribute set containing an attribute - named config and another attribute - named pkgs. The config attribute - contains the result of the merge of all modules. This attribute is - evaluated lazily, such as any Nix expression. For more details on how - options are merged, see the details in . - The pkgs attribute - contains nixpkgs attribute set of packages. This - attribute is necessary for declaring options. +{ option definitions +} + -Usual module content +This is actually an abbreviated form of module +that only defines options, but does not declare any. The structure of +full NixOS modules is shown in . + +Structure of NixOS modules { config, pkgs, ... }: { imports = - [ + [ paths of other modules ]; options = { - + option declarations }; config = { - + option definitions }; } - Illustrates - a module skeleton. +The meaning of each part is as follows. - This line makes the current Nix expression a function. This - line can be omitted if there is no reference to pkgs - and config inside the module. + This line makes the current Nix expression a function. The + variable pkgs contains Nixpkgs, while + config contains the full system configuration. + This line can be omitted if there is no reference to + pkgs and config inside the + module. - This list is used to enumerate path to other modules which are - declaring options used by the current module. In NixOS, default modules - are listed in the file modules/module-list.nix. - The default modules don't need to be added in the import list. + This list enumerates the paths to other NixOS modules that + should be included in the evaluation of the system configuration. + A default set of modules is defined in the file + modules/module-list.nix. These don't need to + be added in the import list. - This attribute set contains an attribute set of option - declaration. + The attribute options is a nested set of + option declarations (described below). - This attribute set contains an attribute set of option - definitions. If the module does not have any imported - modules or any option declarations, then this attribute set can be used - in place of its parent attribute set. This is a common case for simple - modules such - as /etc/nixos/configuration.nix. + The attribute config is a nested set of + option definitions (also described + below). - + shows a module that handles +the regular update of the “locate” database, an index of all files in +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 +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). -A module defines a configuration which would be - interpreted by other modules. To define a configuration, a module needs - to provide option definitions. An option definition is a simple - attribute assignment. - -Option definitions are made in a declarative manner. Without - properties, options will always be defined with the same value. To - introduce more flexibility in the system, option definitions are guarded - by properties. - -Properties are means to introduce conditional values inside option - definitions. This conditional values can be distinguished in two - categories. The condition which are local to the current configuration - and conditions which are dependent on others configurations. Local - properties are mkIf - and mkAssert. Global properties - are mkOverride, mkDefault - and mkOrder. - -mkIf is used to remove the option definitions which - are below it if the condition is evaluated to - false. mkAssert expects the condition to be evaluated - to true otherwise it raises an error message. - -mkOverride is used to mask previous definitions if - the current value has a lower mask number. The mask value is 100 (default) - for any option definition which does not use this property. - Thus, mkDefault is just a short-cut with a higher mask - (1000) than the default mask value. This means that a module can set an - option definition as a preference, and still let another module defining - it with a different value without using any property. - -mkOrder is used to sort definitions based on the - rank number. The rank number will sort all options definitions before - giving the sorted list of option definition to the merge function defined - in the option declaration. A lower rank will move the definition to the - beginning and a higher rank will move the option toward the end. The - default rank is 100. - - - -A module may declare options which are used by - other module to change the configuration provided by the current module. - Changes to the option definitions are made with properties which are using - values extracted from the result of the merge of all modules - (the config argument). - -The config argument reproduce the same hierarchy of - all options declared in all modules. For each option, the result of the - option is available, it is either the default value or the merge of all - definitions of the option. - -Options are declared with the - function pkgs.lib.mkOption. This function expects an - attribute set which at least provides a description. A default value, an - example, a type, a merge function and a post-process function can be - added. - -Types are used to provide a merge strategy for options and to ensure - the type of each option definitions. They are defined - in pkgs.lib.types. - -The merge function expects a list of option definitions and merge - them to obtain one result of the same type. - -The post-process function (named apply) takes the - result of the merge or of the default value, and produce an output which - could have a different type than the type expected by the option. - - - -Locate Module Example +NixOS module for the “locate” service { config, pkgs, ... }: with pkgs.lib; -let - cfg = config.services.locate; - locatedb = "/var/cache/locatedb"; - logfile = "/var/log/updatedb"; - cmd =''root updatedb --localuser=nobody --output=${locatedb} > ${logfile}''; -in +let locatedb = "/var/cache/locatedb"; in { - imports = [ /path/to/nixpkgs/nixos/modules/services/scheduling/cron.nix ]; - options = { + services.locate = { + enable = mkOption { + type = types.bool; default = false; - example = true; - type = with types; bool; description = '' If enabled, NixOS will periodically update the database of files used by the locate command. @@ -267,35 +209,370 @@ in }; period = mkOption { - default = "15 02 * * *"; 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. + locate database is updated. The default is to update at + 02:15 at night every day. ''; }; + }; + }; - config = mkIf cfg.enable { - services.cron = { - enable = true; - systemCronJobs = "${cfg.period} root ${cmd}"; - }; + 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 /media /run' + ''; + }; + + services.cron.systemCronJobs = optional config.services.locate.enable + "${config.services.locate.period} root ${config.systemd.package}/bin/systemctl start update-locatedb.service"; + }; } - illustrates a module which handles - the regular update of the database which index all files on the file - system. This modules has option definitions to rely on the cron service - to run the command at predefined dates. In addition, this modules - provides option declarations to enable the indexing and to use different - period of time to run the indexing. Properties are used to prevent - ambiguous definitions of option (enable locate service and disable cron - services) and to ensure that no options would be defined if the locate - service is not enabled. +
Option declarations + +An option declaration specifies the name, type and description +of a NixOS configuration option. It is illegal to define an option +that hasn’t been declared in any module. A option declaration +generally looks like this: + + +options = { + name = mkOption { + type = type specification; + default = default value; + example = example value; + description = "Description for use in the NixOS manual."; + }; +}; + + + + +The function mkOption accepts the following arguments. + + + + + type + + The type of the option (see below). It may be omitted, + but that’s not advisable since it may lead to errors that are + hard to diagnose. + + + + + default + + The default value used if no value is defined by any + module. A default is not required; in that case, if the option + value is ever used, an error will be thrown. + + + + + example + + An example value that will be shown in the NixOS manual. + + + + + description + + A textual description of the option, in DocBook format, + that will be included in the NixOS manual. + + + + + + + +Here is a non-exhaustive list of option types: + + + + + types.bool + + A Boolean. + + + + + types.int + + An integer. + + + + + types.str + + A string. + + + + + types.lines + + A string. If there are multiple definitions, they are + concatenated, with newline characters in between. + + + + + types.path + + A path, defined as anything that, when coerced to a + string, starts with a slash. This includes derivations. + + + + + types.listOf t + + A list of elements of type t + (e.g., types.listOf types.str is a list of + strings). Multiple definitions are concatenated together. + + + + + types.attrsOf t + + A set of elements of type t + (e.g., types.attrsOf types.int is a set of + name/value pairs, the values being integers). + + + + + types.nullOr t + + Either the value null or something of + type t. + + + + + +You can also create new types using the function +mkOptionType. See +lib/types.nix in Nixpkgs for details. + +
+ + +
Option definitions + +Option definitions are generally straight-forward bindings of values to option names, like + + +config = { + services.httpd.enable = true; +}; + + +However, sometimes you need to wrap an option definition or set of +option definitions in a property to achieve +certain effects: + +Delaying conditionals + +If a set of option definitions is conditional on the value of +another option, you may need to use mkIf. +Consider, for instance: + + +config = if config.services.httpd.enable then { + environment.systemPackages = [ ... ]; + ... +} else {}; + + +This definition will cause Nix to fail with an “infinite recursion” +error. Why? Because the value of + depends on the value +being constructed here. After all, you could also write the clearly +circular and contradictory: + +config = if config.services.httpd.enable then { + services.httpd.enable = false; +} else { + services.httpd.enable = true; +}; + + +The solution is to write: + + +config = mkIf config.services.httpd.enable { + environment.systemPackages = [ ... ]; + ... +}; + + +The special function mkIf causes the evaluation of +the conditional to be “pushed down” into the individual definitions, +as if you had written: + + +config = { + environment.systemPackages = if config.services.httpd.enable then [ ... ] else []; + ... +}; + + + + + + +Setting priorities + +A module can override the definitions of an option in other +modules by setting a priority. All option +definitions that do not have the lowest priority value are discarded. +By default, option definitions have priority 1000. You can specify an +explicit priority by using mkOverride, e.g. + + +services.openssh.enable = mkOverride 10 false; + + +This definition causes all other definitions with priorities above 10 +to be discarded. The function mkForce is +equal to mkOverride 50. + + + +Merging configurations + +In conjunction with mkIf, it is sometimes +useful for a module to return multiple sets of option definitions, to +be merged together as if they were declared in separate modules. This +can be done using mkMerge: + + +config = mkMerge + [ # Unconditional stuff. + { environment.systemPackages = [ ... ]; + } + # Conditional stuff. + (mkIf config.services.bla.enable { + environment.systemPackages = [ ... ]; + }) + ]; + + + + + + +
+ + +
Important options + +NixOS has many options, but some are of particular importance to +module writers. + + + + + + + This set defines files in /etc. A + typical use is: + +environment.etc."os-release".text = + '' + NAME=NixOS + ... + ''; + + which causes a file named /etc/os-release + to be created with the given contents. + + + + + + + A set of shell script fragments that must be executed + whenever the configuration is activated (i.e., at boot time, or + after running nixos-rebuild switch). For instance, + +system.activationScripts.media = + '' + mkdir -m 0755 -p /media + ''; + + causes the directory /media to be created. + Activation scripts must be idempotent. They should not start + background processes such as daemons; use + for that. + + + + + + + This is the set of systemd services. Example: + +systemd.services.dhcpcd = + { description = "DHCP Client"; + wantedBy = [ "multi-user.target" ]; + after = [ "systemd-udev-settle.service" ]; + path = [ dhcpcd pkgs.nettools pkgs.openresolv ]; + serviceConfig = + { Type = "forking"; + PIDFile = "/run/dhcpcd.pid"; + ExecStart = "${dhcpcd}/sbin/dhcpcd --config ${dhcpcdConf}"; + Restart = "always"; + }; + }; + + which creates the systemd unit + dhcpcd.service. The option + determined which other units pull this + one in; multi-user.target is the default + target of the system, so dhcpcd.service will + always be started. The option + provides the main + command for the service; it’s also possible to provide pre-start + actions, stop scripts, and so on. + + + + + + + + If your service requires special UIDs or GIDs, you can + define them with these options. See for details. + + + + + +
+
@@ -306,50 +583,79 @@ in Building specific parts of NixOS - +With the command nix-build, you can build +specific parts of your NixOS configuration. This is done as follows: -$ nix-build /path/to/nixpkgs/nixos -A attr +$ cd /path/to/nixpkgs/nixos +$ nix-build -A config.option -where attr is an attribute in -/path/to/nixpkgs/nixos/default.nix. Attributes of interest include: +where option is a NixOS option with type +“derivation” (i.e. something that can be built). Attributes of +interest include: - config - The computer configuration generated from - the NIXOS_CONFIG environment variable (default - is /etc/nixos/configuration.nix) with the NixOS - default set of modules. + system.build.toplevel + + The top-level option that builds the entire NixOS system. + Everything else in your configuration is indirectly pulled in by + this option. This is what nixos-rebuild + builds and what /run/current-system points + to afterwards. + + A shortcut to build this is: + + +$ nix-build -A system + + - system - The derivation which build your computer system. It is - built by the command nixos-rebuild - build + system.build.manual.manual + The NixOS manual. - vm - The derivation which build your computer system inside a - virtual machine. It is built by the command nixos-rebuild - build-vm + system.build.etc + A tree of symlinks that form the static parts of + /etc. + + + system.build.initialRamdisk + system.build.kernel + + The initial ramdisk and kernel of the system. This allows + a quick way to test whether the kernel and the initial ramdisk + boot correctly, by using QEMU’s and + options: + + +$ nix-build -A config.system.build.initialRamdisk -o initrd +$ nix-build -A config.system.build.kernel -o kernel +$ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/null + + + + + + + + system.build.nixos-rebuild + system.build.nixos-install + system.build.nixos-generate-config + + These build the corresponding NixOS commands. + + + - -Most parts of NixOS can be built through the config -attribute set. This attribute set allows you to have a view of the merged -option definitions and all its derivations. Important derivations are store -inside the option and can be listed with the -command nix-instantiate --xml --eval-only /path/to/nixpkgs/nixos -A -config.system.build - -
@@ -370,8 +676,7 @@ you have to set NIXOS_CONFIG before running nix-build to build the ISO. -$ export NIXOS_CONFIG=/path/to/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix -$ nix-build /path/to/nixpkgs/nixos -A config.system.build.isoImage +$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix @@ -386,23 +691,6 @@ $ mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso
- - -
- -Testing/building the NixOS Manual - -A quick way to see if your documentation improvements -or option descriptions look good: - - -$ nix-build -A config.system.build.manual - - - -
- -
@@ -415,8 +703,7 @@ tedious, so here is a quick way to see if the installer works properly: -$ export NIXOS_CONFIG=/path/to/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix -$ nix-build /path/to/nixpkgs/nixos -A config.system.build.nixos-install +$ nix-build -A config.system.build.nixos-install $ dd if=/dev/zero of=diskimage seek=2G count=0 bs=1 $ yes | mke2fs -j diskimage $ mount -o loop diskimage /mnt @@ -430,91 +717,61 @@ $ ./result/bin/nixos-install -
+
Whole-system testing using virtual machines -Testing the <literal>initrd</literal> +Complete NixOS GNU/Linux systems can be tested in virtual +machines (VMs). This makes it possible to test a system upgrade or +configuration change before rebooting into it, using the +nixos-rebuild build-vm or nixos-rebuild +build-vm-with-bootloader command. -A quick way to test whether the kernel and the initial ramdisk -boot correctly is to use QEMU’s and - options: - - -$ nix-build /path/to/nixpkgs/nixos -A config.system.build.initialRamdisk -o initrd -$ nix-build /path/to/nixpkgs/nixos -A config.system.build.kernel -o kernel -$ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/null - - - - -
- -
- - Whole-system testing using virtual machines - - - Complete NixOS GNU/Linux systems can be tested in virtual machines - (VMs). This makes it possible to test a system upgrade or - configuration change before rebooting into it, using the - nixos-rebuild build-vm or - nixos-rebuild build-vm-with-bootloader command. - - - - - - The tests/ directory in the NixOS source tree - contains several whole-system unit tests. - These tests can be runNixOS tests can be run both from - NixOS and from a non-NixOS GNU/Linux distribution, provided the - Nix package manager is installed. from the NixOS - source tree as follows: + +The tests/ directory in the NixOS source +tree contains several whole-system unit tests. +These tests can be runNixOS tests can be run both from +NixOS and from a non-NixOS GNU/Linux distribution, provided the Nix +package manager is installed. from the NixOS source +tree as follows: $ nix-build tests/ -A nfs.test - This performs an automated test of the NFS client and server - functionality in the Linux kernel, including file locking - semantics (e.g., whether locks are maintained across server - crashes). It will first build or download all the dependencies of - the test (e.g., all packages needed to run a NixOS VM). The test - is defined in - tests/nfs.nix. If the test succeeds, - nix-build will place a symlink - ./result in the current directory pointing at - the location in the Nix store of the test results (e.g., - screenshots, test reports, and so on). In particular, a - pretty-printed log of the test is written to - log.html, which can be viewed using a web - browser like this: +This performs an automated test of the NFS client and server +functionality in the Linux kernel, including file locking semantics +(e.g., whether locks are maintained across server crashes). It will +first build or download all the dependencies of the test (e.g., all +packages needed to run a NixOS VM). The test is defined in +tests/nfs.nix. If the test succeeds, +nix-build will place a symlink +./result in the current directory pointing at the +location in the Nix store of the test results (e.g., screenshots, test +reports, and so on). In particular, a pretty-printed log of the test +is written to log.html, which can be viewed using +a web browser like this: $ firefox result/log.html - + - - It is also possible to run the test environment interactively, - allowing you to experiment with the VMs. For example: +It is also possible to run the test environment interactively, +allowing you to experiment with the VMs. For example: $ nix-build tests/ -A nfs.driver $ ./result/bin/nixos-run-vms - The script nixos-run-vms starts the three - virtual machines defined in the NFS test using QEMU/KVM. The root - file system of the VMs is created on the fly and kept across VM - restarts in - ./hostname.qcow2. - +The script nixos-run-vms starts the three virtual +machines defined in the NFS test using QEMU/KVM. The root file system +of the VMs is created on the fly and kept across VM restarts in +./hostname.qcow2. - - Finally, the test itself can be run interactively. This is - particularly useful when developing or debugging a test: +Finally, the test itself can be run interactively. This is +particularly useful when developing or debugging a test: $ nix-build tests/ -A nfs.driver @@ -523,8 +780,7 @@ starting VDE switch for network 1 > - Perl statements can now be typed in to start or manipulate the - VMs: +Perl statements can now be typed in to start or manipulate the VMs: > startAll; @@ -537,65 +793,61 @@ starting VDE switch for network 1 > $client2->succeed("flock -n -s /data/lock true"); - The function testScript executes the entire - test script and drops you back into the test driver command line - upon its completion. This allows you to inspect the state of the - VMs after the test (e.g. to debug the test script). - +The function testScript executes the entire test +script and drops you back into the test driver command line upon its +completion. This allows you to inspect the state of the VMs after the +test (e.g. to debug the test script). - - This and other tests are continuously run on the Hydra - instance at nixos.org, which allows - developers to be notified of any regressions introduced by a NixOS - or Nixpkgs change. - +This and other tests are continuously run on the Hydra +instance at nixos.org, which allows +developers to be notified of any regressions introduced by a NixOS or +Nixpkgs change. - - The actual Nix programming interface to VM testing is in NixOS, - under - lib/testing.nix. This file defines a - function which takes an attribute set containing a - nixpkgs attribute (the path to a Nixpkgs - checkout), and a system attribute (the system - type). It returns an attribute set containing several utility - functions, among which the main entry point is - makeTest. - +The actual Nix programming interface to VM testing is in NixOS, +under +lib/testing.nix. This file defines a +function which takes an attribute set containing a +nixpkgs attribute (the path to a Nixpkgs checkout), +and a system attribute (the system type). It +returns an attribute set containing several utility functions, among +which the main entry point is makeTest. + - - The makeTest function takes a function similar to - that found in - tests/nfs.nix (discussed above). It - returns an attribute set containing (among others): +The makeTest function takes a function +similar to that found in +tests/nfs.nix (discussed above). It +returns an attribute set containing (among others): - + - - test - A derivation containing the test log as an HTML file, - as seen above, suitable for presentation in the Hydra continuous - build system. - + + test + A derivation containing the test log as an HTML + file, as seen above, suitable for presentation in the Hydra + continuous build system. + - - report - A derivation containing a code coverage report, with - meta-data suitable for Hydra. - + + report + A derivation containing a code coverage report, with + meta-data suitable for Hydra. + - - driver - A derivation containing scripts to run the VM test or - interact with the VM network interactively, as seen above. - - + + driver + A derivation containing scripts to run the VM test or + interact with the VM network interactively, as seen above. + + - - + + +
+ diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 41c562a6f46..652bfa917df 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -103,7 +103,7 @@ in ]; system.build = { - inherit nixos-install nixos-generate-config nixos-option; + inherit nixos-install nixos-generate-config nixos-option nixos-rebuild; }; }; } diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 86898bbb379..2fa95563e9a 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -58,18 +58,15 @@ with pkgs.lib; # Generate /etc/os-release. See # http://0pointer.de/public/systemd-man/os-release.html for the # format. - environment.etc = singleton - { source = pkgs.writeText "os-release" - '' - NAME=NixOS - ID=nixos - VERSION="${config.system.nixosVersion} (${config.system.nixosCodeName})" - VERSION_ID="${config.system.nixosVersion}" - PRETTY_NAME="NixOS ${config.system.nixosVersion} (${config.system.nixosCodeName})" - HOME_URL="http://nixos.org/" - ''; - target = "os-release"; - }; + environment.etc."os-release".text = + '' + NAME=NixOS + ID=nixos + VERSION="${config.system.nixosVersion} (${config.system.nixosCodeName})" + VERSION_ID="${config.system.nixosVersion}" + PRETTY_NAME="NixOS ${config.system.nixosVersion} (${config.system.nixosCodeName})" + HOME_URL="http://nixos.org/" + ''; }; From 444a4fb793c67243512a7f17c287e5665a8e2a68 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 1 Nov 2013 00:34:31 +0100 Subject: [PATCH 174/179] Loosen the type of SSH key files --- nixos/modules/services/networking/ssh/sshd.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 48eddb3b2f6..7a2335847e3 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -39,7 +39,7 @@ let }; keyFiles = mkOption { - type = types.listOf types.str; + type = types.listOf types.unspecified; default = []; description = '' A list of files each containing one OpenSSH public key that should be @@ -172,7 +172,7 @@ in }; authorizedKeysFiles = mkOption { - type = types.listOf types.str; + type = types.listOf types.unspecified; default = []; description = "Files from with authorized keys are read."; }; From 9668294eeb57aaeb8220409e154b411263deedd8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 1 Nov 2013 00:35:48 +0100 Subject: [PATCH 175/179] Mark the value for nixpkgs.system as a default --- nixos/modules/misc/nixpkgs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 1d9b89a0b0f..7433fab168e 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -72,6 +72,6 @@ in }; config = { - nixpkgs.system = pkgs.stdenv.system; + nixpkgs.system = mkDefault pkgs.stdenv.system; }; } From 588db4727ce9e630d46a37c2d3b97048cd2865ab Mon Sep 17 00:00:00 2001 From: Mathijs Kwik Date: Fri, 1 Nov 2013 07:59:11 +0100 Subject: [PATCH 176/179] calibre: fix hash --- pkgs/applications/misc/calibre/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 58b316db585..10d92e4d517 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "mirror://sourceforge/calibre/${name}.tar.xz"; - sha256 = "1883fcf679d4a9c2c94adec94cbb0cdf1b110007bf3e4b7dacd7ef552c11902b"; + sha256 = "0awh24n5bvypmiylngmz0w0126yz1jxlrjfy9b4w5aflg7vgr0qq"; }; inherit python; From 07d68731ffcfa1d7f5b72e862cbb9b0dac2e7741 Mon Sep 17 00:00:00 2001 From: Mathijs Kwik Date: Thu, 31 Oct 2013 09:07:56 +0100 Subject: [PATCH 177/179] haskell-trifecta: jailbreak on comonad --- pkgs/development/libraries/haskell/trifecta/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/haskell/trifecta/default.nix b/pkgs/development/libraries/haskell/trifecta/default.nix index f7b9a7aea81..de876fa7f67 100644 --- a/pkgs/development/libraries/haskell/trifecta/default.nix +++ b/pkgs/development/libraries/haskell/trifecta/default.nix @@ -18,7 +18,8 @@ cabal.mkDerivation (self: { substituteInPlace trifecta.cabal \ --replace "blaze-html >= 0.5 && < 0.6," "blaze-html >= 0.5 && < 0.7," \ --replace "hashable >= 1.2 && < 1.3," "hashable >= 1.1 && < 1.3," \ - --replace "fingertree >= 0.0.1 && < 0.1," "fingertree >= 0.0.1 && < 0.2," + --replace "fingertree >= 0.0.1 && < 0.1," "fingertree >= 0.0.1 && < 0.2," \ + --replace "comonad >= 3 && < 4," "comonad >= 3 && < 5," ''; meta = { homepage = "http://github.com/ekmett/trifecta/"; From 3c2b7f5e33ff3b94262806c82386896f35653b5c Mon Sep 17 00:00:00 2001 From: Mathijs Kwik Date: Thu, 31 Oct 2013 11:01:25 +0100 Subject: [PATCH 178/179] haskell-trifecta: bring back 1.1 for idris --- .../libraries/haskell/trifecta/1.1.nix | 30 +++++++++++++++++++ .../haskell/trifecta/{default.nix => 1.2.nix} | 0 pkgs/top-level/haskell-packages.nix | 8 +++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/libraries/haskell/trifecta/1.1.nix rename pkgs/development/libraries/haskell/trifecta/{default.nix => 1.2.nix} (100%) diff --git a/pkgs/development/libraries/haskell/trifecta/1.1.nix b/pkgs/development/libraries/haskell/trifecta/1.1.nix new file mode 100644 index 00000000000..ac6cfdd43ae --- /dev/null +++ b/pkgs/development/libraries/haskell/trifecta/1.1.nix @@ -0,0 +1,30 @@ +{ cabal, ansiTerminal, ansiWlPprint, blazeBuilder, blazeHtml +, blazeMarkup, charset, comonad, deepseq, doctest, filepath +, fingertree, hashable, lens, mtl, parsers, reducers, semigroups +, transformers, unorderedContainers, utf8String +}: + +cabal.mkDerivation (self: { + pname = "trifecta"; + version = "1.1"; + sha256 = "19wnblpn31hvdi5dc8ir24s0hfjj4vvzr43gg9ydl2qdjq6s166w"; + buildDepends = [ + ansiTerminal ansiWlPprint blazeBuilder blazeHtml blazeMarkup + charset comonad deepseq fingertree hashable lens mtl parsers + reducers semigroups transformers unorderedContainers utf8String + ]; + testDepends = [ doctest filepath ]; + postPatch = '' + substituteInPlace trifecta.cabal \ + --replace "blaze-html >= 0.5 && < 0.6," "blaze-html >= 0.5 && < 0.7," \ + --replace "hashable >= 1.2 && < 1.3," "hashable >= 1.1 && < 1.3," \ + --replace "fingertree >= 0.0.1 && < 0.1," "fingertree >= 0.0.1 && < 0.2," \ + --replace "comonad == 3.*," "comonad >= 3 && < 5," + ''; + meta = { + homepage = "http://github.com/ekmett/trifecta/"; + description = "A modern parser combinator library with convenient diagnostics"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/development/libraries/haskell/trifecta/default.nix b/pkgs/development/libraries/haskell/trifecta/1.2.nix similarity index 100% rename from pkgs/development/libraries/haskell/trifecta/default.nix rename to pkgs/development/libraries/haskell/trifecta/1.2.nix diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index d23df701745..7dd5af49af4 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -2116,7 +2116,9 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x transformersCompat = callPackage ../development/libraries/haskell/transformers-compat {}; - trifecta = callPackage ../development/libraries/haskell/trifecta {}; + trifecta_1_1 = callPackage ../development/libraries/haskell/trifecta/1.1.nix {}; + trifecta_1_2 = callPackage ../development/libraries/haskell/trifecta/1.2.nix {}; + trifecta = self.trifecta_1_2; tuple = callPackage ../development/libraries/haskell/tuple {}; @@ -2442,7 +2444,9 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x darcs = callPackage ../applications/version-management/darcs {}; - idris_plain = callPackage ../development/compilers/idris {}; + idris_plain = callPackage ../development/compilers/idris { + trifecta = self.trifecta_1_1; + }; idris = callPackage ../development/compilers/idris/wrapper.nix {}; From b6519f08da3321a8bc002e6608297a3225cc5439 Mon Sep 17 00:00:00 2001 From: Mathijs Kwik Date: Thu, 31 Oct 2013 12:00:02 +0100 Subject: [PATCH 179/179] haskell-parsers: bring back 0.9 for idris --- .../haskell/parsers/{default.nix => 0.10.nix} | 0 .../libraries/haskell/parsers/0.9.nix | 17 +++++++++++++++++ pkgs/top-level/haskell-packages.nix | 9 +++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) rename pkgs/development/libraries/haskell/parsers/{default.nix => 0.10.nix} (100%) create mode 100644 pkgs/development/libraries/haskell/parsers/0.9.nix diff --git a/pkgs/development/libraries/haskell/parsers/default.nix b/pkgs/development/libraries/haskell/parsers/0.10.nix similarity index 100% rename from pkgs/development/libraries/haskell/parsers/default.nix rename to pkgs/development/libraries/haskell/parsers/0.10.nix diff --git a/pkgs/development/libraries/haskell/parsers/0.9.nix b/pkgs/development/libraries/haskell/parsers/0.9.nix new file mode 100644 index 00000000000..dc42228df66 --- /dev/null +++ b/pkgs/development/libraries/haskell/parsers/0.9.nix @@ -0,0 +1,17 @@ +{ cabal, charset, doctest, filepath, text, transformers +, unorderedContainers +}: + +cabal.mkDerivation (self: { + pname = "parsers"; + version = "0.9"; + sha256 = "04lbayvdv2hax4s9sqlnia7jpzv1sgls41ylql0xbi2zhz5rvyyi"; + buildDepends = [ charset text transformers unorderedContainers ]; + testDepends = [ doctest filepath ]; + meta = { + homepage = "http://github.com/ekmett/parsers/"; + description = "Parsing combinators"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 7dd5af49af4..be07da47393 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1650,7 +1650,9 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x parsec3 = self.parsec_3_1_3; parsec = self.parsec3; - parsers = callPackage ../development/libraries/haskell/parsers {}; + parsers_0_9 = callPackage ../development/libraries/haskell/parsers/0.9.nix {}; + parsers_0_10 = callPackage ../development/libraries/haskell/parsers/0.10.nix {}; + parsers = self.parsers_0_10; parsimony = callPackage ../development/libraries/haskell/parsimony {}; @@ -2116,7 +2118,9 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x transformersCompat = callPackage ../development/libraries/haskell/transformers-compat {}; - trifecta_1_1 = callPackage ../development/libraries/haskell/trifecta/1.1.nix {}; + trifecta_1_1 = callPackage ../development/libraries/haskell/trifecta/1.1.nix { + parsers = self.parsers_0_9; + }; trifecta_1_2 = callPackage ../development/libraries/haskell/trifecta/1.2.nix {}; trifecta = self.trifecta_1_2; @@ -2445,6 +2449,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x darcs = callPackage ../applications/version-management/darcs {}; idris_plain = callPackage ../development/compilers/idris { + parsers = self.parsers_0_9; trifecta = self.trifecta_1_1; };