diff --git a/default.nix b/default.nix index c1b9bfd39f9..e0df520721c 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ -if ! builtins ? nixVersion || builtins.compareVersions "1.6" builtins.nixVersion == 1 then +if ! builtins ? nixVersion || builtins.compareVersions "1.7" builtins.nixVersion == 1 then - abort "This version of Nixpkgs requires Nix >= 1.6, please upgrade!" + abort "This version of Nixpkgs requires Nix >= 1.7, please upgrade!" else diff --git a/doc/language-support.xml b/doc/language-support.xml index f5e89df57fc..117e1d93c15 100644 --- a/doc/language-support.xml +++ b/doc/language-support.xml @@ -233,6 +233,17 @@ twisted = buildPythonPackage { +
Ruby + For example, to package yajl-ruby package, use gem-nix: + + + $ nix-env -i gem-nix + $ gem-nix --no-user-install --nix-file=pkgs/development/interpreters/ruby/generated.nix yajl-ruby + $ nix-build -A rubyLibs.yajl-ruby + +
+ +
Java Ant-based Java packages are typically built from source as follows: diff --git a/doc/meta.xml b/doc/meta.xml index e91f94d15c2..fc0ff977792 100644 --- a/doc/meta.xml +++ b/doc/meta.xml @@ -84,8 +84,7 @@ hello-2.3 A program that produces a familiar, friendly greeting
Standard meta-attributes -The following meta-attributes have a standard -interpretation: +It is expected that each meta-attribute is one of the following: @@ -112,12 +111,23 @@ interpretation: package. + + version + Package version. + + homepage The package’s homepage. Example: http://www.gnu.org/software/hello/manual/ + + downloadPage + The page where a link to the current version can be found. Example: + http://ftp.gnu.org/gnu/hello/ + + license The license for the package. One from the @@ -195,6 +205,16 @@ meta.hydraPlatforms = []; they are fixed. + + updateWalker + If set to true, the package is + tested to be updated correctly by the update-walker.sh + script without additional settings. Such packages have + meta.version set and their homepage (or + the page specified by meta.downloadPage) contains + a direct link to the package tarball. + + @@ -256,9 +276,9 @@ to indicate the specific license: - +
- + diff --git a/doc/quick-start.xml b/doc/quick-start.xml index 0f11a906d77..c0f96f87152 100644 --- a/doc/quick-start.xml +++ b/doc/quick-start.xml @@ -92,17 +92,6 @@ $ git add pkgs/development/libraries/libfoo/default.nix hackery.
- - BitTorrent (wxPython-based): pkgs/tools/networking/p2p/bittorrent/default.nix. - Uses an external build - script, which can be useful if you have lots of code - that you don’t want cluttering up the Nix expression. But - external builders are mostly obsolete. - - - Thunderbird: pkgs/applications/networking/mailreaders/thunderbird/default.nix. diff --git a/lib/licenses.nix b/lib/licenses.nix index bdcf8a7b8a7..dadb9b07a08 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -72,6 +72,11 @@ rec { fullName = "Creative Commons Attribution 3.0"; }; + cc-by-40 = spdx { + shortName = "CC-BY-4.0"; + fullName = "Creative Commons Attribution 4.0"; + }; + cddl = spdx { shortName = "CDDL-1.0"; fullName = "Common Development and Distribution License 1.0"; @@ -232,6 +237,11 @@ rec { fullName = "OpenSSL License"; }; + postgresql = spdx { + shortName = "PostgreSQL"; + fullName = "PostgreSQL License"; + }; + psfl = spdx { shortName = "Python-2.0"; fullName = "Python Software Foundation License version 2"; diff --git a/lib/maintainers.nix b/lib/maintainers.nix index 9ff9f7ea27a..a6c41bbe17f 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -15,6 +15,7 @@ AndersonTorres = "Anderson Torres "; andres = "Andres Loeh "; antono = "Antono Vasiljev "; + aristid = "Aristid Breitkreuz "; arobyn = "Alexei Robyn "; astsmtl = "Alexander Tsamutali "; aszlig = "aszlig "; @@ -27,6 +28,7 @@ bjg = "Brian Gough "; bjornfor = "Bjørn Forsman "; bluescreen303 = "Mathijs Kwik "; + bobvanderlinden = "Bob van der Linden "; bodil = "Bodil Stokke "; bosu = "Boris Sukholitko "; calrama = "Moritz Maxeiner "; @@ -38,6 +40,8 @@ coroa = "Jonas Hörsch "; cstrahan = "Charles Strahan "; DamienCassou = "Damien Cassou "; + DerGuteMoritz = "Moritz Heidkamp "; + dbohdan = "Danyil Bohdan "; doublec = "Chris Double "; ederoyd46 = "Matthew Brown "; edwtjo = "Edward Tjörnhammar "; @@ -101,6 +105,7 @@ roelof = "Roelof Wobben "; romildo = "José Romildo Malaquias "; rszibele = "Richard Szibele "; + rycee = "Robert Helgesson "; sander = "Sander van der Burg "; shlevy = "Shea Levy "; simons = "Peter Simons "; @@ -115,6 +120,7 @@ ttuegel = "Thomas Tuegel "; tv = "Tomislav Viljetić "; urkud = "Yury G. Kudryashov "; + vandenoever = "Jos van den Oever "; vbmithr = "Vincent Bernardoff "; vcunat = "Vladimír Čunát "; viric = "Lluís Batlle i Rossell "; diff --git a/lib/modules.nix b/lib/modules.nix index 9fe26083cfd..1d428311cd1 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -132,20 +132,44 @@ rec { The exception is the ‘options’ attribute, which specifies sub-options. These can be specified multiple times to allow one module to add sub-options to an option declared somewhere else - (e.g. multiple modules define sub-options for ‘fileSystems’). */ + (e.g. multiple modules define sub-options for ‘fileSystems’). + + 'loc' is the list of attribute names where the option is located. + + 'opts' is a list of modules. Each module has an options attribute which + correspond to the definition of 'loc' in 'opt.file'. */ mergeOptionDecls = loc: opts: fold (opt: res: if opt.options ? default && res ? default || opt.options ? example && res ? example || opt.options ? description && res ? description || opt.options ? apply && res ? apply || - opt.options ? type && res ? type + # Accept to merge options which have identical types. + opt.options ? type && res ? type && opt.options.type.name != res.type.name then throw "The option `${showOption loc}' in `${opt.file}' is already declared in ${showFiles res.declarations}." else - opt.options // res // + let + /* Add the modules of the current option to the list of modules + already collected. The options attribute except either a list of + submodules or a submodule. For each submodule, we add the file of the + current option declaration as the file use for the submodule. If the + submodule defines any filename, then we ignore the enclosing option file. */ + options' = toList opt.options.options; + addModuleFile = m: + if isFunction m then args: { _file = opt.file; } // (m args) + else { _file = opt.file; } // m; + coerceOption = file: opt: + if isFunction opt then args: { _file = file; } // (opt args) + else { _file = file; options = opt; }; + getSubModules = opt.options.type.getSubModules or null; + submodules = + if getSubModules != null then map addModuleFile getSubModules ++ res.options + else if opt.options ? options then map (coerceOption opt.file) options' ++ res.options + else res.options; + in opt.options // res // { declarations = [opt.file] ++ res.declarations; - options = if opt.options ? options then [(toList opt.options.options ++ res.options)] else []; + options = submodules; } ) { inherit loc; declarations = []; options = []; } opts; @@ -273,15 +297,12 @@ rec { in sort compare defs'; /* Hack for backward compatibility: convert options of type - optionSet to configOf. FIXME: remove eventually. */ + optionSet to options of type submodule. FIXME: remove + eventually. */ fixupOptionType = loc: opt: let - options' = opt.options or + options = opt.options or (throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}."); - coerce = x: - if isFunction x then x - else { config, ... }: { options = x; }; - options = map coerce (flatten options'); f = tp: if tp.name == "option set" || tp.name == "submodule" then throw "The option ${showOption loc} uses submodules without a wrapping type, in ${showFiles opt.declarations}." @@ -290,7 +311,10 @@ 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 opt // { type = f (opt.type or types.unspecified); }; + in + if opt.type.getSubModules or null == null + then opt // { type = f (opt.type or types.unspecified); } + else opt // { type = opt.type.substSubModules opt.options; options = []; }; /* Properties. */ diff --git a/lib/platforms.nix b/lib/platforms.nix index 44a56b659c7..067670c6b3e 100644 --- a/lib/platforms.nix +++ b/lib/platforms.nix @@ -7,7 +7,7 @@ rec { freebsd = ["i686-freebsd" "x86_64-freebsd"]; openbsd = ["i686-openbsd" "x86_64-openbsd"]; netbsd = ["i686-netbsd" "x86_64-netbsd"]; - cygwin = ["i686-cygwin"]; + cygwin = ["i686-cygwin" "x86_64-cygwin"]; unix = linux ++ darwin ++ freebsd ++ openbsd; all = linux ++ darwin ++ cygwin ++ freebsd ++ openbsd; none = []; diff --git a/lib/types.nix b/lib/types.nix index 0e2b6515e16..1e7abf36535 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -33,9 +33,14 @@ rec { , # 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 }: { _type = "option-type"; - inherit name check merge getSubOptions; + inherit name check merge getSubOptions getSubModules substSubModules; }; @@ -110,6 +115,8 @@ rec { elemType.merge (loc ++ ["[${toString n}-${toString m}]"]) [{ inherit (def) file; value = def'; }]) def.value) defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); + getSubModules = elemType.getSubModules; + substSubModules = m: listOf (elemType.substSubModules m); }; attrsOf = elemType: mkOptionType { @@ -121,6 +128,8 @@ rec { (map (def: listToAttrs (mapAttrsToList (n: def': { name = n; value = { inherit (def) file; value = def'; }; }) def.value)) defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); + getSubModules = elemType.getSubModules; + substSubModules = m: attrsOf (elemType.substSubModules m); }; # List or attribute set of ... @@ -147,12 +156,16 @@ rec { else false; merge = loc: defs: attrOnly.merge loc (imap convertIfList defs); getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); + getSubModules = elemType.getSubModules; + substSubModules = m: loaOf (elemType.substSubModules m); }; uniq = elemType: mkOptionType { inherit (elemType) name check; merge = mergeOneOption; getSubOptions = elemType.getSubOptions; + getSubModules = elemType.getSubModules; + substSubModules = m: uniq (elemType.substSubModules m); }; nullOr = elemType: mkOptionType { @@ -165,14 +178,8 @@ rec { throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}." else elemType.merge loc defs; getSubOptions = elemType.getSubOptions; - }; - - functionTo = elemType: mkOptionType { - name = "function that evaluates to a(n) ${elemType.name}"; - check = isFunction; - merge = loc: defs: - fnArgs: elemType.merge loc (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs); - getSubOptions = elemType.getSubOptions; + getSubModules = elemType.getSubModules; + substSubModules = m: nullOr (elemType.substSubModules m); }; submodule = opts: @@ -192,6 +199,8 @@ rec { { modules = opts'; inherit prefix; # FIXME: hack to get shit to evaluate. args = { name = ""; }; }).options; + getSubModules = opts'; + substSubModules = m: submodule m; }; enum = values: mkOptionType { diff --git a/nixos/doc/manual/configuration/user-mgmt.xml b/nixos/doc/manual/configuration/user-mgmt.xml index 40dc687d03b..40362fbbb23 100644 --- a/nixos/doc/manual/configuration/user-mgmt.xml +++ b/nixos/doc/manual/configuration/user-mgmt.xml @@ -13,11 +13,10 @@ states that a user account named alice shall exist: users.extraUsers.alice = - { createHome = true; + { isNormalUser = true; home = "/home/alice"; description = "Alice Foobar"; extraGroups = [ "wheel" "networkmanager" ]; - useDefaultShell = true; openssh.authorizedKeys.keys = [ "ssh-dss AAAAB3Nza... alice@foobar" ]; }; @@ -58,11 +57,6 @@ users.extraGroups.students.gid = 1000; As with users, the group ID (gid) is optional and will be assigned automatically if it’s missing. -Currently declarative user management is not perfect: -nixos-rebuild does not know how to realise certain -configuration changes. This includes removing a user or group, and -removing group membership from a user. - In the imperative style, users and groups are managed by commands such as useradd, groupmod and so on. For instance, to create a user diff --git a/nixos/doc/manual/configuration/x-windows.xml b/nixos/doc/manual/configuration/x-windows.xml index bc58bb1f066..4008e89fcea 100644 --- a/nixos/doc/manual/configuration/x-windows.xml +++ b/nixos/doc/manual/configuration/x-windows.xml @@ -67,7 +67,7 @@ with other kernel modules. On 64-bit systems, if you want full acceleration for 32-bit programs such as Wine, you should also set the following: -services.xserver.driSupport32Bit = true; +hardware.opengl.driSupport32Bit = true; diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 47e01437ccc..68248081af6 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -6,12 +6,21 @@ with pkgs.lib; let # Remove invisible and internal options. - options' = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options); + optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options); + + # Replace functions by the string + substFunction = x: + if builtins.isAttrs x then mapAttrs (name: substFunction) x + else if builtins.isList x then map substFunction x + else if builtins.isFunction x then "" + else x; # Clean up declaration sites to not refer to the NixOS source tree. - options'' = flip map options' (opt: opt // { + optionsList' = flip map optionsList (opt: opt // { declarations = map (fn: stripPrefix fn) opt.declarations; - }); + } + // optionalAttrs (opt ? example) { example = substFunction opt.example; } + // optionalAttrs (opt ? default) { default = substFunction opt.default; }); prefix = toString ../../..; @@ -21,10 +30,35 @@ let else fn; - optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML options'')); + # Convert the list of options into an XML file and a JSON file. The builtin + # unsafeDiscardStringContext is used to prevent the realisation of the store + # paths which are used in options definitions. + optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML optionsList')); + optionsJSON = builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON optionsList')); + + # Tools-friendly version of the list of NixOS options. + options' = stdenv.mkDerivation { + name = "options"; + + buildCommand = '' + # Export list of options in different format. + dst=$out/share/doc/nixos + mkdir -p $dst + + cp ${optionsJSON} $dst/options.json + cp ${optionsXML} $dst/options.xml + + mkdir -p $out/nix-support + echo "file json $dst/options.json" >> $out/nix-support/hydra-build-products + echo "file xml $dst/options.xml" >> $out/nix-support/hydra-build-products + ''; # */ + + meta.description = "List of NixOS options in various formats."; + }; optionsDocBook = runCommand "options-db.xml" {} '' - if grep /nixpkgs/nixos/modules ${optionsXML}; then + optionsXML=${options'}/share/doc/nixos/options.xml + if grep /nixpkgs/nixos/modules $optionsXML; then echo "The manual appears to depend on the location of Nixpkgs, which is bad" echo "since this prevents sharing via the NixOS channel. This is typically" echo "caused by an option default that refers to a relative path (see above" @@ -33,7 +67,7 @@ let fi ${libxslt}/bin/xsltproc \ --stringparam revision '${revision}' \ - -o $out ${./options-to-docbook.xsl} ${optionsXML} + -o $out ${./options-to-docbook.xsl} $optionsXML ''; sources = sourceFilesBySuffices ./. [".xml"]; @@ -49,6 +83,9 @@ let in rec { + # Tools-friendly version of the list of NixOS options. + options = options'; + # Generate the NixOS manual. manual = stdenv.mkDerivation { name = "nixos-manual"; @@ -90,7 +127,7 @@ in rec { mkdir -p $out/nix-support echo "nix-build out $out" >> $out/nix-support/hydra-build-products - echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products + echo "doc manual $dst" >> $out/nix-support/hydra-build-products ''; # */ meta.description = "The NixOS manual in HTML format"; diff --git a/nixos/doc/manual/man-nixos-option.xml b/nixos/doc/manual/man-nixos-option.xml index 7952847d4db..2875336c67e 100644 --- a/nixos/doc/manual/man-nixos-option.xml +++ b/nixos/doc/manual/man-nixos-option.xml @@ -17,11 +17,6 @@ nixos-option - - - - - option.name @@ -31,50 +26,13 @@ This command evaluates the configuration specified in /etc/nixos/configuration.nix and returns the properties -of the option name given as argument. By default, it returns the value of -the option. +of the option name given as argument. When the option name is not an option, the command prints the list of attributes contained in the attribute set. -Options - -This command accepts the following options: - - - - - , - - Returns the value of the option. This is the default operation - if no other options are defined. - - - - - , - - Return the default value, the example and the description of the - option when available. - - - - - , - - Return the locations where the option is declared and where it - is defined. This is extremely useful to find sources of errors in - your configuration. - - - - - - - - Environment @@ -103,27 +61,21 @@ grub initScript $ nixos-option boot.loader.grub.enable -true +Value: +true -Prints option information: +Default: +true -$ nixos-option -d networking.hostName -Default: "nixos" Description: -The name of the machine. Leave it empty if you want to obtain -it from a DHCP server (if using DHCP). +Whether to enable the GNU GRUB boot loader. -Find the locations which are declaring and defining an option: - -$ nixos-option -l hardware.firmware Declared by: - /mnt/data/nix-sources/nixos/modules/services/hardware/udev.nix + "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix" Defined by: - /path/to/nixpkgs/nixos/modules/system/boot/kernel.nix - /path/to/nixpkgs/nixos/modules/hardware/network/rt73.nix - /path/to/nixpkgs/nixos/modules/hardware/network/intel-3945abg.nix - /path/to/nixpkgs/nixos/modules/hardware/network/intel-2200bg.nix + "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix" + diff --git a/nixos/lib/test-driver/log2html.xsl b/nixos/lib/test-driver/log2html.xsl index ce8a9c6de2b..0485412b4c8 100644 --- a/nixos/lib/test-driver/log2html.xsl +++ b/nixos/lib/test-driver/log2html.xsl @@ -9,8 +9,8 @@ - - + +