From a0661f84f0b2861ca5051aceefa3635b4482eec1 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Tue, 16 Feb 2016 21:04:18 +0100 Subject: [PATCH 01/70] dropbox: 3.12.6 -> 3.14.5 Also updates qt5 dependency to qt55, as per release notes: https://www.dropboxforum.com/hc/en-us/community/posts/205672126-Release-Candidate-3-14-5 --- pkgs/applications/networking/dropbox/default.nix | 6 +++--- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/dropbox/default.nix b/pkgs/applications/networking/dropbox/default.nix index 8030ab313a8..edaa5ed077f 100644 --- a/pkgs/applications/networking/dropbox/default.nix +++ b/pkgs/applications/networking/dropbox/default.nix @@ -20,11 +20,11 @@ let # NOTE: When updating, please also update in current stable, as older versions stop working - version = "3.12.6"; + version = "3.14.5"; sha256 = { - "x86_64-linux" = "16d0g9bygvaixv4r42p72z6a6wqhkf5qzb058lijih93zjr8zjlj"; - "i686-linux" = "1pgqz6axzzyaahql01g0l80an39hd9j4dnq0vfavwvb2qkb27dph"; + "x86_64-linux" = "02yjc910j3m61yd19akfv5yxh0a06cqwx2rxb2xhdbf1cb6c2wdg"; + "i686-linux" = "0aqni6gsnbmshczxwn10qbp43qqnprxr18spx7dc9cz9cq27rgrv"; }."${stdenv.system}" or (throw "system ${stdenv.system} not supported"); arch = diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fae36c212c6..9ff55dca5b3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13380,7 +13380,7 @@ let copy-com = callPackage ../applications/networking/copy-com { }; - dropbox = qt5.callPackage ../applications/networking/dropbox { }; + dropbox = qt55.callPackage ../applications/networking/dropbox { }; dropbox-cli = callPackage ../applications/networking/dropbox-cli { }; From bd3ca11e0d5f4652d4b8da094dc77094f5e05e39 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Tue, 26 Jan 2016 21:32:24 +0100 Subject: [PATCH 02/70] virtualbox: 5.0.12 -> 5.0.14 --- pkgs/applications/virtualization/virtualbox/default.nix | 8 ++++---- .../virtualization/virtualbox/guest-additions/default.nix | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix index 855694e0412..c0fd8214b31 100644 --- a/pkgs/applications/virtualization/virtualbox/default.nix +++ b/pkgs/applications/virtualization/virtualbox/default.nix @@ -18,7 +18,7 @@ let # revision/hash as well. See # http://download.virtualbox.org/virtualbox/${version}/SHA256SUMS # for hashes. - version = "5.0.12"; + version = "5.0.14"; forEachModule = action: '' for mod in \ @@ -39,12 +39,12 @@ let ''; # See https://github.com/NixOS/nixpkgs/issues/672 for details - extpackRevision = "104815"; + extpackRevision = "105127"; extensionPack = requireFile rec { name = "Oracle_VM_VirtualBox_Extension_Pack-${version}-${extpackRevision}.vbox-extpack"; # IMPORTANT: Hash must be base16 encoded because it's used as an input to # VBoxExtPackHelperApp! - sha256 = "ac1bc8452b7fdf183325272149e9f18b9810cc07adf18e48755385a9cd1b236d"; + sha256 = "4a404b0d09dfd3952107e314ab63262293b2fb0a4dc6837b57fb7274bd016865"; message = '' In order to use the extension pack, you need to comply with the VirtualBox Personal Use and Evaluation License (PUEL) by downloading the related binaries from: @@ -63,7 +63,7 @@ in stdenv.mkDerivation { src = fetchurl { url = "http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2"; - sha256 = "de0362b1d404d1ca0298db1984acb6f0f1c6210313aeb744fea345ad9201e86e"; + sha256 = "69abac7255b2251a18fd73c0b7c200d5f8ce72a59fa019b53a5cdbf7f2843002"; }; buildInputs = diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix index 43f591cf6aa..57d9d28a773 100644 --- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix +++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix @@ -12,7 +12,7 @@ stdenv.mkDerivation { src = fetchurl { url = "http://download.virtualbox.org/virtualbox/${version}/VBoxGuestAdditions_${version}.iso"; - sha256 = "61a19c9ec4b449cbc6bb41b636b03a16bf5a47ffa4943423d262863017e8bc9b"; + sha256 = "cec0df18671adfe62a34d3810543f76f76206b212b2b61791fe026214c77507c"; }; KERN_DIR = "${kernel.dev}/lib/modules/*/build"; From ebe983824b4fe32dc224be1aefbece1af9a6dcc7 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Wed, 17 Feb 2016 16:24:06 +0100 Subject: [PATCH 03/70] dropbox: 3.14.5 -> 3.14.7 --- pkgs/applications/networking/dropbox/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/dropbox/default.nix b/pkgs/applications/networking/dropbox/default.nix index edaa5ed077f..a180e2a01ed 100644 --- a/pkgs/applications/networking/dropbox/default.nix +++ b/pkgs/applications/networking/dropbox/default.nix @@ -20,11 +20,11 @@ let # NOTE: When updating, please also update in current stable, as older versions stop working - version = "3.14.5"; + version = "3.14.7"; sha256 = { - "x86_64-linux" = "02yjc910j3m61yd19akfv5yxh0a06cqwx2rxb2xhdbf1cb6c2wdg"; - "i686-linux" = "0aqni6gsnbmshczxwn10qbp43qqnprxr18spx7dc9cz9cq27rgrv"; + "x86_64-linux" = "1pwmghpr0kyca2biysyk90kk9k6ffv4i95vs5rq96vc0zbckws6n"; + "i686-linux" = "08yqrxh09cfd80kbiq1f2sirx9s85acij4khpklvvwrnf2x1i1zm"; }."${stdenv.system}" or (throw "system ${stdenv.system} not supported"); arch = From 7e8faf022f343901301c912c5f0c7fa1d830a08d Mon Sep 17 00:00:00 2001 From: zimbatm Date: Fri, 26 Feb 2016 00:22:12 +0000 Subject: [PATCH 04/70] rubygems: 2.4.8 -> 2.5.2 Closes #11950 --- pkgs/development/interpreters/ruby/rubygems.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/ruby/rubygems.nix b/pkgs/development/interpreters/ruby/rubygems.nix index fb210ceff4b..a08790a15ce 100644 --- a/pkgs/development/interpreters/ruby/rubygems.nix +++ b/pkgs/development/interpreters/ruby/rubygems.nix @@ -2,10 +2,10 @@ stdenv.mkDerivation rec { name = "rubygems-${version}"; - version = "2.4.8"; + version = "2.5.2"; src = fetchurl { url = "http://production.cf.rubygems.org/rubygems/${name}.tgz"; - sha256 = "0pl4civyf0vhqsqbqaivvxrb3fsg8sid9a8jv5vfnk4hypz3ahss"; + sha256 = "1jpcmvjfpj2m0jh23371ghfj95gh4jliihzrj5ln0x2cl1pwwwai"; }; patches = [ ./gem_hook.patch ]; From 8104b8ff1d4d35b2a1b3aa747e9a39d4728aa7f4 Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Sun, 3 Jan 2016 16:54:22 -0800 Subject: [PATCH 05/70] letsencrypt: 0.1.0 -> 0.4.0 Closes #12123 --- pkgs/tools/admin/letsencrypt/default.nix | 28 ++++++++++++----- pkgs/top-level/python-packages.nix | 39 +++++++++++++++++++++++- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/admin/letsencrypt/default.nix b/pkgs/tools/admin/letsencrypt/default.nix index 516fc20c5a7..be314a56731 100644 --- a/pkgs/tools/admin/letsencrypt/default.nix +++ b/pkgs/tools/admin/letsencrypt/default.nix @@ -1,22 +1,36 @@ -{ stdenv, pythonPackages, fetchurl, dialog }: +{ stdenv, pythonPackages, fetchFromGitHub, dialog }: pythonPackages.buildPythonApplication rec { - version = "0.1.0"; name = "letsencrypt-${version}"; + version = "0.4.0"; - src = fetchurl { - url = "https://github.com/letsencrypt/letsencrypt/archive/v${version}.tar.gz"; - sha256 = "056y5bsmpc4ya5xxals4ypzsm927j6n5kwby3bjc03sy3sscf6hw"; + src = fetchFromGitHub { + owner = "letsencrypt"; + repo = "letsencrypt"; + rev = "v${version}"; + sha256 = "0r2wis48w5nailzp2d5brkh2f40al6sbz816xx0akh3ll0rl1hbv"; }; propagatedBuildInputs = with pythonPackages; [ - zope_interface zope_component six requests2 pytz pyopenssl psutil mock acme - cryptography configobj pyRFC3339 python2-pythondialog parsedatetime ConfigArgParse + ConfigArgParse + acme + configobj + cryptography + parsedatetime + psutil + pyRFC3339 + pyopenssl + python2-pythondialog + pytz + six + zope_component + zope_interface ]; buildInputs = with pythonPackages; [ nose dialog ]; patchPhase = '' substituteInPlace letsencrypt/notify.py --replace "/usr/sbin/sendmail" "/var/setuid-wrappers/sendmail" + substituteInPlace letsencrypt/le_util.py --replace "sw_vers" "/usr/bin/sw_vers" ''; postInstall = '' diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 25ba60f69bf..cb8df3afd36 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -260,7 +260,44 @@ in modules // { buildInputs = with self; [ nose ]; - sourceRoot = "letsencrypt-${version}/acme"; + sourceRoot = "letsencrypt-v${version}-src/acme"; + }; + + acme-tiny = buildPythonPackage rec { + name = "acme-tiny-${version}"; + version = "20151229"; + rev = "f61f72c212cea27f388eb4a26ede0d65035bdb53"; + + src = pkgs.fetchgit { + inherit rev; + url = "https://github.com/diafygi/acme-tiny.git"; + sha256 = "dde59354e483bdff3dfd06717c094889ae673efb568e40b150b4695b0c539649"; + }; + + # source doesn't have any python "packaging" as such + configurePhase = " "; + buildPhase = " "; + # the tests are... complex + doCheck = false; + + patchPhase = '' + substituteInPlace acme_tiny.py --replace "openssl" "${pkgs.openssl}/bin/openssl" + substituteInPlace letsencrypt/le_util.py --replace '"sw_vers"' '"/usr/bin/sw_vers"' + ''; + + installPhase = '' + mkdir -p $out/${python.sitePackages}/ + cp acme_tiny.py $out/${python.sitePackages}/ + mkdir -p $out/bin + ln -s $out/${python.sitePackages}/acme_tiny.py $out/bin/acme_tiny + chmod +x $out/bin/acme_tiny + ''; + + meta = { + description = "A tiny script to issue and renew TLS certs from Let's Encrypt"; + homepage = https://github.com/diafygi/acme-tiny; + license = licenses.mit; + }; }; acme-tiny = buildPythonPackage rec { From b6a8348a4b5bd7eca2695d7646c5fb2ceee2c0c5 Mon Sep 17 00:00:00 2001 From: Sheena Artrip Date: Fri, 26 Feb 2016 04:05:55 -0500 Subject: [PATCH 06/70] clamav: 0.98.7 -> 0.99 --- pkgs/tools/security/clamav/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/security/clamav/default.nix b/pkgs/tools/security/clamav/default.nix index 1f36d54ff50..efb72783391 100644 --- a/pkgs/tools/security/clamav/default.nix +++ b/pkgs/tools/security/clamav/default.nix @@ -1,15 +1,15 @@ { stdenv, fetchurl, zlib, bzip2, libiconv, libxml2, openssl, ncurses, curl -, libmilter }: +, libmilter, pcre }: stdenv.mkDerivation rec { name = "clamav-${version}"; - version = "0.98.7"; + version = "0.99"; src = fetchurl { url = "mirror://sourceforge/clamav/clamav-${version}.tar.gz"; - sha256 = "0wp2ad8km4cqmlndni5ljv7q3lfxm6y4r3giv0yf23bl0yvif918"; + sha256 = "1abyg349yr31z764jcgx67q5v098jrkrj88bqkzmys6xza62qyfj"; }; - buildInputs = [ zlib bzip2 libxml2 openssl ncurses curl libiconv libmilter ]; + buildInputs = [ zlib bzip2 libxml2 openssl ncurses curl libiconv libmilter pcre ]; configureFlags = [ "--with-zlib=${zlib}" @@ -19,6 +19,7 @@ stdenv.mkDerivation rec { "--with-openssl=${openssl}" "--with-libncurses-prefix=${ncurses}" "--with-libcurl=${curl}" + "--with-pcre=${pcre}" "--enable-milter" "--disable-clamav" ]; From 82560aefd705e0a382f0daac7227404a8f58a457 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sat, 27 Feb 2016 23:18:31 +0300 Subject: [PATCH 07/70] samba: reduce closure size --- pkgs/servers/samba/4.x.nix | 19 ++++++++----------- pkgs/top-level/all-packages.nix | 1 - 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix index 8fcc1a4a973..4ef47122c28 100644 --- a/pkgs/servers/samba/4.x.nix +++ b/pkgs/servers/samba/4.x.nix @@ -5,7 +5,6 @@ , gnutls, libgcrypt, libgpgerror , ncurses, libunwind, libibverbs, librdmacm, systemd -, enableKerberos ? false , enableInfiniband ? false , enableLDAP ? false , enablePrinting ? false @@ -34,10 +33,9 @@ stdenv.mkDerivation rec { buildInputs = [ python pkgconfig perl libxslt docbook_xsl docbook_xml_dtd_42 /* docbook_xml_dtd_45 */ readline talloc ntdb tdb tevent ldb popt iniparser - libbsd libarchive zlib acl fam libiconv gettext libunwind + libbsd libarchive zlib acl fam libiconv gettext libunwind kerberos ] ++ optionals stdenv.isLinux [ libaio pam systemd ] - ++ optional enableKerberos kerberos ++ optionals (enableInfiniband && stdenv.isLinux) [ libibverbs librdmacm ] ++ optional enableLDAP openldap ++ optional (enablePrinting && stdenv.isLinux) cups @@ -58,23 +56,22 @@ stdenv.mkDerivation rec { configureFlags = [ "--with-static-modules=NONE" "--with-shared-modules=ALL" + "--with-system-mitkrb5" "--enable-fhs" "--sysconfdir=/etc" "--localstatedir=/var" - "--bundled-libraries=${if enableKerberos && kerberos != null && - kerberos.implementation == "heimdal" then "NONE" else "com_err"}" + "--bundled-libraries=NONE" "--private-libraries=NONE" - "--builtin-libraries=replace" + "--builtin-libraries=NONE" ] - ++ optional (enableKerberos && kerberos != null && - kerberos.implementation == "krb5") "--with-system-mitkrb5" ++ optional (!enableDomainController) "--without-ad-dc" ++ optionals (!enableLDAP) [ "--without-ldap" "--without-ads" ]; enableParallelBuilding = true; - stripAllList = [ "bin" "sbin" ]; - + # Some libraries don't have /lib/samba in RPATH but need it. + # Use find -type f -executable -exec echo {} \; -exec sh -c 'ldd {} | grep "not found"' \; + # Looks like a bug in installer scripts. postFixup = '' export SAMBA_LIBS="$(find $out -type f -name \*.so -exec dirname {} \; | sort | uniq)" read -r -d "" SCRIPT << EOF || true @@ -85,7 +82,7 @@ stdenv.mkDerivation rec { patchelf --set-rpath "\$ALL_LIBS" "\$BIN" 2>/dev/null || exit $?; patchelf --shrink-rpath "\$BIN"; EOF - find $out -type f -exec $SHELL -c "$SCRIPT" \; + find $out -type f -name \*.so -exec $SHELL -c "$SCRIPT" \; ''; meta = with stdenv.lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0f756a175ac..6558f04d22e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9819,7 +9819,6 @@ let samba4 = callPackage ../servers/samba/4.x.nix { python = python2; - kerberos = null; # Bundle kerberos because samba uses internal, non-stable functions # enableLDAP }; From 3a6b06f1be55fa7b3ea79c81898921d6c0a5e6bc Mon Sep 17 00:00:00 2001 From: Ozan Sener Date: Sun, 28 Feb 2016 17:45:53 +0200 Subject: [PATCH 08/70] wring: init at 1.0.0 --- pkgs/tools/text/wring/default.nix | 26 ++++++++++++++++++++++++ pkgs/tools/text/wring/node-packages.json | 1 + pkgs/tools/text/wring/node-packages.nix | 24 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 4 files changed, 53 insertions(+) create mode 100644 pkgs/tools/text/wring/default.nix create mode 100644 pkgs/tools/text/wring/node-packages.json create mode 100644 pkgs/tools/text/wring/node-packages.nix diff --git a/pkgs/tools/text/wring/default.nix b/pkgs/tools/text/wring/default.nix new file mode 100644 index 00000000000..038456f82c5 --- /dev/null +++ b/pkgs/tools/text/wring/default.nix @@ -0,0 +1,26 @@ +{ stdenv, callPackage, makeWrapper, nodejs, phantomjs2 }: + +let + self = ( + callPackage ../../../top-level/node-packages.nix { + generated = callPackage ./node-packages.nix { inherit self; }; + overrides = { + "wring" = { + buildInputs = [ makeWrapper phantomjs2 ]; + + postInstall = '' + wrapProgram "$out/bin/wring" \ + --prefix PATH : ${phantomjs2}/bin + ''; + + meta = with stdenv.lib; { + description = "Command-line tool for extracting content from webpages using CSS Selectors, XPath, and JS expressions"; + homepage = https://github.com/osener/wring; + license = licenses.mit; + platforms = platforms.darwin ++ platforms.linux; + maintainers = [ maintainers.osener ]; + }; + }; + }; + }); +in self.wring diff --git a/pkgs/tools/text/wring/node-packages.json b/pkgs/tools/text/wring/node-packages.json new file mode 100644 index 00000000000..9c0e1712928 --- /dev/null +++ b/pkgs/tools/text/wring/node-packages.json @@ -0,0 +1 @@ +[ "wring" ] diff --git a/pkgs/tools/text/wring/node-packages.nix b/pkgs/tools/text/wring/node-packages.nix new file mode 100644 index 00000000000..b3761bd33cb --- /dev/null +++ b/pkgs/tools/text/wring/node-packages.nix @@ -0,0 +1,24 @@ +{ self, fetchurl, fetchgit ? null, lib }: + +{ + by-spec."wring"."*" = + self.by-version."wring"."1.0.0"; + by-version."wring"."1.0.0" = self.buildNodePackage { + name = "wring-1.0.0"; + version = "1.0.0"; + bin = true; + src = fetchurl { + url = "http://registry.npmjs.org/wring/-/wring-1.0.0.tgz"; + name = "wring-1.0.0.tgz"; + sha1 = "3d8ebe894545bf0b42946fdc84c61e37ae657ce1"; + }; + deps = { + }; + optionalDependencies = { + }; + peerDependencies = []; + os = [ ]; + cpu = [ ]; + }; + "wring" = self.by-version."wring"."1.0.0"; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 414fd2ae30a..a91f320949a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3774,6 +3774,8 @@ let wml = callPackage ../development/web/wml { }; + wring = callPackage ../tools/text/wring { }; + wrk = callPackage ../tools/networking/wrk { }; wv = callPackage ../tools/misc/wv { }; From 850a1a332353e73cb624ce5574fa80e424eb6da1 Mon Sep 17 00:00:00 2001 From: Danny Wilson Date: Sun, 28 Feb 2016 18:37:51 +0100 Subject: [PATCH 09/70] Fix "nix" stdenv (close #13554) Broken by changes introduced in d96893647de5c519c458c1254f043f2d67d9b29c --- pkgs/stdenv/nix/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix index 75e1c3814ed..30ac92837cb 100644 --- a/pkgs/stdenv/nix/default.nix +++ b/pkgs/stdenv/nix/default.nix @@ -18,10 +18,9 @@ import ../generic rec { nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr"; nativeLibc = true; inherit stdenv; - binutils = pkgs.binutils; + inherit (pkgs) binutils coreutils gnugrep; cc = pkgs.gcc.cc; isGNU = true; - coreutils = pkgs.coreutils; shell = pkgs.bash + "/bin/sh"; }; From fe09260465f74ac9d8143b2773f66a89e9e1c9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 28 Feb 2016 19:17:52 +0000 Subject: [PATCH 10/70] travis-ci: fix /etc/nix/nix.conf population --- maintainers/scripts/travis-nox-review-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainers/scripts/travis-nox-review-pr.sh b/maintainers/scripts/travis-nox-review-pr.sh index 99cf769fcd7..157ccc08f62 100755 --- a/maintainers/scripts/travis-nox-review-pr.sh +++ b/maintainers/scripts/travis-nox-review-pr.sh @@ -11,7 +11,7 @@ if [[ $1 == nix ]]; then # Make sure we can use hydra's binary cache sudo mkdir /etc/nix - sudo echo "build-max-jobs = 4" > /etc/nix/nix.conf + sudo sh -c 'echo "build-max-jobs = 4" > /etc/nix/nix.conf' # Verify evaluation echo "=== Verifying that nixpkgs evaluates..." From 5e5cd7c93c54c92783394c5b720f616113c77a37 Mon Sep 17 00:00:00 2001 From: "Kovacsics Robert (NixOS)" Date: Sun, 28 Feb 2016 13:48:54 +0000 Subject: [PATCH 11/70] inferno: 645 -> 785 --- pkgs/applications/inferno/default.nix | 46 +++++++++++---------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/pkgs/applications/inferno/default.nix b/pkgs/applications/inferno/default.nix index a0e2796a302..1a720f00300 100644 --- a/pkgs/applications/inferno/default.nix +++ b/pkgs/applications/inferno/default.nix @@ -1,55 +1,47 @@ -{ fetchurl, fetchhg, stdenv, xorg, gcc46, makeWrapper }: +{ fetchurl, fetchhg, stdenv, xorg, makeWrapper }: stdenv.mkDerivation rec { # Inferno is a rolling release from a mercurial repository. For the verison number # of the package I'm using the mercurial commit number. - version = "645"; - name = "inferno-${version}"; - - # The mercurial repository does not contain all the components needed for the - # runtime system. The 'base' package contains these. For this package I download - # the base, extract the elements required from that, and add them to the source - # pulled from the mercurial repository. - srcBase = fetchurl { - url = "http://www.vitanuova.com/dist/4e/inferno-20100120.tgz"; - sha256 = "0msvy3iwl4n5k0ry0xiyysjkq0qsawmwn3hvg67hbi5y8g7f7l88"; - }; + rev = "785"; + name = "inferno-${rev}"; + host = "Linux"; + objtype = "386"; src = fetchhg { - url = "https://inferno-os.googlecode.com/hg"; - rev = "7ab390b860ca"; - sha256 = "09y0iclb3yy10gw1p0182sddg64xh60q2fx4ai7lxyfb65i76qbh"; + url = "https://bitbucket.org/inferno-os/inferno-os"; + sha256 = "1b428ma9fi5skvfrxp91dr43a62kax89wmx7950ahc1cxyx90k7x"; }; - # Fails with gcc48 due to inferno triggering an optimisation issue with floating point. - buildInputs = [ gcc46 xorg.libX11 xorg.libXpm xorg.libXext xorg.xextproto makeWrapper ]; + buildInputs = [ makeWrapper ] ++ (with xorg; [ libX11 libXpm libXext xextproto ]); infernoWrapper = ./inferno; configurePhase = '' - tar --strip-components=1 -xvf $srcBase inferno/fonts inferno/Mkdirs inferno/empties - sed -e 's@^ROOT=.*$@ROOT='"$out"'/share/inferno@g' -e 's@^OBJTYPE=.*$@OBJTYPE=386@g' -e 's@^SYSHOST=.*$@SYSHOST=Linux@g' -i mkconfig - mkdir prof - sh Mkdirs + sed -e 's@^ROOT=.*$@ROOT='"$out"'/share/inferno@g' \ + -e 's@^OBJTYPE=.*$@OBJTYPE=${objtype}@g' \ + -e 's@^SYSHOST=.*$@SYSHOST=${host}@g' \ + -i mkconfig + # Get rid of an annoying warning + sed -e 's/_BSD_SOURCE/_DEFAULT_SOURCE/g' \ + -i ${host}/${objtype}/include/lib9.h ''; buildPhase = '' - export PATH=$PATH:$out/share/inferno/Linux/386/bin mkdir -p $out/share/inferno cp -r . $out/share/inferno ./makemk.sh + export PATH=$PATH:$out/share/inferno/Linux/386/bin mk nuke mk ''; installPhase = '' + # Installs executables in $out/share/inferno/${host}/${objtype}/bin mk install mkdir -p $out/bin - makeWrapper $out/share/inferno/Linux/386/bin/emu $out/bin/emu \ - --suffix LD_LIBRARY_PATH ':' "${gcc46.cc}/lib" \ - --suffix PATH ':' "$out/share/inferno/Linux/386/bin" + # Install start-up script makeWrapper $infernoWrapper $out/bin/inferno \ - --suffix LD_LIBRARY_PATH ':' "${gcc46.cc}/lib" \ --suffix PATH ':' "$out/share/inferno/Linux/386/bin" \ --set INFERNO_ROOT "$out/share/inferno" ''; @@ -58,7 +50,7 @@ stdenv.mkDerivation rec { description = "A compact distributed operating system for building cross-platform distributed systems"; homepage = "http://inferno-os.org/"; license = stdenv.lib.licenses.gpl2; - maintainers = [ "Chris Double " ]; + maintainers = with stdenv.lib.maintainers; [ doublec kovirobi ]; platforms = with stdenv.lib.platforms; linux; }; } From 29852f9d24e9368faad2a6c6709f66c32d706e4f Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sun, 28 Feb 2016 23:45:53 +0300 Subject: [PATCH 12/70] samba: fix evaluation --- pkgs/top-level/all-packages.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 09c707060b8..d014ba39340 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9848,7 +9848,6 @@ let }); samba4Full = lowPrio (samba4.override { - enableKerberos = true; enableInfiniband = true; enableLDAP = true; enablePrinting = true; From b3faef0d9328446cf819fa897116aff28c10a9f9 Mon Sep 17 00:00:00 2001 From: Michael Ekstrand Date: Sat, 27 Feb 2016 20:01:34 -0600 Subject: [PATCH 13/70] nano: build info manual (close #13527) Make nano depend use texinfo, so that the built packages include the info manual, and put it into a separate output. --- pkgs/applications/editors/nano/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/editors/nano/default.nix b/pkgs/applications/editors/nano/default.nix index 9c8238244ff..61818561f74 100644 --- a/pkgs/applications/editors/nano/default.nix +++ b/pkgs/applications/editors/nano/default.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl , ncurses +, texinfo , gettext ? null , enableNls ? true , enableTiny ? false @@ -16,7 +17,8 @@ stdenv.mkDerivation rec { url = "mirror://gnu/nano/${name}.tar.gz"; sha256 = "1vl9bim56k1b4zwc3icxp46w6pn6gb042j1h4jlz1jklxxpkwcpz"; }; - buildInputs = [ ncurses ] ++ optional enableNls gettext; + buildInputs = [ ncurses texinfo ] ++ optional enableNls gettext; + outputs = [ "out" "info" ]; configureFlags = '' --sysconfdir=/etc ${optionalString (!enableNls) "--disable-nls"} From a93a2e23609dcc3fc20c84415219a872222d881f Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Fri, 26 Feb 2016 23:22:34 -0600 Subject: [PATCH 14/70] fish: remove kbd dependency on Darwin --- pkgs/shells/fish/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/shells/fish/default.nix b/pkgs/shells/fish/default.nix index 11eeb18661c..88754fd95a1 100644 --- a/pkgs/shells/fish/default.nix +++ b/pkgs/shells/fish/default.nix @@ -22,8 +22,10 @@ stdenv.mkDerivation rec { postInstall = '' sed -e "s|expr|${coreutils}/bin/expr|" \ + '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' -e "s|if which unicode_start|if true|" \ -e "s|unicode_start|${kbd}/bin/unicode_start|" \ + '' + '' -i "$out/etc/fish/config.fish" sed -e "s|bc|${bc}/bin/bc|" \ -e "s|/usr/bin/seq|${coreutils}/bin/seq|" \ From da1f465b9472d448ce62ac46fce9f95cfe3f2575 Mon Sep 17 00:00:00 2001 From: Nathan Zadoks Date: Mon, 22 Feb 2016 16:25:01 +0100 Subject: [PATCH 15/70] fish: fix hidden dependency on utillinux on Linux --- pkgs/shells/fish/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/shells/fish/default.nix b/pkgs/shells/fish/default.nix index 11eeb18661c..510a9b6f44f 100644 --- a/pkgs/shells/fish/default.nix +++ b/pkgs/shells/fish/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, ncurses, nettools, python, which, groff, gettext, man_db, - bc, libiconv, coreutils, gnused, kbd }: + bc, libiconv, coreutils, gnused, kbd, utillinux }: stdenv.mkDerivation rec { name = "fish-${version}"; @@ -43,6 +43,9 @@ stdenv.mkDerivation rec { "$out/share/fish/functions/prompt_pwd.fish" substituteInPlace "$out/share/fish/functions/fish_default_key_bindings.fish" \ --replace "clear;" "${ncurses}/bin/clear;" + '' + stdenv.lib.optionalString stdenv.isLinux '' + substituteInPlace "$out/share/fish/functions/__fish_print_help.fish" \ + --replace "| ul" "| ${utillinux}/bin/ul" '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' sed -i "s|(hostname\||(${nettools}/bin/hostname\||" "$out/share/fish/functions/fish_prompt.fish" sed -i "s|Popen(\['manpath'|Popen(\['${man_db}/bin/manpath'|" "$out/share/fish/tools/create_manpage_completions.py" From 010271d47ac86e3a11117c6d5266d2cc77db9b47 Mon Sep 17 00:00:00 2001 From: Nathan Zadoks Date: Sun, 28 Feb 2016 22:26:42 +0100 Subject: [PATCH 16/70] fish: fix hidden dependency on ${glibc}/bin/getent on Linux --- pkgs/shells/fish/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/shells/fish/default.nix b/pkgs/shells/fish/default.nix index 510a9b6f44f..83c8e3c5816 100644 --- a/pkgs/shells/fish/default.nix +++ b/pkgs/shells/fish/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, ncurses, nettools, python, which, groff, gettext, man_db, - bc, libiconv, coreutils, gnused, kbd, utillinux }: + bc, libiconv, coreutils, gnused, kbd, utillinux, glibc }: stdenv.mkDerivation rec { name = "fish-${version}"; @@ -46,6 +46,10 @@ stdenv.mkDerivation rec { '' + stdenv.lib.optionalString stdenv.isLinux '' substituteInPlace "$out/share/fish/functions/__fish_print_help.fish" \ --replace "| ul" "| ${utillinux}/bin/ul" + + for cur in $out/share/fish/functions/*.fish; do + substituteInPlace "$cur" --replace "/usr/bin/getent" "${glibc}/bin/getent" + done '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' sed -i "s|(hostname\||(${nettools}/bin/hostname\||" "$out/share/fish/functions/fish_prompt.fish" sed -i "s|Popen(\['manpath'|Popen(\['${man_db}/bin/manpath'|" "$out/share/fish/tools/create_manpage_completions.py" From baeedda1a5bef874362af879e0211a225b090670 Mon Sep 17 00:00:00 2001 From: Tom Hunger Date: Sun, 28 Feb 2016 15:13:23 +0000 Subject: [PATCH 17/70] wtforms: Update to 2.1, make work on python3, disable tests for now. --- pkgs/top-level/python-packages.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 19c4ce2baab..23f2affa9c2 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8935,15 +8935,19 @@ in modules // { }; wtforms = buildPythonPackage rec { - version = "2.0.2"; + version = "2.1"; name = "wtforms-${version}"; src = pkgs.fetchurl { url = "https://pypi.python.org/packages/source/W/WTForms/WTForms-${version}.zip"; - md5 = "613cf723ab40537705bec02733c78d95"; + sha256 = "0vyl26y9cg409cfyj8rhqxazsdnd0jipgjw06civhrd53yyi1pzz"; }; - propagatedBuildInputs = with self; [ ordereddict Babel ]; + # Django tests are broken "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet." + # This is fixed in master I believe but not yet in 2.1; + doCheck = false; + + propagatedBuildInputs = with self; ([ Babel ] ++ (optionals isPy26 [ ordereddict ])); meta = { homepage = https://github.com/wtforms/wtforms; From e1338ad121a636ed45c13a83a74ed5b35fb39b95 Mon Sep 17 00:00:00 2001 From: Cole Mickens Date: Sun, 28 Feb 2016 14:28:38 -0800 Subject: [PATCH 18/70] plexpass: 0.9.15.5.1712 -> 0.9.15.6.1714 --- pkgs/servers/plex/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/plex/default.nix b/pkgs/servers/plex/default.nix index aa27f6dd532..27cca6653b9 100644 --- a/pkgs/servers/plex/default.nix +++ b/pkgs/servers/plex/default.nix @@ -5,9 +5,9 @@ let plexpkg = if enablePlexPass then { - version = "0.9.15.5.1712"; - vsnHash = "ba5070a"; - sha256 = "0nwcjlfbs8dacp6wzmga75hkx16ngyaqrmdhcx8vqvgwm8l31rxs"; + version = "0.9.15.6.1714"; + vsnHash = "7be11e1"; + sha256 = "1kyk41qnbm8w5bvnisp3d99cf0r72wvlggfi9h4np7sq4p8ksa0g"; } else { version = "0.9.15.3.1674"; vsnHash = "f46e7e6"; From f91f3a4c5a7672ead2d9a414acb1415a8bfb8260 Mon Sep 17 00:00:00 2001 From: Cole Mickens Date: Sun, 28 Feb 2016 14:29:01 -0800 Subject: [PATCH 19/70] plex: 0.9.15.3.1674 -> 0.9.15.6.1714 --- pkgs/servers/plex/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/plex/default.nix b/pkgs/servers/plex/default.nix index 27cca6653b9..799fea0fe50 100644 --- a/pkgs/servers/plex/default.nix +++ b/pkgs/servers/plex/default.nix @@ -9,9 +9,9 @@ let vsnHash = "7be11e1"; sha256 = "1kyk41qnbm8w5bvnisp3d99cf0r72wvlggfi9h4np7sq4p8ksa0g"; } else { - version = "0.9.15.3.1674"; - vsnHash = "f46e7e6"; - sha256 = "086njnjcmknmbn90mmvf60ls7q73g2m955yk621jjdngs4ybvm19"; + version = "0.9.15.6.1714"; + vsnHash = "7be11e1"; + sha256 = "1kyk41qnbm8w5bvnisp3d99cf0r72wvlggfi9h4np7sq4p8ksa0g"; }; in stdenv.mkDerivation rec { From edb8991a2cbc1339471353531f5e393997491d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 28 Feb 2016 22:33:43 +0000 Subject: [PATCH 20/70] nixos: bump to 16.09 --- .version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.version b/.version index 1c1d9713015..8c9a730caf3 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -16.03 \ No newline at end of file +16.09 From c483224c82c8e94324c03576e64c5dfbf16bd2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 28 Feb 2016 23:39:38 +0000 Subject: [PATCH 21/70] as always, no newline in .version --- .version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.version b/.version index 8c9a730caf3..18fc8443eec 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -16.09 +16.09 \ No newline at end of file From cad8957eabcbf73062226d28366fd446c15c8737 Mon Sep 17 00:00:00 2001 From: Thomas Strobel Date: Sat, 20 Feb 2016 01:47:01 +0100 Subject: [PATCH 22/70] Add the tool "nixos-typecheck" that can check an option declaration to: - Enforce that an option declaration has a "defaultText" if and only if the type of the option derives from "package", "packageSet" or "nixpkgsConfig" and if a "default" attribute is defined. - Enforce that the value of the "example" attribute is wrapped with "literalExample" if the type of the option derives from "package", "packageSet" or "nixpkgsConfig". - Warn if a "defaultText" is defined in an option declaration if the type of the option does not derive from "package", "packageSet" or "nixpkgsConfig". - Warn if no "type" is defined in an option declaration. --- lib/modules.nix | 99 ++++++-- lib/options.nix | 145 ++++++++++-- lib/types.nix | 221 ++++++++++++++---- nixos/default.nix | 2 + nixos/doc/manual/default.nix | 6 +- .../development/option-declarations.xml | 106 ++++++++- nixos/lib/eval-config.nix | 15 +- nixos/lib/typechecker.nix | 91 ++++++++ nixos/modules/config/i18n.nix | 1 + nixos/modules/config/sysctl.nix | 1 + nixos/modules/installer/tools/nixos-option.sh | 4 +- .../installer/tools/nixos-typecheck.sh | 52 +++++ nixos/modules/installer/tools/tools.nix | 8 +- nixos/modules/misc/meta.nix | 1 + nixos/modules/misc/nixpkgs.nix | 51 ++-- nixos/modules/module-list.nix | 1 + nixos/modules/services/misc/gitlab.nix | 3 + nixos/modules/services/misc/ihaskell.nix | 4 + nixos/modules/services/misc/nixos-manual.nix | 5 +- .../web-servers/apache-httpd/default.nix | 3 +- .../services/x11/window-managers/xmonad.nix | 3 + nixos/modules/system/boot/kernel.nix | 1 + .../system/boot/systemd-unit-options.nix | 5 +- nixos/release.nix | 2 + 24 files changed, 703 insertions(+), 127 deletions(-) create mode 100644 nixos/lib/typechecker.nix create mode 100644 nixos/modules/installer/tools/nixos-typecheck.sh diff --git a/lib/modules.nix b/lib/modules.nix index 12ec7004d1e..d08dc9f85a2 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -23,8 +23,6 @@ rec { specialArgs ? {} , # This would be remove in the future, Prefer _module.args option instead. args ? {} - , # This would be remove in the future, Prefer _module.check option instead. - check ? true }: let # This internal module declare internal options under the `_module' @@ -45,9 +43,22 @@ rec { _module.check = mkOption { type = types.bool; internal = true; - default = check; + default = true; description = "Whether to check whether all option definitions have matching declarations."; }; + + _module.typeInference = mkOption { + type = types.nullOr types.str; + internal = true; + default = null; # TODO: Move away from 'null' after enough testing. + description = '' + Mode of type inferencing. Possible values are: + null = Disable type inferencing completely. Use 'types.unspecified' for every option without type definition. + "silent" = Try to infer type of option without type definition, but do not print anything. + "printUnspecified" = Try to infer type of option without type definition and print options for which no full type could be inferred. + "printAll" = Try to infer type of option without type definition and print all options without type definition. + ''; + }; }; config = { @@ -60,7 +71,7 @@ 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 prefix (reverseList closed); + options = mergeModules (config._module) prefix (reverseList closed); # Traverse options and extract the option values into the final # config set. At the same time, check whether all option @@ -170,11 +181,11 @@ 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 = _module: prefix: modules: + mergeModules' _module prefix modules (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules); - mergeModules' = prefix: options: configs: + mergeModules' = _module: prefix: options: configs: listToAttrs (map (name: { # We're descending into attribute ‘name’. inherit name; @@ -200,8 +211,8 @@ rec { (filter (m: m.config ? ${name}) configs); in if nrOptions == length decls then - let opt = fixupOptionType loc (mergeOptionDecls loc decls); - in evalOptionValue loc opt defns' + let opt = fixupOptionType _module.typeInference loc (mergeOptionDecls loc decls); + in evalOptionValue _module loc opt defns' else if nrOptions != 0 then let firstOption = findFirst (m: isOption m.options) "" decls; @@ -209,7 +220,7 @@ rec { in throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." else - mergeModules' loc decls defns; + mergeModules' _module loc decls defns; }) (concatMap (m: attrNames m.options) options)) // { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; }; @@ -258,7 +269,7 @@ rec { /* Merge all the definitions of an option to produce the final config value. */ - evalOptionValue = loc: opt: defs: + evalOptionValue = _module: loc: opt: defs: let # Add in the default value for this option, if any. defs' = @@ -270,7 +281,7 @@ rec { if opt.readOnly or false && length defs' > 1 then throw "The option `${showOption loc}' is read-only, but it's set multiple times." else - mergeDefinitions loc opt.type defs'; + mergeDefinitions _module loc opt.type defs'; # Check whether the option is defined, and apply the ‘apply’ # function to the merged value. This allows options to yield a @@ -291,7 +302,7 @@ rec { }; # Merge definitions of a value of a given type. - mergeDefinitions = loc: type: defs: rec { + mergeDefinitions = _module: loc: type: defs: rec { defsFinal = let # Process mkMerge and mkIf properties. @@ -314,7 +325,7 @@ rec { mergedValue = foldl' (res: def: if type.check def.value then res else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.name}.") - (type.merge loc defsFinal) defsFinal; + (type.merge _module loc defsFinal) defsFinal; isDefined = defsFinal != []; @@ -412,7 +423,7 @@ rec { /* Hack for backward compatibility: convert options of type optionSet to options of type submodule. FIXME: remove eventually. */ - fixupOptionType = loc: opt: + fixupOptionType = typeInference: loc: opt: let options = opt.options or (throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}."); @@ -424,12 +435,66 @@ rec { 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 if opt.type.getSubModules or null == null - then opt // { type = f (opt.type or types.unspecified); } + then opt // { type = f (opt.type or (inferType typeInference loc opt)); } else opt // { type = opt.type.substSubModules opt.options; options = []; }; + /* Function that tries to infer the type of an option from the default value of the option. */ + inferType = mode: loc: opt: + let + doc = x: elemAt x 0; + type = x: elemAt x 1; + containsUnspecified = x: elemAt x 2; + inferType' = def: + if isDerivation def then [ "package" types.package false ] + else if isBool def then [ "bool" types.bool false ] + else if builtins.isString def then [ "str" types.str false ] + else if isInt def then [ "int" types.int false ] + else if isFunction def then [ "functionTo unspecified" (types.functionTo types.unspecified) true ] + else if isList def then + let nestedType = if (length def > 0) && (all (x: (type (inferType' x)) == (type (inferType' (head def)))) def) + then inferType' (head def) + else [ "unspecified" types.unspecified true ]; + in [ "listOf ${doc nestedType}" (types.listOf (type nestedType)) (containsUnspecified nestedType) ] + else if isAttrs def then + let list = mapAttrsToList (_: v: v) (removeAttrs def ["_args"]); + nestedType = if (length list > 0) && (all (x: (type (inferType' x)) == (type (inferType' (head list)))) list) + then inferType' (head list) + else [ "unspecified" types.unspecified true ]; + in [ "attrsOf ${doc nestedType}" (types.attrsOf (type nestedType)) (containsUnspecified nestedType) ] + else [ "unspecified" types.unspecified true ]; + + inferDoc = x: '' + Inferring the type of "${showOption loc}" to "${doc x}". + Please verify the inferred type and define the type explicitely in ${showFiles opt.declarations}! + ''; + + inferredType = printMode: + let inferred = inferType' opt.default; + in if printMode == "silent" then type inferred + else if printMode == "printAll" then builtins.trace (inferDoc inferred) (type inferred) + else if printMode == "printUnspecified" && (containsUnspecified inferred) then builtins.trace (inferDoc inferred) (type inferred) + else type inferred; + + noInferDoc = '' + Could not infer a type for "${showOption loc}", using "unspecified" instead. + Please define the type explicitely in ${showFiles opt.declarations}! + ''; + + hasDefault = (opt ? default) && !(opt ? defaultText); + isExternalVisible = (opt.visible or true) && !(opt.internal or false); + in + + if isNull mode || !isExternalVisible + then types.unspecified + else if hasDefault + then inferredType mode /* Set to 'true' to see every type that is being inferred, not just those types that result in 'unspecified'. */ + else if mode != "silent" then builtins.trace noInferDoc types.unspecified else types.unspecified; + + /* Properties. */ mkIf = condition: content: @@ -497,7 +562,7 @@ rec { /* Compatibility. */ - fixMergeModules = modules: args: evalModules { inherit modules args; check = false; }; + fixMergeModules = modules: args: evalModules { inherit args; modules = (modules ++ [{ _module.check = false; }]); }; /* Return a module that causes a warning to be shown if the diff --git a/lib/options.nix b/lib/options.nix index 444ec37e6ea..d6876e18fe4 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -6,6 +6,7 @@ with import ./trivial.nix; with import ./lists.nix; with import ./attrsets.nix; with import ./strings.nix; +with {inherit (import ./types.nix) types; }; rec { @@ -42,16 +43,17 @@ rec { description = "Sink for option definitions."; type = mkOptionType { name = "sink"; + typerep = "(sink)"; check = x: true; - merge = loc: defs: false; + merge = config: loc: defs: false; }; apply = x: throw "Option value is not readable because the option is not declared."; } // attrs); - mergeDefaultOption = loc: defs: + mergeDefaultOption = config: loc: defs: let list = getValues defs; in if length list == 1 then head list - else if all isFunction list then x: mergeDefaultOption loc (map (f: f x) list) + else if all isFunction list then x: mergeDefaultOption config loc (map (f: f x) list) else if all isList list then concatLists list else if all isAttrs list then foldl' lib.mergeAttrs {} list else if all isBool list then foldl' lib.or false list @@ -59,14 +61,14 @@ rec { else if all isInt list && all (x: x == head list) list then head list else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}."; - mergeOneOption = loc: defs: + mergeOneOption = config: 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; /* "Merge" option definitions by checking that they all have the same value. */ - mergeEqualOption = loc: defs: + mergeEqualOption = config: loc: defs: if defs == [] then abort "This case should never happen." else foldl' (val: def: if def.value != val then @@ -77,53 +79,154 @@ rec { getValues = map (x: x.value); getFiles = map (x: x.file); - # Generate documentation template from the list of option declaration like # the set generated with filterOptionSets. optionAttrSetToDocList = optionAttrSetToDocList' []; - optionAttrSetToDocList' = prefix: options: + optionAttrSetToDocList' = prefix: internalModuleConfig: options: concatMap (opt: let + decls = filter (x: x != unknownModule) opt.declarations; docOption = rec { name = showOption opt.loc; description = opt.description or (throw "Option `${name}' has no description."); - declarations = filter (x: x != unknownModule) opt.declarations; + declarations = decls; internal = opt.internal or false; visible = opt.visible or true; readOnly = opt.readOnly or false; type = opt.type.name or null; } - // (if opt ? example then { example = scrubOptionValue opt.example; } else {}) - // (if opt ? default then { default = scrubOptionValue opt.default; } else {}) + // (if opt ? example then { example = detectDerivation decls opt.example; } else {}) + // (if opt ? default then { default = detectDerivation decls opt.default; } else {}) // (if opt ? defaultText then { default = opt.defaultText; } else {}); subOptions = - let ss = opt.type.getSubOptions opt.loc; - in if ss != {} then optionAttrSetToDocList' opt.loc ss else []; + let ss = opt.type.getSubOptionsPrefixed opt.loc; + in if ss != {} then optionAttrSetToDocList' opt.loc internalModuleConfig (ss internalModuleConfig) else []; in [ docOption ] ++ subOptions) (collect isOption options); + # TODO: Use "extractOptionAttrSet" instead of "optionAttrSetToDocList'" to reduce the code size. + # It should be a drop-in-replacement. But first, examine the impact on the evaluation time. + # optionAttrSetToDocList = extractOptionAttrSet true []; - /* This function recursively removes all derivation attributes from - `x' except for the `name' attribute. This is to make the - generation of `options.xml' much more efficient: the XML - representation of derivations is very large (on the order of - megabytes) and is not actually used by the manual generator. */ - scrubOptionValue = x: + # Generate a machine readable specification of the list of option declarations. + optionAttrSetToParseableSpecifications = extractOptionAttrSet false []; + + extractOptionAttrSet = toDoc: prefix: internalModuleConfig: options: + concatMap (opt: + let + optionName = showOption opt.loc; + + # Check if a type contains derivations, that is check if a type nests + # a 'package', 'packageSet' or 'nixpkgsConfig' type. + hasDerivation = any (t: elem t opt.type.nestedTypes) ((map (x: x.typerep) (with types; [package packageSet])) ++ ["(nixpkgsConfig)"]); + + # Check if type is 'path' which can potentially contain a derivation. + maybeHiddenDerivation = any (t: elem t opt.type.nestedTypes) (map (x: x.typerep) (with types; [path])); + + isDefaultValue = elem opt.default opt.type.defaultValues; + + /* Enforce that the example attribute is wrapped with 'literalExample' + for every type that contains derivations. */ + example = + if opt ? example + then (if hasDerivation + then (if isLiteralExample opt.example + then { example = detectDerivation decls opt.example; } + else throw "The attribute ${optionName}.example must be wrapped with 'literalExample' in ${concatStringsSep " and " decls}!") + else { example = detectDerivation decls opt.example; }) + else {}; + + /* Enforce that the 'defaultText' attribute is defined for every option + that has a 'default' attribute that contains derivations. */ + default = + if opt ? default + then (if hasDerivation + then (if isDefaultValue + then { default = opt.default; } + else (if opt ? defaultText + then { default = literalExample (detectDerivation decls opt.defaultText); } + else throw "The option ${optionName} requires a 'defaultText' attribute in ${concatStringsSep " and " decls}!")) + else (if opt ? defaultText + then (if maybeHiddenDerivation + then (if (let eval = builtins.tryEval (findDerivation opt.default); in eval.success && !eval.value) + then builtins.trace + "The attribute ${optionName}.defaultText might not be necessary in ${concatStringsSep " and " decls}!" + { default = literalExample (detectDerivation decls opt.defaultText); } + else { default = literalExample (detectDerivation decls opt.defaultText); }) + else builtins.trace + "The attribute ${optionName}.defaultText is not used and can be removed in ${concatStringsSep " and " decls}!" + { default = detectDerivation decls opt.default; }) + else { default = detectDerivation decls opt.default; })) + else {}; + + decls = filter (x: x != unknownModule) opt.declarations; + + docOption = { + name = optionName; + description = opt.description or (throw "Option `${optionName}' has no description."); + declarations = decls; + internal = opt.internal or false; + visible = opt.visible or true; + readOnly = opt.readOnly or false; + } // example // default // subOptions // typeKeys; + + typeKeys = if toDoc then { type = opt.type.name or null; } else { type = opt.type.typerep; keys = opt.loc; }; + + subOptions = + if toDoc + then {} + else let ss = opt.type.getSubOptions; + in if ss != {} then { suboptions = (extractOptionAttrSet false [] internalModuleConfig (ss internalModuleConfig)); } else {}; + + subOptionsDoc = + if toDoc + then let ss = opt.type.getSubOptionsPrefixed opt.loc; + in if ss != {} then extractOptionAttrSet true opt.loc internalModuleConfig (ss internalModuleConfig) else [] + else []; + in + [ docOption ] ++ subOptionsDoc ) + (filter (opt: (opt.visible or true) && !(opt.internal or false)) (collect isOption options)); + + + /* This function recursively checks for derivations within an + an expression, and throws an error if a derivation or a + store path is found. The function is used to ensure that no + derivation leaks from the 'default' or 'example' attributes + of an option. + This makes the generation of `options.xml' much more efficient: + the XML representation of derivations is very large (on the + order of megabytes) and is not actually used by the manual + generator. */ + detectDerivation = decl: x: 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"]) + throw "Found unexpected derivation in '${x.name}' in '${concatStringsSep " and " decl}'!" + else if isString x && isStorePath x then + throw "Found unexpected store path in '${x.name}' in '${concatStringsSep " and " decl}'!" + else if isList x then map (detectDerivation decl) x + else if isAttrs x then mapAttrs (n: v: (detectDerivation decl) v) (removeAttrs x ["_args"]) else x; + /* Same as detectDerivation, but returns a boolean instead of + throwing an exception. */ + findDerivation = x: + if (isString x && isStorePath x) || isDerivation x then true + else if isList x then any findDerivation x + else if isAttrs x then any findDerivation (mapAttrsToList (_: v: v) (removeAttrs x ["_args"])) + else false; + + /* For use in the ‘example’ option attribute. It causes the given text to be included verbatim in documentation. This is necessary for example values that are not simple values, e.g., functions. */ + # TODO: A more general name would probably be "literalNix". literalExample = text: { _type = "literalExample"; inherit text; }; + isLiteralExample = x: isAttrs x && hasAttr "_type" x && x._type == "literalExample"; + /* Helper functions. */ showOption = concatStringsSep "."; diff --git a/lib/types.nix b/lib/types.nix index b4d29ac84d2..385103d4214 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -1,6 +1,8 @@ # Definitions related to run-time type checking. Used in particular # to type-check NixOS configurations. +let lib = import ./default.nix; in + with import ./lists.nix; with import ./attrsets.nix; with import ./options.nix; @@ -21,6 +23,8 @@ rec { mkOptionType = { # Human-readable representation of the type. name + , # Parseable representation of the type. + typerep , # Function applied to each definition that should return true if # its type-correct, false otherwise. check ? (x: true) @@ -31,40 +35,59 @@ rec { # 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. - getSubOptions ? prefix: {} + , # Return list of sub-options. + getSubOptions ? {} + , # Same as 'getSubOptions', but with extra information about the + # location of the option which is used to generate documentation. + getSubOptionsPrefixed ? null , # List of modules if any, or null if none. getSubModules ? null , # Function for building the same option type with a different list of # modules. substSubModules ? m: null + , # List of type representations (typerep) of all the elementary types + # that are nested within the type. For an elementary type the list is + # a singleton of the typerep of itself. + # NOTE: Must be specified for every container type! + nestedTypes ? null + , # List of all default values, and an empty list if no default value exists. + defaultValues ? [] }: { _type = "option-type"; - inherit name check merge getSubOptions getSubModules substSubModules; + inherit name typerep check merge getSubOptions getSubModules substSubModules defaultValues; + nestedTypes = if (isNull nestedTypes) then (singleton typerep) else nestedTypes; + getSubOptionsPrefixed = if (isNull getSubOptionsPrefixed) then (prefix: getSubOptions) else getSubOptionsPrefixed; }; types = rec { + # + # Elementary types + # + unspecified = mkOptionType { name = "unspecified"; + typerep = "(unspecified)"; }; bool = mkOptionType { name = "boolean"; + typerep = "(boolean)"; check = isBool; merge = mergeEqualOption; }; int = mkOptionType { name = "integer"; + typerep = "(integer)"; check = isInt; merge = mergeOneOption; }; str = mkOptionType { name = "string"; + typerep = "(string)"; check = isString; merge = mergeOneOption; }; @@ -72,73 +95,111 @@ rec { # Merge multiple definitions by concatenating them (with the given # separator between the values). separatedString = sep: mkOptionType { - name = "string"; + name = "string" + (optionalString (sep != "") " separated by ${sep}"); + typerep = "(separatedString(${escape ["(" ")"] sep}))"; check = isString; - merge = loc: defs: concatStringsSep sep (getValues defs); + merge = _module: loc: defs: concatStringsSep sep (getValues defs); }; - lines = separatedString "\n"; - commas = separatedString ","; - envVar = separatedString ":"; + lines = separatedString "\n" // { typerep = "(lines)"; }; + commas = separatedString "," // { typerep = "(commas)"; }; + envVar = separatedString ":" // { typerep = "(envVar)"; }; # Deprecated; should not be used because it quietly concatenates # strings, which is usually not what you want. - string = separatedString ""; + string = separatedString "" // { typerep = "(string)"; }; attrs = mkOptionType { name = "attribute set"; + typerep = "(attrs)"; check = isAttrs; - merge = loc: foldl' (res: def: mergeAttrs res def.value) {}; + merge = _module: loc: foldl' (res: def: mergeAttrs res def.value) {}; }; # derivation is a reserved keyword. package = mkOptionType { name = "package"; + typerep = "(package)"; check = x: isDerivation x || isStorePath x; - merge = loc: defs: - let res = mergeOneOption loc defs; + merge = _module: loc: defs: + let res = mergeOneOption _module loc defs; in if isDerivation res then res else toDerivation res; }; + # The correct type of packageSet would be: + # packageSet = attrsOf (either package packageSet) + # (Not sure if nix would allow to define a recursive type.) + # However, currently it is not possible to check that a packageSet actually + # contains packages (that is derivations). The check 'isDerivation' is too + # eager for the current implementation of the assertion mechanism and of the + # licenses control mechanism. That means it is not generally possible to go + # into the attribute set of packages to check that every attribute would + # evaluate to a derivation if the package would actually be evaluated. Maybe + # that restriction can be lifted in the future, but for now the content of + # the packageSet is not checked. + # TODO: The 'merge' function is copied from 'mergeDefaultOption' to keep + # backwards compatibility with the 'unspecified' type that was used for + # package sets previously. Maybe review if the merge function has to change. + packageSet = mkOptionType { + name = "derivation set"; + typerep = "(packageSet)"; + check = isAttrs; + merge = _module: loc: defs: foldl' mergeAttrs {} (map (x: x.value) defs); + }; + path = mkOptionType { name = "path"; + typerep = "(path)"; # Hacky: there is no ‘isPath’ primop. check = x: builtins.substring 0 1 (toString x) == "/"; merge = mergeOneOption; }; + + # + # Container types + # + # drop this in the future: list = builtins.trace "`types.list' is deprecated; use `types.listOf' instead" types.listOf; listOf = elemType: mkOptionType { name = "list of ${elemType.name}s"; + typerep = "(listOf${elemType.typerep})"; check = isList; - merge = loc: defs: + merge = _module: loc: defs: map (x: x.value) (filter (x: x ? value) (concatLists (imap (n: def: imap (m: def': - (mergeDefinitions + (mergeDefinitions _module (loc ++ ["[definition ${toString n}-entry ${toString m}]"]) elemType [{ inherit (def) file; value = def'; }] ).optionalValue ) def.value) defs))); - getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); + getSubOptions = elemType.getSubOptions; + getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed (prefix ++ ["*"]); getSubModules = elemType.getSubModules; substSubModules = m: listOf (elemType.substSubModules m); + nestedTypes = elemType.nestedTypes; + defaultValues = [[]]; }; attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; + typerep = "(attrsOf${elemType.typerep})"; check = isAttrs; - merge = loc: defs: + merge = _module: loc: defs: mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs: - (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue + (mergeDefinitions _module (loc ++ [name]) elemType defs).optionalValue ) # 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 ++ [""]); + getSubOptions = elemType.getSubOptions; + getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed (prefix ++ [""]); getSubModules = elemType.getSubModules; substSubModules = m: attrsOf (elemType.substSubModules m); + nestedTypes = elemType.nestedTypes; + defaultValues = [{}]; }; # List or attribute set of ... @@ -159,18 +220,23 @@ rec { attrOnly = attrsOf elemType; in mkOptionType { name = "list or attribute set of ${elemType.name}s"; + typerep = "(loaOf${elemType.typerep})"; check = x: isList x || isAttrs x; - merge = loc: defs: attrOnly.merge loc (imap convertIfList defs); - getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); + merge = _module: loc: defs: attrOnly.merge _module loc (imap convertIfList defs); + getSubOptions = elemType.getSubOptions; + getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed (prefix ++ [""]); getSubModules = elemType.getSubModules; substSubModules = m: loaOf (elemType.substSubModules m); + nestedTypes = elemType.nestedTypes; + defaultValues = [{} []]; }; # List or element of ... loeOf = elemType: mkOptionType { name = "element or list of ${elemType.name}s"; + typerep = "(loeOf${elemType.typerep})"; check = x: isList x || elemType.check x; - merge = loc: defs: + merge = _module: loc: defs: let defs' = filterOverrides defs; res = (head defs').value; @@ -181,55 +247,41 @@ rec { else if !isString res then throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}." else res; + nestedTypes = elemType.nestedTypes; + defaultValues = [[]] ++ elemType.defaultValues; }; uniq = elemType: mkOptionType { - inherit (elemType) name check; + inherit (elemType) check; + name = "unique ${elemType.name}"; + typerep = "(uniq${elemType.typerep})"; merge = mergeOneOption; getSubOptions = elemType.getSubOptions; + getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed prefix; getSubModules = elemType.getSubModules; substSubModules = m: uniq (elemType.substSubModules m); + nestedTypes = elemType.nestedTypes; + defaultValues = elemType.defaultValues; }; nullOr = elemType: mkOptionType { name = "null or ${elemType.name}"; + typerep = "(nullOr${elemType.typerep})"; check = x: x == null || elemType.check x; - merge = loc: defs: + merge = _module: loc: defs: let nrNulls = count (def: def.value == null) defs; in if nrNulls == length defs then null else if nrNulls != 0 then throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}." - else elemType.merge loc defs; + else elemType.merge _module loc defs; getSubOptions = elemType.getSubOptions; + getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed prefix; getSubModules = elemType.getSubModules; substSubModules = m: nullOr (elemType.substSubModules m); + nestedTypes = elemType.nestedTypes; + defaultValues = [null] ++ elemType.defaultValues; }; - submodule = opts: - let - opts' = toList opts; - inherit (import ./modules.nix) evalModules; - in - mkOptionType rec { - name = "submodule"; - check = x: isAttrs x || isFunction x; - merge = loc: defs: - let - coerce = def: if isFunction def then def else { config = def; }; - 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. - args = { name = ""; }; }).options; - getSubModules = opts'; - substSubModules = m: submodule m; - }; - enum = values: let show = v: @@ -239,23 +291,92 @@ rec { in mkOptionType { name = "one of ${concatMapStringsSep ", " show values}"; + typerep = "(enum${concatMapStrings (x: "(${escape ["(" ")"] (builtins.toString x)})") values})"; check = flip elem values; merge = mergeOneOption; + nestedTypes = []; }; either = t1: t2: mkOptionType { name = "${t1.name} or ${t2.name}"; + typerep = "(either${t1.typerep}${t2.typerep})"; check = x: t1.check x || t2.check x; merge = mergeOneOption; + nestedTypes = t1.nestedTypes ++ t2.nestedTypes; + defaultValues = t1.defaultValues ++ t2.defaultValues; }; + + # + # Complex types + # + + submodule = opts: + let + opts' = toList opts; + inherit (import ./modules.nix) evalModules; + filterVisible = filter (opt: (if opt ? visible then opt.visible else true) && (if opt ? internal then !opt.internal else true)); + in + mkOptionType rec { + name = "submodule"; + typerep = "(submodule)"; + check = x: isAttrs x || isFunction x; + merge = _module: loc: defs: + let + internalModule = [ { inherit _module; } { _module.args.name = lib.mkForce (last loc); } ]; + coerce = def: if isFunction def then def else { config = def; }; + modules = opts' ++ internalModule ++ map (def: { _file = def.file; imports = [(coerce def.value)]; }) defs; + in (evalModules { + inherit modules; + prefix = loc; + }).config; + getSubOptions = getSubOptionsPrefixed []; + getSubOptionsPrefixed = prefix: _module: + let + # FIXME: hack to get shit to evaluate. + internalModule = [ { inherit _module; } { _module.args.name = lib.mkForce ""; } ]; + in (evalModules { + modules = opts' ++ internalModule; + inherit prefix; + }).options; + getSubModules = opts'; + substSubModules = m: submodule m; + nestedTypes = concatMap (opt: opt.type.nestedTypes) (collect (lib.isType "option") (getSubOptions {})); + defaultValues = [{}]; + }; + + + + # + # Legacy types + # + # 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"; + typerep = "(optionSet)"; }; + + # Try to remove module options of that type wherever possible. + # A module option taking a function can not be introspected and documented properly. + functionTo = resultType: + mkOptionType { + name = "function to ${resultType.name}"; + typerep = "(function${resultType.typerep})"; + check = builtins.isFunction; + merge = mergeOneOption; + nestedTypes = resultType.nestedTypes; + defaultValues = map (x: {...}:x) resultType.nestedTypes; # INFO: It seems as nix can't compare functions, yet. + }; + + + # + # misc + # + # 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/default.nix b/nixos/default.nix index 5d69b79e13a..117a7b5d603 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -34,6 +34,8 @@ in system = eval.config.system.build.toplevel; + typechecker = eval.config.system.build.typechecker; + vm = vmConfig.system.build.vm; vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm; diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 4ce6ea1c111..ea860149736 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -1,4 +1,4 @@ -{ pkgs, options, version, revision, extraSources ? [] }: +{ pkgs, options, internalModule, version, revision, extraSources ? [] }: with pkgs; with pkgs.lib; @@ -6,8 +6,10 @@ with pkgs.lib; let # Remove invisible and internal options. - optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options); + optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList internalModule options); + # INFO: Please add 'defaultText' or 'literalExample' to the option + # definition to avoid this substitution! # Replace functions by the string substFunction = x: if builtins.isAttrs x then mapAttrs (name: substFunction) x diff --git a/nixos/doc/manual/development/option-declarations.xml b/nixos/doc/manual/development/option-declarations.xml index ea5d1241876..08bde4a275d 100644 --- a/nixos/doc/manual/development/option-declarations.xml +++ b/nixos/doc/manual/development/option-declarations.xml @@ -8,7 +8,7 @@ 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 +that has not been declared in any module. A option declaration generally looks like this: @@ -145,6 +145,108 @@ options = { You can also create new types using the function mkOptionType. See -lib/types.nix in Nixpkgs for details. +lib/types.nix in Nixpkgs for details. + +An option declaration must follow the following rules: + + + + A defaultText must be defined if and only if the type of the option + derives from package, packageSet or nixpkgsConfig + , and if and only if a default attribute is defined and if and only if + the value of the default attribute is not the default of the type of the + option declaration. + + For example, a defaultText must be defined for + +type = types.listOf types.package; +default = [ pkgs.foo; ]; +defaultText = "[ pkgs.foo; ]"; +. + + But no defaultText must be defined for + +type = types.listOf types.package; +default = []; +, + as [] is the default of types.listOf types.package. + + + + + A defaultText can be defined if the type of the option derives from + path and if a default attribute is defined. + + + + The value of the example attribute must be wrapped with + literalExample if the type of the option derives from package, + packageSet or nixpkgsConfig. + + + + The value of defaultText and literalExample must + be a string which contains a valid nix expression. The nix expression has to evaluate in + {pkgs}: value. + For example: + + + A defaultText could, e.g., be: + +type = types.package; +default = pkgs.foo; +defaultText = "pkgs.foo"; + + But not defaultText = "pkgs.foo;";, as that + corresponds to {pkgs}: pkgs.foo;, which is an + invalid nix expression due to the ending with ;. + + + + A literalExample could be used as, e.g.: + +type = types.path; +example = literalExample "\"\${pkgs.bar}/bin/bar\""; + + But not literalExample "\${pkgs.bar}/bin/bar";, as that corresponds + to {pkgs}: ${pkgs.bar}/bin/bar, which is an invalid nix expression + as the path is not a string anymore. + + + + + + The type attribute must be defined for every option declaration. + + + + +NixOS ships the tool nixos-typecheck that can check an option declaration to: + + + + + Enforce that an option declaration has a defaultText if and only if the + type of the option derives from package, packageSet or + nixpkgsConfig and if a default attribute is defined. + + + + Enforce that the value of the example attribute is wrapped with + literalExample if the type of the option derives from package, + packageSet or nixpkgsConfig. + + + + Warn if a defaultText is defined in an option declaration if the type of + the option does not derive from package, packageSet or + nixpkgsConfig. + + + + Warn if no type is defined in an option declaration. + + + diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index a87b285c5b7..79890e0add7 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -20,8 +20,13 @@ , # !!! See comment about args in lib/modules.nix specialArgs ? {} , modules +, # Pass through a configuration of the internal modules declared + # in lib/modules.nix. + _module ? {} +, # !!! See comment about typeInference in lib/modules.nix + typeInference ? null , # !!! See comment about check in lib/modules.nix - check ? true + check ? null , prefix ? [] , lib ? import ../../lib }: @@ -41,13 +46,17 @@ let }; }; + internalModule = { _module = (_module + // (if isNull check then {} else { inherit check; }) + // (if isNull typeInference then {} else { inherit typeInference; })); }; + in rec { # Merge the option definitions in all modules, forming the full # system configuration. inherit (lib.evalModules { - inherit prefix check; - modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ]; + inherit prefix; + modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ] ++ [ internalModule ]; args = extraArgs; specialArgs = { modulesPath = ../modules; } // specialArgs; }) config options; diff --git a/nixos/lib/typechecker.nix b/nixos/lib/typechecker.nix new file mode 100644 index 00000000000..b4d8277f8fe --- /dev/null +++ b/nixos/lib/typechecker.nix @@ -0,0 +1,91 @@ +{ config, lib, pkgs, baseModules, ... }: + +with pkgs; +with pkgs.lib; + +let + + optionsSpecs = inferenceMode: + let + versionModule = + { system.nixosVersionSuffix = config.system.nixosVersionSuffix; + system.nixosRevision = config.system.nixosRevision; + nixpkgs.system = config.nixpkgs.system; + }; + + internalModule = { _module = config._module; } // (if isNull inferenceMode then {} else { _module.typeInference = mkForce inferenceMode; }); + + eval = evalModules { + modules = [ versionModule ] ++ baseModules ++ [ internalModule ]; + args = (config._module.args) // { modules = [ ]; }; + }; + + # Remove invisible and internal options. + optionsSpecs' = filter (opt: opt.visible && !opt.internal) (optionAttrSetToParseableSpecifications config._module eval.options); + + # INFO: Please add 'defaultText' or 'literalExample' to the option + # definition to avoid this exception! + substFunction = key: decls: x: + if builtins.isAttrs x then mapAttrs (name: substFunction key decls) x + else if builtins.isList x then map (substFunction key decls) x + else if builtins.isFunction x then throw "Found an unexpected in ${key} declared in ${concatStringsSep " and " decls}." + else x; + + prefix = toString ../..; + + stripPrefix = fn: + if substring 0 (stringLength prefix) fn == prefix then + substring (stringLength prefix + 1) 1000 fn + else + fn; + + # Clean up declaration sites to not refer to the NixOS source tree. + cleanupOptions = x: flip map x (opt: + let substFunction' = y: substFunction opt.name opt.declarations y; + in opt + // { declarations = map (fn: stripPrefix fn) opt.declarations; } + // optionalAttrs (opt ? example) { example = substFunction' opt.example; } + // optionalAttrs (opt ? default) { default = substFunction' opt.default; } + // optionalAttrs (opt ? type) { type = substFunction' opt.type; }); + + in + cleanupOptions optionsSpecs'; + +in + +{ + + system.build.typechecker = { + + # The NixOS options as machine readable specifications in JSON format. + specifications = stdenv.mkDerivation { + name = "options-specs-json"; + + buildCommand = '' + # Export list of options in different format. + dst=$out/share/doc/nixos + mkdir -p $dst + + cp ${builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON + (listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs null))))) + } $dst/options-specs.json + + mkdir -p $out/nix-support + echo "file json $dst/options-specs.json" >> $out/nix-support/hydra-build-products + ''; # */ + + meta.description = "List of NixOS options specifications in JSON format"; + }; + + silent = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "silent")); + printAll = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "printAll")); + printUnspecified = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "printUnspecified")); + + }; + +} + + + + + diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index b20fac6ad3e..3d21bda5734 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -64,6 +64,7 @@ in consoleKeyMap = mkOption { type = mkOptionType { name = "string or path"; + typerep = "(stringOrPath)"; check = t: (isString t || types.path.check t); }; diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index 61b02c5ffa6..174d7014ca8 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -6,6 +6,7 @@ let sysctlOption = mkOptionType { name = "sysctl option value"; + typerep = "(sysctl)"; check = val: let checkType = x: isBool x || isString x || isInt x || isNull x; diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh index 17c17d05e28..dd21dc71ee2 100644 --- a/nixos/modules/installer/tools/nixos-option.sh +++ b/nixos/modules/installer/tools/nixos-option.sh @@ -115,8 +115,8 @@ let let name = head attrsNames; rest = tail attrsNames; in if isOption result.options then walkOptions rest { - options = result.options.type.getSubOptions ""; - opt = ''(\${result.opt}.type.getSubOptions "")''; + options = result.options.type.getSubOptionsPrefix ""; + opt = ''(\${result.opt}.type.getSubOptionsPrefix "")''; cfg = ''\${result.cfg}."\${name}"''; } else diff --git a/nixos/modules/installer/tools/nixos-typecheck.sh b/nixos/modules/installer/tools/nixos-typecheck.sh new file mode 100644 index 00000000000..f9557be0c50 --- /dev/null +++ b/nixos/modules/installer/tools/nixos-typecheck.sh @@ -0,0 +1,52 @@ +#! /bin/sh +#! @shell@ + +if [ -x "@shell@" ]; then export SHELL="@shell@"; fi; + +set -e + +showSyntax() { +cat >&1 << EOF +nixos-typecheck +usage: + nixos-typecheck [action] [args] +where: + action = silent | printAll | printUnspecified | getSpecs + with default action: printUnspecified + args = any argument supported by nix-build +EOF +} + + +# Parse the command line. +extraArgs=() +action=printUnspecified + +while [ "$#" -gt 0 ]; do + i="$1"; shift 1 + case "$i" in + --help) + showSyntax + ;; + silent|printAll|printUnspecified|getSpecs) + action="$i" + ;; + *) + extraArgs="$extraArgs $i" + ;; + esac +done + + +if [ "$action" = silent ]; then + nix-build --no-out-link '' -A typechecker.silent $extraArgs +elif [ "$action" = printAll ]; then + nix-build --no-out-link '' -A typechecker.printAll $extraArgs +elif [ "$action" = printUnspecified ]; then + nix-build --no-out-link '' -A typechecker.printUnspecified $extraArgs +elif [ "$action" = getSpecs ]; then + ln -s $(nix-build --no-out-link '' -A typechecker.specifications $extraArgs)/share/doc/nixos/options-specs.json specifications.json +else + showSyntax + exit 1 +fi diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 9ac3b7a5b16..69bd0d26b77 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -54,6 +54,11 @@ let inherit (config.system) nixosVersion nixosCodeName nixosRevision; }; + nixos-typecheck = makeProg { + name = "nixos-typecheck"; + src = ./nixos-typecheck.sh; + }; + in { @@ -67,10 +72,11 @@ in nixos-generate-config nixos-option nixos-version + nixos-typecheck ]; system.build = { - inherit nixos-install nixos-generate-config nixos-option nixos-rebuild; + inherit nixos-install nixos-generate-config nixos-option nixos-rebuild nixos-typecheck; }; }; diff --git a/nixos/modules/misc/meta.nix b/nixos/modules/misc/meta.nix index 22622706f2c..9a453172c63 100644 --- a/nixos/modules/misc/meta.nix +++ b/nixos/modules/misc/meta.nix @@ -5,6 +5,7 @@ with lib; let maintainer = mkOptionType { name = "maintainer"; + typerep = "(maintainer)"; check = email: elem email (attrValues lib.maintainers); merge = loc: defs: listToAttrs (singleton (nameValuePair (last defs).file (last defs).value)); }; diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 5eb38c510b4..511831ae5cd 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -3,32 +3,35 @@ with lib; let - isConfig = x: - builtins.isAttrs x || builtins.isFunction x; - - optCall = f: x: - if builtins.isFunction f - then f x - else f; - - mergeConfig = lhs_: rhs_: + nixpkgsConfig = pkgs: let - lhs = optCall lhs_ { inherit pkgs; }; - rhs = optCall rhs_ { inherit pkgs; }; + isConfig = x: + builtins.isAttrs x || builtins.isFunction x; + + optCall = f: x: + if builtins.isFunction f + then f x + else f; + + mergeConfig = lhs_: rhs_: + let + lhs = optCall lhs_ { inherit pkgs; }; + rhs = optCall rhs_ { inherit pkgs; }; + in + lhs // rhs // + optionalAttrs (lhs ? packageOverrides) { + packageOverrides = pkgs: + optCall lhs.packageOverrides pkgs // + optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; + }; in - lhs // rhs // - optionalAttrs (lhs ? packageOverrides) { - packageOverrides = pkgs: - optCall lhs.packageOverrides pkgs // - optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; + mkOptionType { + name = "nixpkgs config"; + typerep = "(nixpkgsConfig)"; + check = lib.traceValIfNot isConfig; + merge = config: args: fold (def: mergeConfig def.value) {}; + defaultValues = [{}]; }; - - configType = mkOptionType { - name = "nixpkgs config"; - check = traceValIfNot isConfig; - merge = args: fold (def: mergeConfig def.value) {}; - }; - in { @@ -46,7 +49,7 @@ in }; } ''; - type = configType; + type = nixpkgsConfig pkgs; description = '' The configuration of the Nix Packages collection. (For details, see the Nixpkgs documentation.) It allows you to set diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index ad1636e002d..88e01069b26 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -1,4 +1,5 @@ [ + ../lib/typechecker.nix ./config/debug-info.nix ./config/fonts/corefonts.nix ./config/fonts/fontconfig-ultimate.nix diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index cc50bfbea53..e6ebcd6dc14 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -155,18 +155,21 @@ in { packages.gitlab = mkOption { type = types.package; default = pkgs.gitlab; + defaultText = "pkgs.gitlab"; description = "Reference to the gitlab package"; }; packages.gitlab-shell = mkOption { type = types.package; default = pkgs.gitlab-shell; + defaultText = "pkgs.gitlab-shell"; description = "Reference to the gitlab-shell package"; }; packages.gitlab-workhorse = mkOption { type = types.package; default = pkgs.gitlab-workhorse; + defaultText = "pkgs.gitlab-workhorse"; description = "Reference to the gitlab-workhorse package"; }; diff --git a/nixos/modules/services/misc/ihaskell.nix b/nixos/modules/services/misc/ihaskell.nix index d0e9b839e75..c177d68c8fe 100644 --- a/nixos/modules/services/misc/ihaskell.nix +++ b/nixos/modules/services/misc/ihaskell.nix @@ -15,12 +15,14 @@ in options = { services.ihaskell = { enable = mkOption { + type = lib.types.bool; default = false; example = true; description = "Autostart an IHaskell notebook service."; }; haskellPackages = mkOption { + type = lib.types.packageSet; default = pkgs.haskellPackages; defaultText = "pkgs.haskellPackages"; example = literalExample "pkgs.haskell.packages.ghc784"; @@ -33,7 +35,9 @@ in }; extraPackages = mkOption { + type = types.functionTo (types.listOf types.package); default = self: []; + defaultText = "self: []"; example = literalExample '' haskellPackages: [ haskellPackages.wreq diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index 37ea339300d..7ba1c319add 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -17,6 +17,8 @@ let nixpkgs.system = config.nixpkgs.system; }; + internalModule = { _module = config._module; }; + /* For the purpose of generating docs, evaluate options with each derivation in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}". It isn't perfect, but it seems to cover a vast majority of use cases. @@ -29,7 +31,7 @@ let options = let scrubbedEval = evalModules { - modules = [ versionModule ] ++ baseModules; + modules = [ versionModule ] ++ baseModules ++ [ internalModule ]; args = (config._module.args) // { modules = [ ]; }; specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; }; }; @@ -43,6 +45,7 @@ let ) pkgSet; in scrubbedEval.options; + internalModule = config._module; }; entry = "${manual.manual}/share/doc/nixos/index.html"; diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 60ec49c9e66..8340287df45 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -48,8 +48,7 @@ let if svc ? function then svc.function 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; + { modules = [ { options = res.options; config = svc.config or svc; } ] ++ [ { _module.check = false; } ]; }).config; defaults = { extraConfig = ""; diff --git a/nixos/modules/services/x11/window-managers/xmonad.nix b/nixos/modules/services/x11/window-managers/xmonad.nix index 6af88d4f645..d8acb824f7d 100644 --- a/nixos/modules/services/x11/window-managers/xmonad.nix +++ b/nixos/modules/services/x11/window-managers/xmonad.nix @@ -16,6 +16,7 @@ in services.xserver.windowManager.xmonad = { enable = mkEnableOption "xmonad"; haskellPackages = mkOption { + type = lib.types.packageSet; default = pkgs.haskellPackages; defaultText = "pkgs.haskellPackages"; example = literalExample "pkgs.haskell.packages.ghc784"; @@ -28,7 +29,9 @@ in }; extraPackages = mkOption { + type = lib.types.functionTo (lib.types.listOf lib.types.package); default = self: []; + defaultText = "self: []"; example = literalExample '' haskellPackages: [ haskellPackages.xmonad-contrib diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index a6bbca9b30b..5b11a3fc61c 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -20,6 +20,7 @@ in options = { boot.kernelPackages = mkOption { + type = types.packageSet; default = pkgs.linuxPackages; # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index d4cab93b26b..16d0e098b8c 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -17,14 +17,15 @@ in rec { unitOption = mkOptionType { name = "systemd option"; - merge = loc: defs: + typerep = "(systemdOption)"; + merge = _module: loc: defs: let defs' = filterOverrides defs; defs'' = getValues defs'; in if isList (head defs'') then concatLists defs'' - else mergeOneOption loc defs'; + else mergeOneOption _module loc defs'; }; sharedOptions = { diff --git a/nixos/release.nix b/nixos/release.nix index cfe152cc163..3fa1676c861 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -101,6 +101,8 @@ in rec { manpages = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manpages); options = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux; + optionsSpecs = (buildFromConfig ({ pkgs, ... }: { _module.typeInference = "silent"; }) (config: config.system.build.typechecker.specifications)).x86_64-linux; + # Build the initial ramdisk so Hydra can keep track of its size over time. initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk); From 2d6696fc0a23976498d0033d03382880e24e953d Mon Sep 17 00:00:00 2001 From: Thomas Strobel Date: Mon, 29 Feb 2016 01:47:12 +0100 Subject: [PATCH 23/70] nixos-modules: Fixes related to "literalExample" and "defaultText". --- nixos/modules/services/logging/logstash.nix | 6 +++--- nixos/modules/services/misc/octoprint.nix | 2 ++ nixos/modules/services/networking/nsd.nix | 4 ++-- nixos/modules/services/networking/wpa_supplicant.nix | 9 +++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix index d27456e59e8..e019e6c3f23 100644 --- a/nixos/modules/services/logging/logstash.nix +++ b/nixos/modules/services/logging/logstash.nix @@ -85,7 +85,7 @@ in type = types.lines; default = ''stdin { type => "example" }''; description = "Logstash input configuration."; - example = literalExample '' + example = '' # Read from journal pipe { command => "''${pkgs.systemd}/bin/journalctl -f -o json" @@ -98,7 +98,7 @@ in type = types.lines; default = ''noop {}''; description = "logstash filter configuration."; - example = literalExample '' + example = '' if [type] == "syslog" { # Keep only relevant systemd fields # http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html @@ -114,7 +114,7 @@ in outputConfig = mkOption { type = types.lines; - default = literalExample ''stdout { debug => true debug_format => "json"}''; + default = ''stdout { debug => true debug_format => "json"}''; description = "Logstash output configuration."; example = '' redis { host => "localhost" data_type => "list" key => "logstash" codec => json } diff --git a/nixos/modules/services/misc/octoprint.nix b/nixos/modules/services/misc/octoprint.nix index bb9dc5da2eb..150056b8ab0 100644 --- a/nixos/modules/services/misc/octoprint.nix +++ b/nixos/modules/services/misc/octoprint.nix @@ -62,7 +62,9 @@ in }; plugins = mkOption { + type = types.functionTo (types.listOf types.package); default = plugins: []; + defaultText = "plugins: []"; example = literalExample "plugins: [ m3d-fio ]"; description = "Additional plugins."; }; diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix index b3f2730e672..ca08bb57895 100644 --- a/nixos/modules/services/networking/nsd.nix +++ b/nixos/modules/services/networking/nsd.nix @@ -559,7 +559,7 @@ in algorithm = "hmac-md5"; keyFile = "/path/to/my/key"; }; - }; + } ''; description = '' Define your TSIG keys here. @@ -719,7 +719,7 @@ in ... '''; }; - }; + } ''; description = '' Define your zones here. Zones can cascade other zones and therefore diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix index 88345fdc11e..a8f445a2c73 100644 --- a/nixos/modules/services/networking/wpa_supplicant.nix +++ b/nixos/modules/services/networking/wpa_supplicant.nix @@ -78,10 +78,11 @@ in { ''; default = {}; example = literalExample '' - echelon = { - psk = "abcdefgh"; - }; - "free.wifi" = {}; + { echelon = { + psk = "abcdefgh"; + }; + "free.wifi" = {}; + } ''; }; From bc52fa05080b40a2b60fd1a7ab20d4ea510a3807 Mon Sep 17 00:00:00 2001 From: Thomas Strobel Date: Mon, 29 Feb 2016 01:51:41 +0100 Subject: [PATCH 24/70] update maintainer's email address --- lib/maintainers.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maintainers.nix b/lib/maintainers.nix index df5dfced4b4..3bbb30ba3ce 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -330,7 +330,7 @@ tomberek = "Thomas Bereknyei "; travisbhartwell = "Travis B. Hartwell "; trino = "Hubert Mühlhans "; - tstrobel = "Thomas Strobel "; + tstrobel = "Thomas Strobel <4ZKTUB6TEP74PYJOPWIR013S2AV29YUBW5F9ZH2F4D5UMJUJ6S@hash.domains>"; ttuegel = "Thomas Tuegel "; tv = "Tomislav Viljetić "; tvestelind = "Tomas Vestelind "; From 818f2cd19fcb0d450e2b0847b3dd3598007ba38a Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sun, 28 Feb 2016 21:04:23 -0600 Subject: [PATCH 25/70] nethack: fix darwin support --- pkgs/games/nethack/default.nix | 40 +++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix index 05c39fb2f2b..ce12196d3c3 100644 --- a/pkgs/games/nethack/default.nix +++ b/pkgs/games/nethack/default.nix @@ -6,6 +6,7 @@ let else abort "Unknown platform for NetHack"; unixHint = if stdenv.isLinux then "linux" + else if stdenv.isDarwin then "macosx10.10" # We probably want something different for Darwin else "unix"; userDir = "~/.config/nethack"; @@ -24,25 +25,30 @@ in stdenv.mkDerivation { makeFlags = [ "PREFIX=$(out)" ]; - configurePhase = '' - cd sys/${platform} - ${lib.optionalString (platform == "unix") '' - sed -e '/^ *cd /d' -i nethack.sh - ${lib.optionalString (unixHint == "linux") '' - sed \ - -e 's,/bin/gzip,${gzip}/bin/gzip,g' \ - -e 's,^WINTTYLIB=.*,WINTTYLIB=-lncurses,' \ - -i hints/linux - ''} - sh setup.sh hints/${unixHint} - ''} - cd ../.. - - sed -e '/define CHDIR/d' -i include/config.h + patchPhase = '' + sed -e '/^ *cd /d' -i sys/unix/nethack.sh sed \ -e 's/^YACC *=.*/YACC = bison -y/' \ -e 's/^LEX *=.*/LEX = flex/' \ - -i util/Makefile + -i sys/unix/Makefile.utl + sed \ + -e 's,/bin/gzip,${gzip}/bin/gzip,g' \ + -e 's,^WINTTYLIB=.*,WINTTYLIB=-lncurses,' \ + -i sys/unix/hints/linux + sed \ + -e 's,^CC=.*$,CC=cc,' \ + -e 's,^HACKDIR=.*$,HACKDIR=\$(PREFIX)/games/lib/\$(GAME)dir,' \ + -e 's,^SHELLDIR=.*$,SHELLDIR=\$(PREFIX)/games,' \ + -i sys/unix/hints/macosx10.10 + sed -e '/define CHDIR/d' -i include/config.h + ''; + + configurePhase = '' + cd sys/${platform} + ${lib.optionalString (platform == "unix") '' + sh setup.sh hints/${unixHint} + ''} + cd ../.. ''; postInstall = '' @@ -61,7 +67,7 @@ in stdenv.mkDerivation { chmod -R +w ${userDir} fi - RUNDIR=\$(mktemp -td nethack.\$USER.XXXXX) + RUNDIR=\$(mktemp -d) cleanup() { rm -rf \$RUNDIR From 70df5bf9ea1d56dbe7dfe0bd83ed5478882fda8f Mon Sep 17 00:00:00 2001 From: Tim Cuthbertson Date: Mon, 29 Feb 2016 20:15:19 +1100 Subject: [PATCH 26/70] gup: 0.5.3 -> 0.5.4 --- pkgs/development/tools/build-managers/gup/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/build-managers/gup/default.nix b/pkgs/development/tools/build-managers/gup/default.nix index 0f1ecdcaa54..a907e6ace9e 100644 --- a/pkgs/development/tools/build-managers/gup/default.nix +++ b/pkgs/development/tools/build-managers/gup/default.nix @@ -1,10 +1,10 @@ { stdenv, fetchgit, lib, python, which }: let - version = "0.5.3"; + version = "0.5.4"; src = fetchgit { url = "https://github.com/gfxmonk/gup.git"; - rev = "55ffd8828ddc28a2a786b75422d672d6569f961f"; - sha256 = "7c2abbf5d3814c6b84da0de1c91f9f7d299c2362cf091da96f6a68d8fffcb5ce"; + rev = "b3980e529c860167b48e31634d2b479fc4d10274"; + sha256 = "bb02ba0a7f1680ed5b9a8e8c9cc42aa07016329840f397d914b94744f9ed7c85"; }; in import ./build.nix From 0294fc5bbda95f80d39a6242388787d6d3576701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 29 Feb 2016 10:53:35 +0100 Subject: [PATCH 27/70] haskellPackages: fix evaluation It seems `self` was wanted instead of `pkgs` by the author of 3844206. --- pkgs/development/haskell-modules/configuration-common.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 1b2a82f3dcb..4fa6d2f78bb 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -323,7 +323,7 @@ self: super: { github-types = dontCheck super.github-types; # http://hydra.cryp.to/build/1114046/nixlog/1/raw hadoop-rpc = dontCheck super.hadoop-rpc; # http://hydra.cryp.to/build/527461/nixlog/2/raw hasql = dontCheck super.hasql; # http://hydra.cryp.to/build/502489/nixlog/4/raw - hjsonschema = overrideCabal (super.hjsonschema.override { hjsonpointer = pkgs.hjsonpointer_0_2_0_4; }) (drv: { testTarget = "local"; }); + hjsonschema = overrideCabal (super.hjsonschema.override { hjsonpointer = self.hjsonpointer_0_2_0_4; }) (drv: { testTarget = "local"; }); hoogle = overrideCabal super.hoogle (drv: { testTarget = "--test-option=--no-net"; }); marmalade-upload = dontCheck super.marmalade-upload; # http://hydra.cryp.to/build/501904/nixlog/1/raw network-transport-tcp = dontCheck super.network-transport-tcp; From de8c119a4b1e4cac525c36613c8fdba54bb0af5d Mon Sep 17 00:00:00 2001 From: zimbatm Date: Mon, 29 Feb 2016 10:02:59 +0000 Subject: [PATCH 28/70] redmine: fix compilation with ruby 2.3 Just bumped the JSON dependency manually to the one bundled with ruby 2.3 --- pkgs/applications/version-management/redmine/Gemfile.lock | 2 +- pkgs/applications/version-management/redmine/Gemfile.nix | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/version-management/redmine/Gemfile.lock b/pkgs/applications/version-management/redmine/Gemfile.lock index 7d83583c019..c660e73f4a0 100644 --- a/pkgs/applications/version-management/redmine/Gemfile.lock +++ b/pkgs/applications/version-management/redmine/Gemfile.lock @@ -50,7 +50,7 @@ GEM jquery-rails (2.0.3) railties (>= 3.1.0, < 5.0) thor (~> 0.14) - json (1.8.1) + json (1.8.3) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) diff --git a/pkgs/applications/version-management/redmine/Gemfile.nix b/pkgs/applications/version-management/redmine/Gemfile.nix index a7339097b14..77adfba334e 100644 --- a/pkgs/applications/version-management/redmine/Gemfile.nix +++ b/pkgs/applications/version-management/redmine/Gemfile.nix @@ -115,9 +115,9 @@ version = "2.0.3"; } { name = "json"; -hash = "961bfbbfa9fda1e857e9c791e964e6664e0d43bf687b19669dfbc7cdbc5e0200"; -url = "http://rubygems.org/downloads/json-1.8.1.gem"; -version = "1.8.1"; +hash = "1nsby6ry8l9xg3yw4adlhk2pnc7i0h0rznvcss4vk3v74qg0k8lc"; +url = "http://rubygems.org/downloads/json-1.8.3.gem"; +version = "1.8.3"; } { name = "mail"; From 8625d2f8aa645971a19324b0d78770680ee0f845 Mon Sep 17 00:00:00 2001 From: Tobias Pflug Date: Sun, 28 Feb 2016 16:32:56 +0100 Subject: [PATCH 29/70] nodejs-5_x: 5.6.0 -> 5.7.0 --- pkgs/development/web/nodejs/v5.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/web/nodejs/v5.nix b/pkgs/development/web/nodejs/v5.nix index 948c4d10b30..c5bc3311503 100644 --- a/pkgs/development/web/nodejs/v5.nix +++ b/pkgs/development/web/nodejs/v5.nix @@ -7,7 +7,7 @@ assert stdenv.system != "armv5tel-linux"; let - version = "5.6.0"; + version = "5.7.0"; deps = { inherit openssl zlib libuv; @@ -31,7 +31,7 @@ in stdenv.mkDerivation { src = fetchurl { url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz"; - sha256 = "0zy2pq2xpw170lycs0518jjldy1d5vm5y1pjb4zcibvhb5gcrwis"; + sha256 = "1n6jvvf3jfmv7fjd64c5jajjapsmc8gr6rlw113vgys55xmb8f13"; }; configureFlags = concatMap sharedConfigureFlags (builtins.attrNames deps) ++ [ "--without-dtrace" ]; From 56e68d4d5f7db95370aa0be76dc8b107fb169904 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 29 Feb 2016 11:39:11 +0100 Subject: [PATCH 30/70] Manual: rl-unstable.xml -> rl-1603.xml --- nixos/doc/manual/release-notes/release-notes.xml | 2 +- .../doc/manual/release-notes/{rl-unstable.xml => rl-1603.xml} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename nixos/doc/manual/release-notes/{rl-unstable.xml => rl-1603.xml} (99%) diff --git a/nixos/doc/manual/release-notes/release-notes.xml b/nixos/doc/manual/release-notes/release-notes.xml index 6ed99315a7a..2beaab00800 100644 --- a/nixos/doc/manual/release-notes/release-notes.xml +++ b/nixos/doc/manual/release-notes/release-notes.xml @@ -9,7 +9,7 @@ This section lists the release notes for each stable version of NixOS and current unstable revision. - + diff --git a/nixos/doc/manual/release-notes/rl-unstable.xml b/nixos/doc/manual/release-notes/rl-1603.xml similarity index 99% rename from nixos/doc/manual/release-notes/rl-unstable.xml rename to nixos/doc/manual/release-notes/rl-1603.xml index 5c2938794b9..0ede1a9ce8e 100644 --- a/nixos/doc/manual/release-notes/rl-unstable.xml +++ b/nixos/doc/manual/release-notes/rl-1603.xml @@ -2,9 +2,9 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" - xml:id="sec-release-unstable"> + xml:id="sec-release-16.03"> -Unstable +Release 16.03 (“Emu”, 2016/03/??) In addition to numerous new and upgraded packages, this release has the following highlights: From fa4499cc8c8a4d31cf8acff941f3c752fc993bee Mon Sep 17 00:00:00 2001 From: zimbatm Date: Mon, 29 Feb 2016 11:06:02 +0000 Subject: [PATCH 31/70] pythonPackages.acme-tiny: fixup duplicate declaration --- pkgs/top-level/python-packages.nix | 37 ------------------------------ 1 file changed, 37 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 29ed4c07beb..ff2fe1e840a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -300,43 +300,6 @@ in modules // { }; }; - acme-tiny = buildPythonPackage rec { - name = "acme-tiny-${version}"; - version = "20151229"; - rev = "f61f72c212cea27f388eb4a26ede0d65035bdb53"; - - src = pkgs.fetchgit { - inherit rev; - url = "https://github.com/diafygi/acme-tiny.git"; - sha256 = "dde59354e483bdff3dfd06717c094889ae673efb568e40b150b4695b0c539649"; - }; - - # source doesn't have any python "packaging" as such - configurePhase = " "; - buildPhase = " "; - # the tests are... complex - doCheck = false; - - patchPhase = '' - substituteInPlace acme_tiny.py --replace "openssl" "${pkgs.openssl}/bin/openssl" - ''; - - installPhase = '' - mkdir -p $out/${python.sitePackages}/ - cp acme_tiny.py $out/${python.sitePackages}/ - mkdir -p $out/bin - ln -s $out/${python.sitePackages}/acme_tiny.py $out/bin/acme_tiny - chmod +x $out/bin/acme_tiny - ''; - - meta = { - description = "A tiny script to issue and renew TLS certs from Let's Encrypt"; - homepage = https://github.com/diafygi/acme-tiny; - license = licenses.mit; - }; - }; - - actdiag = buildPythonPackage rec { name = "actdiag-0.5.3"; From 22d7c08dc506f74803b7c61c6cbf156dfe844f02 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Sun, 28 Feb 2016 16:35:27 +0000 Subject: [PATCH 32/70] lib.trivial: add a new importJSON function This is meant to be used by packages who often re-generate their inputs. Producing valid JSON is easier than nix, and also garantees it's purity. --- lib/trivial.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/trivial.nix b/lib/trivial.nix index cda8aa08a20..9821e3c138d 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -75,4 +75,25 @@ rec { min = x: y: if x < y then x else y; max = x: y: if x > y then x else y; + /* Reads a JSON file. It is useful to import pure data into other nix + expressions. + + Example: + + mkDerivation { + src = fetchgit (importJSON ./repo.json) + #... + } + + where repo.json contains: + + { + "url": "git://some-domain/some/repo", + "rev": "265de7283488964f44f0257a8b4a055ad8af984d", + "sha256": "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h" + } + + */ + importJSON = path: + builtins.fromJSON (builtins.readFile path); } From ce549c85c8e67892fa23365d70e123e60a94d95b Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Mon, 29 Feb 2016 13:08:12 +0100 Subject: [PATCH 33/70] pharo-vm: stop trying to build on darwin Building these pharo-vm sources on darwin may be possible but doesn't make much sense because native darwin sources exist. --- pkgs/development/pharo/vm/build-vm.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/pharo/vm/build-vm.nix b/pkgs/development/pharo/vm/build-vm.nix index d18f64c9aba..3dfe913145c 100644 --- a/pkgs/development/pharo/vm/build-vm.nix +++ b/pkgs/development/pharo/vm/build-vm.nix @@ -88,6 +88,10 @@ stdenv.mkDerivation rec { homepage = http://pharo.org; license = stdenv.lib.licenses.mit; maintainers = [ stdenv.lib.maintainers.DamienCassou ]; - platforms = stdenv.lib.platforms.mesaPlatforms; + # Pharo VM sources are packaged separately for darwin (OS X) + platforms = with stdenv.lib; + intersectLists + platforms.mesaPlatforms + (subtractLists platforms.darwin platforms.unix); }; } From 756604cc08d801b8648c5d86a0c34f45f15e2f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 29 Feb 2016 13:08:33 +0000 Subject: [PATCH 34/70] transmission: 2.84 -> 2.90 --- pkgs/applications/networking/p2p/transmission/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/p2p/transmission/default.nix b/pkgs/applications/networking/p2p/transmission/default.nix index e81ef7a4f9f..dbd23195a1c 100644 --- a/pkgs/applications/networking/p2p/transmission/default.nix +++ b/pkgs/applications/networking/p2p/transmission/default.nix @@ -4,7 +4,7 @@ }: let - version = "2.84"; + version = "2.90"; in with { inherit (stdenv.lib) optional optionals optionalString; }; @@ -14,7 +14,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "https://transmission.cachefly.net/transmission-${version}.tar.xz"; - sha256 = "1sxr1magqb5s26yvr5yhs1f7bmir8gl09niafg64lhgfnhv1kz59"; + sha256 = "1lig7y9fhmv2ajgq1isj9wqgpcgignzlczs3dy95ahb8h6pqrzv9"; }; buildInputs = [ pkgconfig intltool file openssl curl libevent inotify-tools zlib ] From b5ee64410d00e2cb43edcb1ad269b05c3e33e5ad Mon Sep 17 00:00:00 2001 From: Mitchell Pleune Date: Sat, 27 Feb 2016 16:36:13 -0500 Subject: [PATCH 35/70] x11 service: bspwm limit sxhkd freqency add '-f 100' as an argument to sxhkd to keep it from flooding bspwm add SXHKD_SHELL=/bin/sh to help default to a faster shell than what may be set in $SHELL (example: with zsh) --- nixos/modules/services/x11/window-managers/bspwm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/x11/window-managers/bspwm.nix b/nixos/modules/services/x11/window-managers/bspwm.nix index 8b4e91d25aa..1edf6ba4deb 100644 --- a/nixos/modules/services/x11/window-managers/bspwm.nix +++ b/nixos/modules/services/x11/window-managers/bspwm.nix @@ -15,7 +15,7 @@ in services.xserver.windowManager.session = singleton { name = "bspwm"; start = " - ${pkgs.sxhkd}/bin/sxhkd & + SXHKD_SHELL=/bin/sh ${pkgs.sxhkd}/bin/sxhkd -f 100 & ${pkgs.bspwm}/bin/bspwm "; }; From 6d9cc5408909aa304cd8af25059b129c1652c26e Mon Sep 17 00:00:00 2001 From: zimbatm Date: Mon, 29 Feb 2016 13:49:29 +0000 Subject: [PATCH 36/70] build-maven: use lib.importJSON --- pkgs/build-support/build-maven.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/build-maven.nix b/pkgs/build-support/build-maven.nix index ff91828eeca..ba85428ba8c 100644 --- a/pkgs/build-support/build-maven.nix +++ b/pkgs/build-support/build-maven.nix @@ -11,7 +11,7 @@ * the project. */ infoFile: let - info = builtins.fromJSON (builtins.readFile infoFile); + info = lib.importJSON infoFile; script = writeText "build-maven-repository.sh" '' ${lib.concatStrings (map (dep: let From 694a5ba291c37a324cc8076e456e2e9c85077029 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Mon, 29 Feb 2016 15:35:21 +0100 Subject: [PATCH 37/70] eprover: fix build on Darwin --- pkgs/applications/science/logic/eprover/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/science/logic/eprover/default.nix b/pkgs/applications/science/logic/eprover/default.nix index 97fe7065b85..1f36858ae32 100644 --- a/pkgs/applications/science/logic/eprover/default.nix +++ b/pkgs/applications/science/logic/eprover/default.nix @@ -20,7 +20,11 @@ stdenv.mkDerivation { buildInputs = [ which ]; - preConfigure = "sed -e 's@^EXECPATH\\s.*@EXECPATH = '\$out'/bin@' -i Makefile.vars"; + preConfigure = '' + sed -e 's@^EXECPATH\\s.*@EXECPATH = '\$out'/bin@' \ + -e 's/^CC *= gcc$//' \ + -i Makefile.vars + ''; buildPhase = "make install"; @@ -34,6 +38,8 @@ stdenv.mkDerivation { meta = { inherit (s) version; description = "Automated theorem prover for full first-order logic with equality"; + homepage = http://www.eprover.org/; + license = stdenv.lib.licenses.gpl2; maintainers = [stdenv.lib.maintainers.raskin]; platforms = stdenv.lib.platforms.all; }; From aa9576bceb56d4fe2fb24e6fb47001817baeab34 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Thu, 8 Oct 2015 14:53:37 +0200 Subject: [PATCH 38/70] installer: add graphical GNOME iso --- .../installation-cd-graphical-gnome.nix | 78 +++++++++++++++++++ ...tallation-cd-graphical-kde-new-kernel.nix} | 2 +- ....nix => installation-cd-graphical-kde.nix} | 0 .../services/x11/desktop-managers/gnome3.nix | 57 +++++++++----- nixos/release.nix | 2 +- .../gnome-3/3.18/core/gnome-shell/default.nix | 3 +- .../gnome-3/3.18/core/nautilus/default.nix | 3 +- pkgs/desktops/gnome-3/3.18/default.nix | 3 + pkgs/desktops/gnome-3/3.18/installer.nix | 15 ++++ 9 files changed, 140 insertions(+), 23 deletions(-) create mode 100644 nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix rename nixos/modules/installer/cd-dvd/{installation-cd-graphical-new-kernel.nix => installation-cd-graphical-kde-new-kernel.nix} (60%) rename nixos/modules/installer/cd-dvd/{installation-cd-graphical.nix => installation-cd-graphical-kde.nix} (100%) create mode 100644 pkgs/desktops/gnome-3/3.18/installer.nix diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix new file mode 100644 index 00000000000..5725938465f --- /dev/null +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix @@ -0,0 +1,78 @@ +# This module defines a NixOS installation CD that contains X11 and +# GNOME 3. + +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ./installation-cd-base.nix ]; + + services.xserver = { + enable = true; + # GDM doesn't start in virtual machines with ISO + displayManager.slim = { + enable = true; + defaultUser = "root"; + autoLogin = true; + }; + desktopManager.gnome3 = { + enable = true; + extraGSettingsOverrides = '' + [org.gnome.desktop.background] + show-desktop-icons=true + + [org.gnome.nautilus.desktop] + trash-icon-visible=false + volumes-visible=false + home-icon-visible=false + network-icon-visible=false + ''; + + extraGSettingsOverridePackages = [ pkgs.gnome3.nautilus ]; + }; + }; + + environment.systemPackages = + [ # Include gparted for partitioning disks. + pkgs.gparted + + # Include some editors. + pkgs.vim + pkgs.bvi # binary editor + pkgs.joe + + pkgs.glxinfo + ]; + + # Don't start the X server by default. + services.xserver.autorun = mkForce false; + + # Auto-login as root. + services.xserver.displayManager.gdm.autoLogin = { + enable = true; + user = "root"; + }; + + system.activationScripts.installerDesktop = let + # Must be executable + desktopFile = pkgs.writeScript "nixos-manual.desktop" '' + [Desktop Entry] + Version=1.0 + Type=Link + Name=NixOS Manual + URL=${config.system.build.manual.manual}/share/doc/nixos/index.html + Icon=system-help + ''; + + # use cp and chmod +x, we must be sure the apps are in the nix store though + in '' + mkdir -p /root/Desktop + ln -sfT ${desktopFile} /root/Desktop/nixos-manual.desktop + cp ${pkgs.gnome3.gnome_terminal}/share/applications/gnome-terminal.desktop /root/Desktop/gnome-terminal.desktop + chmod a+rx /root/Desktop/gnome-terminal.desktop + cp ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop + chmod a+rx /root/Desktop/gparted.desktop + ''; + +} diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde-new-kernel.nix similarity index 60% rename from nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix rename to nixos/modules/installer/cd-dvd/installation-cd-graphical-kde-new-kernel.nix index 506b9292b01..a4bcd7079a4 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde-new-kernel.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: { - imports = [ ./installation-cd-graphical.nix ]; + imports = [ ./installation-cd-graphical-kde.nix ]; boot.kernelPackages = pkgs.linuxPackages_latest; } diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix similarity index 100% rename from nixos/modules/installer/cd-dvd/installation-cd-graphical.nix rename to nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 4dd631d8751..be7700424bc 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -27,19 +27,24 @@ let nixos-gsettings-desktop-schemas = pkgs.stdenv.mkDerivation { name = "nixos-gsettings-desktop-schemas"; - buildInputs = [ pkgs.nixos-artwork ]; buildCommand = '' - mkdir -p $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas - cp -rf ${gnome3.gsettings_desktop_schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0 $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/ - chmod -R a+w $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas - cat - > $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF + mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas + cp -rf ${gnome3.gsettings_desktop_schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas + + ${concatMapStrings (pkg: "cp -rf ${pkg}/share/gsettings-schemas/*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas\n") cfg.extraGSettingsOverridePackages} + + chmod -R a+w $out/share/gsettings-schemas/nixos-gsettings-overrides + cat - > $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF [org.gnome.desktop.background] picture-uri='${pkgs.nixos-artwork}/share/artwork/gnome/Gnome_Dark.png' [org.gnome.desktop.screensaver] picture-uri='${pkgs.nixos-artwork}/share/artwork/gnome/Gnome_Dark.png' + + ${cfg.extraGSettingsOverrides} EOF - ${pkgs.glib}/bin/glib-compile-schemas $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/glib-2.0/schemas/ + + ${pkgs.glib}/bin/glib-compile-schemas $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/ ''; }; @@ -47,19 +52,33 @@ in { options = { - services.xserver.desktopManager.gnome3.enable = mkOption { - default = false; - example = true; - description = "Enable Gnome 3 desktop manager."; - }; + services.xserver.desktopManager.gnome3 = { + enable = mkOption { + default = false; + example = true; + description = "Enable Gnome 3 desktop manager."; + }; - services.xserver.desktopManager.gnome3.sessionPath = mkOption { - default = []; - example = literalExample "[ pkgs.gnome3.gpaste ]"; - description = "Additional list of packages to be added to the session search path. - Useful for gnome shell extensions or gsettings-conditionated autostart."; - apply = list: list ++ [ gnome3.gnome_shell gnome3.gnome-shell-extensions ]; - }; + sessionPath = mkOption { + default = []; + example = literalExample "[ pkgs.gnome3.gpaste ]"; + description = "Additional list of packages to be added to the session search path. + Useful for gnome shell extensions or gsettings-conditionated autostart."; + apply = list: list ++ [ gnome3.gnome_shell gnome3.gnome-shell-extensions ]; + }; + + extraGSettingsOverrides = mkOption { + default = ""; + type = types.lines; + description = "Additional gsettings overrides."; + }; + + extraGSettingsOverridePackages = mkOption { + default = []; + type = types.listOf types.path; + description = "List of packages for which gsettings are overridden."; + }; + }; environment.gnome3.packageSet = mkOption { type = types.nullOr types.package; @@ -130,7 +149,7 @@ in { export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${mimeAppsList}/share # Override gsettings-desktop-schema - export XDG_DATA_DIRS=${nixos-gsettings-desktop-schemas}/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS + export XDG_DATA_DIRS=${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS # Let nautilus find extensions export NAUTILUS_EXTENSION_DIR=${config.system.path}/lib/nautilus/extensions-3.0/ diff --git a/nixos/release.nix b/nixos/release.nix index d9f3e46b27c..76ca15ef97f 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -113,7 +113,7 @@ in rec { }); iso_graphical = forAllSystems (system: makeIso { - module = ./modules/installer/cd-dvd/installation-cd-graphical.nix; + module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix; type = "graphical"; inherit system; }); diff --git a/pkgs/desktops/gnome-3/3.18/core/gnome-shell/default.nix b/pkgs/desktops/gnome-3/3.18/core/gnome-shell/default.nix index 899efc5443b..11d78cd6132 100644 --- a/pkgs/desktops/gnome-3/3.18/core/gnome-shell/default.nix +++ b/pkgs/desktops/gnome-3/3.18/core/gnome-shell/default.nix @@ -37,7 +37,8 @@ stdenv.mkDerivation rec { --prefix PATH : "${unzip}/bin" \ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ - --suffix XDG_DATA_DIRS : "${gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" + --prefix XDG_DATA_DIRS : "${gnome_themes_standard}/share:$out/share:$XDG_ICON_DIRS" \ + --suffix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" wrapProgram "$out/libexec/gnome-shell-calendar-server" \ --prefix XDG_DATA_DIRS : "${evolution_data_server}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" diff --git a/pkgs/desktops/gnome-3/3.18/core/nautilus/default.nix b/pkgs/desktops/gnome-3/3.18/core/nautilus/default.nix index f28e86d7bad..ff9f847d3cd 100644 --- a/pkgs/desktops/gnome-3/3.18/core/nautilus/default.nix +++ b/pkgs/desktops/gnome-3/3.18/core/nautilus/default.nix @@ -13,7 +13,8 @@ stdenv.mkDerivation rec { wrapProgram "$out/bin/nautilus" \ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ - --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$out/share:$GSETTINGS_SCHEMAS_PATH" + --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$out/share" \ + --suffix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" ''; patches = [ ./extension_dir.patch ]; diff --git a/pkgs/desktops/gnome-3/3.18/default.nix b/pkgs/desktops/gnome-3/3.18/default.nix index f949eb1b208..8234d21f39e 100644 --- a/pkgs/desktops/gnome-3/3.18/default.nix +++ b/pkgs/desktops/gnome-3/3.18/default.nix @@ -65,6 +65,9 @@ let # Simplify the nixos module and gnome packages defaultIconTheme = adwaita-icon-theme; +# ISO installer + installerIso = callPackage ./installer.nix {}; + #### Core (http://ftp.acc.umu.se/pub/GNOME/core/) adwaita-icon-theme = callPackage ./core/adwaita-icon-theme { }; diff --git a/pkgs/desktops/gnome-3/3.18/installer.nix b/pkgs/desktops/gnome-3/3.18/installer.nix new file mode 100644 index 00000000000..e4d64ac9e88 --- /dev/null +++ b/pkgs/desktops/gnome-3/3.18/installer.nix @@ -0,0 +1,15 @@ +{ isoBaseName ? "nixos-graphical-gnome", system ? builtins.currentSystem +, extraModules ? [] }: + +let + + module = ../../../../nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix; + + config = (import ../../../../nixos/lib/eval-config.nix { + inherit system; + modules = [ module { isoImage.isoBaseName = isoBaseName; } ] ++ extraModules; + }).config; + +in + config.system.build.isoImage + From 1685ad23674823ccef5071053522d852822cb56f Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Mon, 29 Feb 2016 17:20:41 +0100 Subject: [PATCH 39/70] Update ECL --- pkgs/development/compilers/ecl/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/ecl/default.nix b/pkgs/development/compilers/ecl/default.nix index 172283b19de..a04ec454cae 100644 --- a/pkgs/development/compilers/ecl/default.nix +++ b/pkgs/development/compilers/ecl/default.nix @@ -7,11 +7,11 @@ let s = # Generated upstream information rec { baseName="ecl"; - version="16.0.0"; + version="16.1.2"; name="${baseName}-${version}"; - hash="0czh78z9i5b7jc241mq1h1gdscvdw5fbhfb0g9sn4rchwk1x8gil"; - url="https://common-lisp.net/project/ecl/files/release/16.0.0/ecl-16.0.0.tgz"; - sha256="0czh78z9i5b7jc241mq1h1gdscvdw5fbhfb0g9sn4rchwk1x8gil"; + hash="16ab8qs3awvdxy8xs8jy82v8r04x4wr70l9l2j45vgag18d2nj1d"; + url="https://common-lisp.net/project/ecl/files/release/16.1.2/ecl-16.1.2.tgz"; + sha256="16ab8qs3awvdxy8xs8jy82v8r04x4wr70l9l2j45vgag18d2nj1d"; }; buildInputs = [ libtool autoconf automake From cef37d8de1b4ad19ac8184f96b3b85a82be1b5e9 Mon Sep 17 00:00:00 2001 From: michael bishop Date: Mon, 29 Feb 2016 12:37:20 -0400 Subject: [PATCH 40/70] openiscsi: fix download url, add platforms --- pkgs/os-specific/linux/open-iscsi/default.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/os-specific/linux/open-iscsi/default.nix b/pkgs/os-specific/linux/open-iscsi/default.nix index e6682aec6c6..d004328a10b 100644 --- a/pkgs/os-specific/linux/open-iscsi/default.nix +++ b/pkgs/os-specific/linux/open-iscsi/default.nix @@ -2,13 +2,16 @@ let pname = "open-iscsi-2.0-873"; in stdenv.mkDerivation { - name = "${pname}"; + name = pname; outputs = [ "out" "iscsistart" ]; buildInputs = [ nukeReferences ]; src = fetchurl { - url = "http://www.open-iscsi.org/bits/${pname}.tar.gz"; + urls = [ + "http://www.open-iscsi.org/bits/${pname}.tar.gz" + "http://pkgs.fedoraproject.org/repo/pkgs/iscsi-initiator-utils/${pname}.tar.gz/8b8316d7c9469149a6cc6234478347f7/${pname}.tar.gz" + ]; sha256 = "1nbwmj48xzy45h52917jbvyqpsfg9zm49nm8941mc5x4gpwz5nbx"; }; @@ -24,9 +27,10 @@ in stdenv.mkDerivation { nuke-refs $iscsistart/bin/iscsistart ''; - meta = { + meta = with stdenv.lib; { description = "A high performance, transport independent, multi-platform implementation of RFC3720"; - license = stdenv.lib.licenses.gpl2Plus; + license = licenses.gpl2Plus; homepage = http://www.open-iscsi.org; + platforms = platforms.linux; }; } From 9af50a2e7d735b4a024cb91e2bf720341675031f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Mon, 29 Feb 2016 08:31:58 +0100 Subject: [PATCH 41/70] kodi: add optional joystick support --- pkgs/applications/video/kodi/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/default.nix index 5761a443df8..c2b3914f850 100644 --- a/pkgs/applications/video/kodi/default.nix +++ b/pkgs/applications/video/kodi/default.nix @@ -7,7 +7,7 @@ , libXt, libXmu, libXext, xextproto , libXinerama, libXrandr, randrproto , libXtst, libXfixes, fixesproto, systemd -, SDL, SDL_image, SDL_mixer, alsaLib +, SDL, SDL2, SDL_image, SDL_mixer, alsaLib , mesa, glew, fontconfig, freetype, ftgl , libjpeg, jasper, libpng, libtiff , libmpeg2, libsamplerate, libmad @@ -26,6 +26,7 @@ , rtmpdump ? null, rtmpSupport ? true , libvdpau ? null, vdpauSupport ? true , libpulseaudio ? null, pulseSupport ? true +, joystickSupport ? true }: assert dbusSupport -> dbus_libs != null; @@ -78,7 +79,9 @@ in stdenv.mkDerivation rec { ++ lib.optional sambaSupport samba ++ lib.optional vdpauSupport libvdpau ++ lib.optional pulseSupport libpulseaudio - ++ lib.optional rtmpSupport rtmpdump; + ++ lib.optional rtmpSupport rtmpdump + ++ lib.optional joystickSupport SDL2; + dontUseCmakeConfigure = true; @@ -98,7 +101,8 @@ in stdenv.mkDerivation rec { ++ lib.optional (!sambaSupport) "--disable-samba" ++ lib.optional vdpauSupport "--enable-vdpau" ++ lib.optional pulseSupport "--enable-pulse" - ++ lib.optional rtmpSupport "--enable-rtmp"; + ++ lib.optional rtmpSupport "--enable-rtmp" + ++ lib.optional joystickSupport "--enable-joystick"; postInstall = '' for p in $(ls $out/bin/) ; do @@ -113,7 +117,8 @@ in stdenv.mkDerivation rec { --prefix LD_LIBRARY_PATH ":" "${libcec}/lib" \ --prefix LD_LIBRARY_PATH ":" "${libcec_platform}/lib" \ --prefix LD_LIBRARY_PATH ":" "${libass}/lib" \ - --prefix LD_LIBRARY_PATH ":" "${rtmpdump}/lib" + --prefix LD_LIBRARY_PATH ":" "${rtmpdump}/lib" \ + --prefix LD_LIBRARY_PATH ":" "${SDL2}/lib" done ''; From a6d3b3f97ffe72f84be336aaee02b1be0a04c9dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Mon, 29 Feb 2016 19:11:38 +0100 Subject: [PATCH 42/70] zotero: patch firefox xpi loading --- pkgs/applications/office/zotero/default.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/office/zotero/default.nix b/pkgs/applications/office/zotero/default.nix index d74e1ac4b7c..5939478d695 100644 --- a/pkgs/applications/office/zotero/default.nix +++ b/pkgs/applications/office/zotero/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, bash, firefox, perl, unzipNLS, xorg }: +{ stdenv, fetchurl, fetchpatch, bash, firefox, perl, unzipNLS, xorg }: let @@ -7,6 +7,14 @@ let sha256 = "02h2ja08v8as4fawj683rh5rmxsjf5d0qmvqa77i176nm20y5s7s"; }; + firefox' = stdenv.lib.overrideDerivation (firefox) (attrs: { + patches = [ (fetchpatch { + url = "https://hg.mozilla.org/releases/mozilla-beta/raw-rev/0558da46f20c"; + sha256 = "08ibp7hny78x8ywfvrh56z90kf8fjpf04mibdlrwkw4f1vgm3fc3"; + name = "fix-external-xpi-loader"; + }) ]; + }); + version = "4.0.28"; in @@ -21,7 +29,9 @@ stdenv.mkDerivation { nativeBuildInputs = [ perl unzipNLS ]; - inherit bash firefox; + inherit bash; + + firefox = firefox'; phases = "unpackPhase installPhase fixupPhase"; From b1801168e3eb819d20b301409135e7e7f6a45b7e Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Mon, 29 Feb 2016 19:14:41 +0100 Subject: [PATCH 43/70] pixman: remove legacy patches --- pkgs/development/libraries/pixman/default.nix | 2 +- pkgs/development/libraries/pixman/fix-clang36.patch | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 pkgs/development/libraries/pixman/fix-clang36.patch diff --git a/pkgs/development/libraries/pixman/default.nix b/pkgs/development/libraries/pixman/default.nix index 681e54a781b..dc378711d36 100644 --- a/pkgs/development/libraries/pixman/default.nix +++ b/pkgs/development/libraries/pixman/default.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation rec { sha256 = "184lazwdpv67zrlxxswpxrdap85wminh1gmq1i5lcz6iycw39fir"; }; - patches = stdenv.lib.optional stdenv.isDarwin ./fix-clang36.patch; + patches = []; nativeBuildInputs = [ pkgconfig ]; buildInputs = stdenv.lib.optional doCheck libpng; diff --git a/pkgs/development/libraries/pixman/fix-clang36.patch b/pkgs/development/libraries/pixman/fix-clang36.patch deleted file mode 100644 index 7db3c7ecaba..00000000000 --- a/pkgs/development/libraries/pixman/fix-clang36.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pixman/pixman-mmx.c 2014-04-24 08:34:14.000000000 +0400 -+++ b/pixman/pixman-mmx.c 2015-01-30 20:19:28.000000000 +0300 -@@ -89,7 +89,7 @@ - return __A; - } - --# ifdef __OPTIMIZE__ -+# if defined(__OPTIMIZE__) && !(defined (__clang__) && defined(__clang_major__) && defined(__clang_minor__) && __clang_major__ == 3 && __clang_minor__ >= 6) - extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) - _mm_shuffle_pi16 (__m64 __A, int8_t const __N) - { From cd897f657c28fafe9b018feb25ef5f2dbf691e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Mon, 29 Feb 2016 19:36:51 +0100 Subject: [PATCH 44/70] cb2bib: init at 1.9.2 --- pkgs/applications/office/cb2bib/default.nix | 24 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/applications/office/cb2bib/default.nix diff --git a/pkgs/applications/office/cb2bib/default.nix b/pkgs/applications/office/cb2bib/default.nix new file mode 100644 index 00000000000..aa246d241ca --- /dev/null +++ b/pkgs/applications/office/cb2bib/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchurl, qt5Full, lzo, libX11 }: + +stdenv.mkDerivation rec { + name = pname + "-" + version; + pname = "cb2bib"; + version = "1.9.2"; + src = fetchurl { + url = "http://www.molspaces.com/dl/progs/${name}.tar.gz"; + sha256 = "0yz79v023w1229wzck3gij0iqah1xg8rg4a352q8idvg7bdmyfin"; + }; + buildInputs = [ qt5Full lzo libX11 ]; + QTDIR=qt5Full; + configurePhase ='' + ./configure --prefix $out + ''; + + meta = with stdenv.lib; { + description = "Rapidly extract unformatted, or unstandardized bibliographic references from email alerts, journal Web pages and PDF files"; + homepage = http://www.molspaces.com/d_cb2bib-overview.php; + maintainers = with maintainers; [ edwtjo ]; + license = licenses.gpl3; + }; + +} \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index caa5c0ca8ad..b0e9b022f46 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11549,6 +11549,10 @@ let cava = callPackage ../applications/audio/cava { }; + cb2bib = callPackage ../applications/office/cb2bib { + inherit (xorg) libX11; + }; + cbatticon = callPackage ../applications/misc/cbatticon { }; cbc = callPackage ../applications/science/math/cbc { }; From abfc9e2afa90f30011832e42f25feb9815990200 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Sat, 20 Feb 2016 15:38:30 +0100 Subject: [PATCH 45/70] ocamlPackages.result: init at 1.1 --- .../ocaml-modules/ocaml-result/default.nix | 30 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/development/ocaml-modules/ocaml-result/default.nix diff --git a/pkgs/development/ocaml-modules/ocaml-result/default.nix b/pkgs/development/ocaml-modules/ocaml-result/default.nix new file mode 100644 index 00000000000..8b6e0966f7e --- /dev/null +++ b/pkgs/development/ocaml-modules/ocaml-result/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchFromGitHub, ocaml, findlib }: + +let version = "1.1"; in + +stdenv.mkDerivation { + name = "ocaml-result-${version}"; + + src = fetchFromGitHub { + owner = "janestreet"; + repo = "result"; + rev = "${version}"; + sha256 = "05y07rxdbkaxsc8cy458y00gq05i8gp35hhwg1b757mam21ccxxz"; + }; + + buildInputs = [ ocaml findlib ]; + + createFindlibDestdir = true; + + meta = { + homepage = https://github.com/janestreet/result; + description = "Compatibility Result module"; + longDescription = '' + Projects that want to use the new result type defined in OCaml >= 4.03 + while staying compatible with older version of OCaml should use the + Result module defined in this library. + ''; + license = stdenv.lib.licenses.bsd3; + platforms = ocaml.meta.platforms; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b0e9b022f46..dc20729fc51 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4920,6 +4920,8 @@ let re2 = callPackage ../development/ocaml-modules/re2 { }; + result = callPackage ../development/ocaml-modules/ocaml-result { }; + sequence = callPackage ../development/ocaml-modules/sequence { }; tuntap = callPackage ../development/ocaml-modules/tuntap { }; From cac77dafc4809dbdab43b7a5d4dd0f046ffc8269 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Sat, 20 Feb 2016 15:39:08 +0100 Subject: [PATCH 46/70] ocamlPackages.tsdl: init at 0.9.0 --- .../ocaml-modules/tsdl/default.nix | 49 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 51 insertions(+) create mode 100644 pkgs/development/ocaml-modules/tsdl/default.nix diff --git a/pkgs/development/ocaml-modules/tsdl/default.nix b/pkgs/development/ocaml-modules/tsdl/default.nix new file mode 100644 index 00000000000..85ea80aeafe --- /dev/null +++ b/pkgs/development/ocaml-modules/tsdl/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchurl, ocaml, findlib, ctypes, result, SDL2, pkgconfig, opam }: + +let + inherit (stdenv.lib) getVersion; + + pname = "tsdl"; + version = "0.9.0"; + webpage = "http://erratique.ch/software/${pname}"; + +in + +stdenv.mkDerivation { + name = "ocaml-${pname}-${version}"; + + src = fetchurl { + url = "${webpage}/releases/${pname}-${version}.tbz"; + sha256 = "02x0wsy5nxagxrh07yb2h4yqqy1bxryp2gwrylds0j6ybqsv4shm"; + }; + + buildInputs = [ ocaml findlib result pkgconfig opam ]; + propagatedBuildInputs = [ SDL2 ctypes ]; + + createFindlibDestdir = true; + + unpackCmd = "tar xjf $src"; + + buildPhase = '' + # The following is done to avoid an additional dependency (ncurses) + # due to linking in the custom bytecode runtime. Instead, just + # compile directly into a native binary, even if it's just a + # temporary build product. + substituteInPlace myocamlbuild.ml \ + --replace ".byte" ".native" + + ocaml pkg/build.ml native=true native-dynlink=true + ''; + + installPhase = '' + opam-installer --script --prefix=$out ${pname}.install | sh + ln -s $out/lib/${pname} $out/lib/ocaml/${getVersion ocaml}/site-lib/${pname} + ''; + + meta = with stdenv.lib; { + homepage = "${webpage}"; + description = "Thin bindings to the cross-platform SDL library"; + license = licenses.bsd3; + platforms = ocaml.meta.platforms; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dc20729fc51..e75686e4eb7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5001,6 +5001,8 @@ let stringext = callPackage ../development/ocaml-modules/stringext { }; + tsdl = callPackage ../development/ocaml-modules/tsdl { }; + twt = callPackage ../development/ocaml-modules/twt { }; typerep = callPackage ../development/ocaml-modules/typerep { }; From 5f8311775c8832b1c5a88576cf58be05fd5c9070 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Mon, 29 Feb 2016 20:42:58 +0100 Subject: [PATCH 47/70] chromium: add StartupWMClass to desktop file. Fixes #12433 --- pkgs/applications/networking/browsers/chromium/default.nix | 3 +++ pkgs/build-support/make-desktopitem/default.nix | 2 ++ 2 files changed, 5 insertions(+) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index c0c5e485e59..f9ed1f31e54 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -57,6 +57,9 @@ let "x-scheme-handler/unknown" ]; categories = "Network;WebBrowser"; + extraEntries = '' + StartupWMClass=chromium-browser + ''; }; suffix = if channel != "stable" then "-" + channel else ""; diff --git a/pkgs/build-support/make-desktopitem/default.nix b/pkgs/build-support/make-desktopitem/default.nix index 2f6c827d875..f5b4e5af93a 100644 --- a/pkgs/build-support/make-desktopitem/default.nix +++ b/pkgs/build-support/make-desktopitem/default.nix @@ -10,6 +10,7 @@ , mimeType ? "" , categories ? "Application;Other;" , startupNotify ? null +, extraEntries ? "" }: stdenv.mkDerivation { @@ -27,6 +28,7 @@ stdenv.mkDerivation { GenericName=${genericName} MimeType=${mimeType} Categories=${categories} + ${extraEntries} ${if startupNotify == null then ''EOF'' else '' StartupNotify=${startupNotify} EOF''} From 765c6c5f2cab86a760095f61b78bcedfdc437826 Mon Sep 17 00:00:00 2001 From: Tomas Hlavaty Date: Mon, 29 Feb 2016 21:03:27 +0100 Subject: [PATCH 48/70] sbcl: 1.3.2 -> 1.3.3 --- pkgs/development/compilers/sbcl/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 3212601e789..82348f35e30 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { name = "sbcl-${version}"; - version = "1.3.2"; + version = "1.3.3"; src = fetchurl { url = "mirror://sourceforge/project/sbcl/sbcl/${version}/${name}-source.tar.bz2"; - sha256 = "18mgj1h9wqi0zq4k7y5r5fk10mlbpgh3796d3dac75bpxabg30nk"; + sha256 = "0kzvwzz196ws9z20l8fm15m5gckhmkkc6lxvdib12mfvy80gcf6v"; }; patchPhase = '' From b82c8e3cd44c5ad97624dd21f9e7d431e7d283ff Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Mon, 29 Feb 2016 21:15:25 +0100 Subject: [PATCH 49/70] geolite-legacy 2016-02-25 -> 2016-02-29 --- pkgs/data/misc/geolite-legacy/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/data/misc/geolite-legacy/default.nix b/pkgs/data/misc/geolite-legacy/default.nix index 59ae72d863c..c9b6eb8917f 100644 --- a/pkgs/data/misc/geolite-legacy/default.nix +++ b/pkgs/data/misc/geolite-legacy/default.nix @@ -8,7 +8,7 @@ let in stdenv.mkDerivation rec { name = "geolite-legacy-${version}"; - version = "2016-02-25"; + version = "2016-02-29"; srcGeoIP = fetchDB "GeoLiteCountry/GeoIP.dat.gz" "GeoIP.dat.gz" @@ -24,10 +24,10 @@ stdenv.mkDerivation rec { "0fnlznn04lpkkd7sy9r9kdl3fcp8ix7msdrncwgz26dh537ml32z"; srcGeoIPASNum = fetchDB "asnum/GeoIPASNum.dat.gz" "GeoIPASNum.dat.gz" - "0gli3glr2w58qw2b4lwlp8cqbpfy27c3ryih3qi2bbilqy0r3ibl"; + "10i4c8irvh9shbl3y0s0ffkm71vf3r290fvxjx20snqa558hkvib"; srcGeoIPASNumv6 = fetchDB "asnum/GeoIPASNumv6.dat.gz" "GeoIPASNumv6.dat.gz" - "1k7a9b8hsman64jjk6y3nkhms89gkq1vk26n2xklw710f15jzcsf"; + "1rvbjrj98pqj9w5ql5j49b3h40496g6aralpnz1gj21v6dfrd55n"; meta = with stdenv.lib; { description = "GeoLite Legacy IP geolocation databases"; From 06a50554ad576aed9e9202628bdc291acd86e58a Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Mon, 29 Feb 2016 22:51:30 +0100 Subject: [PATCH 50/70] simple-scan: 3.19.90 -> 3.19.91 --- pkgs/applications/graphics/simple-scan/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/graphics/simple-scan/default.nix b/pkgs/applications/graphics/simple-scan/default.nix index 658df21a654..7ee298f7281 100644 --- a/pkgs/applications/graphics/simple-scan/default.nix +++ b/pkgs/applications/graphics/simple-scan/default.nix @@ -3,10 +3,10 @@ stdenv.mkDerivation rec { name = "simple-scan-${version}"; - version = "3.19.90"; + version = "3.19.91"; src = fetchurl { - sha256 = "16s8855sqrn5iiirpqva0mys8abfpzk9xryrb6rpjbynvx2lanmd"; + sha256 = "1c5glf5vxgld41w4jxfqcv17q76qnh43fawpv33hncgh8d283xkf"; url = "https://launchpad.net/simple-scan/3.19/${version}/+download/${name}.tar.xz"; }; @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { configureFlags = [ "--disable-packagekit" ]; preBuild = '' - # Clean up stale generated .c files still referencing packagekit headers: + # Clean up stale .c files referencing packagekit headers as of 3.19.91: make clean ''; From 931fa7433d4ce63f205b13015912e26e06b94b9b Mon Sep 17 00:00:00 2001 From: Pascal Wittmann Date: Mon, 29 Feb 2016 22:05:57 +0100 Subject: [PATCH 51/70] checkstyle: 6.15 -> 6.16 --- pkgs/development/tools/analysis/checkstyle/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/analysis/checkstyle/default.nix b/pkgs/development/tools/analysis/checkstyle/default.nix index f9131cf2af2..168e9ce95be 100644 --- a/pkgs/development/tools/analysis/checkstyle/default.nix +++ b/pkgs/development/tools/analysis/checkstyle/default.nix @@ -1,12 +1,12 @@ { stdenv, fetchurl }: stdenv.mkDerivation rec { - version = "6.15"; + version = "6.16"; name = "checkstyle-${version}"; src = fetchurl { url = "mirror://sourceforge/checkstyle/${name}-bin.tar.gz"; - sha256 = "1bazjgfr1mq6qfg4nmack467zg7s4z8v7zfzw46d2dk04mv8y9b8"; + sha256 = "0kmddfzn7p6fads6crw4gnahvi36xwqyw35i7a2lplrdp8dn9xdd"; }; installPhase = '' From b56c1982bdb49381081ef004aa5ea83b2af63aed Mon Sep 17 00:00:00 2001 From: Pascal Wittmann Date: Mon, 29 Feb 2016 22:08:01 +0100 Subject: [PATCH 52/70] libfilezilla: 0.4.0 -> 0.4.0.1 --- pkgs/development/libraries/libfilezilla/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libfilezilla/default.nix b/pkgs/development/libraries/libfilezilla/default.nix index 120b707af1e..d8e1c29875c 100644 --- a/pkgs/development/libraries/libfilezilla/default.nix +++ b/pkgs/development/libraries/libfilezilla/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { name = "libfilezilla-${version}"; - version = "0.4.0"; + version = "0.4.0.1"; src = fetchurl { url = "mirror://sourceforge/project/filezilla/libfilezilla/${version}/${name}.tar.bz2"; - sha256 = "1l7rih17nzy75zf5h8mx5x38jbl9kxyxpr0ib6nn2615fw92xxgj"; + sha256 = "1ldiyhjv4jg2jyj3d56mlgyj9lx0qkf1857wvsy51lp9aj96h0v0"; }; meta = with stdenv.lib; { From 5ba31560d517a603c6f9b90539e809a7c9c21208 Mon Sep 17 00:00:00 2001 From: Pascal Wittmann Date: Mon, 29 Feb 2016 22:10:45 +0100 Subject: [PATCH 53/70] pdf2djvu: 0.9.3 -> 0.9.4 --- pkgs/tools/typesetting/pdf2djvu/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/typesetting/pdf2djvu/default.nix b/pkgs/tools/typesetting/pdf2djvu/default.nix index 96106d06ca5..5f344628e37 100644 --- a/pkgs/tools/typesetting/pdf2djvu/default.nix +++ b/pkgs/tools/typesetting/pdf2djvu/default.nix @@ -1,12 +1,12 @@ { stdenv, fetchurl, pkgconfig, djvulibre, poppler, fontconfig, libjpeg }: stdenv.mkDerivation rec { - version = "0.9.3"; + version = "0.9.4"; name = "pdf2djvu-${version}"; src = fetchurl { url = "https://bitbucket.org/jwilk/pdf2djvu/downloads/${name}.tar.xz"; - sha256 = "0xvh9kzfym5vsma9bhr1w1lla31qdqfaqc9q25vqpl921shvfpnh"; + sha256 = "1a1gwr6yzbiximbpgg4rc69dq8g3jmxwcbcwqk0fhfbgzj1j4w65"; }; buildInputs = [ pkgconfig djvulibre poppler fontconfig libjpeg ]; From 5a0dbaabad6c3e8f30e12d0528a0f6b2f4ce99cf Mon Sep 17 00:00:00 2001 From: Pascal Wittmann Date: Mon, 29 Feb 2016 22:21:55 +0100 Subject: [PATCH 54/70] parallel: 20160122 -> 20160222 --- pkgs/tools/misc/parallel/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/misc/parallel/default.nix b/pkgs/tools/misc/parallel/default.nix index c45c62cb3ad..d4c920f4acc 100644 --- a/pkgs/tools/misc/parallel/default.nix +++ b/pkgs/tools/misc/parallel/default.nix @@ -1,11 +1,11 @@ { fetchurl, stdenv, perl, makeWrapper, procps }: stdenv.mkDerivation rec { - name = "parallel-20160122"; + name = "parallel-20160222"; src = fetchurl { url = "mirror://gnu/parallel/${name}.tar.bz2"; - sha256 = "1xs8y8jh7wyjs27079xz0ja7xfi4dywz8d6hbkl44mafdnnfjfiy"; + sha256 = "1sjmvinwr9j2a0jdk9y9nf2x4hhzcbl529slkwpz0vva0cwybywd"; }; nativeBuildInputs = [ makeWrapper ]; From afd2d0588b500bd23caee3f3c99286832f1856ea Mon Sep 17 00:00:00 2001 From: Pascal Wittmann Date: Mon, 29 Feb 2016 22:40:08 +0100 Subject: [PATCH 55/70] calibre: 2.51.0 -> 2.52.0 --- 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 5e1bebf900c..5d936421d9e 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -5,12 +5,12 @@ }: stdenv.mkDerivation rec { - version = "2.51.0"; + version = "2.52.0"; name = "calibre-${version}"; src = fetchurl { url = "http://download.calibre-ebook.com/${version}/${name}.tar.xz"; - sha256 = "1rhpcxic4g2zyr5s3xn8dayyb45l9r8zyniaig8j7pl5kmsfjijn"; + sha256 = "1la114vhkm73iv0rrzwws28ydiszl58q5y9d6aafn5sh16ph2aws"; }; inherit python; From 90de261f3313fab8b82d33df149738be700f2426 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Mon, 29 Feb 2016 22:47:16 +0000 Subject: [PATCH 56/70] nix-prefetch-git: change the default output to JSON As discussed on the mailing list. The nix output was short-lived so it's probably okay to change it. --- pkgs/build-support/fetchgit/nix-prefetch-git | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index 22a241d5e0e..2c9d61504ed 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -325,9 +325,9 @@ print_results() { fi if test -n "$hash"; then echo "{" - echo " url = \"$url\";" - echo " rev = \"$fullRev\";" - echo " $hashType = \"$hash\";" + echo " \"url\": \"$url\"," + echo " \"rev\": \"$fullRev\"," + echo " \"$hashType\": \"$hash\"" echo "}" fi } From a3119bd35dbaad51b11abcae5cc4e83fb510ca69 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Tue, 1 Mar 2016 00:19:27 +0000 Subject: [PATCH 57/70] bats: fixes installation The build was failing with: /...-stdenv/setup: ./install.sh: /usr/bin/env: bad interpreter: No such file or directory See https://hydra.nixos.org/build/32353411/log --- pkgs/development/interpreters/bats/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/interpreters/bats/default.nix b/pkgs/development/interpreters/bats/default.nix index 4eb86460be9..bf262d4f050 100644 --- a/pkgs/development/interpreters/bats/default.nix +++ b/pkgs/development/interpreters/bats/default.nix @@ -9,6 +9,8 @@ stdenv.mkDerivation rec { sha256 = "05xpvfm0xky1532i3hd2l3wznxzh99bv2hxgykwdpxh18h6jr6jm"; }; + patchPhase = "patchShebangs ./install.sh"; + installPhase = "./install.sh $out"; meta = with stdenv.lib; { From 202ebf794cbd5ea293170f71999bc4e8f788779e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Tue, 1 Mar 2016 11:01:00 +0100 Subject: [PATCH 58/70] vm/rpm/rpm-closure.pl: make it deterministic Some recent perl version introduced "keys" to return the keys in random order. As some of the packages are solved by "provides" and based on the order, this randomness affects what packages get into the closure. This problem may be in other nix perl scripts. --- pkgs/build-support/vm/rpm/rpm-closure.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/vm/rpm/rpm-closure.pl b/pkgs/build-support/vm/rpm/rpm-closure.pl index 8f7669d6fef..6442cd91a95 100644 --- a/pkgs/build-support/vm/rpm/rpm-closure.pl +++ b/pkgs/build-support/vm/rpm/rpm-closure.pl @@ -90,7 +90,7 @@ for (my $i = 0; $i < scalar(@packagesFiles); $i++) { } my %provides; -PKG: foreach my $pkgName (keys %pkgs) { +PKG: foreach my $pkgName (sort(keys %pkgs)) { #print STDERR "looking at $pkgName\n"; my $pkg = $pkgs{$pkgName}; From a110c8d52b5156717010655dce344bd8b107eae7 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Tue, 1 Mar 2016 11:59:00 +0100 Subject: [PATCH 59/70] perl-MooseX-Role-WithOverloading: fix hash The version had been updated, but the hash hadn't. --- pkgs/top-level/perl-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 7cae676f829..41e46f32342 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -8147,7 +8147,7 @@ let self = _self // overrides; _self = with self; { name = "MooseX-Role-WithOverloading-0.17"; src = fetchurl { url = "mirror://cpan/authors/id/E/ET/ETHER/${name}.tar.gz"; - sha256 = "01mqpvbz7yw993918hgp72vl22i6mgicpq5b3zrrsp6vl8sqj2sw"; + sha256 = "0rb8k0dp1a55bm2pr6r0vsi5msvjl1dslfidxp1gj80j7zbrbc4j"; }; buildInputs = [ TestCheckDeps TestNoWarnings ModuleMetadata]; propagatedBuildInputs = [ aliased Moose namespaceautoclean namespaceclean ]; From b2889efff29ea316e66083e590ba22327b851e33 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Tue, 1 Mar 2016 12:50:23 +0100 Subject: [PATCH 60/70] devhelp: fix build with new webkitgtk --- pkgs/desktops/gnome-3/3.18/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/desktops/gnome-3/3.18/default.nix b/pkgs/desktops/gnome-3/3.18/default.nix index 8234d21f39e..11e2c7e9beb 100644 --- a/pkgs/desktops/gnome-3/3.18/default.nix +++ b/pkgs/desktops/gnome-3/3.18/default.nix @@ -312,9 +312,7 @@ let anjuta = callPackage ./devtools/anjuta { }; - devhelp = callPackage ./devtools/devhelp { - webkitgtk = webkitgtk24x; - }; + devhelp = callPackage ./devtools/devhelp { }; gdl = callPackage ./devtools/gdl { }; From c8e55671cd85a7468a726eb0bc2d127b61aaa4f4 Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Tue, 1 Mar 2016 12:29:31 +0000 Subject: [PATCH 61/70] nodejs-4_x: bump to version 4.3.1 --- pkgs/development/web/nodejs/v4.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/web/nodejs/v4.nix b/pkgs/development/web/nodejs/v4.nix index 04dbd1b1a27..629864b6e0b 100644 --- a/pkgs/development/web/nodejs/v4.nix +++ b/pkgs/development/web/nodejs/v4.nix @@ -7,7 +7,7 @@ assert stdenv.system != "armv5tel-linux"; let - version = "4.3.0"; + version = "4.3.1"; deps = { inherit openssl zlib libuv; @@ -31,7 +31,7 @@ in stdenv.mkDerivation { src = fetchurl { url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz"; - sha256 = "1f86jy71mi01g4xd411l5w8pi80nlk6sz7d2c0ghdk83v734ll0q"; + sha256 = "0wzf5sirbph5kaik3pm9i2dxbjwqh5qlnqn71azrsv0vhs7dbqk1"; }; configureFlags = concatMap sharedConfigureFlags (builtins.attrNames deps) ++ [ "--without-dtrace" ]; From 75f361f4c9af5a53d6591d2272c78318550ee3a9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 Mar 2016 13:50:31 +0100 Subject: [PATCH 62/70] Revert "all-packages: Rewrite packageOverrides to use fix'/extends" This reverts commit 9c0121be81fa8c5e6b5f7bd23326dd76d22e5d0b. I don't know what this change does and I don't have time to review it at the moment, sorry. --- pkgs/top-level/all-packages.nix | 96 ++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 42 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e75686e4eb7..804230e05b0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -64,7 +64,7 @@ let # { /* the config */ } and # { pkgs, ... } : { /* the config */ } if builtins.isFunction configExpr - then configExpr { pkgs = pkgsFinal; } + then configExpr { inherit pkgs; } else configExpr; # Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc) @@ -83,38 +83,51 @@ let platform = if platform_ != null then platform_ else config.platform or platformAuto; - # The complete set of packages, after applying the overrides - pkgsFinal = lib.fix' (lib.extends configOverrides (lib.extends stdenvOverrides pkgsFun)); + # Helper functions that are exported through `pkgs'. + helperFunctions = + stdenvAdapters // + (import ../build-support/trivial-builders.nix { inherit lib; inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; }); - stdenvOverrides = - # We don't want stdenv overrides in the case of cross-building, - # or otherwise the basic overrided packages will not be built - # with the crossStdenv adapter. - if crossSystem == null - then self: super: lib.optionalAttrs (super.stdenv ? overrides) (super.stdenv.overrides super) - else self: super: {}; + stdenvAdapters = + import ../stdenv/adapters.nix pkgs; - # Packages can be overriden globally via the `packageOverrides' + + # Allow packages to be overriden globally via the `packageOverrides' # configuration option, which must be a function that takes `pkgs' # as an argument and returns a set of new or overriden packages. - # The recommended usage follows this snippet: - # packageOverrides = super: let self = super.pkgs in ... - # `super' is the *original* (un-overriden) set of packages, - # while `self' refers to the final (overriden) set of packages. - configOverrides = - if config ? packageOverrides && bootStdenv == null # don't apply config overrides in stdenv boot - then self: config.packageOverrides - else self: super: {}; + # The `packageOverrides' function is called with the *original* + # (un-overriden) set of packages, allowing packageOverrides + # attributes to refer to the original attributes (e.g. "foo = + # ... pkgs.foo ..."). + pkgs = applyGlobalOverrides (config.packageOverrides or (pkgs: {})); + + mkOverrides = pkgsOrig: overrides: overrides // + (lib.optionalAttrs (pkgsOrig.stdenv ? overrides && crossSystem == null) (pkgsOrig.stdenv.overrides pkgsOrig)); + + # Return the complete set of packages, after applying the overrides + # returned by the `overrider' function (see above). Warning: this + # function is very expensive! + applyGlobalOverrides = overrider: + let + # Call the overrider function. We don't want stdenv overrides + # in the case of cross-building, or otherwise the basic + # overrided packages will not be built with the crossStdenv + # adapter. + overrides = mkOverrides pkgsOrig (overrider pkgsOrig); + + # The un-overriden packages, passed to `overrider'. + pkgsOrig = pkgsFun pkgs {}; + + # The overriden, final packages. + pkgs = pkgsFun pkgs overrides; + in pkgs; + # The package compositions. Yes, this isn't properly indented. - pkgsFun = pkgs: - let defaultScope = pkgs // pkgs.xorg; - helperFunctions = pkgs_.stdenvAdapters // pkgs_.trivial-builders; - pkgsRet = helperFunctions // pkgs_; - pkgs_ = with pkgs; { - # Helper functions that are exported through `pkgs'. - trivial-builders = import ../build-support/trivial-builders.nix { inherit lib; inherit stdenv; inherit (xorg) lndir; }; - stdenvAdapters = import ../stdenv/adapters.nix pkgs; + pkgsFun = pkgs: overrides: + with helperFunctions; + let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides; + self_ = with self; helperFunctions // { # Make some arguments passed to all-packages.nix available inherit system platform; @@ -144,7 +157,11 @@ let # # The result is `pkgs' where all the derivations depending on `foo' # will use the new version. - overridePackages = f: lib.fix' (lib.extends f pkgs.__unfix__); + overridePackages = f: + let + newpkgs = pkgsFun newpkgs overrides; + overrides = mkOverrides pkgs (f newpkgs pkgs); + in newpkgs; # Override system. This is useful to build i686 packages on x86_64-linux. forceSystem = system: kernel: (import ./all-packages.nix) { @@ -166,7 +183,7 @@ let ### Helper functions. - inherit lib config; + inherit lib config stdenvAdapters; inherit (lib) lowPrio hiPrio appendToName makeOverridable; inherit (misc) versionedDerivation; @@ -197,8 +214,7 @@ let allPackages = args: import ./all-packages.nix ({ inherit config system; } // args); }; - # We use pkgs_ because accessing pkgs would lead to an infinite recursion in stdenvOverrides - defaultStdenv = pkgs_.allStdenvs.stdenv // { inherit platform; }; + defaultStdenv = allStdenvs.stdenv // { inherit platform; }; stdenvCross = lowPrio (makeStdenvCross defaultStdenv crossSystem binutilsCross gccCrossStageFinal); @@ -218,7 +234,7 @@ let }; } else - pkgs_.defaultStdenv; + defaultStdenv; forceNativeDrv = drv : if crossSystem == null then drv else (drv // { crossDrv = drv.nativeDrv; }); @@ -5988,8 +6004,8 @@ let gotty = goPackages.gotty.bin // { outputs = [ "bin" ]; }; gradleGen = callPackage ../development/tools/build-managers/gradle { }; - gradle = gradleGen.gradleLatest; - gradle25 = gradleGen.gradle25; + gradle = self.gradleGen.gradleLatest; + gradle25 = self.gradleGen.gradle25; gperf = callPackage ../development/tools/misc/gperf { }; @@ -11824,7 +11840,7 @@ let AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit ImageCaptureCore GSS ImageIO; }); - emacs24Macport = emacs24Macport_24_5; + emacs24Macport = self.emacs24Macport_24_5; emacs25pre = lowPrio (callPackage ../applications/editors/emacs-25 { # use override to enable additional features @@ -16200,13 +16216,12 @@ let mg = callPackage ../applications/editors/mg { }; -}; -# end pkgs_ = +}; # self_ = ### Deprecated aliases - for backward compatibility -aliases = with pkgs; { +aliases = with self; rec { accounts-qt = qt5.accounts-qt; # added 2015-12-19 adobeReader = adobe-reader; aircrackng = aircrack-ng; # added 2016-01-14 @@ -16295,7 +16310,4 @@ tweakAlias = _n: alias: with lib; removeAttrs alias ["recurseForDerivations"] else alias; -in lib.mapAttrs tweakAlias aliases // pkgsRet; -# end pkgsFun - -in pkgsFinal +in lib.mapAttrs tweakAlias aliases // self; in pkgs From 7eb15265d3cfa493dd8e839d10c512d4b9d97b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20Pag=C3=A8s?= Date: Tue, 1 Mar 2016 13:52:30 +0100 Subject: [PATCH 63/70] kodiPlugins.pvr-hts: 2.1.18 -> 2.2.13 --- pkgs/applications/video/kodi/plugins.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/video/kodi/plugins.nix b/pkgs/applications/video/kodi/plugins.nix index 34b454ddcdd..96c47a15ef1 100644 --- a/pkgs/applications/video/kodi/plugins.nix +++ b/pkgs/applications/video/kodi/plugins.nix @@ -215,13 +215,13 @@ in pvr-hts = (mkKodiPlugin rec { plugin = "pvr-hts"; namespace = "pvr.hts"; - version = "2.1.18"; + version = "2.2.13"; src = fetchFromGitHub { owner = "kodi-pvr"; repo = "pvr.hts"; - rev = "016b0b3251d6d5bffaf68baf59010e4347759c4a"; - sha256 = "03lhxipz03r516pycabqc9b89kd7wih3c2dr4p602bk64bsmpi0j"; + rev = "3274354511e970e2101c2aa437001b2f245f80da"; + sha256 = "0i7cb61pjv6vbj3x96cm1n4w91mvc8z6lxa8ykjasrrbi95ph7ld"; }; meta = with stdenv.lib; { From e5069c1be590df367f9f2e3085bc238cf053d285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 1 Mar 2016 14:13:02 +0100 Subject: [PATCH 64/70] rethinkdb: patch for glibc 2.23 --- pkgs/servers/nosql/rethinkdb/default.nix | 2 + pkgs/servers/nosql/rethinkdb/glibc-2.23.patch | 111 ++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 pkgs/servers/nosql/rethinkdb/glibc-2.23.patch diff --git a/pkgs/servers/nosql/rethinkdb/default.nix b/pkgs/servers/nosql/rethinkdb/default.nix index 4566a670206..f1b57546c7d 100644 --- a/pkgs/servers/nosql/rethinkdb/default.nix +++ b/pkgs/servers/nosql/rethinkdb/default.nix @@ -11,6 +11,8 @@ stdenv.mkDerivation rec { sha256 = "0zs07g7arrrvm85mqbkffyzgd255qawn64r6iqdws25lj1kq2qim"; }; + patches = [ ./glibc-2.23.patch ]; + postPatch = stdenv.lib.optionalString stdenv.isDarwin '' sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' external/v8_3.30.33.16/build/gyp/pylib/gyp/xcode_emulation.py diff --git a/pkgs/servers/nosql/rethinkdb/glibc-2.23.patch b/pkgs/servers/nosql/rethinkdb/glibc-2.23.patch new file mode 100644 index 00000000000..818ea124564 --- /dev/null +++ b/pkgs/servers/nosql/rethinkdb/glibc-2.23.patch @@ -0,0 +1,111 @@ +From 84be09f314c4cbf88b4ac8fe9dbff1d36f0f5781 Mon Sep 17 00:00:00 2001 +From: Daniel Mewes +Date: Fri, 5 Feb 2016 18:45:28 -0800 +Subject: [PATCH] Alpinelinux compilation fixes + +by @clandmeter +--- + src/containers/buffer_group.hpp | 1 + + src/containers/printf_buffer.hpp | 1 + + src/errors.cc | 2 +- + src/rdb_protocol/geo/s2/util/math/exactfloat/exactfloat.cc | 4 ++-- + src/rdb_protocol/geo/s2/util/math/mathlimits.h | 12 ++++++------ + src/threading.hpp | 2 ++ + 6 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/src/containers/buffer_group.hpp b/src/containers/buffer_group.hpp +index 865c5cb..0403db6 100644 +--- a/src/containers/buffer_group.hpp ++++ b/src/containers/buffer_group.hpp +@@ -3,6 +3,7 @@ + #define CONTAINERS_BUFFER_GROUP_HPP_ + + #include ++#include + #include + #include + +diff --git a/src/containers/printf_buffer.hpp b/src/containers/printf_buffer.hpp +index b7a5154..76959f3 100644 +--- a/src/containers/printf_buffer.hpp ++++ b/src/containers/printf_buffer.hpp +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + + // Cannot include utils.hpp, we are included by utils.hpp. + #include "errors.hpp" +diff --git a/src/errors.cc b/src/errors.cc +index d40c04f..39efc9f 100644 +--- a/src/errors.cc ++++ b/src/errors.cc +@@ -89,7 +89,7 @@ void report_fatal_error(const char *file, int line, const char *msg, ...) { + } + + const char *errno_string_maybe_using_buffer(int errsv, char *buf, size_t buflen) { +-#ifdef _GNU_SOURCE ++#ifdef __GLIBC__ + return strerror_r(errsv, buf, buflen); + #elif defined(_WIN32) + UNUSED errno_t res = strerror_s(buf, buflen, errsv); +diff --git a/src/rdb_protocol/geo/s2/util/math/exactfloat/exactfloat.cc b/src/rdb_protocol/geo/s2/util/math/exactfloat/exactfloat.cc +index 3b07392..aa1a1d3 100644 +--- a/src/rdb_protocol/geo/s2/util/math/exactfloat/exactfloat.cc ++++ b/src/rdb_protocol/geo/s2/util/math/exactfloat/exactfloat.cc +@@ -110,9 +110,9 @@ static int BN_ext_count_low_zero_bits(const BIGNUM* bn) { + ExactFloat::ExactFloat(double v) { + BN_init(&bn_); + sign_ = signbit(v) ? -1 : 1; +- if (isnan(v)) { ++ if (std::isnan(v)) { + set_nan(); +- } else if (isinf(v)) { ++ } else if (std::isinf(v)) { + set_inf(sign_); + } else { + // The following code is much simpler than messing about with bit masks, +diff --git a/src/rdb_protocol/geo/s2/util/math/mathlimits.h b/src/rdb_protocol/geo/s2/util/math/mathlimits.h +index 5148422..86af72d 100644 +--- a/src/rdb_protocol/geo/s2/util/math/mathlimits.h ++++ b/src/rdb_protocol/geo/s2/util/math/mathlimits.h +@@ -14,7 +14,7 @@ + #define UTIL_MATH_MATHLIMITS_H__ + + #include +-#include ++#include + #include + + #include "rdb_protocol/geo/s2/base/basictypes.h" +@@ -195,11 +195,11 @@ DECL_UNSIGNED_INT_LIMITS(unsigned long long int) + static bool IsNegInf(const Type x) { return _fpclass(x) == _FPCLASS_NINF; } + #else + #define DECL_FP_LIMIT_FUNCS \ +- static bool IsFinite(const Type x) { return !isinf(x) && !isnan(x); } \ +- static bool IsNaN(const Type x) { return isnan(x); } \ +- static bool IsInf(const Type x) { return isinf(x); } \ +- static bool IsPosInf(const Type x) { return isinf(x) && x > 0; } \ +- static bool IsNegInf(const Type x) { return isinf(x) && x < 0; } ++ static bool IsFinite(const Type x) { return !std::isinf(x) && !std::isnan(x); } \ ++ static bool IsNaN(const Type x) { return std::isnan(x); } \ ++ static bool IsInf(const Type x) { return std::isinf(x); } \ ++ static bool IsPosInf(const Type x) { return std::isinf(x) && x > 0; } \ ++ static bool IsNegInf(const Type x) { return std::isinf(x) && x < 0; } + #endif + + // We can't put floating-point constant values in the header here because +diff --git a/src/threading.hpp b/src/threading.hpp +index 14fc6a8..9bf033f 100644 +--- a/src/threading.hpp ++++ b/src/threading.hpp +@@ -1,6 +1,8 @@ + #ifndef THREADING_HPP_ + #define THREADING_HPP_ + ++#include ++#include + #include + #include + From 976657a71f96d9b7cdd09e96c8d1e844a74ce4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 1 Mar 2016 14:31:33 +0100 Subject: [PATCH 65/70] openspades: fix build --- pkgs/games/openspades/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/games/openspades/default.nix b/pkgs/games/openspades/default.nix index df987b3f856..475a844c1ab 100644 --- a/pkgs/games/openspades/default.nix +++ b/pkgs/games/openspades/default.nix @@ -12,6 +12,13 @@ stdenv.mkDerivation rec { sha256 = "1aa848cck8qrp67ha9vrkzm3k24r2aiv1v4dxla6pi22rw98yxzm"; }; + # https://github.com/yvt/openspades/issues/354 + postPatch = '' + substituteInPlace Sources/Client/Client_Input.cpp --replace "isnan(" "std::isnan(" + substituteInPlace Sources/Client/Corpse.cpp --replace "isnan(" "std::isnan(" + substituteInPlace Sources/Draw/SWMapRenderer.cpp --replace "isnan(" "std::isnan(" --replace "isinf(" "std::isinf(" + ''; + nativeBuildInputs = with stdenv.lib; [ cmake curl glew makeWrapper mesa SDL2 SDL2_image unzip wget zlib ] From 82fa1a796b1e8be27e5c02bc00c6cdba06b26693 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Tue, 1 Mar 2016 15:26:01 +0100 Subject: [PATCH 66/70] lib/copyPathToStore: annotate docstring --- pkgs/build-support/trivial-builders.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 6cd82adf8e7..93b8b1cbc42 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -157,6 +157,9 @@ rec { ''; # Copy a path to the Nix store. + # Nix automatically copies files to the store before stringifying paths. + # If you need the store path of a file, ${copyPathToStore } can be + # shortened to ${}. copyPathToStore = builtins.filterSource (p: t: true); # Copy a list of paths to the Nix store. From ac687200e3945ca70bd9170d8ac8b46b8b9d1206 Mon Sep 17 00:00:00 2001 From: Allan Espinosa Date: Sat, 26 Sep 2015 13:00:22 +0900 Subject: [PATCH 67/70] nexus: init at 2.12.0-01 --- .../repository-managers/nexus/default.nix | 29 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 pkgs/development/tools/repository-managers/nexus/default.nix diff --git a/pkgs/development/tools/repository-managers/nexus/default.nix b/pkgs/development/tools/repository-managers/nexus/default.nix new file mode 100644 index 00000000000..1b2f48b696c --- /dev/null +++ b/pkgs/development/tools/repository-managers/nexus/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, makeWrapper, jre }: +stdenv.mkDerivation rec { + name = "nexus-${version}"; + version = "2.12.0-01"; + + src = fetchurl { + url = "https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-${version}-bundle.tar.gz"; + sha256 = "1k3z7kwcmr1pxaxfnak99fq5s8br9zbqbfpyw1afi86ykkph4g5z"; + }; + + sourceRoot = name; + + buildInputs = [ makeWrapper ]; + + installPhase = + '' + mkdir -p $out + cp -rfv * $out + rm -fv $out/bin/nexus.bat + ''; + + meta = with stdenv.lib; { + description = "Repository manager for binary software components"; + homepage = http://www.sonatype.org/nexus; + license = licenses.epl10; + platforms = platforms.all; + maintainers = [ maintainers.aespinosa ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 804230e05b0..931a7c413ca 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6112,6 +6112,8 @@ let pythonPackages = python3Packages; }; + nexus = callPackage ../development/tools/repository-managers/nexus { }; + node_webkit = node_webkit_0_9; nwjs_0_12 = callPackage ../development/tools/node-webkit/nw12.nix { From f3d94cfc23a2787772a369e2ca9e0cd94e72b8b3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 Mar 2016 20:47:08 +0100 Subject: [PATCH 68/70] Revert "Add the tool "nixos-typecheck" that can check an option declaration to:" This reverts commit cad8957eabcbf73062226d28366fd446c15c8737. It breaks NixOps, but more importantly, such major changes to the module system really need to be reviewed. --- lib/modules.nix | 99 ++------ lib/options.nix | 145 ++---------- lib/types.nix | 221 ++++-------------- nixos/default.nix | 2 - nixos/doc/manual/default.nix | 6 +- .../development/option-declarations.xml | 106 +-------- nixos/lib/eval-config.nix | 15 +- nixos/lib/typechecker.nix | 91 -------- nixos/modules/config/i18n.nix | 1 - nixos/modules/config/sysctl.nix | 1 - nixos/modules/installer/tools/nixos-option.sh | 4 +- .../installer/tools/nixos-typecheck.sh | 52 ----- nixos/modules/installer/tools/tools.nix | 8 +- nixos/modules/misc/meta.nix | 1 - nixos/modules/misc/nixpkgs.nix | 51 ++-- nixos/modules/module-list.nix | 1 - nixos/modules/services/misc/gitlab.nix | 3 - nixos/modules/services/misc/ihaskell.nix | 4 - nixos/modules/services/misc/nixos-manual.nix | 5 +- .../web-servers/apache-httpd/default.nix | 3 +- .../services/x11/window-managers/xmonad.nix | 3 - nixos/modules/system/boot/kernel.nix | 1 - .../system/boot/systemd-unit-options.nix | 5 +- nixos/release.nix | 2 - 24 files changed, 127 insertions(+), 703 deletions(-) delete mode 100644 nixos/lib/typechecker.nix delete mode 100644 nixos/modules/installer/tools/nixos-typecheck.sh diff --git a/lib/modules.nix b/lib/modules.nix index d08dc9f85a2..12ec7004d1e 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -23,6 +23,8 @@ rec { specialArgs ? {} , # This would be remove in the future, Prefer _module.args option instead. args ? {} + , # This would be remove in the future, Prefer _module.check option instead. + check ? true }: let # This internal module declare internal options under the `_module' @@ -43,22 +45,9 @@ rec { _module.check = mkOption { type = types.bool; internal = true; - default = true; + default = check; description = "Whether to check whether all option definitions have matching declarations."; }; - - _module.typeInference = mkOption { - type = types.nullOr types.str; - internal = true; - default = null; # TODO: Move away from 'null' after enough testing. - description = '' - Mode of type inferencing. Possible values are: - null = Disable type inferencing completely. Use 'types.unspecified' for every option without type definition. - "silent" = Try to infer type of option without type definition, but do not print anything. - "printUnspecified" = Try to infer type of option without type definition and print options for which no full type could be inferred. - "printAll" = Try to infer type of option without type definition and print all options without type definition. - ''; - }; }; config = { @@ -71,7 +60,7 @@ 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 (config._module) prefix (reverseList closed); + 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 @@ -181,11 +170,11 @@ 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 = _module: prefix: modules: - mergeModules' _module prefix modules + mergeModules = prefix: modules: + mergeModules' prefix modules (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules); - mergeModules' = _module: prefix: options: configs: + mergeModules' = prefix: options: configs: listToAttrs (map (name: { # We're descending into attribute ‘name’. inherit name; @@ -211,8 +200,8 @@ rec { (filter (m: m.config ? ${name}) configs); in if nrOptions == length decls then - let opt = fixupOptionType _module.typeInference loc (mergeOptionDecls loc decls); - in evalOptionValue _module 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; @@ -220,7 +209,7 @@ rec { in throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." else - mergeModules' _module loc decls defns; + mergeModules' loc decls defns; }) (concatMap (m: attrNames m.options) options)) // { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; }; @@ -269,7 +258,7 @@ rec { /* Merge all the definitions of an option to produce the final config value. */ - evalOptionValue = _module: loc: opt: defs: + evalOptionValue = loc: opt: defs: let # Add in the default value for this option, if any. defs' = @@ -281,7 +270,7 @@ rec { if opt.readOnly or false && length defs' > 1 then throw "The option `${showOption loc}' is read-only, but it's set multiple times." else - mergeDefinitions _module loc opt.type defs'; + mergeDefinitions loc opt.type defs'; # Check whether the option is defined, and apply the ‘apply’ # function to the merged value. This allows options to yield a @@ -302,7 +291,7 @@ rec { }; # Merge definitions of a value of a given type. - mergeDefinitions = _module: loc: type: defs: rec { + mergeDefinitions = loc: type: defs: rec { defsFinal = let # Process mkMerge and mkIf properties. @@ -325,7 +314,7 @@ rec { mergedValue = foldl' (res: def: if type.check def.value then res else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.name}.") - (type.merge _module loc defsFinal) defsFinal; + (type.merge loc defsFinal) defsFinal; isDefined = defsFinal != []; @@ -423,7 +412,7 @@ rec { /* Hack for backward compatibility: convert options of type optionSet to options of type submodule. FIXME: remove eventually. */ - fixupOptionType = typeInference: loc: opt: + fixupOptionType = loc: opt: let options = opt.options or (throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}."); @@ -435,66 +424,12 @@ rec { 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 if opt.type.getSubModules or null == null - then opt // { type = f (opt.type or (inferType typeInference loc opt)); } + then opt // { type = f (opt.type or types.unspecified); } else opt // { type = opt.type.substSubModules opt.options; options = []; }; - /* Function that tries to infer the type of an option from the default value of the option. */ - inferType = mode: loc: opt: - let - doc = x: elemAt x 0; - type = x: elemAt x 1; - containsUnspecified = x: elemAt x 2; - inferType' = def: - if isDerivation def then [ "package" types.package false ] - else if isBool def then [ "bool" types.bool false ] - else if builtins.isString def then [ "str" types.str false ] - else if isInt def then [ "int" types.int false ] - else if isFunction def then [ "functionTo unspecified" (types.functionTo types.unspecified) true ] - else if isList def then - let nestedType = if (length def > 0) && (all (x: (type (inferType' x)) == (type (inferType' (head def)))) def) - then inferType' (head def) - else [ "unspecified" types.unspecified true ]; - in [ "listOf ${doc nestedType}" (types.listOf (type nestedType)) (containsUnspecified nestedType) ] - else if isAttrs def then - let list = mapAttrsToList (_: v: v) (removeAttrs def ["_args"]); - nestedType = if (length list > 0) && (all (x: (type (inferType' x)) == (type (inferType' (head list)))) list) - then inferType' (head list) - else [ "unspecified" types.unspecified true ]; - in [ "attrsOf ${doc nestedType}" (types.attrsOf (type nestedType)) (containsUnspecified nestedType) ] - else [ "unspecified" types.unspecified true ]; - - inferDoc = x: '' - Inferring the type of "${showOption loc}" to "${doc x}". - Please verify the inferred type and define the type explicitely in ${showFiles opt.declarations}! - ''; - - inferredType = printMode: - let inferred = inferType' opt.default; - in if printMode == "silent" then type inferred - else if printMode == "printAll" then builtins.trace (inferDoc inferred) (type inferred) - else if printMode == "printUnspecified" && (containsUnspecified inferred) then builtins.trace (inferDoc inferred) (type inferred) - else type inferred; - - noInferDoc = '' - Could not infer a type for "${showOption loc}", using "unspecified" instead. - Please define the type explicitely in ${showFiles opt.declarations}! - ''; - - hasDefault = (opt ? default) && !(opt ? defaultText); - isExternalVisible = (opt.visible or true) && !(opt.internal or false); - in - - if isNull mode || !isExternalVisible - then types.unspecified - else if hasDefault - then inferredType mode /* Set to 'true' to see every type that is being inferred, not just those types that result in 'unspecified'. */ - else if mode != "silent" then builtins.trace noInferDoc types.unspecified else types.unspecified; - - /* Properties. */ mkIf = condition: content: @@ -562,7 +497,7 @@ rec { /* Compatibility. */ - fixMergeModules = modules: args: evalModules { inherit args; modules = (modules ++ [{ _module.check = false; }]); }; + fixMergeModules = modules: args: evalModules { inherit modules args; check = false; }; /* Return a module that causes a warning to be shown if the diff --git a/lib/options.nix b/lib/options.nix index d6876e18fe4..444ec37e6ea 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -6,7 +6,6 @@ with import ./trivial.nix; with import ./lists.nix; with import ./attrsets.nix; with import ./strings.nix; -with {inherit (import ./types.nix) types; }; rec { @@ -43,17 +42,16 @@ rec { description = "Sink for option definitions."; type = mkOptionType { name = "sink"; - typerep = "(sink)"; check = x: true; - merge = config: loc: defs: false; + merge = loc: defs: false; }; apply = x: throw "Option value is not readable because the option is not declared."; } // attrs); - mergeDefaultOption = config: loc: defs: + mergeDefaultOption = loc: defs: let list = getValues defs; in if length list == 1 then head list - else if all isFunction list then x: mergeDefaultOption config loc (map (f: f x) list) + else if all 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 foldl' lib.mergeAttrs {} list else if all isBool list then foldl' lib.or false list @@ -61,14 +59,14 @@ rec { else if all isInt list && all (x: x == head list) list then head list else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}."; - mergeOneOption = config: loc: defs: + 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; /* "Merge" option definitions by checking that they all have the same value. */ - mergeEqualOption = config: loc: defs: + mergeEqualOption = loc: defs: if defs == [] then abort "This case should never happen." else foldl' (val: def: if def.value != val then @@ -79,154 +77,53 @@ rec { getValues = map (x: x.value); getFiles = map (x: x.file); + # Generate documentation template from the list of option declaration like # the set generated with filterOptionSets. optionAttrSetToDocList = optionAttrSetToDocList' []; - optionAttrSetToDocList' = prefix: internalModuleConfig: options: + optionAttrSetToDocList' = prefix: options: concatMap (opt: let - decls = filter (x: x != unknownModule) opt.declarations; docOption = rec { name = showOption opt.loc; description = opt.description or (throw "Option `${name}' has no description."); - declarations = decls; + declarations = filter (x: x != unknownModule) opt.declarations; internal = opt.internal or false; visible = opt.visible or true; readOnly = opt.readOnly or false; type = opt.type.name or null; } - // (if opt ? example then { example = detectDerivation decls opt.example; } else {}) - // (if opt ? default then { default = detectDerivation decls opt.default; } else {}) + // (if opt ? example then { example = scrubOptionValue opt.example; } else {}) + // (if opt ? default then { default = scrubOptionValue opt.default; } else {}) // (if opt ? defaultText then { default = opt.defaultText; } else {}); subOptions = - let ss = opt.type.getSubOptionsPrefixed opt.loc; - in if ss != {} then optionAttrSetToDocList' opt.loc internalModuleConfig (ss internalModuleConfig) else []; + let ss = opt.type.getSubOptions opt.loc; + in if ss != {} then optionAttrSetToDocList' opt.loc ss else []; in [ docOption ] ++ subOptions) (collect isOption options); - # TODO: Use "extractOptionAttrSet" instead of "optionAttrSetToDocList'" to reduce the code size. - # It should be a drop-in-replacement. But first, examine the impact on the evaluation time. - # optionAttrSetToDocList = extractOptionAttrSet true []; - # Generate a machine readable specification of the list of option declarations. - optionAttrSetToParseableSpecifications = extractOptionAttrSet false []; - - extractOptionAttrSet = toDoc: prefix: internalModuleConfig: options: - concatMap (opt: - let - optionName = showOption opt.loc; - - # Check if a type contains derivations, that is check if a type nests - # a 'package', 'packageSet' or 'nixpkgsConfig' type. - hasDerivation = any (t: elem t opt.type.nestedTypes) ((map (x: x.typerep) (with types; [package packageSet])) ++ ["(nixpkgsConfig)"]); - - # Check if type is 'path' which can potentially contain a derivation. - maybeHiddenDerivation = any (t: elem t opt.type.nestedTypes) (map (x: x.typerep) (with types; [path])); - - isDefaultValue = elem opt.default opt.type.defaultValues; - - /* Enforce that the example attribute is wrapped with 'literalExample' - for every type that contains derivations. */ - example = - if opt ? example - then (if hasDerivation - then (if isLiteralExample opt.example - then { example = detectDerivation decls opt.example; } - else throw "The attribute ${optionName}.example must be wrapped with 'literalExample' in ${concatStringsSep " and " decls}!") - else { example = detectDerivation decls opt.example; }) - else {}; - - /* Enforce that the 'defaultText' attribute is defined for every option - that has a 'default' attribute that contains derivations. */ - default = - if opt ? default - then (if hasDerivation - then (if isDefaultValue - then { default = opt.default; } - else (if opt ? defaultText - then { default = literalExample (detectDerivation decls opt.defaultText); } - else throw "The option ${optionName} requires a 'defaultText' attribute in ${concatStringsSep " and " decls}!")) - else (if opt ? defaultText - then (if maybeHiddenDerivation - then (if (let eval = builtins.tryEval (findDerivation opt.default); in eval.success && !eval.value) - then builtins.trace - "The attribute ${optionName}.defaultText might not be necessary in ${concatStringsSep " and " decls}!" - { default = literalExample (detectDerivation decls opt.defaultText); } - else { default = literalExample (detectDerivation decls opt.defaultText); }) - else builtins.trace - "The attribute ${optionName}.defaultText is not used and can be removed in ${concatStringsSep " and " decls}!" - { default = detectDerivation decls opt.default; }) - else { default = detectDerivation decls opt.default; })) - else {}; - - decls = filter (x: x != unknownModule) opt.declarations; - - docOption = { - name = optionName; - description = opt.description or (throw "Option `${optionName}' has no description."); - declarations = decls; - internal = opt.internal or false; - visible = opt.visible or true; - readOnly = opt.readOnly or false; - } // example // default // subOptions // typeKeys; - - typeKeys = if toDoc then { type = opt.type.name or null; } else { type = opt.type.typerep; keys = opt.loc; }; - - subOptions = - if toDoc - then {} - else let ss = opt.type.getSubOptions; - in if ss != {} then { suboptions = (extractOptionAttrSet false [] internalModuleConfig (ss internalModuleConfig)); } else {}; - - subOptionsDoc = - if toDoc - then let ss = opt.type.getSubOptionsPrefixed opt.loc; - in if ss != {} then extractOptionAttrSet true opt.loc internalModuleConfig (ss internalModuleConfig) else [] - else []; - in - [ docOption ] ++ subOptionsDoc ) - (filter (opt: (opt.visible or true) && !(opt.internal or false)) (collect isOption options)); - - - /* This function recursively checks for derivations within an - an expression, and throws an error if a derivation or a - store path is found. The function is used to ensure that no - derivation leaks from the 'default' or 'example' attributes - of an option. - This makes the generation of `options.xml' much more efficient: - the XML representation of derivations is very large (on the - order of megabytes) and is not actually used by the manual - generator. */ - detectDerivation = decl: x: + /* This function recursively removes all derivation attributes from + `x' except for the `name' attribute. This is to make the + generation of `options.xml' much more efficient: the XML + 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 - throw "Found unexpected derivation in '${x.name}' in '${concatStringsSep " and " decl}'!" - else if isString x && isStorePath x then - throw "Found unexpected store path in '${x.name}' in '${concatStringsSep " and " decl}'!" - else if isList x then map (detectDerivation decl) x - else if isAttrs x then mapAttrs (n: v: (detectDerivation decl) v) (removeAttrs x ["_args"]) + { 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; - /* Same as detectDerivation, but returns a boolean instead of - throwing an exception. */ - findDerivation = x: - if (isString x && isStorePath x) || isDerivation x then true - else if isList x then any findDerivation x - else if isAttrs x then any findDerivation (mapAttrsToList (_: v: v) (removeAttrs x ["_args"])) - else false; - - /* For use in the ‘example’ option attribute. It causes the given text to be included verbatim in documentation. This is necessary for example values that are not simple values, e.g., functions. */ - # TODO: A more general name would probably be "literalNix". literalExample = text: { _type = "literalExample"; inherit text; }; - isLiteralExample = x: isAttrs x && hasAttr "_type" x && x._type == "literalExample"; - /* Helper functions. */ showOption = concatStringsSep "."; diff --git a/lib/types.nix b/lib/types.nix index 385103d4214..b4d29ac84d2 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -1,8 +1,6 @@ # Definitions related to run-time type checking. Used in particular # to type-check NixOS configurations. -let lib = import ./default.nix; in - with import ./lists.nix; with import ./attrsets.nix; with import ./options.nix; @@ -23,8 +21,6 @@ rec { mkOptionType = { # Human-readable representation of the type. name - , # Parseable representation of the type. - typerep , # Function applied to each definition that should return true if # its type-correct, false otherwise. check ? (x: true) @@ -35,59 +31,40 @@ rec { # definition values and locations (e.g. [ { file = "/foo.nix"; # value = 1; } { file = "/bar.nix"; value = 2 } ]). merge ? mergeDefaultOption - , # Return list of sub-options. - getSubOptions ? {} - , # Same as 'getSubOptions', but with extra information about the - # location of the option which is used to generate documentation. - getSubOptionsPrefixed ? null + , # Return a flat list of sub-options. Used to generate + # documentation. + getSubOptions ? prefix: {} , # List of modules if any, or null if none. getSubModules ? null , # Function for building the same option type with a different list of # modules. substSubModules ? m: null - , # List of type representations (typerep) of all the elementary types - # that are nested within the type. For an elementary type the list is - # a singleton of the typerep of itself. - # NOTE: Must be specified for every container type! - nestedTypes ? null - , # List of all default values, and an empty list if no default value exists. - defaultValues ? [] }: { _type = "option-type"; - inherit name typerep check merge getSubOptions getSubModules substSubModules defaultValues; - nestedTypes = if (isNull nestedTypes) then (singleton typerep) else nestedTypes; - getSubOptionsPrefixed = if (isNull getSubOptionsPrefixed) then (prefix: getSubOptions) else getSubOptionsPrefixed; + inherit name check merge getSubOptions getSubModules substSubModules; }; types = rec { - # - # Elementary types - # - unspecified = mkOptionType { name = "unspecified"; - typerep = "(unspecified)"; }; bool = mkOptionType { name = "boolean"; - typerep = "(boolean)"; check = isBool; merge = mergeEqualOption; }; int = mkOptionType { name = "integer"; - typerep = "(integer)"; check = isInt; merge = mergeOneOption; }; str = mkOptionType { name = "string"; - typerep = "(string)"; check = isString; merge = mergeOneOption; }; @@ -95,111 +72,73 @@ rec { # Merge multiple definitions by concatenating them (with the given # separator between the values). separatedString = sep: mkOptionType { - name = "string" + (optionalString (sep != "") " separated by ${sep}"); - typerep = "(separatedString(${escape ["(" ")"] sep}))"; + name = "string"; check = isString; - merge = _module: loc: defs: concatStringsSep sep (getValues defs); + merge = loc: defs: concatStringsSep sep (getValues defs); }; - lines = separatedString "\n" // { typerep = "(lines)"; }; - commas = separatedString "," // { typerep = "(commas)"; }; - envVar = separatedString ":" // { typerep = "(envVar)"; }; + 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 = separatedString "" // { typerep = "(string)"; }; + string = separatedString ""; attrs = mkOptionType { name = "attribute set"; - typerep = "(attrs)"; check = isAttrs; - merge = _module: loc: foldl' (res: def: mergeAttrs res def.value) {}; + merge = loc: foldl' (res: def: mergeAttrs res def.value) {}; }; # derivation is a reserved keyword. package = mkOptionType { name = "package"; - typerep = "(package)"; check = x: isDerivation x || isStorePath x; - merge = _module: loc: defs: - let res = mergeOneOption _module loc defs; + merge = loc: defs: + let res = mergeOneOption loc defs; in if isDerivation res then res else toDerivation res; }; - # The correct type of packageSet would be: - # packageSet = attrsOf (either package packageSet) - # (Not sure if nix would allow to define a recursive type.) - # However, currently it is not possible to check that a packageSet actually - # contains packages (that is derivations). The check 'isDerivation' is too - # eager for the current implementation of the assertion mechanism and of the - # licenses control mechanism. That means it is not generally possible to go - # into the attribute set of packages to check that every attribute would - # evaluate to a derivation if the package would actually be evaluated. Maybe - # that restriction can be lifted in the future, but for now the content of - # the packageSet is not checked. - # TODO: The 'merge' function is copied from 'mergeDefaultOption' to keep - # backwards compatibility with the 'unspecified' type that was used for - # package sets previously. Maybe review if the merge function has to change. - packageSet = mkOptionType { - name = "derivation set"; - typerep = "(packageSet)"; - check = isAttrs; - merge = _module: loc: defs: foldl' mergeAttrs {} (map (x: x.value) defs); - }; - path = mkOptionType { name = "path"; - typerep = "(path)"; # Hacky: there is no ‘isPath’ primop. check = x: builtins.substring 0 1 (toString x) == "/"; merge = mergeOneOption; }; - - # - # Container types - # - # drop this in the future: list = builtins.trace "`types.list' is deprecated; use `types.listOf' instead" types.listOf; listOf = elemType: mkOptionType { name = "list of ${elemType.name}s"; - typerep = "(listOf${elemType.typerep})"; check = isList; - merge = _module: loc: defs: + merge = loc: defs: map (x: x.value) (filter (x: x ? value) (concatLists (imap (n: def: imap (m: def': - (mergeDefinitions _module + (mergeDefinitions (loc ++ ["[definition ${toString n}-entry ${toString m}]"]) elemType [{ inherit (def) file; value = def'; }] ).optionalValue ) def.value) defs))); - getSubOptions = elemType.getSubOptions; - getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed (prefix ++ ["*"]); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); getSubModules = elemType.getSubModules; substSubModules = m: listOf (elemType.substSubModules m); - nestedTypes = elemType.nestedTypes; - defaultValues = [[]]; }; attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; - typerep = "(attrsOf${elemType.typerep})"; check = isAttrs; - merge = _module: loc: defs: + merge = loc: defs: mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs: - (mergeDefinitions _module (loc ++ [name]) elemType defs).optionalValue + (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue ) # Push down position info. (map (def: listToAttrs (mapAttrsToList (n: def': { name = n; value = { inherit (def) file; value = def'; }; }) def.value)) defs))); - getSubOptions = elemType.getSubOptions; - getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed (prefix ++ [""]); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); getSubModules = elemType.getSubModules; substSubModules = m: attrsOf (elemType.substSubModules m); - nestedTypes = elemType.nestedTypes; - defaultValues = [{}]; }; # List or attribute set of ... @@ -220,23 +159,18 @@ rec { attrOnly = attrsOf elemType; in mkOptionType { name = "list or attribute set of ${elemType.name}s"; - typerep = "(loaOf${elemType.typerep})"; check = x: isList x || isAttrs x; - merge = _module: loc: defs: attrOnly.merge _module loc (imap convertIfList defs); - getSubOptions = elemType.getSubOptions; - getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed (prefix ++ [""]); + merge = loc: defs: attrOnly.merge loc (imap convertIfList defs); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); getSubModules = elemType.getSubModules; substSubModules = m: loaOf (elemType.substSubModules m); - nestedTypes = elemType.nestedTypes; - defaultValues = [{} []]; }; # List or element of ... loeOf = elemType: mkOptionType { name = "element or list of ${elemType.name}s"; - typerep = "(loeOf${elemType.typerep})"; check = x: isList x || elemType.check x; - merge = _module: loc: defs: + merge = loc: defs: let defs' = filterOverrides defs; res = (head defs').value; @@ -247,41 +181,55 @@ rec { else if !isString res then throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}." else res; - nestedTypes = elemType.nestedTypes; - defaultValues = [[]] ++ elemType.defaultValues; }; uniq = elemType: mkOptionType { - inherit (elemType) check; - name = "unique ${elemType.name}"; - typerep = "(uniq${elemType.typerep})"; + inherit (elemType) name check; merge = mergeOneOption; getSubOptions = elemType.getSubOptions; - getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed prefix; getSubModules = elemType.getSubModules; substSubModules = m: uniq (elemType.substSubModules m); - nestedTypes = elemType.nestedTypes; - defaultValues = elemType.defaultValues; }; nullOr = elemType: mkOptionType { name = "null or ${elemType.name}"; - typerep = "(nullOr${elemType.typerep})"; check = x: x == null || elemType.check x; - merge = _module: loc: defs: + merge = loc: defs: let nrNulls = count (def: def.value == null) defs; in if nrNulls == length defs then null else if nrNulls != 0 then throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}." - else elemType.merge _module loc defs; + else elemType.merge loc defs; getSubOptions = elemType.getSubOptions; - getSubOptionsPrefixed = prefix: elemType.getSubOptionsPrefixed prefix; getSubModules = elemType.getSubModules; substSubModules = m: nullOr (elemType.substSubModules m); - nestedTypes = elemType.nestedTypes; - defaultValues = [null] ++ elemType.defaultValues; }; + submodule = opts: + let + opts' = toList opts; + inherit (import ./modules.nix) evalModules; + in + mkOptionType rec { + name = "submodule"; + check = x: isAttrs x || isFunction x; + merge = loc: defs: + let + coerce = def: if isFunction def then def else { config = def; }; + 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. + args = { name = ""; }; }).options; + getSubModules = opts'; + substSubModules = m: submodule m; + }; + enum = values: let show = v: @@ -291,92 +239,23 @@ rec { in mkOptionType { name = "one of ${concatMapStringsSep ", " show values}"; - typerep = "(enum${concatMapStrings (x: "(${escape ["(" ")"] (builtins.toString x)})") values})"; check = flip elem values; merge = mergeOneOption; - nestedTypes = []; }; either = t1: t2: mkOptionType { name = "${t1.name} or ${t2.name}"; - typerep = "(either${t1.typerep}${t2.typerep})"; check = x: t1.check x || t2.check x; merge = mergeOneOption; - nestedTypes = t1.nestedTypes ++ t2.nestedTypes; - defaultValues = t1.defaultValues ++ t2.defaultValues; }; - - # - # Complex types - # - - submodule = opts: - let - opts' = toList opts; - inherit (import ./modules.nix) evalModules; - filterVisible = filter (opt: (if opt ? visible then opt.visible else true) && (if opt ? internal then !opt.internal else true)); - in - mkOptionType rec { - name = "submodule"; - typerep = "(submodule)"; - check = x: isAttrs x || isFunction x; - merge = _module: loc: defs: - let - internalModule = [ { inherit _module; } { _module.args.name = lib.mkForce (last loc); } ]; - coerce = def: if isFunction def then def else { config = def; }; - modules = opts' ++ internalModule ++ map (def: { _file = def.file; imports = [(coerce def.value)]; }) defs; - in (evalModules { - inherit modules; - prefix = loc; - }).config; - getSubOptions = getSubOptionsPrefixed []; - getSubOptionsPrefixed = prefix: _module: - let - # FIXME: hack to get shit to evaluate. - internalModule = [ { inherit _module; } { _module.args.name = lib.mkForce ""; } ]; - in (evalModules { - modules = opts' ++ internalModule; - inherit prefix; - }).options; - getSubModules = opts'; - substSubModules = m: submodule m; - nestedTypes = concatMap (opt: opt.type.nestedTypes) (collect (lib.isType "option") (getSubOptions {})); - defaultValues = [{}]; - }; - - - - # - # Legacy types - # - # 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"; - typerep = "(optionSet)"; }; - - # Try to remove module options of that type wherever possible. - # A module option taking a function can not be introspected and documented properly. - functionTo = resultType: - mkOptionType { - name = "function to ${resultType.name}"; - typerep = "(function${resultType.typerep})"; - check = builtins.isFunction; - merge = mergeOneOption; - nestedTypes = resultType.nestedTypes; - defaultValues = map (x: {...}:x) resultType.nestedTypes; # INFO: It seems as nix can't compare functions, yet. - }; - - - # - # misc - # - # 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/default.nix b/nixos/default.nix index 117a7b5d603..5d69b79e13a 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -34,8 +34,6 @@ in system = eval.config.system.build.toplevel; - typechecker = eval.config.system.build.typechecker; - vm = vmConfig.system.build.vm; vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm; diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index ea860149736..4ce6ea1c111 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -1,4 +1,4 @@ -{ pkgs, options, internalModule, version, revision, extraSources ? [] }: +{ pkgs, options, version, revision, extraSources ? [] }: with pkgs; with pkgs.lib; @@ -6,10 +6,8 @@ with pkgs.lib; let # Remove invisible and internal options. - optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList internalModule options); + optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options); - # INFO: Please add 'defaultText' or 'literalExample' to the option - # definition to avoid this substitution! # Replace functions by the string substFunction = x: if builtins.isAttrs x then mapAttrs (name: substFunction) x diff --git a/nixos/doc/manual/development/option-declarations.xml b/nixos/doc/manual/development/option-declarations.xml index 08bde4a275d..ea5d1241876 100644 --- a/nixos/doc/manual/development/option-declarations.xml +++ b/nixos/doc/manual/development/option-declarations.xml @@ -8,7 +8,7 @@ An option declaration specifies the name, type and description of a NixOS configuration option. It is illegal to define an option -that has not been declared in any module. A option declaration +that hasn’t been declared in any module. A option declaration generally looks like this: @@ -145,108 +145,6 @@ options = { You can also create new types using the function mkOptionType. See -lib/types.nix in Nixpkgs for details. - -An option declaration must follow the following rules: - - - - A defaultText must be defined if and only if the type of the option - derives from package, packageSet or nixpkgsConfig - , and if and only if a default attribute is defined and if and only if - the value of the default attribute is not the default of the type of the - option declaration. - - For example, a defaultText must be defined for - -type = types.listOf types.package; -default = [ pkgs.foo; ]; -defaultText = "[ pkgs.foo; ]"; -. - - But no defaultText must be defined for - -type = types.listOf types.package; -default = []; -, - as [] is the default of types.listOf types.package. - - - - - A defaultText can be defined if the type of the option derives from - path and if a default attribute is defined. - - - - The value of the example attribute must be wrapped with - literalExample if the type of the option derives from package, - packageSet or nixpkgsConfig. - - - - The value of defaultText and literalExample must - be a string which contains a valid nix expression. The nix expression has to evaluate in - {pkgs}: value. - For example: - - - A defaultText could, e.g., be: - -type = types.package; -default = pkgs.foo; -defaultText = "pkgs.foo"; - - But not defaultText = "pkgs.foo;";, as that - corresponds to {pkgs}: pkgs.foo;, which is an - invalid nix expression due to the ending with ;. - - - - A literalExample could be used as, e.g.: - -type = types.path; -example = literalExample "\"\${pkgs.bar}/bin/bar\""; - - But not literalExample "\${pkgs.bar}/bin/bar";, as that corresponds - to {pkgs}: ${pkgs.bar}/bin/bar, which is an invalid nix expression - as the path is not a string anymore. - - - - - - The type attribute must be defined for every option declaration. - - - - -NixOS ships the tool nixos-typecheck that can check an option declaration to: - - - - - Enforce that an option declaration has a defaultText if and only if the - type of the option derives from package, packageSet or - nixpkgsConfig and if a default attribute is defined. - - - - Enforce that the value of the example attribute is wrapped with - literalExample if the type of the option derives from package, - packageSet or nixpkgsConfig. - - - - Warn if a defaultText is defined in an option declaration if the type of - the option does not derive from package, packageSet or - nixpkgsConfig. - - - - Warn if no type is defined in an option declaration. - - - +lib/types.nix in Nixpkgs for details. diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index 79890e0add7..a87b285c5b7 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -20,13 +20,8 @@ , # !!! See comment about args in lib/modules.nix specialArgs ? {} , modules -, # Pass through a configuration of the internal modules declared - # in lib/modules.nix. - _module ? {} -, # !!! See comment about typeInference in lib/modules.nix - typeInference ? null , # !!! See comment about check in lib/modules.nix - check ? null + check ? true , prefix ? [] , lib ? import ../../lib }: @@ -46,17 +41,13 @@ let }; }; - internalModule = { _module = (_module - // (if isNull check then {} else { inherit check; }) - // (if isNull typeInference then {} else { inherit typeInference; })); }; - in rec { # Merge the option definitions in all modules, forming the full # system configuration. inherit (lib.evalModules { - inherit prefix; - modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ] ++ [ internalModule ]; + inherit prefix check; + modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ]; args = extraArgs; specialArgs = { modulesPath = ../modules; } // specialArgs; }) config options; diff --git a/nixos/lib/typechecker.nix b/nixos/lib/typechecker.nix deleted file mode 100644 index b4d8277f8fe..00000000000 --- a/nixos/lib/typechecker.nix +++ /dev/null @@ -1,91 +0,0 @@ -{ config, lib, pkgs, baseModules, ... }: - -with pkgs; -with pkgs.lib; - -let - - optionsSpecs = inferenceMode: - let - versionModule = - { system.nixosVersionSuffix = config.system.nixosVersionSuffix; - system.nixosRevision = config.system.nixosRevision; - nixpkgs.system = config.nixpkgs.system; - }; - - internalModule = { _module = config._module; } // (if isNull inferenceMode then {} else { _module.typeInference = mkForce inferenceMode; }); - - eval = evalModules { - modules = [ versionModule ] ++ baseModules ++ [ internalModule ]; - args = (config._module.args) // { modules = [ ]; }; - }; - - # Remove invisible and internal options. - optionsSpecs' = filter (opt: opt.visible && !opt.internal) (optionAttrSetToParseableSpecifications config._module eval.options); - - # INFO: Please add 'defaultText' or 'literalExample' to the option - # definition to avoid this exception! - substFunction = key: decls: x: - if builtins.isAttrs x then mapAttrs (name: substFunction key decls) x - else if builtins.isList x then map (substFunction key decls) x - else if builtins.isFunction x then throw "Found an unexpected in ${key} declared in ${concatStringsSep " and " decls}." - else x; - - prefix = toString ../..; - - stripPrefix = fn: - if substring 0 (stringLength prefix) fn == prefix then - substring (stringLength prefix + 1) 1000 fn - else - fn; - - # Clean up declaration sites to not refer to the NixOS source tree. - cleanupOptions = x: flip map x (opt: - let substFunction' = y: substFunction opt.name opt.declarations y; - in opt - // { declarations = map (fn: stripPrefix fn) opt.declarations; } - // optionalAttrs (opt ? example) { example = substFunction' opt.example; } - // optionalAttrs (opt ? default) { default = substFunction' opt.default; } - // optionalAttrs (opt ? type) { type = substFunction' opt.type; }); - - in - cleanupOptions optionsSpecs'; - -in - -{ - - system.build.typechecker = { - - # The NixOS options as machine readable specifications in JSON format. - specifications = stdenv.mkDerivation { - name = "options-specs-json"; - - buildCommand = '' - # Export list of options in different format. - dst=$out/share/doc/nixos - mkdir -p $dst - - cp ${builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON - (listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs null))))) - } $dst/options-specs.json - - mkdir -p $out/nix-support - echo "file json $dst/options-specs.json" >> $out/nix-support/hydra-build-products - ''; # */ - - meta.description = "List of NixOS options specifications in JSON format"; - }; - - silent = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "silent")); - printAll = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "printAll")); - printUnspecified = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "printUnspecified")); - - }; - -} - - - - - diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 3d21bda5734..b20fac6ad3e 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -64,7 +64,6 @@ in consoleKeyMap = mkOption { type = mkOptionType { name = "string or path"; - typerep = "(stringOrPath)"; check = t: (isString t || types.path.check t); }; diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index 174d7014ca8..61b02c5ffa6 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -6,7 +6,6 @@ let sysctlOption = mkOptionType { name = "sysctl option value"; - typerep = "(sysctl)"; check = val: let checkType = x: isBool x || isString x || isInt x || isNull x; diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh index dd21dc71ee2..17c17d05e28 100644 --- a/nixos/modules/installer/tools/nixos-option.sh +++ b/nixos/modules/installer/tools/nixos-option.sh @@ -115,8 +115,8 @@ let let name = head attrsNames; rest = tail attrsNames; in if isOption result.options then walkOptions rest { - options = result.options.type.getSubOptionsPrefix ""; - opt = ''(\${result.opt}.type.getSubOptionsPrefix "")''; + options = result.options.type.getSubOptions ""; + opt = ''(\${result.opt}.type.getSubOptions "")''; cfg = ''\${result.cfg}."\${name}"''; } else diff --git a/nixos/modules/installer/tools/nixos-typecheck.sh b/nixos/modules/installer/tools/nixos-typecheck.sh deleted file mode 100644 index f9557be0c50..00000000000 --- a/nixos/modules/installer/tools/nixos-typecheck.sh +++ /dev/null @@ -1,52 +0,0 @@ -#! /bin/sh -#! @shell@ - -if [ -x "@shell@" ]; then export SHELL="@shell@"; fi; - -set -e - -showSyntax() { -cat >&1 << EOF -nixos-typecheck -usage: - nixos-typecheck [action] [args] -where: - action = silent | printAll | printUnspecified | getSpecs - with default action: printUnspecified - args = any argument supported by nix-build -EOF -} - - -# Parse the command line. -extraArgs=() -action=printUnspecified - -while [ "$#" -gt 0 ]; do - i="$1"; shift 1 - case "$i" in - --help) - showSyntax - ;; - silent|printAll|printUnspecified|getSpecs) - action="$i" - ;; - *) - extraArgs="$extraArgs $i" - ;; - esac -done - - -if [ "$action" = silent ]; then - nix-build --no-out-link '' -A typechecker.silent $extraArgs -elif [ "$action" = printAll ]; then - nix-build --no-out-link '' -A typechecker.printAll $extraArgs -elif [ "$action" = printUnspecified ]; then - nix-build --no-out-link '' -A typechecker.printUnspecified $extraArgs -elif [ "$action" = getSpecs ]; then - ln -s $(nix-build --no-out-link '' -A typechecker.specifications $extraArgs)/share/doc/nixos/options-specs.json specifications.json -else - showSyntax - exit 1 -fi diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 69bd0d26b77..9ac3b7a5b16 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -54,11 +54,6 @@ let inherit (config.system) nixosVersion nixosCodeName nixosRevision; }; - nixos-typecheck = makeProg { - name = "nixos-typecheck"; - src = ./nixos-typecheck.sh; - }; - in { @@ -72,11 +67,10 @@ in nixos-generate-config nixos-option nixos-version - nixos-typecheck ]; system.build = { - inherit nixos-install nixos-generate-config nixos-option nixos-rebuild nixos-typecheck; + inherit nixos-install nixos-generate-config nixos-option nixos-rebuild; }; }; diff --git a/nixos/modules/misc/meta.nix b/nixos/modules/misc/meta.nix index 9a453172c63..22622706f2c 100644 --- a/nixos/modules/misc/meta.nix +++ b/nixos/modules/misc/meta.nix @@ -5,7 +5,6 @@ with lib; let maintainer = mkOptionType { name = "maintainer"; - typerep = "(maintainer)"; check = email: elem email (attrValues lib.maintainers); merge = loc: defs: listToAttrs (singleton (nameValuePair (last defs).file (last defs).value)); }; diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 511831ae5cd..5eb38c510b4 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -3,35 +3,32 @@ with lib; let - nixpkgsConfig = pkgs: + isConfig = x: + builtins.isAttrs x || builtins.isFunction x; + + optCall = f: x: + if builtins.isFunction f + then f x + else f; + + mergeConfig = lhs_: rhs_: let - isConfig = x: - builtins.isAttrs x || builtins.isFunction x; - - optCall = f: x: - if builtins.isFunction f - then f x - else f; - - mergeConfig = lhs_: rhs_: - let - lhs = optCall lhs_ { inherit pkgs; }; - rhs = optCall rhs_ { inherit pkgs; }; - in - lhs // rhs // - optionalAttrs (lhs ? packageOverrides) { - packageOverrides = pkgs: - optCall lhs.packageOverrides pkgs // - optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; - }; + lhs = optCall lhs_ { inherit pkgs; }; + rhs = optCall rhs_ { inherit pkgs; }; in - mkOptionType { - name = "nixpkgs config"; - typerep = "(nixpkgsConfig)"; - check = lib.traceValIfNot isConfig; - merge = config: args: fold (def: mergeConfig def.value) {}; - defaultValues = [{}]; + lhs // rhs // + optionalAttrs (lhs ? packageOverrides) { + packageOverrides = pkgs: + optCall lhs.packageOverrides pkgs // + optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; }; + + configType = mkOptionType { + name = "nixpkgs config"; + check = traceValIfNot isConfig; + merge = args: fold (def: mergeConfig def.value) {}; + }; + in { @@ -49,7 +46,7 @@ in }; } ''; - type = nixpkgsConfig pkgs; + type = configType; description = '' The configuration of the Nix Packages collection. (For details, see the Nixpkgs documentation.) It allows you to set diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 88e01069b26..ad1636e002d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -1,5 +1,4 @@ [ - ../lib/typechecker.nix ./config/debug-info.nix ./config/fonts/corefonts.nix ./config/fonts/fontconfig-ultimate.nix diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index e6ebcd6dc14..cc50bfbea53 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -155,21 +155,18 @@ in { packages.gitlab = mkOption { type = types.package; default = pkgs.gitlab; - defaultText = "pkgs.gitlab"; description = "Reference to the gitlab package"; }; packages.gitlab-shell = mkOption { type = types.package; default = pkgs.gitlab-shell; - defaultText = "pkgs.gitlab-shell"; description = "Reference to the gitlab-shell package"; }; packages.gitlab-workhorse = mkOption { type = types.package; default = pkgs.gitlab-workhorse; - defaultText = "pkgs.gitlab-workhorse"; description = "Reference to the gitlab-workhorse package"; }; diff --git a/nixos/modules/services/misc/ihaskell.nix b/nixos/modules/services/misc/ihaskell.nix index c177d68c8fe..d0e9b839e75 100644 --- a/nixos/modules/services/misc/ihaskell.nix +++ b/nixos/modules/services/misc/ihaskell.nix @@ -15,14 +15,12 @@ in options = { services.ihaskell = { enable = mkOption { - type = lib.types.bool; default = false; example = true; description = "Autostart an IHaskell notebook service."; }; haskellPackages = mkOption { - type = lib.types.packageSet; default = pkgs.haskellPackages; defaultText = "pkgs.haskellPackages"; example = literalExample "pkgs.haskell.packages.ghc784"; @@ -35,9 +33,7 @@ in }; extraPackages = mkOption { - type = types.functionTo (types.listOf types.package); default = self: []; - defaultText = "self: []"; example = literalExample '' haskellPackages: [ haskellPackages.wreq diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index 7ba1c319add..37ea339300d 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -17,8 +17,6 @@ let nixpkgs.system = config.nixpkgs.system; }; - internalModule = { _module = config._module; }; - /* For the purpose of generating docs, evaluate options with each derivation in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}". It isn't perfect, but it seems to cover a vast majority of use cases. @@ -31,7 +29,7 @@ let options = let scrubbedEval = evalModules { - modules = [ versionModule ] ++ baseModules ++ [ internalModule ]; + modules = [ versionModule ] ++ baseModules; args = (config._module.args) // { modules = [ ]; }; specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; }; }; @@ -45,7 +43,6 @@ let ) pkgSet; in scrubbedEval.options; - internalModule = config._module; }; entry = "${manual.manual}/share/doc/nixos/index.html"; diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 8340287df45..60ec49c9e66 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -48,7 +48,8 @@ let if svc ? function then svc.function 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; } ] ++ [ { _module.check = false; } ]; + { modules = [ { options = res.options; config = svc.config or svc; } ]; + check = false; }).config; defaults = { extraConfig = ""; diff --git a/nixos/modules/services/x11/window-managers/xmonad.nix b/nixos/modules/services/x11/window-managers/xmonad.nix index d8acb824f7d..6af88d4f645 100644 --- a/nixos/modules/services/x11/window-managers/xmonad.nix +++ b/nixos/modules/services/x11/window-managers/xmonad.nix @@ -16,7 +16,6 @@ in services.xserver.windowManager.xmonad = { enable = mkEnableOption "xmonad"; haskellPackages = mkOption { - type = lib.types.packageSet; default = pkgs.haskellPackages; defaultText = "pkgs.haskellPackages"; example = literalExample "pkgs.haskell.packages.ghc784"; @@ -29,9 +28,7 @@ in }; extraPackages = mkOption { - type = lib.types.functionTo (lib.types.listOf lib.types.package); default = self: []; - defaultText = "self: []"; example = literalExample '' haskellPackages: [ haskellPackages.xmonad-contrib diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 5b11a3fc61c..a6bbca9b30b 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -20,7 +20,6 @@ in options = { boot.kernelPackages = mkOption { - type = types.packageSet; default = pkgs.linuxPackages; # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index 16d0e098b8c..d4cab93b26b 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -17,15 +17,14 @@ in rec { unitOption = mkOptionType { name = "systemd option"; - typerep = "(systemdOption)"; - merge = _module: loc: defs: + merge = loc: defs: let defs' = filterOverrides defs; defs'' = getValues defs'; in if isList (head defs'') then concatLists defs'' - else mergeOneOption _module loc defs'; + else mergeOneOption loc defs'; }; sharedOptions = { diff --git a/nixos/release.nix b/nixos/release.nix index 521cae760ae..d8ef23199cb 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -101,8 +101,6 @@ in rec { manpages = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manpages); options = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux; - optionsSpecs = (buildFromConfig ({ pkgs, ... }: { _module.typeInference = "silent"; }) (config: config.system.build.typechecker.specifications)).x86_64-linux; - # Build the initial ramdisk so Hydra can keep track of its size over time. initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk); From c523cec12c0672666c507143505a7ed7c63bba13 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 1 Mar 2016 21:02:36 +0100 Subject: [PATCH 69/70] josm: 9329 -> 9900 --- pkgs/applications/misc/josm/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/josm/default.nix b/pkgs/applications/misc/josm/default.nix index 9bd7bbb4385..99e337baa1a 100644 --- a/pkgs/applications/misc/josm/default.nix +++ b/pkgs/applications/misc/josm/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { name = "josm-${version}"; - version = "9329"; + version = "9900"; src = fetchurl { url = "https://josm.openstreetmap.de/download/josm-snapshot-${version}.jar"; - sha256 = "084a3pizmz09abn2n7brhx6757bq9k3xq3jy8ip2ifbl2hcrw7pq"; + sha256 = "1dsfamh2bsiz3xkhmh7g4jz6bbh25x22k3zgj1k0v0gj8k6yl7dy"; }; phases = [ "installPhase" ]; From 02891a0de97d965be5b792c60d8287794d3c2e5f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 Mar 2016 22:03:37 +0100 Subject: [PATCH 70/70] gnome: Drop installerIso from nix-env evaluation This makes nix-env -qa depend on NixOS, which is not a good thing. @lethalman --- pkgs/desktops/gnome-3/3.18/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/desktops/gnome-3/3.18/default.nix b/pkgs/desktops/gnome-3/3.18/default.nix index 11e2c7e9beb..de8b6a5e0dc 100644 --- a/pkgs/desktops/gnome-3/3.18/default.nix +++ b/pkgs/desktops/gnome-3/3.18/default.nix @@ -66,7 +66,7 @@ let defaultIconTheme = adwaita-icon-theme; # ISO installer - installerIso = callPackage ./installer.nix {}; +# installerIso = callPackage ./installer.nix {}; #### Core (http://ftp.acc.umu.se/pub/GNOME/core/)