diff --git a/doc/coding-conventions.xml b/doc/coding-conventions.xml index 48356247a49..799f1479467 100644 --- a/doc/coding-conventions.xml +++ b/doc/coding-conventions.xml @@ -8,24 +8,17 @@ - Use 2 spaces of indentation per indentation level in Nix expressions, 4 - spaces in shell scripts. + Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts. - Do not use tab characters, i.e. configure your editor to use soft tabs. - For instance, use (setq-default indent-tabs-mode nil) - in Emacs. Everybody has different tab settings so it’s asking for - trouble. + Do not use tab characters, i.e. configure your editor to use soft tabs. For instance, use (setq-default indent-tabs-mode nil) in Emacs. Everybody has different tab settings so it’s asking for trouble. - Use lowerCamelCase for variable names, not - UpperCamelCase. Note, this rule does not apply to - package attribute names, which instead follow the rules in - . + Use lowerCamelCase for variable names, not UpperCamelCase. Note, this rule does not apply to package attribute names, which instead follow the rules in . @@ -52,8 +45,7 @@ foo { arg = ...; } - In attribute sets or lists that span multiple lines, the attribute names - or list elements should be aligned: + In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned: # A long list. list = [ @@ -97,8 +89,7 @@ attrs = { x = 1280; y = 1024; }; - Breaking in the middle of a function argument can give hard-to-read code, - like + Breaking in the middle of a function argument can give hard-to-read code, like someFunction { x = 1280; y = 1024; } otherArg @@ -123,8 +114,7 @@ in someFunction res otherArg yetAnotherArg - The bodies of functions, asserts, and withs are not indented to prevent a - lot of superfluous indentation levels, i.e. + The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e. { arg1, arg2 }: assert system == "i686-linux"; @@ -156,8 +146,7 @@ stdenv.mkDerivation { ... - Functions should list their expected arguments as precisely as possible. - That is, write + Functions should list their expected arguments as precisely as possible. That is, write { stdenv, fetchurl, perl }: ... @@ -171,9 +160,7 @@ args: with args; ... - For functions that are truly generic in the number of arguments (such as - wrappers around mkDerivation) that have some required - arguments, you should write them using an @-pattern: + For functions that are truly generic in the number of arguments (such as wrappers around mkDerivation) that have some required arguments, you should write them using an @-pattern: { stdenv, doCoverageAnalysis ? false, ... } @ args: @@ -197,35 +184,20 @@ args.stdenv.mkDerivation (args // { Package naming - The key words must, must not, - required, shall, shall - not, should, should - not, recommended, may, - and optional in this section are to be interpreted as - described in RFC - 2119. Only emphasized words are to be - interpreted in this way. + The key words must, must not, required, shall, shall not, should, should not, recommended, may, and optional in this section are to be interpreted as described in RFC 2119. Only emphasized words are to be interpreted in this way. - In Nixpkgs, there are generally three different names associated with a - package: + In Nixpkgs, there are generally three different names associated with a package: - The name attribute of the derivation (excluding the - version part). This is what most users see, in particular when using - nix-env. + The name attribute of the derivation (excluding the version part). This is what most users see, in particular when using nix-env. - The variable name used for the instantiated package in - all-packages.nix, and when passing it as a - dependency to other functions. Typically this is called the - package attribute name. This is what Nix expression - authors see. It can also be used when installing using nix-env - -iA. + The variable name used for the instantiated package in all-packages.nix, and when passing it as a dependency to other functions. Typically this is called the package attribute name. This is what Nix expression authors see. It can also be used when installing using nix-env -iA. @@ -234,12 +206,7 @@ args.stdenv.mkDerivation (args // { - Most of the time, these are the same. For instance, the package - e2fsprogs has a name attribute - "e2fsprogs-version", is bound - to the variable name e2fsprogs in - all-packages.nix, and the Nix expression is in - pkgs/os-specific/linux/e2fsprogs/default.nix. + Most of the time, these are the same. For instance, the package e2fsprogs has a name attribute "e2fsprogs-version", is bound to the variable name e2fsprogs in all-packages.nix, and the Nix expression is in pkgs/os-specific/linux/e2fsprogs/default.nix. @@ -247,51 +214,32 @@ args.stdenv.mkDerivation (args // { - The name attribute should be - identical to the upstream package name. + The name attribute should be identical to the upstream package name. - The name attribute must not - contain uppercase letters — e.g., "mplayer-1.0rc2" - instead of "MPlayer-1.0rc2". + The name attribute must not contain uppercase letters — e.g., "mplayer-1.0rc2" instead of "MPlayer-1.0rc2". - The version part of the name attribute - must start with a digit (following a dash) — e.g., - "hello-0.3.1rc2". + The version part of the name attribute must start with a digit (following a dash) — e.g., "hello-0.3.1rc2". - If a package is not a release but a commit from a repository, then the - version part of the name must be the date of that - (fetched) commit. The date must be in - "YYYY-MM-DD" format. Also append - "unstable" to the name - e.g., - "pkgname-unstable-2014-09-23". + If a package is not a release but a commit from a repository, then the version part of the name must be the date of that (fetched) commit. The date must be in "YYYY-MM-DD" format. Also append "unstable" to the name - e.g., "pkgname-unstable-2014-09-23". - Dashes in the package name should be preserved in - new variable names, rather than converted to underscores or camel cased - — e.g., http-parser instead of - http_parser or httpParser. The - hyphenated style is preferred in all three package names. + Dashes in the package name should be preserved in new variable names, rather than converted to underscores or camel cased — e.g., http-parser instead of http_parser or httpParser. The hyphenated style is preferred in all three package names. - If there are multiple versions of a package, this - should be reflected in the variable names in - all-packages.nix, e.g. json-c-0-9 - and json-c-0-11. If there is an obvious “default” - version, make an attribute like json-c = json-c-0-9;. - See also + If there are multiple versions of a package, this should be reflected in the variable names in all-packages.nix, e.g. json-c-0-9 and json-c-0-11. If there is an obvious “default” version, make an attribute like json-c = json-c-0-9;. See also @@ -301,31 +249,18 @@ args.stdenv.mkDerivation (args // { File naming and organisation - Names of files and directories should be in lowercase, with dashes between - words — not in camel case. For instance, it should be - all-packages.nix, not - allPackages.nix or - AllPackages.nix. + Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be all-packages.nix, not allPackages.nix or AllPackages.nix.
Hierarchy - Each package should be stored in its own directory somewhere in the - pkgs/ tree, i.e. in - pkgs/category/subcategory/.../pkgname. - Below are some rules for picking the right category for a package. Many - packages fall under several categories; what matters is the - primary purpose of a package. For example, the - libxml2 package builds both a library and some tools; - but it’s a library foremost, so it goes under - pkgs/development/libraries. + Each package should be stored in its own directory somewhere in the pkgs/ tree, i.e. in pkgs/category/subcategory/.../pkgname. Below are some rules for picking the right category for a package. Many packages fall under several categories; what matters is the primary purpose of a package. For example, the libxml2 package builds both a library and some tools; but it’s a library foremost, so it goes under pkgs/development/libraries. - When in doubt, consider refactoring the pkgs/ tree, - e.g. creating new categories or splitting up an existing category. + When in doubt, consider refactoring the pkgs/ tree, e.g. creating new categories or splitting up an existing category. @@ -341,8 +276,7 @@ args.stdenv.mkDerivation (args // { - development/libraries (e.g. - libxml2) + development/libraries (e.g. libxml2) @@ -352,8 +286,7 @@ args.stdenv.mkDerivation (args // { - development/compilers (e.g. - gcc) + development/compilers (e.g. gcc) @@ -363,8 +296,7 @@ args.stdenv.mkDerivation (args // { - development/interpreters (e.g. - guile) + development/interpreters (e.g. guile) @@ -380,8 +312,7 @@ args.stdenv.mkDerivation (args // { - development/tools/parsing (e.g. - bison, flex) + development/tools/parsing (e.g. bison, flex) @@ -391,8 +322,7 @@ args.stdenv.mkDerivation (args // { - development/tools/build-managers (e.g. - gnumake) + development/tools/build-managers (e.g. gnumake) @@ -402,8 +332,7 @@ args.stdenv.mkDerivation (args // { - development/tools/misc (e.g. - binutils) + development/tools/misc (e.g. binutils) @@ -429,8 +358,7 @@ args.stdenv.mkDerivation (args // { - (A tool is a relatively small program, especially one intended to be - used non-interactively.) + (A tool is a relatively small program, especially one intended to be used non-interactively.) @@ -439,8 +367,7 @@ args.stdenv.mkDerivation (args // { - tools/networking (e.g. - wget) + tools/networking (e.g. wget) @@ -470,8 +397,7 @@ args.stdenv.mkDerivation (args // { - tools/archivers (e.g. zip, - tar) + tools/archivers (e.g. zip, tar) @@ -481,8 +407,7 @@ args.stdenv.mkDerivation (args // { - tools/compression (e.g. - gzip, bzip2) + tools/compression (e.g. gzip, bzip2) @@ -492,8 +417,7 @@ args.stdenv.mkDerivation (args // { - tools/security (e.g. nmap, - gnupg) + tools/security (e.g. nmap, gnupg) @@ -532,8 +456,7 @@ args.stdenv.mkDerivation (args // { - servers/http (e.g. - apache-httpd) + servers/http (e.g. apache-httpd) @@ -543,8 +466,7 @@ args.stdenv.mkDerivation (args // { - servers/x11 (e.g. xorg — - this includes the client libraries and programs) + servers/x11 (e.g. xorg — this includes the client libraries and programs) @@ -567,8 +489,7 @@ args.stdenv.mkDerivation (args // { - desktops (e.g. kde, - gnome, enlightenment) + desktops (e.g. kde, gnome, enlightenment) @@ -578,8 +499,7 @@ args.stdenv.mkDerivation (args // { - applications/window-managers (e.g. - awesome, stumpwm) + applications/window-managers (e.g. awesome, stumpwm) @@ -589,8 +509,7 @@ args.stdenv.mkDerivation (args // { - A (typically large) program with a distinct user interface, primarily - used interactively. + A (typically large) program with a distinct user interface, primarily used interactively. @@ -599,8 +518,7 @@ args.stdenv.mkDerivation (args // { - applications/version-management (e.g. - subversion) + applications/version-management (e.g. subversion) @@ -610,8 +528,7 @@ args.stdenv.mkDerivation (args // { - applications/video (e.g. - vlc) + applications/video (e.g. vlc) @@ -621,8 +538,7 @@ args.stdenv.mkDerivation (args // { - applications/graphics (e.g. - gimp) + applications/graphics (e.g. gimp) @@ -638,8 +554,7 @@ args.stdenv.mkDerivation (args // { - applications/networking/mailreaders (e.g. - thunderbird) + applications/networking/mailreaders (e.g. thunderbird) @@ -649,8 +564,7 @@ args.stdenv.mkDerivation (args // { - applications/networking/newsreaders (e.g. - pan) + applications/networking/newsreaders (e.g. pan) @@ -660,8 +574,7 @@ args.stdenv.mkDerivation (args // { - applications/networking/browsers (e.g. - firefox) + applications/networking/browsers (e.g. firefox) @@ -719,8 +632,7 @@ args.stdenv.mkDerivation (args // { - data/sgml+xml/schemas/xml-dtd (e.g. - docbook) + data/sgml+xml/schemas/xml-dtd (e.g. docbook) @@ -733,8 +645,7 @@ args.stdenv.mkDerivation (args // { (Okay, these are executable...) - data/sgml+xml/stylesheets/xslt (e.g. - docbook-xsl) + data/sgml+xml/stylesheets/xslt (e.g. docbook-xsl) @@ -771,36 +682,15 @@ args.stdenv.mkDerivation (args // { Versioning - Because every version of a package in Nixpkgs creates a potential - maintenance burden, old versions of a package should not be kept unless - there is a good reason to do so. For instance, Nixpkgs contains several - versions of GCC because other packages don’t build with the latest - version of GCC. Other examples are having both the latest stable and latest - pre-release version of a package, or to keep several major releases of an - application that differ significantly in functionality. + Because every version of a package in Nixpkgs creates a potential maintenance burden, old versions of a package should not be kept unless there is a good reason to do so. For instance, Nixpkgs contains several versions of GCC because other packages don’t build with the latest version of GCC. Other examples are having both the latest stable and latest pre-release version of a package, or to keep several major releases of an application that differ significantly in functionality. - If there is only one version of a package, its Nix expression should be - named e2fsprogs/default.nix. If there are multiple - versions, this should be reflected in the filename, e.g. - e2fsprogs/1.41.8.nix and - e2fsprogs/1.41.9.nix. The version in the filename - should leave out unnecessary detail. For instance, if we keep the latest - Firefox 2.0.x and 3.5.x versions in Nixpkgs, they should be named - firefox/2.0.nix and - firefox/3.5.nix, respectively (which, at a given - point, might contain versions 2.0.0.20 and - 3.5.4). If a version requires many auxiliary files, you - can use a subdirectory for each version, e.g. - firefox/2.0/default.nix and - firefox/3.5/default.nix. + If there is only one version of a package, its Nix expression should be named e2fsprogs/default.nix. If there are multiple versions, this should be reflected in the filename, e.g. e2fsprogs/1.41.8.nix and e2fsprogs/1.41.9.nix. The version in the filename should leave out unnecessary detail. For instance, if we keep the latest Firefox 2.0.x and 3.5.x versions in Nixpkgs, they should be named firefox/2.0.nix and firefox/3.5.nix, respectively (which, at a given point, might contain versions 2.0.0.20 and 3.5.4). If a version requires many auxiliary files, you can use a subdirectory for each version, e.g. firefox/2.0/default.nix and firefox/3.5/default.nix. - All versions of a package must be included in - all-packages.nix to make sure that they evaluate - correctly. + All versions of a package must be included in all-packages.nix to make sure that they evaluate correctly.
@@ -808,25 +698,15 @@ args.stdenv.mkDerivation (args // { Fetching Sources - There are multiple ways to fetch a package source in nixpkgs. The general - guideline is that you should package reproducible sources with a high degree - of availability. Right now there is only one fetcher which has mirroring - support and that is fetchurl. Note that you should also - prefer protocols which have a corresponding proxy environment variable. + There are multiple ways to fetch a package source in nixpkgs. The general guideline is that you should package reproducible sources with a high degree of availability. Right now there is only one fetcher which has mirroring support and that is fetchurl. Note that you should also prefer protocols which have a corresponding proxy environment variable. - You can find many source fetch helpers in - pkgs/build-support/fetch*. + You can find many source fetch helpers in pkgs/build-support/fetch*. - In the file pkgs/top-level/all-packages.nix you can find - fetch helpers, these have names on the form fetchFrom*. - The intention of these are to provide snapshot fetches but using the same - api as some of the version controlled fetchers from - pkgs/build-support/. As an example going from bad to - good: + In the file pkgs/top-level/all-packages.nix you can find fetch helpers, these have names on the form fetchFrom*. The intention of these are to provide snapshot fetches but using the same api as some of the version controlled fetchers from pkgs/build-support/. As an example going from bad to good: @@ -863,11 +743,7 @@ src = fetchFromGitHub { sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc"; } - Find the value to put as sha256 by running - nix run -f '<nixpkgs>' nix-prefetch-github -c - nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS - nix or nix-prefetch-url --unpack - https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz. + Find the value to put as sha256 by running nix run -f '<nixpkgs>' nix-prefetch-github -c nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS nix or nix-prefetch-url --unpack https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz. @@ -883,40 +759,23 @@ src = fetchFromGitHub { - Prefetch URL (with nix-prefetch-XXX - URL, where - XXX is one of url, - git, hg, cvs, - bzr, svn). Hash is printed to - stdout. + Prefetch URL (with nix-prefetch-XXX URL, where XXX is one of url, git, hg, cvs, bzr, svn). Hash is printed to stdout. - Prefetch by package source (with nix-prefetch-url - '<nixpkgs>' -A PACKAGE.src, - where PACKAGE is package attribute name). Hash - is printed to stdout. + Prefetch by package source (with nix-prefetch-url '<nixpkgs>' -A PACKAGE.src, where PACKAGE is package attribute name). Hash is printed to stdout. - This works well when you've upgraded existing package version and want to - find out new hash, but is useless if package can't be accessed by - attribute or package has multiple sources (.srcs, - architecture-dependent sources, etc). + This works well when you've upgraded existing package version and want to find out new hash, but is useless if package can't be accessed by attribute or package has multiple sources (.srcs, architecture-dependent sources, etc). - Upstream provided hash: use it when upstream provides - sha256 or sha512 (when upstream - provides md5, don't use it, compute - sha256 instead). + Upstream provided hash: use it when upstream provides sha256 or sha512 (when upstream provides md5, don't use it, compute sha256 instead). - A little nuance is that nix-prefetch-* tools produce - hash encoded with base32, but upstream usually provides - hexadecimal (base16) encoding. Fetchers understand both - formats. Nixpkgs does not standardize on any one format. + A little nuance is that nix-prefetch-* tools produce hash encoded with base32, but upstream usually provides hexadecimal (base16) encoding. Fetchers understand both formats. Nixpkgs does not standardize on any one format. You can convert between formats with nix-hash, for example: @@ -927,28 +786,18 @@ src = fetchFromGitHub { - Extracting hash from local source tarball can be done with - sha256sum. Use nix-prefetch-url - file:///path/to/tarball if you want base32 hash. + Extracting hash from local source tarball can be done with sha256sum. Use nix-prefetch-url file:///path/to/tarball if you want base32 hash. - Fake hash: set fake hash in package expression, perform build and extract - correct hash from error Nix prints. + Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints. - For package updates it is enough to change one symbol to make hash fake. - For new packages, you can use lib.fakeSha256, - lib.fakeSha512 or any other fake hash. + For package updates it is enough to change one symbol to make hash fake. For new packages, you can use lib.fakeSha256, lib.fakeSha512 or any other fake hash. - This is last resort method when reconstructing source URL is non-trivial - and nix-prefetch-url -A isn't applicable (for example, - - one of kodi dependencies). The easiest way then - would be replace hash with a fake one and rebuild. Nix build will fail and - error message will contain desired hash. + This is last resort method when reconstructing source URL is non-trivial and nix-prefetch-url -A isn't applicable (for example, one of kodi dependencies). The easiest way then would be replace hash with a fake one and rebuild. Nix build will fail and error message will contain desired hash. @@ -962,9 +811,7 @@ src = fetchFromGitHub { Obtaining hashes securely - Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead - of fetching source you can fetch malware, and instead of source hash you - get hash of malware. Here are security considerations for this scenario: + Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead of fetching source you can fetch malware, and instead of source hash you get hash of malware. Here are security considerations for this scenario: @@ -975,8 +822,7 @@ src = fetchFromGitHub { - hashes from upstream (in method 3) should be obtained via secure - protocol; + hashes from upstream (in method 3) should be obtained via secure protocol; @@ -986,12 +832,7 @@ src = fetchFromGitHub { - https:// URLs are not secure in method 5. When - obtaining hashes with fake hash method, TLS checks are disabled. So - refetch source hash from several different networks to exclude MITM - scenario. Alternatively, use fake hash method to make Nix error, but - instead of extracting hash from error, extract - https:// URL and prefetch it with method 1. + https:// URLs are not secure in method 5. When obtaining hashes with fake hash method, TLS checks are disabled. So refetch source hash from several different networks to exclude MITM scenario. Alternatively, use fake hash method to make Nix error, but instead of extracting hash from error, extract https:// URL and prefetch it with method 1. @@ -1001,8 +842,7 @@ src = fetchFromGitHub { Patches - Patches available online should be retrieved using - fetchpatch. + Patches available online should be retrieved using fetchpatch. @@ -1018,10 +858,7 @@ patches = [ - Otherwise, you can add a .patch file to the - nixpkgs repository. In the interest of keeping our - maintenance burden to a minimum, only patches that are unique to - nixpkgs should be added in this way. + Otherwise, you can add a .patch file to the nixpkgs repository. In the interest of keeping our maintenance burden to a minimum, only patches that are unique to nixpkgs should be added in this way. @@ -1031,8 +868,7 @@ patches = [ ./0001-changes.patch ]; - If you do need to do create this sort of patch file, one way to do so is - with git: + If you do need to do create this sort of patch file, one way to do so is with git: @@ -1043,8 +879,7 @@ patches = [ ./0001-changes.patch ]; - If a git repository is not already present, create one and stage all of - the source files. + If a git repository is not already present, create one and stage all of the source files. $ git init $ git add . @@ -1052,8 +887,7 @@ patches = [ ./0001-changes.patch ]; - Edit some files to make whatever changes need to be included in the - patch. + Edit some files to make whatever changes need to be included in the patch. diff --git a/doc/configuration.xml b/doc/configuration.xml index b497fa4e272..cb660452d82 100644 --- a/doc/configuration.xml +++ b/doc/configuration.xml @@ -3,49 +3,38 @@ xml:id="chap-packageconfig"> Global configuration - Nix comes with certain defaults about what packages can and cannot be - installed, based on a package's metadata. By default, Nix will prevent - installation if any of the following criteria are true: + Nix comes with certain defaults about what packages can and cannot be installed, based on a package's metadata. By default, Nix will prevent installation if any of the following criteria are true: - The package is thought to be broken, and has had its - meta.broken set to true. + The package is thought to be broken, and has had its meta.broken set to true. - The package isn't intended to run on the given system, as none of its - meta.platforms match the given system. + The package isn't intended to run on the given system, as none of its meta.platforms match the given system. - The package's meta.license is set to a license which is - considered to be unfree. + The package's meta.license is set to a license which is considered to be unfree. - The package has known security vulnerabilities but has not or can not be - updated for some reason, and a list of issues has been entered in to the - package's meta.knownVulnerabilities. + The package has known security vulnerabilities but has not or can not be updated for some reason, and a list of issues has been entered in to the package's meta.knownVulnerabilities. - Note that all this is checked during evaluation already, and the check - includes any package that is evaluated. In particular, all build-time - dependencies are checked. nix-env -qa will (attempt to) - hide any packages that would be refused. + Note that all this is checked during evaluation already, and the check includes any package that is evaluated. In particular, all build-time dependencies are checked. nix-env -qa will (attempt to) hide any packages that would be refused. Each of these criteria can be altered in the nixpkgs configuration. - The nixpkgs configuration for a NixOS system is set in the - configuration.nix, as in the following example: + The nixpkgs configuration for a NixOS system is set in the configuration.nix, as in the following example: { nixpkgs.config = { @@ -53,13 +42,10 @@ }; } - However, this does not allow unfree software for individual users. Their - configurations are managed separately. + However, this does not allow unfree software for individual users. Their configurations are managed separately. - A user's of nixpkgs configuration is stored in a user-specific configuration - file located at ~/.config/nixpkgs/config.nix. For - example: + A user's of nixpkgs configuration is stored in a user-specific configuration file located at ~/.config/nixpkgs/config.nix. For example: { allowUnfree = true; @@ -67,31 +53,25 @@ - Note that we are not able to test or build unfree software on Hydra due to - policy. Most unfree licenses prohibit us from either executing or - distributing the software. + Note that we are not able to test or build unfree software on Hydra due to policy. Most unfree licenses prohibit us from either executing or distributing the software.
Installing broken packages - There are two ways to try compiling a package which has been marked as - broken. + There are two ways to try compiling a package which has been marked as broken. - For allowing the build of a broken package once, you can use an - environment variable for a single invocation of the nix tools: + For allowing the build of a broken package once, you can use an environment variable for a single invocation of the nix tools: $ export NIXPKGS_ALLOW_BROKEN=1 - For permanently allowing broken packages to be built, you may add - allowBroken = true; to your user's configuration file, - like this: + For permanently allowing broken packages to be built, you may add allowBroken = true; to your user's configuration file, like this: { allowBroken = true; @@ -105,23 +85,19 @@ Installing packages on unsupported systems - There are also two ways to try compiling a package which has been marked as - unsuported for the given system. + There are also two ways to try compiling a package which has been marked as unsuported for the given system. - For allowing the build of a broken package once, you can use an - environment variable for a single invocation of the nix tools: + For allowing the build of a broken package once, you can use an environment variable for a single invocation of the nix tools: $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 - For permanently allowing broken packages to be built, you may add - allowUnsupportedSystem = true; to your user's - configuration file, like this: + For permanently allowing broken packages to be built, you may add allowUnsupportedSystem = true; to your user's configuration file, like this: { allowUnsupportedSystem = true; @@ -132,42 +108,29 @@ - The difference between a package being unsupported on some system and being - broken is admittedly a bit fuzzy. If a program ought to - work on a certain platform, but doesn't, the platform should be included in - meta.platforms, but marked as broken with e.g. - meta.broken = !hostPlatform.isWindows. Of course, this - begs the question of what "ought" means exactly. That is left to the package - maintainer. + The difference between a package being unsupported on some system and being broken is admittedly a bit fuzzy. If a program ought to work on a certain platform, but doesn't, the platform should be included in meta.platforms, but marked as broken with e.g. meta.broken = !hostPlatform.isWindows. Of course, this begs the question of what "ought" means exactly. That is left to the package maintainer.
Installing unfree packages - There are several ways to tweak how Nix handles a package which has been - marked as unfree. + There are several ways to tweak how Nix handles a package which has been marked as unfree. - To temporarily allow all unfree packages, you can use an environment - variable for a single invocation of the nix tools: + To temporarily allow all unfree packages, you can use an environment variable for a single invocation of the nix tools: $ export NIXPKGS_ALLOW_UNFREE=1 - It is possible to permanently allow individual unfree packages, while - still blocking unfree packages by default using the - allowUnfreePredicate configuration option in the user - configuration file. + It is possible to permanently allow individual unfree packages, while still blocking unfree packages by default using the allowUnfreePredicate configuration option in the user configuration file. - This option is a function which accepts a package as a parameter, and - returns a boolean. The following example configuration accepts a package - and always returns false: + This option is a function which accepts a package as a parameter, and returns a boolean. The following example configuration accepts a package and always returns false: { allowUnfreePredicate = (pkg: false); @@ -175,8 +138,7 @@ - For a more useful example, try the following. This configuration only - allows unfree packages named flash player and visual studio code: + For a more useful example, try the following. This configuration only allows unfree packages named flash player and visual studio code: { allowUnfreePredicate = (pkg: builtins.elem @@ -190,14 +152,10 @@ - It is also possible to whitelist and blacklist licenses that are - specifically acceptable or not acceptable, using - whitelistedLicenses and - blacklistedLicenses, respectively. + It is also possible to whitelist and blacklist licenses that are specifically acceptable or not acceptable, using whitelistedLicenses and blacklistedLicenses, respectively. - The following example configuration whitelists the licenses - amd and wtfpl: + The following example configuration whitelists the licenses amd and wtfpl: { whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ]; @@ -205,8 +163,7 @@ - The following example configuration blacklists the gpl3 - and agpl3 licenses: + The following example configuration blacklists the gpl3 and agpl3 licenses: { blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ]; @@ -217,37 +174,29 @@ - A complete list of licenses can be found in the file - lib/licenses.nix of the nixpkgs tree. + A complete list of licenses can be found in the file lib/licenses.nix of the nixpkgs tree.
Installing insecure packages - There are several ways to tweak how Nix handles a package which has been - marked as insecure. + There are several ways to tweak how Nix handles a package which has been marked as insecure. - To temporarily allow all insecure packages, you can use an environment - variable for a single invocation of the nix tools: + To temporarily allow all insecure packages, you can use an environment variable for a single invocation of the nix tools: $ export NIXPKGS_ALLOW_INSECURE=1 - It is possible to permanently allow individual insecure packages, while - still blocking other insecure packages by default using the - permittedInsecurePackages configuration option in the - user configuration file. + It is possible to permanently allow individual insecure packages, while still blocking other insecure packages by default using the permittedInsecurePackages configuration option in the user configuration file. - The following example configuration permits the installation of the - hypothetically insecure package hello, version - 1.2.3: + The following example configuration permits the installation of the hypothetically insecure package hello, version 1.2.3: { permittedInsecurePackages = [ @@ -259,18 +208,13 @@ - It is also possible to create a custom policy around which insecure - packages to allow and deny, by overriding the - allowInsecurePredicate configuration option. + It is also possible to create a custom policy around which insecure packages to allow and deny, by overriding the allowInsecurePredicate configuration option. - The allowInsecurePredicate option is a function which - accepts a package and returns a boolean, much like - allowUnfreePredicate. + The allowInsecurePredicate option is a function which accepts a package and returns a boolean, much like allowUnfreePredicate. - The following configuration example only allows insecure packages with - very short names: + The following configuration example only allows insecure packages with very short names: { allowInsecurePredicate = (pkg: (builtins.stringLength (builtins.parseDrvName pkg.name).name) <= 5); @@ -278,8 +222,7 @@ - Note that permittedInsecurePackages is only checked if - allowInsecurePredicate is not specified. + Note that permittedInsecurePackages is only checked if allowInsecurePredicate is not specified. @@ -289,10 +232,7 @@ Modify packages via <literal>packageOverrides</literal> - You can define a function called packageOverrides in your - local ~/.config/nixpkgs/config.nix to override Nix - packages. It must be a function that takes pkgs as an argument and returns a - modified set of packages. + You can define a function called packageOverrides in your local ~/.config/nixpkgs/config.nix to override Nix packages. It must be a function that takes pkgs as an argument and returns a modified set of packages. { packageOverrides = pkgs: rec { @@ -309,15 +249,7 @@ Build an environment - Using packageOverrides, it is possible to manage - packages declaratively. This means that we can list all of our desired - packages within a declarative Nix expression. For example, to have - aspell, bc, - ffmpeg, coreutils, - gdb, nixUnstable, - emscripten, jq, - nox, and silver-searcher, we could - use the following in ~/.config/nixpkgs/config.nix: + Using packageOverrides, it is possible to manage packages declaratively. This means that we can list all of our desired packages within a declarative Nix expression. For example, to have aspell, bc, ffmpeg, coreutils, gdb, nixUnstable, emscripten, jq, nox, and silver-searcher, we could use the following in ~/.config/nixpkgs/config.nix: @@ -343,13 +275,7 @@ - To install it into our environment, you can just run nix-env -iA - nixpkgs.myPackages. If you want to load the packages to be built - from a working copy of nixpkgs you just run - nix-env -f. -iA myPackages. To explore what's been - installed, just look through ~/.nix-profile/. You can - see that a lot of stuff has been installed. Some of this stuff is useful - some of it isn't. Let's tell Nixpkgs to only link the stuff that we want: + To install it into our environment, you can just run nix-env -iA nixpkgs.myPackages. If you want to load the packages to be built from a working copy of nixpkgs you just run nix-env -f. -iA myPackages. To explore what's been installed, just look through ~/.nix-profile/. You can see that a lot of stuff has been installed. Some of this stuff is useful some of it isn't. Let's tell Nixpkgs to only link the stuff that we want: @@ -376,12 +302,7 @@ - pathsToLink tells Nixpkgs to only link the paths listed - which gets rid of the extra stuff in the profile. /bin - and /share are good defaults for a user environment, - getting rid of the clutter. If you are running on Nix on MacOS, you may - want to add another path as well, /Applications, that - makes GUI apps available. + pathsToLink tells Nixpkgs to only link the paths listed which gets rid of the extra stuff in the profile. /bin and /share are good defaults for a user environment, getting rid of the clutter. If you are running on Nix on MacOS, you may want to add another path as well, /Applications, that makes GUI apps available.
@@ -389,13 +310,7 @@ Getting documentation - After building that new environment, look through - ~/.nix-profile to make sure everything is there that - we wanted. Discerning readers will note that some files are missing. Look - inside ~/.nix-profile/share/man/man1/ to verify this. - There are no man pages for any of the Nix tools! This is because some - packages like Nix have multiple outputs for things like documentation (see - section 4). Let's make Nix install those as well. + After building that new environment, look through ~/.nix-profile to make sure everything is there that we wanted. Discerning readers will note that some files are missing. Look inside ~/.nix-profile/share/man/man1/ to verify this. There are no man pages for any of the Nix tools! This is because some packages like Nix have multiple outputs for things like documentation (see section 4). Let's make Nix install those as well. @@ -422,9 +337,7 @@ - This provides us with some useful documentation for using our packages. - However, if we actually want those manpages to be detected by man, we need - to set up our environment. This can also be managed within Nix expressions. + This provides us with some useful documentation for using our packages. However, if we actually want those manpages to be detected by man, we need to set up our environment. This can also be managed within Nix expressions. @@ -460,9 +373,7 @@ - For this to work fully, you must also have this script sourced when you are - logged in. Try adding something like this to your - ~/.profile file: + For this to work fully, you must also have this script sourced when you are logged in. Try adding something like this to your ~/.profile file: @@ -477,8 +388,7 @@ fi - Now just run source $HOME/.profile and you can starting - loading man pages from your environent. + Now just run source $HOME/.profile and you can starting loading man pages from your environent. @@ -486,9 +396,7 @@ fi GNU info setup - Configuring GNU info is a little bit trickier than man pages. To work - correctly, info needs a database to be generated. This can be done with - some small modifications to our environment scripts. + Configuring GNU info is a little bit trickier than man pages. To work correctly, info needs a database to be generated. This can be done with some small modifications to our environment scripts. @@ -534,11 +442,7 @@ fi - postBuild tells Nixpkgs to run a command after building - the environment. In this case, install-info adds the - installed info pages to dir which is GNU info's default - root node. Note that texinfoInteractive is added to the - environment to give the install-info command. + postBuild tells Nixpkgs to run a command after building the environment. In this case, install-info adds the installed info pages to dir which is GNU info's default root node. Note that texinfoInteractive is added to the environment to give the install-info command. diff --git a/doc/contributing.xml b/doc/contributing.xml index 523c1c9c8f0..b0266043775 100644 --- a/doc/contributing.xml +++ b/doc/contributing.xml @@ -3,10 +3,8 @@ xml:id="chap-contributing"> Contributing to this documentation - The DocBook sources of the Nixpkgs manual are in the - doc - subdirectory of the Nixpkgs repository. + The DocBook sources of the Nixpkgs manual are in the doc subdirectory of the Nixpkgs repository. You can quickly check your edits with make: @@ -17,19 +15,16 @@ xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc [nix-shell]$ make - If you experience problems, run make debug to help - understand the docbook errors. + If you experience problems, run make debug to help understand the docbook errors. - After making modifications to the manual, it's important to build it before - committing. You can do that as follows: + After making modifications to the manual, it's important to build it before committing. You can do that as follows: $ cd /path/to/nixpkgs/doc $ nix-shell [nix-shell]$ make clean [nix-shell]$ nix-build . - If the build succeeds, the manual will be in - ./result/share/doc/nixpkgs/manual.html. + If the build succeeds, the manual will be in ./result/share/doc/nixpkgs/manual.html. diff --git a/doc/cross-compilation.xml b/doc/cross-compilation.xml index d212706e171..f496fa3f896 100644 --- a/doc/cross-compilation.xml +++ b/doc/cross-compilation.xml @@ -6,25 +6,11 @@ Introduction - "Cross-compilation" means compiling a program on one machine for another - type of machine. For example, a typical use of cross-compilation is to - compile programs for embedded devices. These devices often don't have the - computing power and memory to compile their own programs. One might think - that cross-compilation is a fairly niche concern. However, there are - significant advantages to rigorously distinguishing between build-time and - run-time environments! Significant, because the benefits apply even when one - is developing and deploying on the same machine. Nixpkgs is increasingly - adopting the opinion that packages should be written with cross-compilation - in mind, and nixpkgs should evaluate in a similar way (by minimizing - cross-compilation-specific special cases) whether or not one is - cross-compiling. + "Cross-compilation" means compiling a program on one machine for another type of machine. For example, a typical use of cross-compilation is to compile programs for embedded devices. These devices often don't have the computing power and memory to compile their own programs. One might think that cross-compilation is a fairly niche concern. However, there are significant advantages to rigorously distinguishing between build-time and run-time environments! Significant, because the benefits apply even when one is developing and deploying on the same machine. Nixpkgs is increasingly adopting the opinion that packages should be written with cross-compilation in mind, and nixpkgs should evaluate in a similar way (by minimizing cross-compilation-specific special cases) whether or not one is cross-compiling. - This chapter will be organized in three parts. First, it will describe the - basics of how to package software in a way that supports cross-compilation. - Second, it will describe how to use Nixpkgs when cross-compiling. Third, it - will describe the internal infrastructure supporting cross-compilation. + This chapter will be organized in three parts. First, it will describe the basics of how to package software in a way that supports cross-compilation. Second, it will describe how to use Nixpkgs when cross-compiling. Third, it will describe the internal infrastructure supporting cross-compilation. @@ -35,24 +21,12 @@ Platform parameters - Nixpkgs follows the - conventions - of GNU autoconf. We distinguish between 3 types of platforms when - building a derivation: build, - host, and target. In - summary, build is the platform on which a package - is being built, host is the platform on which it - will run. The third attribute, target, is relevant - only for certain specific compilers and build tools. + Nixpkgs follows the conventions of GNU autoconf. We distinguish between 3 types of platforms when building a derivation: build, host, and target. In summary, build is the platform on which a package is being built, host is the platform on which it will run. The third attribute, target, is relevant only for certain specific compilers and build tools. - In Nixpkgs, these three platforms are defined as attribute sets under the - names buildPlatform, hostPlatform, - and targetPlatform. They are always defined as - attributes in the standard environment. That means one can access them - like: + In Nixpkgs, these three platforms are defined as attribute sets under the names buildPlatform, hostPlatform, and targetPlatform. They are always defined as attributes in the standard environment. That means one can access them like: { stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform... . @@ -64,9 +38,7 @@ - The "build platform" is the platform on which a package is built. Once - someone has a built package, or pre-built binary package, the build - platform should not matter and can be ignored. + The "build platform" is the platform on which a package is built. Once someone has a built package, or pre-built binary package, the build platform should not matter and can be ignored. @@ -76,9 +48,7 @@ - The "host platform" is the platform on which a package will be run. This - is the simplest platform to understand, but also the one with the worst - name. + The "host platform" is the platform on which a package will be run. This is the simplest platform to understand, but also the one with the worst name. @@ -88,44 +58,23 @@ - The "target platform" attribute is, unlike the other two attributes, not - actually fundamental to the process of building software. Instead, it is - only relevant for compatibility with building certain specific compilers - and build tools. It can be safely ignored for all other packages. + The "target platform" attribute is, unlike the other two attributes, not actually fundamental to the process of building software. Instead, it is only relevant for compatibility with building certain specific compilers and build tools. It can be safely ignored for all other packages. - The build process of certain compilers is written in such a way that the - compiler resulting from a single build can itself only produce binaries - for a single platform. The task of specifying this single "target - platform" is thus pushed to build time of the compiler. The root cause - of this is that the compiler (which will be run on the host) and the - standard library/runtime (which will be run on the target) are built by - a single build process. + The build process of certain compilers is written in such a way that the compiler resulting from a single build can itself only produce binaries for a single platform. The task of specifying this single "target platform" is thus pushed to build time of the compiler. The root cause of this is that the compiler (which will be run on the host) and the standard library/runtime (which will be run on the target) are built by a single build process. - There is no fundamental need to think about a single target ahead of - time like this. If the tool supports modular or pluggable backends, both - the need to specify the target at build time and the constraint of - having only a single target disappear. An example of such a tool is - LLVM. + There is no fundamental need to think about a single target ahead of time like this. If the tool supports modular or pluggable backends, both the need to specify the target at build time and the constraint of having only a single target disappear. An example of such a tool is LLVM. - Although the existence of a "target platfom" is arguably a historical - mistake, it is a common one: examples of tools that suffer from it are - GCC, Binutils, GHC and Autoconf. Nixpkgs tries to avoid sharing in the - mistake where possible. Still, because the concept of a target platform - is so ingrained, it is best to support it as is. + Although the existence of a "target platfom" is arguably a historical mistake, it is a common one: examples of tools that suffer from it are GCC, Binutils, GHC and Autoconf. Nixpkgs tries to avoid sharing in the mistake where possible. Still, because the concept of a target platform is so ingrained, it is best to support it as is. - The exact schema these fields follow is a bit ill-defined due to a long and - convoluted evolution, but this is slowly being cleaned up. You can see - examples of ones used in practice in - lib.systems.examples; note how they are not all very - consistent. For now, here are few fields can count on them containing: + The exact schema these fields follow is a bit ill-defined due to a long and convoluted evolution, but this is slowly being cleaned up. You can see examples of ones used in practice in lib.systems.examples; note how they are not all very consistent. For now, here are few fields can count on them containing: @@ -135,13 +84,7 @@ - This is a two-component shorthand for the platform. Examples of this - would be "x86_64-darwin" and "i686-linux"; see - lib.systems.doubles for more. The first component - corresponds to the CPU architecture of the platform and the second to - the operating system of the platform ([cpu]-[os]). - This format has built-in support in Nix, such as the - builtins.currentSystem impure string. + This is a two-component shorthand for the platform. Examples of this would be "x86_64-darwin" and "i686-linux"; see lib.systems.doubles for more. The first component corresponds to the CPU architecture of the platform and the second to the operating system of the platform ([cpu]-[os]). This format has built-in support in Nix, such as the builtins.currentSystem impure string. @@ -151,15 +94,7 @@ - This is a 3- or 4- component shorthand for the platform. Examples of - this would be x86_64-unknown-linux-gnu and - aarch64-apple-darwin14. This is a standard format - called the "LLVM target triple", as they are pioneered by LLVM. In the - 4-part form, this corresponds to - [cpu]-[vendor]-[os]-[abi]. This format is strictly - more informative than the "Nix host double", as the previous format - could analogously be termed. This needs a better name than - config! + This is a 3- or 4- component shorthand for the platform. Examples of this would be x86_64-unknown-linux-gnu and aarch64-apple-darwin14. This is a standard format called the "LLVM target triple", as they are pioneered by LLVM. In the 4-part form, this corresponds to [cpu]-[vendor]-[os]-[abi]. This format is strictly more informative than the "Nix host double", as the previous format could analogously be termed. This needs a better name than config! @@ -169,10 +104,7 @@ - This is a Nix representation of a parsed LLVM target triple with - white-listed components. This can be specified directly, or actually - parsed from the config. See - lib.systems.parse for the exact representation. + This is a Nix representation of a parsed LLVM target triple with white-listed components. This can be specified directly, or actually parsed from the config. See lib.systems.parse for the exact representation. @@ -182,10 +114,7 @@ - This is a string identifying the standard C library used. Valid - identifiers include "glibc" for GNU libc, "libSystem" for Darwin's - Libsystem, and "uclibc" for µClibc. It should probably be refactored to - use the module system, like parse. + This is a string identifying the standard C library used. Valid identifiers include "glibc" for GNU libc, "libSystem" for Darwin's Libsystem, and "uclibc" for µClibc. It should probably be refactored to use the module system, like parse. @@ -195,10 +124,7 @@ - These predicates are defined in lib.systems.inspect, - and slapped onto every platform. They are superior to the ones in - stdenv as they force the user to be explicit about - which platform they are inspecting. Please use these instead of those. + These predicates are defined in lib.systems.inspect, and slapped onto every platform. They are superior to the ones in stdenv as they force the user to be explicit about which platform they are inspecting. Please use these instead of those. @@ -208,11 +134,7 @@ - This is, quite frankly, a dumping ground of ad-hoc settings (it's an - attribute set). See lib.systems.platforms for - examples—there's hopefully one in there that will work verbatim for - each platform that is working. Please help us triage these flags and - give them better homes! + This is, quite frankly, a dumping ground of ad-hoc settings (it's an attribute set). See lib.systems.platforms for examples—there's hopefully one in there that will work verbatim for each platform that is working. Please help us triage these flags and give them better homes! @@ -224,62 +146,33 @@ - This is a rather philosophical description that isn't very - Nixpkgs-specific. For an overview of all the relevant attributes given to - mkDerivation, see - . For a description of how - everything is implemented, see - . + This is a rather philosophical description that isn't very Nixpkgs-specific. For an overview of all the relevant attributes given to mkDerivation, see . For a description of how everything is implemented, see . - In this section we explore the relationship between both runtime and - build-time dependencies and the 3 Autoconf platforms. + In this section we explore the relationship between both runtime and build-time dependencies and the 3 Autoconf platforms. - A run time dependency between two packages requires that their host - platforms match. This is directly implied by the meaning of "host platform" - and "runtime dependency": The package dependency exists while both packages - are running on a single host platform. + A run time dependency between two packages requires that their host platforms match. This is directly implied by the meaning of "host platform" and "runtime dependency": The package dependency exists while both packages are running on a single host platform. - A build time dependency, however, has a shift in platforms between the - depending package and the depended-on package. "build time dependency" - means that to build the depending package we need to be able to run the - depended-on's package. The depending package's build platform is therefore - equal to the depended-on package's host platform. + A build time dependency, however, has a shift in platforms between the depending package and the depended-on package. "build time dependency" means that to build the depending package we need to be able to run the depended-on's package. The depending package's build platform is therefore equal to the depended-on package's host platform. - If both the dependency and depending packages aren't compilers or other - machine-code-producing tools, we're done. And indeed - buildInputs and nativeBuildInputs - have covered these simpler build-time and run-time (respectively) changes - for many years. But if the dependency does produce machine code, we might - need to worry about its target platform too. In principle, that target - platform might be any of the depending package's build, host, or target - platforms, but we prohibit dependencies from a "later" platform to an - earlier platform to limit confusion because we've never seen a legitimate - use for them. + If both the dependency and depending packages aren't compilers or other machine-code-producing tools, we're done. And indeed buildInputs and nativeBuildInputs have covered these simpler build-time and run-time (respectively) changes for many years. But if the dependency does produce machine code, we might need to worry about its target platform too. In principle, that target platform might be any of the depending package's build, host, or target platforms, but we prohibit dependencies from a "later" platform to an earlier platform to limit confusion because we've never seen a legitimate use for them. - Finally, if the depending package is a compiler or other - machine-code-producing tool, it might need dependencies that run at "emit - time". This is for compilers that (regrettably) insist on being built - together with their source langauges' standard libraries. Assuming build != - host != target, a run-time dependency of the standard library cannot be run - at the compiler's build time or run time, but only at the run time of code - emitted by the compiler. + Finally, if the depending package is a compiler or other machine-code-producing tool, it might need dependencies that run at "emit time". This is for compilers that (regrettably) insist on being built together with their source langauges' standard libraries. Assuming build != host != target, a run-time dependency of the standard library cannot be run at the compiler's build time or run time, but only at the run time of code emitted by the compiler. - Putting this all together, that means we have dependencies in the form - "host → target", in at most the following six combinations: + Putting this all together, that means we have dependencies in the form "host → target", in at most the following six combinations: @@ -318,16 +211,7 @@ - Some examples will make this table clearer. Suppose there's some package - that is being built with a (build, host, target) - platform triple of (foo, bar, baz). If it has a - build-time library dependency, that would be a "host → build" dependency - with a triple of (foo, foo, *) (the target platform is - irrelevant). If it needs a compiler to be built, that would be a "build → - host" dependency with a triple of (foo, foo, *) (the - target platform is irrelevant). That compiler, would be built with another - compiler, also "build → host" dependency, with a triple of (foo, - foo, foo). + Some examples will make this table clearer. Suppose there's some package that is being built with a (build, host, target) platform triple of (foo, bar, baz). If it has a build-time library dependency, that would be a "host → build" dependency with a triple of (foo, foo, *) (the target platform is irrelevant). If it needs a compiler to be built, that would be a "build → host" dependency with a triple of (foo, foo, *) (the target platform is irrelevant). That compiler, would be built with another compiler, also "build → host" dependency, with a triple of (foo, foo, foo). @@ -335,20 +219,14 @@ Cross packaging cookbook - Some frequently encountered problems when packaging for cross-compilation - should be answered here. Ideally, the information above is exhaustive, so - this section cannot provide any new information, but it is ludicrous and - cruel to expect everyone to spend effort working through the interaction of - many features just to figure out the same answer to the same common - problem. Feel free to add to this list! + Some frequently encountered problems when packaging for cross-compilation should be answered here. Ideally, the information above is exhaustive, so this section cannot provide any new information, but it is ludicrous and cruel to expect everyone to spend effort working through the interaction of many features just to figure out the same answer to the same common problem. Feel free to add to this list! - What if my package's build system needs to build a C program to be run - under the build environment? + What if my package's build system needs to build a C program to be run under the build environment? @@ -366,11 +244,7 @@ - Many packages assume that an unprefixed ar is - available, but Nix doesn't provide one. It only provides a prefixed one, - just as it only does for all the other binutils programs. It may be - necessary to patch the package to fix the build system to use a prefixed - `ar`. + Many packages assume that an unprefixed ar is available, but Nix doesn't provide one. It only provides a prefixed one, just as it only does for all the other binutils programs. It may be necessary to patch the package to fix the build system to use a prefixed `ar`. @@ -395,82 +269,32 @@ Cross-building packages - Nixpkgs can be instantiated with localSystem alone, in - which case there is no cross-compiling and everything is built by and for - that system, or also with crossSystem, in which case - packages run on the latter, but all building happens on the former. Both - parameters take the same schema as the 3 (build, host, and target) platforms - defined in the previous section. As mentioned above, - lib.systems.examples has some platforms which are used as - arguments for these parameters in practice. You can use them - programmatically, or on the command line: + Nixpkgs can be instantiated with localSystem alone, in which case there is no cross-compiling and everything is built by and for that system, or also with crossSystem, in which case packages run on the latter, but all building happens on the former. Both parameters take the same schema as the 3 (build, host, and target) platforms defined in the previous section. As mentioned above, lib.systems.examples has some platforms which are used as arguments for these parameters in practice. You can use them programmatically, or on the command line: nix-build <nixpkgs> --arg crossSystem '(import <nixpkgs/lib>).systems.examples.fooBarBaz' -A whatever - Eventually we would like to make these platform examples an unnecessary - convenience so that + Eventually we would like to make these platform examples an unnecessary convenience so that nix-build <nixpkgs> --arg crossSystem '{ config = "<arch>-<os>-<vendor>-<abi>"; }' -A whatever - works in the vast majority of cases. The problem today is dependencies on - other sorts of configuration which aren't given proper defaults. We rely on - the examples to crudely to set those configuration parameters in some - vaguely sane manner on the users behalf. Issue - #34274 - tracks this inconvenience along with its root cause in crufty configuration - options. + works in the vast majority of cases. The problem today is dependencies on other sorts of configuration which aren't given proper defaults. We rely on the examples to crudely to set those configuration parameters in some vaguely sane manner on the users behalf. Issue #34274 tracks this inconvenience along with its root cause in crufty configuration options. - While one is free to pass both parameters in full, there's a lot of logic to - fill in missing fields. As discussed in the previous section, only one of - system, config, and - parsed is needed to infer the other two. Additionally, - libc will be inferred from parse. - Finally, localSystem.system is also - impurely inferred based on the platform evaluation - occurs. This means it is often not necessary to pass - localSystem at all, as in the command-line example in the - previous paragraph. + While one is free to pass both parameters in full, there's a lot of logic to fill in missing fields. As discussed in the previous section, only one of system, config, and parsed is needed to infer the other two. Additionally, libc will be inferred from parse. Finally, localSystem.system is also impurely inferred based on the platform evaluation occurs. This means it is often not necessary to pass localSystem at all, as in the command-line example in the previous paragraph. - Many sources (manual, wiki, etc) probably mention passing - system, platform, along with the - optional crossSystem to nixpkgs: import - <nixpkgs> { system = ..; platform = ..; crossSystem = ..; - }. Passing those two instead of localSystem is - still supported for compatibility, but is discouraged. Indeed, much of the - inference we do for these parameters is motivated by compatibility as much - as convenience. + Many sources (manual, wiki, etc) probably mention passing system, platform, along with the optional crossSystem to nixpkgs: import <nixpkgs> { system = ..; platform = ..; crossSystem = ..; }. Passing those two instead of localSystem is still supported for compatibility, but is discouraged. Indeed, much of the inference we do for these parameters is motivated by compatibility as much as convenience. - One would think that localSystem and - crossSystem overlap horribly with the three - *Platforms (buildPlatform, - hostPlatform, and targetPlatform; see - stage.nix or the manual). Actually, those identifiers are - purposefully not used here to draw a subtle but important distinction: While - the granularity of having 3 platforms is necessary to properly *build* - packages, it is overkill for specifying the user's *intent* when making a - build plan or package set. A simple "build vs deploy" dichotomy is adequate: - the sliding window principle described in the previous section shows how to - interpolate between the these two "end points" to get the 3 platform triple - for each bootstrapping stage. That means for any package a given package - set, even those not bound on the top level but only reachable via - dependencies or buildPackages, the three platforms will - be defined as one of localSystem or - crossSystem, with the former replacing the latter as one - traverses build-time dependencies. A last simple difference is that - crossSystem should be null when one doesn't want to - cross-compile, while the *Platforms are always non-null. - localSystem is always non-null. + One would think that localSystem and crossSystem overlap horribly with the three *Platforms (buildPlatform, hostPlatform, and targetPlatform; see stage.nix or the manual). Actually, those identifiers are purposefully not used here to draw a subtle but important distinction: While the granularity of having 3 platforms is necessary to properly *build* packages, it is overkill for specifying the user's *intent* when making a build plan or package set. A simple "build vs deploy" dichotomy is adequate: the sliding window principle described in the previous section shows how to interpolate between the these two "end points" to get the 3 platform triple for each bootstrapping stage. That means for any package a given package set, even those not bound on the top level but only reachable via dependencies or buildPackages, the three platforms will be defined as one of localSystem or crossSystem, with the former replacing the latter as one traverses build-time dependencies. A last simple difference is that crossSystem should be null when one doesn't want to cross-compile, while the *Platforms are always non-null. localSystem is always non-null. @@ -481,61 +305,20 @@ nix-build <nixpkgs> --arg crossSystem '{ config = "<arch>-<os> Implementation of dependencies - The categorizes of dependencies developed in - are specified as - lists of derivations given to mkDerivation, as - documented in . In short, each - list of dependencies for "host → target" of "foo → bar" is called - depsFooBar, with exceptions for backwards compatibility - that depsBuildHost is instead called - nativeBuildInputs and depsHostTarget - is instead called buildInputs. Nixpkgs is now structured - so that each depsFooBar is automatically taken from - pkgsFooBar. (These pkgsFooBars are - quite new, so there is no special case for - nativeBuildInputs and buildInputs.) - For example, pkgsBuildHost.gcc should be used at - build-time, while pkgsHostTarget.gcc should be used at - run-time. + The categorizes of dependencies developed in are specified as lists of derivations given to mkDerivation, as documented in . In short, each list of dependencies for "host → target" of "foo → bar" is called depsFooBar, with exceptions for backwards compatibility that depsBuildHost is instead called nativeBuildInputs and depsHostTarget is instead called buildInputs. Nixpkgs is now structured so that each depsFooBar is automatically taken from pkgsFooBar. (These pkgsFooBars are quite new, so there is no special case for nativeBuildInputs and buildInputs.) For example, pkgsBuildHost.gcc should be used at build-time, while pkgsHostTarget.gcc should be used at run-time. - Now, for most of Nixpkgs's history, there were no - pkgsFooBar attributes, and most packages have not been - refactored to use it explicitly. Prior to those, there were just - buildPackages, pkgs, and - targetPackages. Those are now redefined as aliases to - pkgsBuildHost, pkgsHostTarget, and - pkgsTargetTarget. It is acceptable, even recommended, to - use them for libraries to show that the host platform is irrelevant. + Now, for most of Nixpkgs's history, there were no pkgsFooBar attributes, and most packages have not been refactored to use it explicitly. Prior to those, there were just buildPackages, pkgs, and targetPackages. Those are now redefined as aliases to pkgsBuildHost, pkgsHostTarget, and pkgsTargetTarget. It is acceptable, even recommended, to use them for libraries to show that the host platform is irrelevant. - But before that, there was just pkgs, even though both - buildInputs and nativeBuildInputs - existed. [Cross barely worked, and those were implemented with some hacks - on mkDerivation to override dependencies.] What this - means is the vast majority of packages do not use any explicit package set - to populate their dependencies, just using whatever - callPackage gives them even if they do correctly sort - their dependencies into the multiple lists described above. And indeed, - asking that users both sort their dependencies, and - take them from the right attribute set, is both too onerous and redundant, - so the recommended approach (for now) is to continue just categorizing by - list and not using an explicit package set. + But before that, there was just pkgs, even though both buildInputs and nativeBuildInputs existed. [Cross barely worked, and those were implemented with some hacks on mkDerivation to override dependencies.] What this means is the vast majority of packages do not use any explicit package set to populate their dependencies, just using whatever callPackage gives them even if they do correctly sort their dependencies into the multiple lists described above. And indeed, asking that users both sort their dependencies, and take them from the right attribute set, is both too onerous and redundant, so the recommended approach (for now) is to continue just categorizing by list and not using an explicit package set. - To make this work, we "splice" together the six - pkgsFooBar package sets and have - callPackage actually take its arguments from that. This - is currently implemented in pkgs/top-level/splice.nix. - mkDerivation then, for each dependency attribute, pulls - the right derivation out from the splice. This splicing can be skipped when - not cross-compiling as the package sets are the same, but still is a bit - slow for cross-compiling. We'd like to do something better, but haven't - come up with anything yet. + To make this work, we "splice" together the six pkgsFooBar package sets and have callPackage actually take its arguments from that. This is currently implemented in pkgs/top-level/splice.nix. mkDerivation then, for each dependency attribute, pulls the right derivation out from the splice. This splicing can be skipped when not cross-compiling as the package sets are the same, but still is a bit slow for cross-compiling. We'd like to do something better, but haven't come up with anything yet. @@ -543,21 +326,11 @@ nix-build <nixpkgs> --arg crossSystem '{ config = "<arch>-<os> Bootstrapping - Each of the package sets described above come from a single bootstrapping - stage. While pkgs/top-level/default.nix, coordinates - the composition of stages at a high level, - pkgs/top-level/stage.nix "ties the knot" (creates the - fixed point) of each stage. The package sets are defined per-stage however, - so they can be thought of as edges between stages (the nodes) in a graph. - Compositions like pkgsBuildTarget.targetPackages can be - thought of as paths to this graph. + Each of the package sets described above come from a single bootstrapping stage. While pkgs/top-level/default.nix, coordinates the composition of stages at a high level, pkgs/top-level/stage.nix "ties the knot" (creates the fixed point) of each stage. The package sets are defined per-stage however, so they can be thought of as edges between stages (the nodes) in a graph. Compositions like pkgsBuildTarget.targetPackages can be thought of as paths to this graph. - While there are many package sets, and thus many edges, the stages can also - be arranged in a linear chain. In other words, many of the edges are - redundant as far as connectivity is concerned. This hinges on the type of - bootstrapping we do. Currently for cross it is: + While there are many package sets, and thus many edges, the stages can also be arranged in a linear chain. In other words, many of the edges are redundant as far as connectivity is concerned. This hinges on the type of bootstrapping we do. Currently for cross it is: @@ -575,102 +348,45 @@ nix-build <nixpkgs> --arg crossSystem '{ config = "<arch>-<os> - In each stage, pkgsBuildHost refers the the previous - stage, pkgsBuildBuild refers to the one before that, and - pkgsHostTarget refers to the current one, and - pkgsTargetTarget refers to the next one. When there is - no previous or next stage, they instead refer to the current stage. Note - how all the invariants regarding the mapping between dependency and - depending packages' build host and target platforms are preserved. - pkgsBuildTarget and pkgsHostHost are - more complex in that the stage fitting the requirements isn't always a - fixed chain of "prevs" and "nexts" away (modulo the "saturating" - self-references at the ends). We just special case each instead. All the - primary edges are implemented is in - pkgs/stdenv/booter.nix, and secondarily aliases in - pkgs/top-level/stage.nix. + In each stage, pkgsBuildHost refers the the previous stage, pkgsBuildBuild refers to the one before that, and pkgsHostTarget refers to the current one, and pkgsTargetTarget refers to the next one. When there is no previous or next stage, they instead refer to the current stage. Note how all the invariants regarding the mapping between dependency and depending packages' build host and target platforms are preserved. pkgsBuildTarget and pkgsHostHost are more complex in that the stage fitting the requirements isn't always a fixed chain of "prevs" and "nexts" away (modulo the "saturating" self-references at the ends). We just special case each instead. All the primary edges are implemented is in pkgs/stdenv/booter.nix, and secondarily aliases in pkgs/top-level/stage.nix. - Note the native stages are bootstrapped in legacy ways that predate the - current cross implementation. This is why the the bootstrapping stages - leading up to the final stages are ignored inthe previous paragraph. + Note the native stages are bootstrapped in legacy ways that predate the current cross implementation. This is why the the bootstrapping stages leading up to the final stages are ignored inthe previous paragraph. - If one looks at the 3 platform triples, one can see that they overlap such - that one could put them together into a chain like: + If one looks at the 3 platform triples, one can see that they overlap such that one could put them together into a chain like: (native, native, native, foreign, foreign) - If one imagines the saturating self references at the end being replaced - with infinite stages, and then overlays those platform triples, one ends up - with the infinite tuple: + If one imagines the saturating self references at the end being replaced with infinite stages, and then overlays those platform triples, one ends up with the infinite tuple: (native..., native, native, native, foreign, foreign, foreign...) - On can then imagine any sequence of platforms such that there are bootstrap - stages with their 3 platforms determined by "sliding a window" that is the - 3 tuple through the sequence. This was the original model for - bootstrapping. Without a target platform (assume a better world where all - compilers are multi-target and all standard libraries are built in their - own derivation), this is sufficient. Conversely if one wishes to cross - compile "faster", with a "Canadian Cross" bootstraping stage where - build != host != target, more bootstrapping stages are - needed since no sliding window providess the pesky - pkgsBuildTarget package set since it skips the Canadian - cross stage's "host". + On can then imagine any sequence of platforms such that there are bootstrap stages with their 3 platforms determined by "sliding a window" that is the 3 tuple through the sequence. This was the original model for bootstrapping. Without a target platform (assume a better world where all compilers are multi-target and all standard libraries are built in their own derivation), this is sufficient. Conversely if one wishes to cross compile "faster", with a "Canadian Cross" bootstraping stage where build != host != target, more bootstrapping stages are needed since no sliding window providess the pesky pkgsBuildTarget package set since it skips the Canadian cross stage's "host". - It is much better to refer to buildPackages than - targetPackages, or more broadly package sets that do - not mention "target". There are three reasons for this. + It is much better to refer to buildPackages than targetPackages, or more broadly package sets that do not mention "target". There are three reasons for this. - First, it is because bootstrapping stages do not have a unique - targetPackages. For example a (x86-linux, - x86-linux, arm-linux) and (x86-linux, x86-linux, - x86-windows) package set both have a (x86-linux, - x86-linux, x86-linux) package set. Because there is no canonical - targetPackages for such a native (build == - host == target) package set, we set their - targetPackages + First, it is because bootstrapping stages do not have a unique targetPackages. For example a (x86-linux, x86-linux, arm-linux) and (x86-linux, x86-linux, x86-windows) package set both have a (x86-linux, x86-linux, x86-linux) package set. Because there is no canonical targetPackages for such a native (build == host == target) package set, we set their targetPackages - Second, it is because this is a frequent source of hard-to-follow - "infinite recursions" / cycles. When only package sets that don't mention - target are used, the package set forms a directed acyclic graph. This - means that all cycles that exist are confined to one stage. This means - they are a lot smaller, and easier to follow in the code or a backtrace. - It also means they are present in native and cross builds alike, and so - more likely to be caught by CI and other users. + Second, it is because this is a frequent source of hard-to-follow "infinite recursions" / cycles. When only package sets that don't mention target are used, the package set forms a directed acyclic graph. This means that all cycles that exist are confined to one stage. This means they are a lot smaller, and easier to follow in the code or a backtrace. It also means they are present in native and cross builds alike, and so more likely to be caught by CI and other users. - Thirdly, it is because everything target-mentioning only exists to - accommodate compilers with lousy build systems that insist on the compiler - itself and standard library being built together. Of course that is bad - because bigger derivations means longer rebuilds. It is also problematic - because it tends to make the standard libraries less like other libraries - than they could be, complicating code and build systems alike. Because of - the other problems, and because of these innate disadvantages, compilers - ought to be packaged another way where possible. + Thirdly, it is because everything target-mentioning only exists to accommodate compilers with lousy build systems that insist on the compiler itself and standard library being built together. Of course that is bad because bigger derivations means longer rebuilds. It is also problematic because it tends to make the standard libraries less like other libraries than they could be, complicating code and build systems alike. Because of the other problems, and because of these innate disadvantages, compilers ought to be packaged another way where possible. - If one explores Nixpkgs, they will see derivations with names like - gccCross. Such *Cross derivations is - a holdover from before we properly distinguished between the host and - target platforms—the derivation with "Cross" in the name covered the - build = host != target case, while the other covered - the host = target, with build platform the same or not - based on whether one was using its .nativeDrv or - .crossDrv. This ugliness will disappear soon. + If one explores Nixpkgs, they will see derivations with names like gccCross. Such *Cross derivations is a holdover from before we properly distinguished between the host and target platforms—the derivation with "Cross" in the name covered the build = host != target case, while the other covered the host = target, with build platform the same or not based on whether one was using its .nativeDrv or .crossDrv. This ugliness will disappear soon. diff --git a/doc/functions.xml b/doc/functions.xml index 96bd95958ea..3e126e6b139 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -4,8 +4,7 @@ xml:id="chap-functions"> Functions reference - The nixpkgs repository has several utility functions to manipulate Nix - expressions. + The nixpkgs repository has several utility functions to manipulate Nix expressions. diff --git a/doc/functions/appimagetools.xml b/doc/functions/appimagetools.xml index e6dbc22f48d..37e4251cda2 100644 --- a/doc/functions/appimagetools.xml +++ b/doc/functions/appimagetools.xml @@ -5,17 +5,12 @@ pkgs.appimageTools - pkgs.appimageTools is a set of functions for extracting - and wrapping AppImage files. - They are meant to be used if traditional packaging from source is infeasible, - or it would take too long. To quickly run an AppImage file, - pkgs.appimage-run can be used as well. + pkgs.appimageTools is a set of functions for extracting and wrapping AppImage files. They are meant to be used if traditional packaging from source is infeasible, or it would take too long. To quickly run an AppImage file, pkgs.appimage-run can be used as well. - The appimageTools API is unstable and may be subject to - backwards-incompatible changes in the future. + The appimageTools API is unstable and may be subject to backwards-incompatible changes in the future. @@ -23,9 +18,7 @@ AppImage formats - There are different formats for AppImages, see - the - specification for details. + There are different formats for AppImages, see the specification for details. @@ -55,8 +48,7 @@ type2.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (Lepton 3.x) - Note how the type 1 AppImage is described as an ISO 9660 CD-ROM - filesystem, and the type 2 AppImage is not. + Note how the type 1 AppImage is described as an ISO 9660 CD-ROM filesystem, and the type 2 AppImage is not. @@ -64,8 +56,7 @@ type2.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (Lepton 3.x) Wrapping - Depending on the type of AppImage you're wrapping, you'll have to use - wrapType1 or wrapType2. + Depending on the type of AppImage you're wrapping, you'll have to use wrapType1 or wrapType2. @@ -91,23 +82,16 @@ appimageTools.wrapType2 { # or wrapType1 - extraPkgs allows you to pass a function to include - additional packages inside the FHS environment your AppImage is going to - run in. There are a few ways to learn which dependencies an application - needs: + extraPkgs allows you to pass a function to include additional packages inside the FHS environment your AppImage is going to run in. There are a few ways to learn which dependencies an application needs: - Looking through the extracted AppImage files, reading its scripts and - running patchelf and ldd on its - executables. This can also be done in appimage-run, - by setting APPIMAGE_DEBUG_EXEC=bash. + Looking through the extracted AppImage files, reading its scripts and running patchelf and ldd on its executables. This can also be done in appimage-run, by setting APPIMAGE_DEBUG_EXEC=bash. - Running strace -vfefile on the wrapped executable, - looking for libraries that can't be found. + Running strace -vfefile on the wrapped executable, looking for libraries that can't be found. diff --git a/doc/functions/debug.xml b/doc/functions/debug.xml index c6b3611eea5..c27421f12e7 100644 --- a/doc/functions/debug.xml +++ b/doc/functions/debug.xml @@ -5,17 +5,10 @@ Debugging Nix Expressions - Nix is a unityped, dynamic language, this means every value can potentially - appear anywhere. Since it is also non-strict, evaluation order and what - ultimately is evaluated might surprise you. Therefore it is important to be - able to debug nix expressions. + Nix is a unityped, dynamic language, this means every value can potentially appear anywhere. Since it is also non-strict, evaluation order and what ultimately is evaluated might surprise you. Therefore it is important to be able to debug nix expressions. - In the lib/debug.nix file you will find a number of - functions that help (pretty-)printing values while evaluation is runnnig. You - can even specify how deep these values should be printed recursively, and - transform them on the fly. Please consult the docstrings in - lib/debug.nix for usage information. + In the lib/debug.nix file you will find a number of functions that help (pretty-)printing values while evaluation is runnnig. You can even specify how deep these values should be printed recursively, and transform them on the fly. Please consult the docstrings in lib/debug.nix for usage information. diff --git a/doc/functions/dockertools.xml b/doc/functions/dockertools.xml index 6b293a2e778..2243453c3e9 100644 --- a/doc/functions/dockertools.xml +++ b/doc/functions/dockertools.xml @@ -5,17 +5,12 @@ pkgs.dockerTools - pkgs.dockerTools is a set of functions for creating and - manipulating Docker images according to the - - Docker Image Specification v1.2.0 . Docker itself is not used to - perform any of the operations done by these functions. + pkgs.dockerTools is a set of functions for creating and manipulating Docker images according to the Docker Image Specification v1.2.0 . Docker itself is not used to perform any of the operations done by these functions. - The dockerTools API is unstable and may be subject to - backwards-incompatible changes in the future. + The dockerTools API is unstable and may be subject to backwards-incompatible changes in the future. @@ -23,15 +18,11 @@ buildImage - This function is analogous to the docker build command, - in that it can be used to build a Docker-compatible repository tarball - containing a single image with one or multiple layers. As such, the result - is suitable for being loaded in Docker with docker load. + This function is analogous to the docker build command, in that it can be used to build a Docker-compatible repository tarball containing a single image with one or multiple layers. As such, the result is suitable for being loaded in Docker with docker load. - The parameters of buildImage with relative example values - are described below: + The parameters of buildImage with relative example values are described below: @@ -63,135 +54,89 @@ buildImage { - The above example will build a Docker image redis/latest - from the given base image. Loading and running this image in Docker results - in redis-server being started automatically. + The above example will build a Docker image redis/latest from the given base image. Loading and running this image in Docker results in redis-server being started automatically. - name specifies the name of the resulting image. This is - the only required argument for buildImage. + name specifies the name of the resulting image. This is the only required argument for buildImage. - tag specifies the tag of the resulting image. By - default it's null, which indicates that the nix output - hash will be used as tag. + tag specifies the tag of the resulting image. By default it's null, which indicates that the nix output hash will be used as tag. - fromImage is the repository tarball containing the base - image. It must be a valid Docker image, such as exported by - docker save. By default it's null, - which can be seen as equivalent to FROM scratch of a - Dockerfile. + fromImage is the repository tarball containing the base image. It must be a valid Docker image, such as exported by docker save. By default it's null, which can be seen as equivalent to FROM scratch of a Dockerfile. - fromImageName can be used to further specify the base - image within the repository, in case it contains multiple images. By - default it's null, in which case - buildImage will peek the first image available in the - repository. + fromImageName can be used to further specify the base image within the repository, in case it contains multiple images. By default it's null, in which case buildImage will peek the first image available in the repository. - fromImageTag can be used to further specify the tag of - the base image within the repository, in case an image contains multiple - tags. By default it's null, in which case - buildImage will peek the first tag available for the - base image. + fromImageTag can be used to further specify the tag of the base image within the repository, in case an image contains multiple tags. By default it's null, in which case buildImage will peek the first tag available for the base image. - contents is a derivation that will be copied in the new - layer of the resulting image. This can be similarly seen as ADD - contents/ / in a Dockerfile. By default - it's null. + contents is a derivation that will be copied in the new layer of the resulting image. This can be similarly seen as ADD contents/ / in a Dockerfile. By default it's null. - runAsRoot is a bash script that will run as root in an - environment that overlays the existing layers of the base image with the - new resulting layer, including the previously copied - contents derivation. This can be similarly seen as - RUN ... in a Dockerfile. + runAsRoot is a bash script that will run as root in an environment that overlays the existing layers of the base image with the new resulting layer, including the previously copied contents derivation. This can be similarly seen as RUN ... in a Dockerfile. - Using this parameter requires the kvm device to be - available. + Using this parameter requires the kvm device to be available. - config is used to specify the configuration of the - containers that will be started off the built image in Docker. The - available options are listed in the - - Docker Image Specification v1.2.0 . + config is used to specify the configuration of the containers that will be started off the built image in Docker. The available options are listed in the Docker Image Specification v1.2.0 . - After the new layer has been created, its closure (to which - contents, config and - runAsRoot contribute) will be copied in the layer itself. - Only new dependencies that are not already in the existing layers will be - copied. + After the new layer has been created, its closure (to which contents, config and runAsRoot contribute) will be copied in the layer itself. Only new dependencies that are not already in the existing layers will be copied. - At the end of the process, only one new single layer will be produced and - added to the resulting image. + At the end of the process, only one new single layer will be produced and added to the resulting image. - The resulting repository will only list the single image - image/tag. In the case of - it would be - redis/latest. + The resulting repository will only list the single image image/tag. In the case of it would be redis/latest. - It is possible to inspect the arguments with which an image was built using - its buildArgs attribute. + It is possible to inspect the arguments with which an image was built using its buildArgs attribute. - If you see errors similar to getProtocolByName: does not exist (no - such protocol name: tcp) you may need to add - pkgs.iana-etc to contents. + If you see errors similar to getProtocolByName: does not exist (no such protocol name: tcp) you may need to add pkgs.iana-etc to contents. - If you see errors similar to Error_Protocol ("certificate has - unknown CA",True,UnknownCa) you may need to add - pkgs.cacert to contents. + If you see errors similar to Error_Protocol ("certificate has unknown CA",True,UnknownCa) you may need to add pkgs.cacert to contents. Impurely Defining a Docker Layer's Creation Date - By default buildImage will use a static date of one - second past the UNIX Epoch. This allows buildImage to - produce binary reproducible images. When listing images with - docker images, the newly created images will be listed - like this: + By default buildImage will use a static date of one second past the UNIX Epoch. This allows buildImage to produce binary reproducible images. When listing images with docker images, the newly created images will be listed like this: - You can break binary reproducibility but have a sorted, meaningful - CREATED column by setting created to - now. + You can break binary reproducibility but have a sorted, meaningful CREATED column by setting created to now. - and now the Docker CLI will display a reasonable date and sort the images - as expected: + and now the Docker CLI will display a reasonable date and sort the images as expected: buildLayeredImage - Create a Docker image with many of the store paths being on their own layer - to improve sharing between images. + Create a Docker image with many of the store paths being on their own layer to improve sharing between images. @@ -264,8 +205,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB - Top level paths in the container. Either a single derivation, or a list - of derivations. + Top level paths in the container. Either a single derivation, or a list of derivations. Default: [] @@ -278,10 +218,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB - Run-time configuration of the container. A full list of the options are - available at in the - - Docker Image Specification v1.2.0 . + Run-time configuration of the container. A full list of the options are available at in the Docker Image Specification v1.2.0 . Default: {} @@ -294,9 +231,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB - Date and time the layers were created. Follows the same - now exception supported by - buildImage. + Date and time the layers were created. Follows the same now exception supported by buildImage. Default: 1970-01-01T00:00:01Z @@ -325,9 +260,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB - Shell commands to run while building the final layer, without access to - most of the layer contents. Changes to this layer are "on top" of all the - other layers, so can create additional directories and files. + Shell commands to run while building the final layer, without access to most of the layer contents. Changes to this layer are "on top" of all the other layers, so can create additional directories and files. @@ -337,8 +270,7 @@ hello latest de2bf4786de6 About a minute ago 25.2MB Behavior of <varname>contents</varname> in the final image - Each path directly listed in contents will have a - symlink in the root of the image. + Each path directly listed in contents will have a symlink in the root of the image. @@ -349,8 +281,7 @@ pkgs.dockerTools.buildLayeredImage { contents = [ pkgs.hello ]; } ]]> - will create symlinks for all the paths in the hello - package: + will create symlinks for all the paths in the hello package: /nix/store/h1zb1padqbbb7jicsvkmrym3r6snphxg-hello-2.10/bin/hello /share/info/hello.info -> /nix/store/h1zb1padqbbb7jicsvkmrym3r6snphxg-hello-2.10/share/info/hello.info @@ -363,13 +294,11 @@ pkgs.dockerTools.buildLayeredImage { Automatic inclusion of <varname>config</varname> references - The closure of config is automatically included in the - closure of the final image. + The closure of config is automatically included in the closure of the final image. - This allows you to make very simple Docker images with very little code. - This container will start up and run hello: + This allows you to make very simple Docker images with very little code. This container will start up and run hello: Adjusting maxLayers - Increasing the maxLayers increases the number of layers - which have a chance to be shared between different images. + Increasing the maxLayers increases the number of layers which have a chance to be shared between different images. - Modern Docker installations support up to 128 layers, however older - versions support as few as 42. + Modern Docker installations support up to 128 layers, however older versions support as few as 42. - If the produced image will not be extended by other Docker builds, it is - safe to set maxLayers to 128. However - it will be impossible to extend the image further. + If the produced image will not be extended by other Docker builds, it is safe to set maxLayers to 128. However it will be impossible to extend the image further. - The first (maxLayers-2) most "popular" paths will have - their own individual layers, then layer #maxLayers-1 - will contain all the remaining "unpopular" paths, and finally layer - #maxLayers will contain the Image configuration. + The first (maxLayers-2) most "popular" paths will have their own individual layers, then layer #maxLayers-1 will contain all the remaining "unpopular" paths, and finally layer #maxLayers will contain the Image configuration. - Docker's Layers are not inherently ordered, they are content-addressable - and are not explicitly layered until they are composed in to an Image. + Docker's Layers are not inherently ordered, they are content-addressable and are not explicitly layered until they are composed in to an Image. @@ -416,10 +337,7 @@ pkgs.dockerTools.buildLayeredImage { pullImage - This function is analogous to the docker pull command, in - that it can be used to pull a Docker image from a Docker registry. By - default Docker Hub is used - to pull images. + This function is analogous to the docker pull command, in that it can be used to pull a Docker image from a Docker registry. By default Docker Hub is used to pull images. @@ -444,71 +362,51 @@ pullImage { - imageName specifies the name of the image to be - downloaded, which can also include the registry namespace (e.g. - nixos). This argument is required. + imageName specifies the name of the image to be downloaded, which can also include the registry namespace (e.g. nixos). This argument is required. - imageDigest specifies the digest of the image to be - downloaded. This argument is required. + imageDigest specifies the digest of the image to be downloaded. This argument is required. - finalImageName, if specified, this is the name of the - image to be created. Note it is never used to fetch the image since we - prefer to rely on the immutable digest ID. By default it's equal to - imageName. + finalImageName, if specified, this is the name of the image to be created. Note it is never used to fetch the image since we prefer to rely on the immutable digest ID. By default it's equal to imageName. - finalImageTag, if specified, this is the tag of the - image to be created. Note it is never used to fetch the image since we - prefer to rely on the immutable digest ID. By default it's - latest. + finalImageTag, if specified, this is the tag of the image to be created. Note it is never used to fetch the image since we prefer to rely on the immutable digest ID. By default it's latest. - sha256 is the checksum of the whole fetched image. This - argument is required. + sha256 is the checksum of the whole fetched image. This argument is required. - os, if specified, is the operating system of the - fetched image. By default it's linux. + os, if specified, is the operating system of the fetched image. By default it's linux. - arch, if specified, is the cpu architecture of the - fetched image. By default it's x86_64. + arch, if specified, is the cpu architecture of the fetched image. By default it's x86_64. - nix-prefetch-docker command can be used to get required - image parameters: + nix-prefetch-docker command can be used to get required image parameters: $ nix run nixpkgs.nix-prefetch-docker -c nix-prefetch-docker --image-name mysql --image-tag 5 - Since a given imageName may transparently refer to a - manifest list of images which support multiple architectures and/or - operating systems, you can supply the and - arguments to specify exactly which image you want. - By default it will match the OS and architecture of the host the command is - run on. + Since a given imageName may transparently refer to a manifest list of images which support multiple architectures and/or operating systems, you can supply the and arguments to specify exactly which image you want. By default it will match the OS and architecture of the host the command is run on. $ nix-prefetch-docker --image-name mysql --image-tag 5 --arch x86_64 --os linux - Desired image name and tag can be set using - and - arguments: + Desired image name and tag can be set using and arguments: $ nix-prefetch-docker --image-name mysql --image-tag 5 --final-image-name eu.gcr.io/my-project/mysql --final-image-tag prod @@ -519,17 +417,12 @@ pullImage { exportImage - This function is analogous to the docker export command, - in that it can be used to flatten a Docker image that contains multiple - layers. It is in fact the result of the merge of all the layers of the - image. As such, the result is suitable for being imported in Docker with - docker import. + This function is analogous to the docker export command, in that it can be used to flatten a Docker image that contains multiple layers. It is in fact the result of the merge of all the layers of the image. As such, the result is suitable for being imported in Docker with docker import. - Using this function requires the kvm device to be - available. + Using this function requires the kvm device to be available. @@ -551,14 +444,11 @@ exportImage { - The parameters relative to the base image have the same synopsis as - described in , except that - fromImage is the only required argument in this case. + The parameters relative to the base image have the same synopsis as described in , except that fromImage is the only required argument in this case. - The name argument is the name of the derivation output, - which defaults to fromImage.name. + The name argument is the name of the derivation output, which defaults to fromImage.name. @@ -566,11 +456,7 @@ exportImage { shadowSetup - This constant string is a helper for setting up the base files for managing - users and groups, only if such files don't exist already. It is suitable for - being used in a runAsRoot - script for cases like - in the example below: + This constant string is a helper for setting up the base files for managing users and groups, only if such files don't exist already. It is suitable for being used in a runAsRoot script for cases like in the example below: @@ -592,9 +478,7 @@ buildImage { - Creating base files like /etc/passwd or - /etc/login.defs is necessary for shadow-utils to - manipulate users and groups. + Creating base files like /etc/passwd or /etc/login.defs is necessary for shadow-utils to manipulate users and groups. diff --git a/doc/functions/fetchers.xml b/doc/functions/fetchers.xml index a736008c9d4..369c1fb153e 100644 --- a/doc/functions/fetchers.xml +++ b/doc/functions/fetchers.xml @@ -5,18 +5,11 @@ Fetcher functions - When using Nix, you will frequently need to download source code and other - files from the internet. Nixpkgs comes with a few helper functions that allow - you to fetch fixed-output derivations in a structured way. + When using Nix, you will frequently need to download source code and other files from the internet. Nixpkgs comes with a few helper functions that allow you to fetch fixed-output derivations in a structured way. - The two fetcher primitives are fetchurl and - fetchzip. Both of these have two required arguments, a - URL and a hash. The hash is typically sha256, although - many more hash algorithms are supported. Nixpkgs contributors are currently - recommended to use sha256. This hash will be used by Nix - to identify your source. A typical usage of fetchurl is provided below. + The two fetcher primitives are fetchurl and fetchzip. Both of these have two required arguments, a URL and a hash. The hash is typically sha256, although many more hash algorithms are supported. Nixpkgs contributors are currently recommended to use sha256. This hash will be used by Nix to identify your source. A typical usage of fetchurl is provided below. - The main difference between fetchurl and - fetchzip is in how they store the contents. - fetchurl will store the unaltered contents of the URL - within the Nix store. fetchzip on the other hand will - decompress the archive for you, making files and directories directly - accessible in the future. fetchzip can only be used with - archives. Despite the name, fetchzip is not limited to - .zip files and can also be used with any tarball. + The main difference between fetchurl and fetchzip is in how they store the contents. fetchurl will store the unaltered contents of the URL within the Nix store. fetchzip on the other hand will decompress the archive for you, making files and directories directly accessible in the future. fetchzip can only be used with archives. Despite the name, fetchzip is not limited to .zip files and can also be used with any tarball. - fetchpatch works very similarly to - fetchurl with the same arguments expected. It expects - patch files as a source and and performs normalization on them before - computing the checksum. For example it will remove comments or other unstable - parts that are sometimes added by version control systems and can change over - time. + fetchpatch works very similarly to fetchurl with the same arguments expected. It expects patch files as a source and and performs normalization on them before computing the checksum. For example it will remove comments or other unstable parts that are sometimes added by version control systems and can change over time. - Other fetcher functions allow you to add source code directly from a VCS such - as subversion or git. These are mostly straightforward names based on the - name of the command used with the VCS system. Because they give you a working - repository, they act most like fetchzip. + Other fetcher functions allow you to add source code directly from a VCS such as subversion or git. These are mostly straightforward names based on the name of the command used with the VCS system. Because they give you a working repository, they act most like fetchzip. @@ -65,8 +43,7 @@ stdenv.mkDerivation { - Used with Subversion. Expects url to a Subversion - directory, rev, and sha256. + Used with Subversion. Expects url to a Subversion directory, rev, and sha256. @@ -76,10 +53,7 @@ stdenv.mkDerivation { - Used with Git. Expects url to a Git repo, - rev, and sha256. - rev in this case can be full the git commit id (SHA1 - hash) or a tag name like refs/tags/v1.0. + Used with Git. Expects url to a Git repo, rev, and sha256. rev in this case can be full the git commit id (SHA1 hash) or a tag name like refs/tags/v1.0. @@ -89,8 +63,7 @@ stdenv.mkDerivation { - Used with Fossil. Expects url to a Fossil archive, - rev, and sha256. + Used with Fossil. Expects url to a Fossil archive, rev, and sha256. @@ -100,8 +73,7 @@ stdenv.mkDerivation { - Used with CVS. Expects cvsRoot, tag, - and sha256. + Used with CVS. Expects cvsRoot, tag, and sha256. @@ -111,18 +83,14 @@ stdenv.mkDerivation { - Used with Mercurial. Expects url, - rev, and sha256. + Used with Mercurial. Expects url, rev, and sha256. - A number of fetcher functions wrap part of fetchurl and - fetchzip. They are mainly convenience functions intended - for commonly used destinations of source code in Nixpkgs. These wrapper - fetchers are listed below. + A number of fetcher functions wrap part of fetchurl and fetchzip. They are mainly convenience functions intended for commonly used destinations of source code in Nixpkgs. These wrapper fetchers are listed below. @@ -132,17 +100,7 @@ stdenv.mkDerivation { - fetchFromGitHub expects four arguments. - owner is a string corresponding to the GitHub user or - organization that controls this repository. repo - corresponds to the name of the software repository. These are located at - the top of every GitHub HTML page as - owner/repo. rev - corresponds to the Git commit hash or tag (e.g v1.0) - that will be downloaded from Git. Finally, sha256 - corresponds to the hash of the extracted directory. Again, other hash - algorithms are also available but sha256 is currently - preferred. + fetchFromGitHub expects four arguments. owner is a string corresponding to the GitHub user or organization that controls this repository. repo corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as owner/repo. rev corresponds to the Git commit hash or tag (e.g v1.0) that will be downloaded from Git. Finally, sha256 corresponds to the hash of the extracted directory. Again, other hash algorithms are also available but sha256 is currently preferred. @@ -152,8 +110,7 @@ stdenv.mkDerivation { - This is used with GitLab repositories. The arguments expected are very - similar to fetchFromGitHub above. + This is used with GitLab repositories. The arguments expected are very similar to fetchFromGitHub above. @@ -163,8 +120,7 @@ stdenv.mkDerivation { - This is used with BitBucket repositories. The arguments expected are very - similar to fetchFromGitHub above. + This is used with BitBucket repositories. The arguments expected are very similar to fetchFromGitHub above. @@ -174,8 +130,7 @@ stdenv.mkDerivation { - This is used with Savannah repositories. The arguments expected are very - similar to fetchFromGitHub above. + This is used with Savannah repositories. The arguments expected are very similar to fetchFromGitHub above. @@ -185,8 +140,7 @@ stdenv.mkDerivation { - This is used with repo.or.cz repositories. The arguments expected are very - similar to fetchFromGitHub above. + This is used with repo.or.cz repositories. The arguments expected are very similar to fetchFromGitHub above. diff --git a/doc/functions/fhs-environments.xml b/doc/functions/fhs-environments.xml index 79682080be3..e7b81e97a23 100644 --- a/doc/functions/fhs-environments.xml +++ b/doc/functions/fhs-environments.xml @@ -5,15 +5,7 @@ buildFHSUserEnv - buildFHSUserEnv provides a way to build and run - FHS-compatible lightweight sandboxes. It creates an isolated root with bound - /nix/store, so its footprint in terms of disk space - needed is quite small. This allows one to run software which is hard or - unfeasible to patch for NixOS -- 3rd-party source trees with FHS assumptions, - games distributed as tarballs, software with integrity checking and/or - external self-updated binaries. It uses Linux namespaces feature to create - temporary lightweight environments which are destroyed after all child - processes exit, without root user rights requirement. Accepted arguments are: + buildFHSUserEnv provides a way to build and run FHS-compatible lightweight sandboxes. It creates an isolated root with bound /nix/store, so its footprint in terms of disk space needed is quite small. This allows one to run software which is hard or unfeasible to patch for NixOS -- 3rd-party source trees with FHS assumptions, games distributed as tarballs, software with integrity checking and/or external self-updated binaries. It uses Linux namespaces feature to create temporary lightweight environments which are destroyed after all child processes exit, without root user rights requirement. Accepted arguments are: @@ -33,8 +25,7 @@ - Packages to be installed for the main host's architecture (i.e. x86_64 on - x86_64 installations). Along with libraries binaries are also installed. + Packages to be installed for the main host's architecture (i.e. x86_64 on x86_64 installations). Along with libraries binaries are also installed. @@ -44,9 +35,7 @@ - Packages to be installed for all architectures supported by a host (i.e. - i686 and x86_64 on x86_64 installations). Only libraries are installed by - default. + Packages to be installed for all architectures supported by a host (i.e. i686 and x86_64 on x86_64 installations). Only libraries are installed by default. @@ -66,8 +55,7 @@ - Like extraBuildCommands, but executed only on multilib - architectures. + Like extraBuildCommands, but executed only on multilib architectures. @@ -77,8 +65,7 @@ - Additional derivation outputs to be linked for both target and - multi-architecture packages. + Additional derivation outputs to be linked for both target and multi-architecture packages. @@ -88,8 +75,7 @@ - Additional commands to be executed for finalizing the derivation with - runner script. + Additional commands to be executed for finalizing the derivation with runner script. @@ -99,16 +85,14 @@ - A command that would be executed inside the sandbox and passed all the - command line arguments. It defaults to bash. + A command that would be executed inside the sandbox and passed all the command line arguments. It defaults to bash. - One can create a simple environment using a shell.nix like - that: + One can create a simple environment using a shell.nix like that: - Running nix-shell would then drop you into a shell with - these libraries and binaries available. You can use this to run closed-source - applications which expect FHS structure without hassles: simply change - runScript to the application path, e.g. - ./bin/start.sh -- relative paths are supported. + Running nix-shell would then drop you into a shell with these libraries and binaries available. You can use this to run closed-source applications which expect FHS structure without hassles: simply change runScript to the application path, e.g. ./bin/start.sh -- relative paths are supported. diff --git a/doc/functions/generators.xml b/doc/functions/generators.xml index e860b10e897..9ce1f85eb17 100644 --- a/doc/functions/generators.xml +++ b/doc/functions/generators.xml @@ -5,28 +5,15 @@ Generators - Generators are functions that create file formats from nix data structures, - e. g. for configuration files. There are generators available for: - INI, JSON and YAML + Generators are functions that create file formats from nix data structures, e. g. for configuration files. There are generators available for: INI, JSON and YAML - All generators follow a similar call interface: generatorName - configFunctions data, where configFunctions is an - attrset of user-defined functions that format nested parts of the content. - They each have common defaults, so often they do not need to be set manually. - An example is mkSectionName ? (name: libStr.escape [ "[" "]" ] - name) from the INI generator. It receives the name - of a section and sanitizes it. The default mkSectionName - escapes [ and ] with a backslash. + All generators follow a similar call interface: generatorName configFunctions data, where configFunctions is an attrset of user-defined functions that format nested parts of the content. They each have common defaults, so often they do not need to be set manually. An example is mkSectionName ? (name: libStr.escape [ "[" "]" ] name) from the INI generator. It receives the name of a section and sanitizes it. The default mkSectionName escapes [ and ] with a backslash. - Generators can be fine-tuned to produce exactly the file format required by - your application/service. One example is an INI-file format which uses - : as separator, the strings - "yes"/"no" as boolean values and - requires all string values to be quoted: + Generators can be fine-tuned to produce exactly the file format required by your application/service. One example is an INI-file format which uses : as separator, the strings "yes"/"no" as boolean values and requires all string values to be quoted: @@ -77,13 +64,11 @@ merge:"diff3" - Nix store paths can be converted to strings by enclosing a derivation - attribute like so: "${drv}". + Nix store paths can be converted to strings by enclosing a derivation attribute like so: "${drv}". - Detailed documentation for each generator can be found in - lib/generators.nix. + Detailed documentation for each generator can be found in lib/generators.nix. diff --git a/doc/functions/library.xml b/doc/functions/library.xml index e6aedaa6efd..6ffb944b5a6 100644 --- a/doc/functions/library.xml +++ b/doc/functions/library.xml @@ -5,8 +5,7 @@ Nixpkgs Library Functions - Nixpkgs provides a standard library at pkgs.lib, or - through import <nixpkgs/lib>. + Nixpkgs provides a standard library at pkgs.lib, or through import <nixpkgs/lib>. diff --git a/doc/functions/library/asserts.xml b/doc/functions/library/asserts.xml index 437850e408b..10891039e86 100644 --- a/doc/functions/library/asserts.xml +++ b/doc/functions/library/asserts.xml @@ -27,8 +27,7 @@ - Condition under which the msg should - not be printed. + Condition under which the msg should not be printed. @@ -64,9 +63,7 @@ stderr> assert failed - Specialized asserts.assertMsg for checking if - val is one of the elements of xs. - Useful for checking enums. + Specialized asserts.assertMsg for checking if val is one of the elements of xs. Useful for checking enums. @@ -76,8 +73,7 @@ stderr> assert failed - The name of the variable the user entered val into, - for inclusion in the error message. + The name of the variable the user entered val into, for inclusion in the error message. @@ -87,8 +83,7 @@ stderr> assert failed - The value of what the user provided, to be compared against the values in - xs. + The value of what the user provided, to be compared against the values in xs. diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml index 65d0b40e2e8..f9234069392 100644 --- a/doc/functions/library/attrsets.xml +++ b/doc/functions/library/attrsets.xml @@ -23,8 +23,7 @@ - A list of strings representing the path through the nested attribute set - set. + A list of strings representing the path through the nested attribute set set. @@ -34,8 +33,7 @@ - Default value if attrPath does not resolve to an - existing value. + Default value if attrPath does not resolve to an existing value. @@ -88,8 +86,7 @@ lib.attrsets.attrByPath [ "a" "b" ] 0 {} - A list of strings representing the path through the nested attribute set - set. + A list of strings representing the path through the nested attribute set set. @@ -125,8 +122,7 @@ lib.attrsets.hasAttrByPath - Create a new attribute set with value set at the nested - attribute location specified in attrPath. + Create a new attribute set with value set at the nested attribute location specified in attrPath. @@ -146,8 +142,7 @@ lib.attrsets.hasAttrByPath - The value to set at the location described by - attrPath. + The value to set at the location described by attrPath. @@ -171,8 +166,7 @@ lib.attrsets.setAttrByPath [ "a" "b" ] 3 - Like except - without a default, and it will throw if the value doesn't exist. + Like except without a default, and it will throw if the value doesn't exist. @@ -182,8 +176,7 @@ lib.attrsets.setAttrByPath [ "a" "b" ] 3 - A list of strings representing the path through the nested attribute set - set. + A list of strings representing the path through the nested attribute set set. @@ -235,8 +228,7 @@ lib.attrsets.getAttrFromPath [ "x" "y" ] { } - The list of attributes to fetch from set. Each - attribute name must exist on the attrbitue set. + The list of attributes to fetch from set. Each attribute name must exist on the attrbitue set. @@ -282,8 +274,7 @@ error: attribute 'd' missing - Provides a backwards-compatible interface of - builtins.attrValues for Nix version older than 1.8. + Provides a backwards-compatible interface of builtins.attrValues for Nix version older than 1.8. @@ -317,14 +308,11 @@ lib.attrsets.attrValues { a = 1; b = 2; c = 3; } - Collect each attribute named `attr' from the list of attribute sets, - sets. Sets that don't contain the named attribute are - ignored. + Collect each attribute named `attr' from the list of attribute sets, sets. Sets that don't contain the named attribute are ignored. - Provides a backwards-compatible interface of - builtins.catAttrs for Nix version older than 1.9. + Provides a backwards-compatible interface of builtins.catAttrs for Nix version older than 1.9. @@ -334,8 +322,7 @@ lib.attrsets.attrValues { a = 1; b = 2; c = 3; } - Attribute name to select from each attribute set in - sets. + Attribute name to select from each attribute set in sets. @@ -372,8 +359,7 @@ catAttrs "a" [{a = 1;} {b = 0;} {a = 2;}] - Filter an attribute set by removing all attributes for which the given - predicate return false. + Filter an attribute set by removing all attributes for which the given predicate return false. @@ -386,8 +372,7 @@ catAttrs "a" [{a = 1;} {b = 0;} {a = 2;}] String -> Any -> Bool - Predicate which returns true to include an attribute, or returns false to - exclude it. + Predicate which returns true to include an attribute, or returns false to exclude it. @@ -412,8 +397,7 @@ catAttrs "a" [{a = 1;} {b = 0;} {a = 2;}] - Returns true to include the attribute, - false to exclude the attribute. + Returns true to include the attribute, false to exclude the attribute. @@ -447,8 +431,7 @@ filterAttrs (n: v: n == "foo") { foo = 1; bar = 2; } - Filter an attribute set recursively by removing all attributes for which the - given predicate return false. + Filter an attribute set recursively by removing all attributes for which the given predicate return false. @@ -461,8 +444,7 @@ filterAttrs (n: v: n == "foo") { foo = 1; bar = 2; } String -> Any -> Bool - Predicate which returns true to include an attribute, or returns false to - exclude it. + Predicate which returns true to include an attribute, or returns false to exclude it. @@ -487,8 +469,7 @@ filterAttrs (n: v: n == "foo") { foo = 1; bar = 2; } - Returns true to include the attribute, - false to exclude the attribute. + Returns true to include the attribute, false to exclude the attribute. @@ -557,8 +538,7 @@ lib.attrsets.filterAttrsRecursive Any -> Any -> Any - Given a value val and a collector - col, combine the two. + Given a value val and a collector col, combine the two. @@ -578,8 +558,7 @@ lib.attrsets.filterAttrsRecursive - The result of previous op calls with other values - and nul. + The result of previous op calls with other values and nul. @@ -632,9 +611,7 @@ lib.attrsets.foldAttrs - Recursively collect sets that verify a given predicate named - pred from the set attrs. The recursion - stops when pred returns true. + Recursively collect sets that verify a given predicate named pred from the set attrs. The recursion stops when pred returns true. @@ -702,8 +679,7 @@ collect (x: x ? outPath) - Utility function that creates a {name, value} pair as - expected by builtins.listToAttrs. + Utility function that creates a {name, value} pair as expected by builtins.listToAttrs. @@ -747,13 +723,11 @@ nameValuePair "some" 6 - Apply a function to each element in an attribute set, creating a new - attribute set. + Apply a function to each element in an attribute set, creating a new attribute set. - Provides a backwards-compatible interface of - builtins.mapAttrs for Nix version older than 2.1. + Provides a backwards-compatible interface of builtins.mapAttrs for Nix version older than 2.1. @@ -814,9 +788,7 @@ lib.attrsets.mapAttrs - Like mapAttrs, but allows the name of each attribute to - be changed in addition to the value. The applied function should return both - the new name and value as a nameValuePair. + Like mapAttrs, but allows the name of each attribute to be changed in addition to the value. The applied function should return both the new name and value as a nameValuePair. @@ -829,10 +801,8 @@ lib.attrsets.mapAttrs String -> Any -> { name = String; value = Any } - Given an attribute's name and value, return a new - name - value pair. + Given an attribute's name and value, return a new name value pair. @@ -891,8 +861,7 @@ lib.attrsets.mapAttrs' (name: value: lib.attrsets.nameValuePair ("foo_" + name) - Call fn for each attribute in the given - set and return the result in a list. + Call fn for each attribute in the given set and return the result in a list. @@ -962,9 +931,7 @@ lib.attrsets.mapAttrsToList (name: value: "${name}=${value}") - Like mapAttrs, except that it recursively applies - itself to attribute sets. Also, the first argument of the argument function - is a list of the names of the containing attributes. + Like mapAttrs, except that it recursively applies itself to attribute sets. Also, the first argument of the argument function is a list of the names of the containing attributes. @@ -989,10 +956,7 @@ lib.attrsets.mapAttrsToList (name: value: "${name}=${value}") The list of attribute names to this value. - For example, the name_path for the - example string in the attribute set { foo - = { bar = "example"; }; } is [ "foo" "bar" - ]. + For example, the name_path for the example string in the attribute set { foo = { bar = "example"; }; } is [ "foo" "bar" ]. @@ -1059,11 +1023,7 @@ mapAttrsRecursive - Like mapAttrsRecursive, but it takes an additional - predicate function that tells it whether to recursive into an attribute set. - If it returns false, mapAttrsRecursiveCond does not - recurse, but does apply the map function. It is returns true, it does - recurse, and does not apply the map function. + Like mapAttrsRecursive, but it takes an additional predicate function that tells it whether to recursive into an attribute set. If it returns false, mapAttrsRecursiveCond does not recurse, but does apply the map function. It is returns true, it does recurse, and does not apply the map function. @@ -1076,8 +1036,7 @@ mapAttrsRecursive (AttrSet -> Bool) - Determine if mapAttrsRecursive should recurse deeper - in to the attribute set. + Determine if mapAttrsRecursive should recurse deeper in to the attribute set. @@ -1114,10 +1073,7 @@ mapAttrsRecursive The list of attribute names to this value. - For example, the name_path for the - example string in the attribute set { foo - = { bar = "example"; }; } is [ "foo" "bar" - ]. + For example, the name_path for the example string in the attribute set { foo = { bar = "example"; }; } is [ "foo" "bar" ]. @@ -1181,8 +1137,7 @@ lib.attrsets.mapAttrsRecursiveCond - Generate an attribute set by mapping a function over a list of attribute - names. + Generate an attribute set by mapping a function over a list of attribute names. @@ -1241,8 +1196,7 @@ lib.attrsets.genAttrs [ "foo" "bar" ] (name: "x_${name}") - Check whether the argument is a derivation. Any set with { type = - "derivation"; } counts as a derivation. + Check whether the argument is a derivation. Any set with { type = "derivation"; } counts as a derivation. @@ -1320,8 +1274,7 @@ lib.attrsets.isDerivation "foobar" - Condition under which the as attribute set is - returned. + Condition under which the as attribute set is returned. @@ -1363,8 +1316,7 @@ lib.attrsets.optionalAttrs false { my = "set"; } - Merge sets of attributes and use the function f to merge - attribute values where the attribute name is in names. + Merge sets of attributes and use the function f to merge attribute values where the attribute name is in names. @@ -1451,11 +1403,8 @@ lib.attrsets.zipAttrsWithNames - Merge sets of attributes and use the function f to merge - attribute values. Similar to - where - all key names are passed for names. + Merge sets of attributes and use the function f to merge attribute values. Similar to where all key names are passed for names. @@ -1531,9 +1480,7 @@ lib.attrsets.zipAttrsWith - Merge sets of attributes and combine each attribute value in to a list. - Similar to - where the merge function returns a list of all values. + Merge sets of attributes and combine each attribute value in to a list. Similar to where the merge function returns a list of all values. @@ -1573,12 +1520,7 @@ lib.attrsets.zipAttrs - Does the same as the update operator // except that - attributes are merged until the given predicate is verified. The predicate - should accept 3 arguments which are the path to reach the attribute, a part - of the first attribute set and a part of the second attribute set. When the - predicate is verified, the value of the first attribute set is replaced by - the value of the second attribute set. + Does the same as the update operator // except that attributes are merged until the given predicate is verified. The predicate should accept 3 arguments which are the path to reach the attribute, a part of the first attribute set and a part of the second attribute set. When the predicate is verified, the value of the first attribute set is replaced by the value of the second attribute set. @@ -1681,10 +1623,7 @@ lib.attrsets.recursiveUpdateUntil (path: l: r: path == ["foo"]) - A recursive variant of the update operator //. The - recursion stops when one of the attribute values is not an attribute set, in - which case the right hand side value takes precedence over the left hand - side value. + A recursive variant of the update operator //. The recursion stops when one of the attribute values is not an attribute set, in which case the right hand side value takes precedence over the left hand side value. diff --git a/doc/functions/nix-gitignore.xml b/doc/functions/nix-gitignore.xml index 9011570d1ea..37a82b196cc 100644 --- a/doc/functions/nix-gitignore.xml +++ b/doc/functions/nix-gitignore.xml @@ -5,21 +5,14 @@ pkgs.nix-gitignore - pkgs.nix-gitignore is a function that acts similarly to - builtins.filterSource but also allows filtering with the - help of the gitignore format. + pkgs.nix-gitignore is a function that acts similarly to builtins.filterSource but also allows filtering with the help of the gitignore format.
Usage - pkgs.nix-gitignore exports a number of functions, but - you'll most likely need either gitignoreSource or - gitignoreSourcePure. As their first argument, they both - accept either 1. a file with gitignore lines or 2. a string with gitignore - lines, or 3. a list of either of the two. They will be concatenated into a - single big string. + pkgs.nix-gitignore exports a number of functions, but you'll most likely need either gitignoreSource or gitignoreSourcePure. As their first argument, they both accept either 1. a file with gitignore lines or 2. a string with gitignore lines, or 3. a list of either of the two. They will be concatenated into a single big string. - These functions are derived from the Filter functions by - setting the first filter argument to (_: _: true): + These functions are derived from the Filter functions by setting the first filter argument to (_: _: true): - Those filter functions accept the same arguments the - builtins.filterSource function would pass to its filters, - thus fn: gitignoreFilterSourcePure fn "" should be - extensionally equivalent to filterSource. The file is - blacklisted iff it's blacklisted by either your filter or the - gitignoreFilter. + Those filter functions accept the same arguments the builtins.filterSource function would pass to its filters, thus fn: gitignoreFilterSourcePure fn "" should be extensionally equivalent to filterSource. The file is blacklisted iff it's blacklisted by either your filter or the gitignoreFilter. @@ -71,8 +58,7 @@ gitignoreFilter = ign: root: filterPattern (gitignoreToPatterns ign) root; gitignore files in subdirectories - If you wish to use a filter that would search for .gitignore files in - subdirectories, just like git does by default, use this function: + If you wish to use a filter that would search for .gitignore files in subdirectories, just like git does by default, use this function: pkgs.ociTools - pkgs.ociTools is a set of functions for creating - containers according to the - OCI - container specification v1.0.0. Beyond that it makes no assumptions - about the container runner you choose to use to run the created container. + pkgs.ociTools is a set of functions for creating containers according to the OCI container specification v1.0.0. Beyond that it makes no assumptions about the container runner you choose to use to run the created container.
buildContainer - This function creates a simple OCI container that runs a single command - inside of it. An OCI container consists of a config.json - and a rootfs directory.The nix store of the container will contain all - referenced dependencies of the given command. + This function creates a simple OCI container that runs a single command inside of it. An OCI container consists of a config.json and a rootfs directory.The nix store of the container will contain all referenced dependencies of the given command. - The parameters of buildContainer with an example value - are described below: + The parameters of buildContainer with an example value are described below: @@ -51,23 +43,17 @@ buildContainer { - args specifies a set of arguments to run inside the - container. This is the only required argument for - buildContainer. All referenced packages inside the - derivation will be made available inside the container + args specifies a set of arguments to run inside the container. This is the only required argument for buildContainer. All referenced packages inside the derivation will be made available inside the container - mounts specifies additional mount points chosen by the - user. By default only a minimal set of necessary filesystems are mounted - into the container (e.g procfs, cgroupfs) + mounts specifies additional mount points chosen by the user. By default only a minimal set of necessary filesystems are mounted into the container (e.g procfs, cgroupfs) - readonly makes the container's rootfs read-only if it - is set to true. The default value is false false. + readonly makes the container's rootfs read-only if it is set to true. The default value is false false. diff --git a/doc/functions/overrides.xml b/doc/functions/overrides.xml index 1bd90d2a0c7..4ba4283c609 100644 --- a/doc/functions/overrides.xml +++ b/doc/functions/overrides.xml @@ -5,23 +5,18 @@ Overriding - Sometimes one wants to override parts of nixpkgs, e.g. - derivation attributes, the results of derivations. + Sometimes one wants to override parts of nixpkgs, e.g. derivation attributes, the results of derivations. - These functions are used to make changes to packages, returning only single - packages. Overlays, on the other - hand, can be used to combine the overridden packages across the entire - package set of Nixpkgs. + These functions are used to make changes to packages, returning only single packages. Overlays, on the other hand, can be used to combine the overridden packages across the entire package set of Nixpkgs.
<pkg>.override - The function override is usually available for all the - derivations in the nixpkgs expression (pkgs). + The function override is usually available for all the derivations in the nixpkgs expression (pkgs). @@ -47,10 +42,7 @@ mypkg = pkgs.callPackage ./mypkg.nix { - In the first example, pkgs.foo is the result of a - function call with some default arguments, usually a derivation. Using - pkgs.foo.override will call the same function with the - given new arguments. + In the first example, pkgs.foo is the result of a function call with some default arguments, usually a derivation. Using pkgs.foo.override will call the same function with the given new arguments.
@@ -58,12 +50,7 @@ mypkg = pkgs.callPackage ./mypkg.nix { <pkg>.overrideAttrs - The function overrideAttrs allows overriding the - attribute set passed to a stdenv.mkDerivation call, - producing a new derivation based on the original one. This function is - available on all derivations produced by the - stdenv.mkDerivation function, which is most packages in - the nixpkgs expression pkgs. + The function overrideAttrs allows overriding the attribute set passed to a stdenv.mkDerivation call, producing a new derivation based on the original one. This function is available on all derivations produced by the stdenv.mkDerivation function, which is most packages in the nixpkgs expression pkgs. @@ -76,30 +63,16 @@ helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec { - In the above example, the separateDebugInfo attribute is - overridden to be true, thus building debug info for - helloWithDebug, while all other attributes will be - retained from the original hello package. + In the above example, the separateDebugInfo attribute is overridden to be true, thus building debug info for helloWithDebug, while all other attributes will be retained from the original hello package. - The argument oldAttrs is conventionally used to refer to - the attr set originally passed to stdenv.mkDerivation. + The argument oldAttrs is conventionally used to refer to the attr set originally passed to stdenv.mkDerivation. - Note that separateDebugInfo is processed only by the - stdenv.mkDerivation function, not the generated, raw Nix - derivation. Thus, using overrideDerivation will not work - in this case, as it overrides only the attributes of the final derivation. - It is for this reason that overrideAttrs should be - preferred in (almost) all cases to overrideDerivation, - i.e. to allow using stdenv.mkDerivation to process input - arguments, as well as the fact that it is easier to use (you can use the - same attribute names you see in your Nix code, instead of the ones - generated (e.g. buildInputs vs - nativeBuildInputs), and it involves less typing). + Note that separateDebugInfo is processed only by the stdenv.mkDerivation function, not the generated, raw Nix derivation. Thus, using overrideDerivation will not work in this case, as it overrides only the attributes of the final derivation. It is for this reason that overrideAttrs should be preferred in (almost) all cases to overrideDerivation, i.e. to allow using stdenv.mkDerivation to process input arguments, as well as the fact that it is easier to use (you can use the same attribute names you see in your Nix code, instead of the ones generated (e.g. buildInputs vs nativeBuildInputs), and it involves less typing).
@@ -109,34 +82,18 @@ helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec { - You should prefer overrideAttrs in almost all cases, see - its documentation for the reasons why. - overrideDerivation is not deprecated and will continue - to work, but is less nice to use and does not have as many abilities as - overrideAttrs. + You should prefer overrideAttrs in almost all cases, see its documentation for the reasons why. overrideDerivation is not deprecated and will continue to work, but is less nice to use and does not have as many abilities as overrideAttrs. - Do not use this function in Nixpkgs as it evaluates a Derivation before - modifying it, which breaks package abstraction and removes error-checking - of function arguments. In addition, this evaluation-per-function - application incurs a performance penalty, which can become a problem if - many overrides are used. It is only intended for ad-hoc customisation, such - as in ~/.config/nixpkgs/config.nix. + Do not use this function in Nixpkgs as it evaluates a Derivation before modifying it, which breaks package abstraction and removes error-checking of function arguments. In addition, this evaluation-per-function application incurs a performance penalty, which can become a problem if many overrides are used. It is only intended for ad-hoc customisation, such as in ~/.config/nixpkgs/config.nix. - The function overrideDerivation creates a new derivation - based on an existing one by overriding the original's attributes with the - attribute set produced by the specified function. This function is available - on all derivations defined using the makeOverridable - function. Most standard derivation-producing functions, such as - stdenv.mkDerivation, are defined using this function, - which means most packages in the nixpkgs expression, - pkgs, have this function. + The function overrideDerivation creates a new derivation based on an existing one by overriding the original's attributes with the attribute set produced by the specified function. This function is available on all derivations defined using the makeOverridable function. Most standard derivation-producing functions, such as stdenv.mkDerivation, are defined using this function, which means most packages in the nixpkgs expression, pkgs, have this function. @@ -154,27 +111,16 @@ mySed = pkgs.gnused.overrideDerivation (oldAttrs: { - In the above example, the name, src, - and patches of the derivation will be overridden, while - all other attributes will be retained from the original derivation. + In the above example, the name, src, and patches of the derivation will be overridden, while all other attributes will be retained from the original derivation. - The argument oldAttrs is used to refer to the attribute - set of the original derivation. + The argument oldAttrs is used to refer to the attribute set of the original derivation. - A package's attributes are evaluated *before* being modified by the - overrideDerivation function. For example, the - name attribute reference in url = - "mirror://gnu/hello/${name}.tar.gz"; is filled-in *before* the - overrideDerivation function modifies the attribute set. - This means that overriding the name attribute, in this - example, *will not* change the value of the url - attribute. Instead, we need to override both the name - *and* url attributes. + A package's attributes are evaluated *before* being modified by the overrideDerivation function. For example, the name attribute reference in url = "mirror://gnu/hello/${name}.tar.gz"; is filled-in *before* the overrideDerivation function modifies the attribute set. This means that overriding the name attribute, in this example, *will not* change the value of the url attribute. Instead, we need to override both the name *and* url attributes.
@@ -183,9 +129,7 @@ mySed = pkgs.gnused.overrideDerivation (oldAttrs: { lib.makeOverridable - The function lib.makeOverridable is used to make the - result of a function easily customizable. This utility only makes sense for - functions that accept an argument set and return an attribute set. + The function lib.makeOverridable is used to make the result of a function easily customizable. This utility only makes sense for functions that accept an argument set and return an attribute set. @@ -197,16 +141,11 @@ c = lib.makeOverridable f { a = 1; b = 2; }; - The variable c is the value of the f - function applied with some default arguments. Hence the value of - c.result is 3, in this example. + The variable c is the value of the f function applied with some default arguments. Hence the value of c.result is 3, in this example. - The variable c however also has some additional - functions, like c.override which can - be used to override the default arguments. In this example the value of - (c.override { a = 4; }).result is 6. + The variable c however also has some additional functions, like c.override which can be used to override the default arguments. In this example the value of (c.override { a = 4; }).result is 6. diff --git a/doc/functions/prefer-remote-fetch.xml b/doc/functions/prefer-remote-fetch.xml index 3e43fd28ade..94d25d3d3ae 100644 --- a/doc/functions/prefer-remote-fetch.xml +++ b/doc/functions/prefer-remote-fetch.xml @@ -5,16 +5,12 @@ prefer-remote-fetch overlay - prefer-remote-fetch is an overlay that download sources - on remote builder. This is useful when the evaluating machine has a slow - upload while the builder can fetch faster directly from the source. To use - it, put the following snippet as a new overlay: + prefer-remote-fetch is an overlay that download sources on remote builder. This is useful when the evaluating machine has a slow upload while the builder can fetch faster directly from the source. To use it, put the following snippet as a new overlay: self: super: (super.prefer-remote-fetch self super) - A full configuration example for that sets the overlay up for your own - account, could look like this + A full configuration example for that sets the overlay up for your own account, could look like this $ mkdir ~/.config/nixpkgs/overlays/ $ cat > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix <<EOF diff --git a/doc/functions/shell.xml b/doc/functions/shell.xml index e5031c9463c..cef65d06b88 100644 --- a/doc/functions/shell.xml +++ b/doc/functions/shell.xml @@ -5,9 +5,7 @@ pkgs.mkShell - pkgs.mkShell is a special kind of derivation that is - only useful when using it combined with nix-shell. It will - in fact fail to instantiate when invoked with nix-build. + pkgs.mkShell is a special kind of derivation that is only useful when using it combined with nix-shell. It will in fact fail to instantiate when invoked with nix-build.
diff --git a/doc/functions/snaptools.xml b/doc/functions/snaptools.xml index d0e3efdf6c6..422fcfa37d8 100644 --- a/doc/functions/snaptools.xml +++ b/doc/functions/snaptools.xml @@ -5,28 +5,22 @@ pkgs.snapTools - pkgs.snapTools is a set of functions for creating - Snapcraft images. Snap and Snapcraft is not used to perform these operations. + pkgs.snapTools is a set of functions for creating Snapcraft images. Snap and Snapcraft is not used to perform these operations.
The makeSnap Function - makeSnap takes a single named argument, - meta. This argument mirrors - the upstream - snap.yaml format exactly. + makeSnap takes a single named argument, meta. This argument mirrors the upstream snap.yaml format exactly. - The base should not be be specified, as - makeSnap will force set it. + The base should not be be specified, as makeSnap will force set it. - Currently, makeSnap does not support creating GUI - stubs. + Currently, makeSnap does not support creating GUI stubs.
@@ -40,9 +34,7 @@ - nix-build this expression and install it with - snap install ./result --dangerous. - hello will now be the Snapcraft version of the package. + nix-build this expression and install it with snap install ./result --dangerous. hello will now be the Snapcraft version of the package.
@@ -53,21 +45,14 @@ Making a Graphical Snap - Graphical programs require many more integrations with the host. This - example uses Firefox as an example, because it is one of the most - complicated programs we could package. + Graphical programs require many more integrations with the host. This example uses Firefox as an example, because it is one of the most complicated programs we could package. - nix-build this expression and install it with - snap install ./result --dangerous. - nix-example-firefox will now be the Snapcraft version of - the Firefox package. + nix-build this expression and install it with snap install ./result --dangerous. nix-example-firefox will now be the Snapcraft version of the Firefox package. - The specific meaning behind plugs can be looked up in the - Snapcraft - interface documentation. + The specific meaning behind plugs can be looked up in the Snapcraft interface documentation. diff --git a/doc/functions/trivial-builders.xml b/doc/functions/trivial-builders.xml index 0211a4f3172..ae9f3a1b255 100644 --- a/doc/functions/trivial-builders.xml +++ b/doc/functions/trivial-builders.xml @@ -5,11 +5,7 @@ Trivial builders - Nixpkgs provides a couple of functions that help with building derivations. - The most important one, stdenv.mkDerivation, has already - been documented above. The following functions wrap - stdenv.mkDerivation, making it easier to use in certain - cases. + Nixpkgs provides a couple of functions that help with building derivations. The most important one, stdenv.mkDerivation, has already been documented above. The following functions wrap stdenv.mkDerivation, making it easier to use in certain cases. @@ -19,17 +15,7 @@ - This takes three arguments, name, - env, and buildCommand. - name is just the name that Nix will append to the store - path in the same way that stdenv.mkDerivation uses its - name attribute. env is an attribute - set specifying environment variables that will be set for this derivation. - These attributes are then passed to the wrapped - stdenv.mkDerivation. buildCommand - specifies the commands that will be run to create this derivation. Note - that you will need to create $out for Nix to register - the command as successful. + This takes three arguments, name, env, and buildCommand. name is just the name that Nix will append to the store path in the same way that stdenv.mkDerivation uses its name attribute. env is an attribute set specifying environment variables that will be set for this derivation. These attributes are then passed to the wrapped stdenv.mkDerivation. buildCommand specifies the commands that will be run to create this derivation. Note that you will need to create $out for Nix to register the command as successful. An example of using runCommand is provided below. @@ -62,10 +48,7 @@ - This works just like runCommand. The only difference is - that it also provides a C compiler in buildCommand’s - environment. To minimize your dependencies, you should only use this if - you are sure you will need a C compiler as part of running your command. + This works just like runCommand. The only difference is that it also provides a C compiler in buildCommand’s environment. To minimize your dependencies, you should only use this if you are sure you will need a C compiler as part of running your command. @@ -75,20 +58,10 @@ - These functions write text to the Nix store. This is - useful for creating scripts from Nix expressions. - writeTextFile takes an attribute set and expects two - arguments, name and text. - name corresponds to the name used in the Nix store - path. text will be the contents of the file. You can - also set executable to true to make this file have the - executable bit set. + These functions write text to the Nix store. This is useful for creating scripts from Nix expressions. writeTextFile takes an attribute set and expects two arguments, name and text. name corresponds to the name used in the Nix store path. text will be the contents of the file. You can also set executable to true to make this file have the executable bit set. - Many more commands wrap writeTextFile including - writeText, writeTextDir, - writeScript, and writeScriptBin. - These are convenience functions over writeTextFile. + Many more commands wrap writeTextFile including writeText, writeTextDir, writeScript, and writeScriptBin. These are convenience functions over writeTextFile. @@ -98,14 +71,7 @@ - This can be used to put many derivations into the same directory - structure. It works by creating a new derivation and adding symlinks to - each of the paths listed. It expects two arguments, - name, and paths. - name is the name used in the Nix store path for the - created derivation. paths is a list of paths that will - be symlinked. These paths can be to Nix store derivations or any other - subdirectory contained within. + This can be used to put many derivations into the same directory structure. It works by creating a new derivation and adding symlinks to each of the paths listed. It expects two arguments, name, and paths. name is the name used in the Nix store path for the created derivation. paths is a list of paths that will be symlinked. These paths can be to Nix store derivations or any other subdirectory contained within. diff --git a/doc/languages-frameworks/beam.xml b/doc/languages-frameworks/beam.xml index dee7f2d7419..65f28d0a2d3 100644 --- a/doc/languages-frameworks/beam.xml +++ b/doc/languages-frameworks/beam.xml @@ -7,12 +7,7 @@ Introduction - In this document and related Nix expressions, we use the term, - BEAM, to describe the environment. BEAM is the name of - the Erlang Virtual Machine and, as far as we're concerned, from a packaging - perspective, all languages that run on the BEAM are interchangeable. That - which varies, like the build system, is transparent to users of any given - BEAM package, so we make no distinction. + In this document and related Nix expressions, we use the term, BEAM, to describe the environment. BEAM is the name of the Erlang Virtual Machine and, as far as we're concerned, from a packaging perspective, all languages that run on the BEAM are interchangeable. That which varies, like the build system, is transparent to users of any given BEAM package, so we make no distinction. @@ -20,57 +15,36 @@ Structure - All BEAM-related expressions are available via the top-level - beam attribute, which includes: + All BEAM-related expressions are available via the top-level beam attribute, which includes: - interpreters: a set of compilers running on the BEAM, - including multiple Erlang/OTP versions - (beam.interpreters.erlangR19, etc), Elixir - (beam.interpreters.elixir) and LFE - (beam.interpreters.lfe). + interpreters: a set of compilers running on the BEAM, including multiple Erlang/OTP versions (beam.interpreters.erlangR19, etc), Elixir (beam.interpreters.elixir) and LFE (beam.interpreters.lfe). - packages: a set of package sets, each compiled with a - specific Erlang/OTP version, e.g. - beam.packages.erlangR19. + packages: a set of package sets, each compiled with a specific Erlang/OTP version, e.g. beam.packages.erlangR19. - The default Erlang compiler, defined by - beam.interpreters.erlang, is aliased as - erlang. The default BEAM package set is defined by - beam.packages.erlang and aliased at the top level as - beamPackages. + The default Erlang compiler, defined by beam.interpreters.erlang, is aliased as erlang. The default BEAM package set is defined by beam.packages.erlang and aliased at the top level as beamPackages. - To create a package set built with a custom Erlang version, use the lambda, - beam.packagesWith, which accepts an Erlang/OTP derivation - and produces a package set similar to - beam.packages.erlang. + To create a package set built with a custom Erlang version, use the lambda, beam.packagesWith, which accepts an Erlang/OTP derivation and produces a package set similar to beam.packages.erlang. - Many Erlang/OTP distributions available in - beam.interpreters have versions with ODBC and/or Java - enabled. For example, there's - beam.interpreters.erlangR19_odbc_javac, which corresponds - to beam.interpreters.erlangR19. + Many Erlang/OTP distributions available in beam.interpreters have versions with ODBC and/or Java enabled. For example, there's beam.interpreters.erlangR19_odbc_javac, which corresponds to beam.interpreters.erlangR19. - We also provide the lambda, - beam.packages.erlang.callPackage, which simplifies - writing BEAM package definitions by injecting all packages from - beam.packages.erlang into the top-level context. + We also provide the lambda, beam.packages.erlang.callPackage, which simplifies writing BEAM package definitions by injecting all packages from beam.packages.erlang into the top-level context. @@ -81,24 +55,16 @@ Rebar3 - By default, Rebar3 wants to manage its own dependencies. This is perfectly - acceptable in the normal, non-Nix setup, but in the Nix world, it is not. - To rectify this, we provide two versions of Rebar3: + By default, Rebar3 wants to manage its own dependencies. This is perfectly acceptable in the normal, non-Nix setup, but in the Nix world, it is not. To rectify this, we provide two versions of Rebar3: - rebar3: patched to remove the ability to download - anything. When not running it via nix-shell or - nix-build, it's probably not going to work as - desired. + rebar3: patched to remove the ability to download anything. When not running it via nix-shell or nix-build, it's probably not going to work as desired. - rebar3-open: the normal, unmodified Rebar3. It should - work exactly as would any other version of Rebar3. Any Erlang package - should rely on rebar3 instead. See - rebar3-open: the normal, unmodified Rebar3. It should work exactly as would any other version of Rebar3. Any Erlang package should rely on rebar3 instead. See . @@ -110,10 +76,7 @@ Mix & Erlang.mk - Both Mix and Erlang.mk work exactly as expected. There is a bootstrap - process that needs to be run for both, however, which is supported by the - buildMix and buildErlangMk - derivations, respectively. + Both Mix and Erlang.mk work exactly as expected. There is a bootstrap process that needs to be run for both, however, which is supported by the buildMix and buildErlangMk derivations, respectively. @@ -122,13 +85,7 @@ How to Install BEAM Packages - BEAM packages are not registered at the top level, simply because they are - not relevant to the vast majority of Nix users. They are installable using - the beam.packages.erlang attribute set (aliased as - beamPackages), which points to packages built by the - default Erlang/OTP version in Nixpkgs, as defined by - beam.interpreters.erlang. To list the available packages - in beamPackages, use the following command: + BEAM packages are not registered at the top level, simply because they are not relevant to the vast majority of Nix users. They are installable using the beam.packages.erlang attribute set (aliased as beamPackages), which points to packages built by the default Erlang/OTP version in Nixpkgs, as defined by beam.interpreters.erlang. To list the available packages in beamPackages, use the following command: @@ -143,8 +100,7 @@ beamPackages.rebar3-pc pc-1.1.0 - To install any of those packages into your profile, refer to them by their - attribute path (first column): + To install any of those packages into your profile, refer to them by their attribute path (first column): @@ -152,9 +108,7 @@ beamPackages.rebar3-pc pc-1.1.0 - The attribute path of any BEAM package corresponds to the name of that - particular package in Hex or its - OTP Application/Release name. + The attribute path of any BEAM package corresponds to the name of that particular package in Hex or its OTP Application/Release name. @@ -168,13 +122,8 @@ beamPackages.rebar3-pc pc-1.1.0 Rebar3 Packages - The Nix function, buildRebar3, defined in - beam.packages.erlang.buildRebar3 and aliased at the top - level, can be used to build a derivation that understands how to build a - Rebar3 project. For example, we can build - hex2nix - as follows: + The Nix function, buildRebar3, defined in beam.packages.erlang.buildRebar3 and aliased at the top level, can be used to build a derivation that understands how to build a Rebar3 project. For example, we can build hex2nix as follows: @@ -196,25 +145,16 @@ buildRebar3 rec { - Such derivations are callable with - beam.packages.erlang.callPackage (see - ). To call this package using - the normal callPackage, refer to dependency packages - via beamPackages, e.g. - beamPackages.ibrowse. + Such derivations are callable with beam.packages.erlang.callPackage (see ). To call this package using the normal callPackage, refer to dependency packages via beamPackages, e.g. beamPackages.ibrowse. - Notably, buildRebar3 includes - beamDeps, while stdenv.mkDerivation - does not. BEAM dependencies added there will be correctly handled by the - system. + Notably, buildRebar3 includes beamDeps, while stdenv.mkDerivation does not. BEAM dependencies added there will be correctly handled by the system. - If a package needs to compile native code via Rebar3's port compilation - mechanism, add compilePort = true; to the derivation. + If a package needs to compile native code via Rebar3's port compilation mechanism, add compilePort = true; to the derivation. @@ -222,9 +162,7 @@ buildRebar3 rec { Erlang.mk Packages - Erlang.mk functions similarly to Rebar3, except we use - buildErlangMk instead of - buildRebar3. + Erlang.mk functions similarly to Rebar3, except we use buildErlangMk instead of buildRebar3. @@ -257,8 +195,7 @@ buildErlangMk { Mix Packages - Mix functions similarly to Rebar3, except we use - buildMix instead of buildRebar3. + Mix functions similarly to Rebar3, except we use buildMix instead of buildRebar3. @@ -323,11 +260,7 @@ buildHex { Accessing an Environment - Often, we simply want to access a valid environment that contains a - specific package and its dependencies. We can accomplish that with the - env attribute of a derivation. For example, let's say we - want to access an Erlang REPL with ibrowse loaded up. We - could do the following: + Often, we simply want to access a valid environment that contains a specific package and its dependencies. We can accomplish that with the env attribute of a derivation. For example, let's say we want to access an Erlang REPL with ibrowse loaded up. We could do the following: @@ -373,8 +306,7 @@ ok - Notice the -A beamPackages.ibrowse.env. That is the key - to this functionality. + Notice the -A beamPackages.ibrowse.env. That is the key to this functionality. @@ -382,11 +314,7 @@ ok Creating a Shell - Getting access to an environment often isn't enough to do real development. - Usually, we need to create a shell.nix file and do our - development inside of the environment specified therein. This file looks a - lot like the packaging described above, except that src - points to the project root and we call the package directly. + Getting access to an environment often isn't enough to do real development. Usually, we need to create a shell.nix file and do our development inside of the environment specified therein. This file looks a lot like the packaging described above, except that src points to the project root and we call the package directly. @@ -414,8 +342,7 @@ in Building in a Shell (for Mix Projects) - We can leverage the support of the derivation, irrespective of the build - derivation, by calling the commands themselves. + We can leverage the support of the derivation, irrespective of the build derivation, by calling the commands themselves. @@ -477,12 +404,8 @@ analyze: build plt - Using a shell.nix as described (see - ) should just work. Aside from - test, plt, and - analyze, the Make targets work just fine for all of the - build derivations. + Using a shell.nix as described (see ) should just work. Aside from test, plt, and analyze, the Make targets work just fine for all of the build derivations. @@ -492,25 +415,14 @@ analyze: build plt Generating Packages from Hex with <literal>hex2nix</literal> - Updating the Hex package set - requires - hex2nix. - Given the path to the Erlang modules (usually - pkgs/development/erlang-modules), it will dump a file - called hex-packages.nix, containing all the packages that - use a recognized build system in - Hex. It can't be determined, - however, whether every package is buildable. + Updating the Hex package set requires hex2nix. Given the path to the Erlang modules (usually pkgs/development/erlang-modules), it will dump a file called hex-packages.nix, containing all the packages that use a recognized build system in Hex. It can't be determined, however, whether every package is buildable. - To make life easier for our users, try to build every - Hex package and remove those - that fail. To do that, simply run the following command in the root of your - nixpkgs repository: + To make life easier for our users, try to build every Hex package and remove those that fail. To do that, simply run the following command in the root of your nixpkgs repository: @@ -518,11 +430,8 @@ analyze: build plt - That will attempt to build every package in beamPackages. - Then manually remove those that fail. Hopefully, someone will improve - hex2nix - in the future to automate the process. + That will attempt to build every package in beamPackages. Then manually remove those that fail. Hopefully, someone will improve hex2nix in the future to automate the process. diff --git a/doc/languages-frameworks/bower.xml b/doc/languages-frameworks/bower.xml index 118f6e10473..b0738cad293 100644 --- a/doc/languages-frameworks/bower.xml +++ b/doc/languages-frameworks/bower.xml @@ -4,32 +4,22 @@ Bower - Bower is a package manager for web - site front-end components. Bower packages (comprising of build artefacts and - sometimes sources) are stored in git repositories, - typically on Github. The package registry is run by the Bower team with - package metadata coming from the bower.json file within - each package. + Bower is a package manager for web site front-end components. Bower packages (comprising of build artefacts and sometimes sources) are stored in git repositories, typically on Github. The package registry is run by the Bower team with package metadata coming from the bower.json file within each package. - The end result of running Bower is a bower_components - directory which can be included in the web app's build process. + The end result of running Bower is a bower_components directory which can be included in the web app's build process. - Bower can be run interactively, by installing - nodePackages.bower. More interestingly, the Bower - components can be declared in a Nix derivation, with the help of - nodePackages.bower2nix. + Bower can be run interactively, by installing nodePackages.bower. More interestingly, the Bower components can be declared in a Nix derivation, with the help of nodePackages.bower2nix.
<command>bower2nix</command> usage - Suppose you have a bower.json with the following - contents: + Suppose you have a bower.json with the following contents: <filename>bower.json</filename> @@ -45,8 +35,7 @@ - Running bower2nix will produce something like the - following output: + Running bower2nix will produce something like the following output: - Using the bower2nix command line arguments, the output - can be redirected to a file. A name like - bower-packages.nix would be fine. + Using the bower2nix command line arguments, the output can be redirected to a file. A name like bower-packages.nix would be fine. - The resulting derivation is a union of all the downloaded Bower packages - (and their dependencies). To use it, they still need to be linked together - by Bower, which is where buildBowerComponents is useful. + The resulting derivation is a union of all the downloaded Bower packages (and their dependencies). To use it, they still need to be linked together by Bower, which is where buildBowerComponents is useful.
@@ -74,10 +59,7 @@ buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [ <varname>buildBowerComponents</varname> function - The function is implemented in - - pkgs/development/bower-modules/generic/default.nix. - Example usage: + The function is implemented in pkgs/development/bower-modules/generic/default.nix. Example usage: buildBowerComponents @@ -91,34 +73,27 @@ bowerComponents = buildBowerComponents { - In , the following arguments are - of special significance to the function: + In , the following arguments are of special significance to the function: - generated specifies the file which was created by - bower2nix. + generated specifies the file which was created by bower2nix. - src is your project's sources. It needs to contain a - bower.json file. + src is your project's sources. It needs to contain a bower.json file. - buildBowerComponents will run Bower to link together the - output of bower2nix, resulting in a - bower_components directory which can be used. + buildBowerComponents will run Bower to link together the output of bower2nix, resulting in a bower_components directory which can be used. - Here is an example of a web frontend build process using - gulp. You might use grunt, or anything - else. + Here is an example of a web frontend build process using gulp. You might use grunt, or anything else. @@ -174,21 +149,17 @@ pkgs.stdenv.mkDerivation { - The result of buildBowerComponents is an input to the - frontend build. + The result of buildBowerComponents is an input to the frontend build. - Whether to symlink or copy the bower_components - directory depends on the build tool in use. In this case a copy is used - to avoid gulp silliness with permissions. + Whether to symlink or copy the bower_components directory depends on the build tool in use. In this case a copy is used to avoid gulp silliness with permissions. - gulp requires HOME to refer to a - writeable directory. + gulp requires HOME to refer to a writeable directory. @@ -210,17 +181,13 @@ pkgs.stdenv.mkDerivation { - This means that Bower was looking for a package version which doesn't - exist in the generated bower-packages.nix. + This means that Bower was looking for a package version which doesn't exist in the generated bower-packages.nix. - If bower.json has been updated, then run - bower2nix again. + If bower.json has been updated, then run bower2nix again. - It could also be a bug in bower2nix or - fetchbower. If possible, try reformulating the version - specification in bower.json. + It could also be a bug in bower2nix or fetchbower. If possible, try reformulating the version specification in bower.json. diff --git a/doc/languages-frameworks/coq.xml b/doc/languages-frameworks/coq.xml index 4314df5c9df..86d9226166f 100644 --- a/doc/languages-frameworks/coq.xml +++ b/doc/languages-frameworks/coq.xml @@ -4,31 +4,19 @@ Coq - Coq libraries should be installed in - $(out)/lib/coq/${coq.coq-version}/user-contrib/. Such - directories are automatically added to the $COQPATH - environment variable by the hook defined in the Coq derivation. + Coq libraries should be installed in $(out)/lib/coq/${coq.coq-version}/user-contrib/. Such directories are automatically added to the $COQPATH environment variable by the hook defined in the Coq derivation. - Some extensions (plugins) might require OCaml and sometimes other OCaml - packages. The coq.ocamlPackages attribute can be used to - depend on the same package set Coq was built against. + Some extensions (plugins) might require OCaml and sometimes other OCaml packages. The coq.ocamlPackages attribute can be used to depend on the same package set Coq was built against. - Coq libraries may be compatible with some specific versions of Coq only. The - compatibleCoqVersions attribute is used to precisely - select those versions of Coq that are compatible with this derivation. + Coq libraries may be compatible with some specific versions of Coq only. The compatibleCoqVersions attribute is used to precisely select those versions of Coq that are compatible with this derivation. - Here is a simple package example. It is a pure Coq library, thus it depends - on Coq. It builds on the Mathematical Components library, thus it also takes - mathcomp as buildInputs. Its - Makefile has been generated using - coq_makefile so we only have to set the - $COQLIB variable at install time. + Here is a simple package example. It is a pure Coq library, thus it depends on Coq. It builds on the Mathematical Components library, thus it also takes mathcomp as buildInputs. Its Makefile has been generated using coq_makefile so we only have to set the $COQLIB variable at install time. diff --git a/doc/languages-frameworks/gnome.xml b/doc/languages-frameworks/gnome.xml index 42b4ae04322..9e0f21a6c74 100644 --- a/doc/languages-frameworks/gnome.xml +++ b/doc/languages-frameworks/gnome.xml @@ -5,53 +5,26 @@ Packaging GNOME applications - Programs in the GNOME universe are written in various languages but they all - use GObject-based libraries like GLib, GTK or GStreamer. These libraries are - often modular, relying on looking into certain directories to find their - modules. However, due to Nix’s specific file system organization, this - will fail without our intervention. Fortunately, the libraries usually allow - overriding the directories through environment variables, either natively or - thanks to a patch in nixpkgs. - Wrapping the executables to - ensure correct paths are available to the application constitutes a - significant part of packaging a modern desktop application. In this section, - we will describe various modules needed by such applications, environment - variables needed to make the modules load, and finally a script that will do - the work for us. + Programs in the GNOME universe are written in various languages but they all use GObject-based libraries like GLib, GTK or GStreamer. These libraries are often modular, relying on looking into certain directories to find their modules. However, due to Nix’s specific file system organization, this will fail without our intervention. Fortunately, the libraries usually allow overriding the directories through environment variables, either natively or thanks to a patch in nixpkgs. Wrapping the executables to ensure correct paths are available to the application constitutes a significant part of packaging a modern desktop application. In this section, we will describe various modules needed by such applications, environment variables needed to make the modules load, and finally a script that will do the work for us.
Settings - GSettings - API is often used for storing settings. GSettings schemas are required, to - know the type and other metadata of the stored values. GLib looks for - glib-2.0/schemas/gschemas.compiled files inside the - directories of XDG_DATA_DIRS. + GSettings API is often used for storing settings. GSettings schemas are required, to know the type and other metadata of the stored values. GLib looks for glib-2.0/schemas/gschemas.compiled files inside the directories of XDG_DATA_DIRS. - On Linux, GSettings API is implemented using - dconf - backend. You will need to add dconf GIO module to - GIO_EXTRA_MODULES variable, otherwise the - memory backend will be used and the saved settings will - not be persistent. + On Linux, GSettings API is implemented using dconf backend. You will need to add dconf GIO module to GIO_EXTRA_MODULES variable, otherwise the memory backend will be used and the saved settings will not be persistent. - Last you will need the dconf database D-Bus service itself. You can enable - it using . + Last you will need the dconf database D-Bus service itself. You can enable it using . - Some applications will also require - gsettings-desktop-schemas for things like reading proxy - configuration or user interface customization. This dependency is often not - mentioned by upstream, you should grep for - org.gnome.desktop and - org.gnome.system to see if the schemas are needed. + Some applications will also require gsettings-desktop-schemas for things like reading proxy configuration or user interface customization. This dependency is often not mentioned by upstream, you should grep for org.gnome.desktop and org.gnome.system to see if the schemas are needed.
@@ -59,16 +32,7 @@ Icons - When an application uses icons, an icon theme should be available in - XDG_DATA_DIRS. The package for the default, icon-less - hicolor-icon-theme - contains a setup - hook that will pick up icon themes from - buildInputs and pass it to our wrapper. Unfortunately, - relying on that would mean every user has to download the theme included in - the package expression no matter their preference. For that reason, we - leave the installation of icon theme on the user. If you use one of the - desktop environments, you probably already have an icon theme installed. + When an application uses icons, an icon theme should be available in XDG_DATA_DIRS. The package for the default, icon-less hicolor-icon-theme contains a setup hook that will pick up icon themes from buildInputs and pass it to our wrapper. Unfortunately, relying on that would mean every user has to download the theme included in the package expression no matter their preference. For that reason, we leave the installation of icon theme on the user. If you use one of the desktop environments, you probably already have an icon theme installed. @@ -76,12 +40,7 @@ GTK Themes - Previously, a GTK theme needed to be in XDG_DATA_DIRS. This - is no longer necessary for most programs since GTK incorporated Adwaita - theme. Some programs (for example, those designed for - elementary - HIG) might require a special theme like - pantheon.elementary-gtk-theme. + Previously, a GTK theme needed to be in XDG_DATA_DIRS. This is no longer necessary for most programs since GTK incorporated Adwaita theme. Some programs (for example, those designed for elementary HIG) might require a special theme like pantheon.elementary-gtk-theme. @@ -89,10 +48,7 @@ GObject introspection typelibs - GObject - introspection allows applications to use C libraries in other - languages easily. It does this through typelib files - searched in GI_TYPELIB_PATH. + GObject introspection allows applications to use C libraries in other languages easily. It does this through typelib files searched in GI_TYPELIB_PATH. @@ -100,11 +56,7 @@ Various plug-ins - If your application uses - GStreamer or - Grilo, you - should set GST_PLUGIN_SYSTEM_PATH_1_0 and - GRL_PLUGIN_PATH, respectively. + If your application uses GStreamer or Grilo, you should set GST_PLUGIN_SYSTEM_PATH_1_0 and GRL_PLUGIN_PATH, respectively. @@ -113,8 +65,7 @@ Onto <package>wrapGAppsHook</package> - Given the requirements above, the package expression would become messy - quickly: + Given the requirements above, the package expression would become messy quickly: preFixup = '' for f in $(find $out/bin/ $out/libexec/ -type f -executable); do @@ -128,76 +79,48 @@ preFixup = '' done ''; - Fortunately, there is wrapGAppsHook, that does the - wrapping for us. In particular, it works in conjunction with other setup - hooks that will populate the variable: + Fortunately, there is wrapGAppsHook, that does the wrapping for us. In particular, it works in conjunction with other setup hooks that will populate the variable: - wrapGAppsHook itself will add the package’s - share directory to XDG_DATA_DIRS. + wrapGAppsHook itself will add the package’s share directory to XDG_DATA_DIRS. - glib setup hook will populate - GSETTINGS_SCHEMAS_PATH and then - wrapGAppsHook will prepend it to - XDG_DATA_DIRS. + glib setup hook will populate GSETTINGS_SCHEMAS_PATH and then wrapGAppsHook will prepend it to XDG_DATA_DIRS. - gnome3.dconf.lib is a dependency of - wrapGAppsHook, which then also adds it to the - GIO_EXTRA_MODULES variable. + gnome3.dconf.lib is a dependency of wrapGAppsHook, which then also adds it to the GIO_EXTRA_MODULES variable. - hicolor-icon-theme’s setup hook will add icon themes - to XDG_ICON_DIRS which is prepended to - XDG_DATA_DIRS by wrapGAppsHook. + hicolor-icon-theme’s setup hook will add icon themes to XDG_ICON_DIRS which is prepended to XDG_DATA_DIRS by wrapGAppsHook. - gobject-introspection setup hook populates - GI_TYPELIB_PATH variable with - lib/girepository-1.0 directories of dependencies, - which is then added to wrapper by wrapGAppsHook. It - also adds share directories of dependencies to - XDG_DATA_DIRS, which is intended to promote GIR files but - it also - pollutes - the closures of packages using wrapGAppsHook. + gobject-introspection setup hook populates GI_TYPELIB_PATH variable with lib/girepository-1.0 directories of dependencies, which is then added to wrapper by wrapGAppsHook. It also adds share directories of dependencies to XDG_DATA_DIRS, which is intended to promote GIR files but it also pollutes the closures of packages using wrapGAppsHook. - The setup hook - currently - does not work in expressions with strictDeps enabled, - like Python packages. In those cases, you will need to disable it with - strictDeps = false;. + The setup hook currently does not work in expressions with strictDeps enabled, like Python packages. In those cases, you will need to disable it with strictDeps = false;. - Setup hooks of gst_all_1.gstreamer and - gnome3.grilo will populate the - GST_PLUGIN_SYSTEM_PATH_1_0 and - GRL_PLUGIN_PATH variables, respectively, which will then - be added to the wrapper by wrapGAppsHook. + Setup hooks of gst_all_1.gstreamer and gnome3.grilo will populate the GST_PLUGIN_SYSTEM_PATH_1_0 and GRL_PLUGIN_PATH variables, respectively, which will then be added to the wrapper by wrapGAppsHook. - You can also pass additional arguments to makeWrapper - using gappsWrapperArgs in preFixup - hook: + You can also pass additional arguments to makeWrapper using gappsWrapperArgs in preFixup hook: preFixup = '' gappsWrapperArgs+=( @@ -215,13 +138,7 @@ preFixup = '' Updating GNOME packages - Most GNOME package offer - updateScript, - it is therefore possible to update to latest source tarball by running - nix-shell maintainers/scripts/update.nix --argstr package - gnome3.nautilus or even en masse with nix-shell - maintainers/scripts/update.nix --argstr path gnome3. Read the - package’s NEWS file to see what changed. + Most GNOME package offer updateScript, it is therefore possible to update to latest source tarball by running nix-shell maintainers/scripts/update.nix --argstr package gnome3.nautilus or even en masse with nix-shell maintainers/scripts/update.nix --argstr path gnome3. Read the package’s NEWS file to see what changed. @@ -235,17 +152,7 @@ preFixup = '' - There are no schemas avalable in XDG_DATA_DIRS. - Temporarily add a random package containing schemas like - gsettings-desktop-schemas to - buildInputs. - glib and - wrapGAppsHook - setup hooks will take care of making the schemas available to application - and you will see the actual missing schemas with the - next - error. Or you can try looking through the source code for the - actual schemas used. + There are no schemas avalable in XDG_DATA_DIRS. Temporarily add a random package containing schemas like gsettings-desktop-schemas to buildInputs. glib and wrapGAppsHook setup hooks will take care of making the schemas available to application and you will see the actual missing schemas with the next error. Or you can try looking through the source code for the actual schemas used. @@ -255,11 +162,7 @@ preFixup = '' - Package is missing some GSettings schemas. You can find out the package - containing the schema with nix-locate - org.gnome.foo.gschema.xml and let - the hooks handle the wrapping as - above. + Package is missing some GSettings schemas. You can find out the package containing the schema with nix-locate org.gnome.foo.gschema.xml and let the hooks handle the wrapping as above. @@ -269,14 +172,7 @@ preFixup = '' - This is because derivers like - python.pkgs.buildPythonApplication or - qt5.mkDerivation have setup-hooks automatically - added that produce wrappers with makeWrapper. The - simplest way to workaround that is to disable the - wrapGAppsHook automatic wrapping with - dontWrapGApps = true; and pass the arguments it intended to - pass to makeWrapper to another. + This is because derivers like python.pkgs.buildPythonApplication or qt5.mkDerivation have setup-hooks automatically added that produce wrappers with makeWrapper. The simplest way to workaround that is to disable the wrapGAppsHook automatic wrapping with dontWrapGApps = true; and pass the arguments it intended to pass to makeWrapper to another. In the case of a Python application it could look like: @@ -328,55 +224,34 @@ mkDerivation { - You can rely on applications depending on the library set the necessary - environment variables but that it often easy to miss. Instead we - recommend to patch the paths in the source code whenever possible. Here - are some examples: + You can rely on applications depending on the library set the necessary environment variables but that it often easy to miss. Instead we recommend to patch the paths in the source code whenever possible. Here are some examples: - Replacing - a GI_TYPELIB_PATH in GNOME Shell extension – - we are using substituteAll to include the path to - a typelib into a patch. + Replacing a GI_TYPELIB_PATH in GNOME Shell extension – we are using substituteAll to include the path to a typelib into a patch. - The following examples are hardcoding GSettings schema paths. To get - the schema paths we use the functions + The following examples are hardcoding GSettings schema paths. To get the schema paths we use the functions - glib.getSchemaPath Takes a nix package - attribute as an argument. + glib.getSchemaPath Takes a nix package attribute as an argument. - glib.makeSchemaPath Takes a package output - like $out and a derivation name. You should use - this if the schemas you need to hardcode are in the same - derivation. + glib.makeSchemaPath Takes a package output like $out and a derivation name. You should use this if the schemas you need to hardcode are in the same derivation. - Hard-coding - GSettings schema path in Vala plug-in (dynamically loaded - library) – here, substituteAll cannot be - used since the schema comes from the same package preventing us from - pass its path to the function, probably due to a - Nix - bug. + Hard-coding GSettings schema path in Vala plug-in (dynamically loaded library) – here, substituteAll cannot be used since the schema comes from the same package preventing us from pass its path to the function, probably due to a Nix bug. - Hard-coding - GSettings schema path in C library – nothing special other - than using - Coccinelle - patch to generate the patch itself. + Hard-coding GSettings schema path in C library – nothing special other than using Coccinelle patch to generate the patch itself. diff --git a/doc/languages-frameworks/go.xml b/doc/languages-frameworks/go.xml index b2b4962cb5f..288a9029863 100644 --- a/doc/languages-frameworks/go.xml +++ b/doc/languages-frameworks/go.xml @@ -7,21 +7,16 @@ Go modules - The function buildGoModule builds Go programs managed - with Go modules. It builds a - Go - modules through a two phase build: + The function buildGoModule builds Go programs managed with Go modules. It builds a Go modules through a two phase build: - An intermediate fetcher derivation. This derivation will be used to fetch - all of the dependencies of the Go module. + An intermediate fetcher derivation. This derivation will be used to fetch all of the dependencies of the Go module. - A final derivation will use the output of the intermediate derivation to - build the binaries and produce the final output. + A final derivation will use the output of the intermediate derivation to build the binaries and produce the final output. @@ -57,21 +52,16 @@ pet = buildGoModule rec {
- is an example expression using - buildGoModule, the following arguments are of special significance to the - function: + is an example expression using buildGoModule, the following arguments are of special significance to the function: - modSha256 is the hash of the output of the - intermediate fetcher derivation. + modSha256 is the hash of the output of the intermediate fetcher derivation. - subPackages limits the builder from building child - packages that have not been listed. If subPackages is - not specified, all child packages will be built. + subPackages limits the builder from building child packages that have not been listed. If subPackages is not specified, all child packages will be built. @@ -82,8 +72,7 @@ pet = buildGoModule rec { Go legacy - The function buildGoPackage builds legacy Go programs, - not supporting Go modules. + The function buildGoPackage builds legacy Go programs, not supporting Go modules. @@ -111,49 +100,36 @@ deis = buildGoPackage rec { - is an example expression using - buildGoPackage, the following arguments are of special significance to the - function: + is an example expression using buildGoPackage, the following arguments are of special significance to the function: - goPackagePath specifies the package's canonical Go - import path. + goPackagePath specifies the package's canonical Go import path. - subPackages limits the builder from building child - packages that have not been listed. If subPackages is - not specified, all child packages will be built. + subPackages limits the builder from building child packages that have not been listed. If subPackages is not specified, all child packages will be built. - In this example only github.com/deis/deis/client will - be built. + In this example only github.com/deis/deis/client will be built. - goDeps is where the Go dependencies of a Go program - are listed as a list of package source identified by Go import path. It - could be imported as a separate deps.nix file for - readability. The dependency data structure is described below. + goDeps is where the Go dependencies of a Go program are listed as a list of package source identified by Go import path. It could be imported as a separate deps.nix file for readability. The dependency data structure is described below. - buildFlags is a list of flags passed to the go build - command. + buildFlags is a list of flags passed to the go build command. - The goDeps attribute can be imported from a separate - nix file that defines which Go libraries are needed and - should be included in GOPATH for - buildPhase. + The goDeps attribute can be imported from a separate nix file that defines which Go libraries are needed and should be included in GOPATH for buildPhase. @@ -196,27 +172,18 @@ deis = buildGoPackage rec { - fetch type that needs to be used to get package - source. If git is used there should be - url, rev and - sha256 defined next to it. + fetch type that needs to be used to get package source. If git is used there should be url, rev and sha256 defined next to it. - To extract dependency information from a Go package in automated way use - go2nix. It can - produce complete derivation and goDeps file for Go - programs. + To extract dependency information from a Go package in automated way use go2nix. It can produce complete derivation and goDeps file for Go programs. - buildGoPackage produces - where - bin includes program binaries. You can test build a Go - binary as follows: + buildGoPackage produces where bin includes program binaries. You can test build a Go binary as follows: $ nix-build -A deis.bin @@ -224,13 +191,11 @@ deis = buildGoPackage rec { $ nix-build -A deis.all - bin output will be installed by default with - nix-env -i or systemPackages. + bin output will be installed by default with nix-env -i or systemPackages. - You may use Go packages installed into the active Nix profiles by adding the - following to your ~/.bashrc: + You may use Go packages installed into the active Nix profiles by adding the following to your ~/.bashrc: for p in $NIX_PROFILES; do GOPATH="$p/share/go:$GOPATH" diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index 5836294b774..cd0b48adb14 100644 --- a/doc/languages-frameworks/index.xml +++ b/doc/languages-frameworks/index.xml @@ -3,12 +3,7 @@ xml:id="chap-language-support"> Support for specific programming languages and frameworks - The standard build environment makes it - easy to build typical Autotools-based packages with very little code. Any - other kind of package can be accomodated by overriding the appropriate phases - of stdenv. However, there are specialised functions in - Nixpkgs to easily build packages for other programming languages, such as - Perl or Haskell. These are described in this chapter. + The standard build environment makes it easy to build typical Autotools-based packages with very little code. Any other kind of package can be accomodated by overriding the appropriate phases of stdenv. However, there are specialised functions in Nixpkgs to easily build packages for other programming languages, such as Perl or Haskell. These are described in this chapter. diff --git a/doc/languages-frameworks/java.xml b/doc/languages-frameworks/java.xml index 68a1a097984..bf0fc488392 100644 --- a/doc/languages-frameworks/java.xml +++ b/doc/languages-frameworks/java.xml @@ -15,37 +15,24 @@ stdenv.mkDerivation { buildPhase = "ant"; }
- Note that jdk is an alias for the OpenJDK (self-built - where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in - Nixpkgs (Aarch32, Aarch64) point to the - (unfree) oraclejdk. + Note that jdk is an alias for the OpenJDK (self-built where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in Nixpkgs (Aarch32, Aarch64) point to the (unfree) oraclejdk.
- JAR files that are intended to be used by other packages should be installed - in $out/share/java. JDKs have a stdenv setup hook that - add any JARs in the share/java directories of the build - inputs to the CLASSPATH environment variable. For instance, if - the package libfoo installs a JAR named - foo.jar in its share/java - directory, and another package declares the attribute + JAR files that are intended to be used by other packages should be installed in $out/share/java. JDKs have a stdenv setup hook that add any JARs in the share/java directories of the build inputs to the CLASSPATH environment variable. For instance, if the package libfoo installs a JAR named foo.jar in its share/java directory, and another package declares the attribute buildInputs = [ libfoo ]; nativeBuildInputs = [ jdk ]; - then CLASSPATH will be set to - /nix/store/...-libfoo/share/java/foo.jar. + then CLASSPATH will be set to /nix/store/...-libfoo/share/java/foo.jar. - Private JARs should be installed in a location like - $out/share/package-name. + Private JARs should be installed in a location like $out/share/package-name. - If your Java package provides a program, you need to generate a wrapper - script to run it using the OpenJRE. You can use - makeWrapper for this: + If your Java package provides a program, you need to generate a wrapper script to run it using the OpenJRE. You can use makeWrapper for this: nativeBuildInputs = [ makeWrapper ]; @@ -56,30 +43,21 @@ installPhase = --add-flags "-cp $out/share/java/foo.jar org.foo.Main" ''; - Note the use of jre, which is the part of the OpenJDK - package that contains the Java Runtime Environment. By using - ${jre}/bin/java instead of - ${jdk}/bin/java, you prevent your package from depending - on the JDK at runtime. + Note the use of jre, which is the part of the OpenJDK package that contains the Java Runtime Environment. By using ${jre}/bin/java instead of ${jdk}/bin/java, you prevent your package from depending on the JDK at runtime. - Note all JDKs passthru home, so if your application - requires environment variables like JAVA_HOME being set, that - can be done in a generic fashion with the --set argument - of makeWrapper: + Note all JDKs passthru home, so if your application requires environment variables like JAVA_HOME being set, that can be done in a generic fashion with the --set argument of makeWrapper: --set JAVA_HOME ${jdk.home} - It is possible to use a different Java compiler than javac - from the OpenJDK. For instance, to use the GNU Java Compiler: + It is possible to use a different Java compiler than javac from the OpenJDK. For instance, to use the GNU Java Compiler: nativeBuildInputs = [ gcj ant ]; - Here, Ant will automatically use gij (the GNU Java - Runtime) instead of the OpenJRE. + Here, Ant will automatically use gij (the GNU Java Runtime) instead of the OpenJRE. diff --git a/doc/languages-frameworks/lua.xml b/doc/languages-frameworks/lua.xml index 5144bb24ff6..bcca6b73753 100644 --- a/doc/languages-frameworks/lua.xml +++ b/doc/languages-frameworks/lua.xml @@ -4,18 +4,11 @@ Lua - Lua packages are built by the buildLuaPackage function. - This function is implemented in - - pkgs/development/lua-modules/generic/default.nix - and works similarly to buildPerlPackage. (See - for details.) + Lua packages are built by the buildLuaPackage function. This function is implemented in pkgs/development/lua-modules/generic/default.nix and works similarly to buildPerlPackage. (See for details.) - Lua packages are defined in - pkgs/top-level/lua-packages.nix. - Most of them are simple. For example: + Lua packages are defined in pkgs/top-level/lua-packages.nix. Most of them are simple. For example: fileSystem = buildLuaPackage { name = "filesystem-1.6.2"; @@ -33,16 +26,11 @@ fileSystem = buildLuaPackage { - Though, more complicated package should be placed in a seperate file in - pkgs/development/lua-modules. - Lua packages accept additional parameter disabled, which - defines the condition of disabling package from luaPackages. For example, if - package has disabled assigned to lua.luaversion - != "5.1", it will not be included in any luaPackages except - lua51Packages, making it only be built for lua 5.1. + Lua packages accept additional parameter disabled, which defines the condition of disabling package from luaPackages. For example, if package has disabled assigned to lua.luaversion != "5.1", it will not be included in any luaPackages except lua51Packages, making it only be built for lua 5.1. diff --git a/doc/languages-frameworks/ocaml.xml b/doc/languages-frameworks/ocaml.xml index b7006ecba99..a0ea209b493 100644 --- a/doc/languages-frameworks/ocaml.xml +++ b/doc/languages-frameworks/ocaml.xml @@ -4,35 +4,15 @@ OCaml - OCaml libraries should be installed in - $(out)/lib/ocaml/${ocaml.version}/site-lib/. Such - directories are automatically added to the $OCAMLPATH - environment variable when building another package that depends on them or - when opening a nix-shell. + OCaml libraries should be installed in $(out)/lib/ocaml/${ocaml.version}/site-lib/. Such directories are automatically added to the $OCAMLPATH environment variable when building another package that depends on them or when opening a nix-shell. - Given that most of the OCaml ecosystem is now built with dune, nixpkgs - includes a convenience build support function called - buildDunePackage that will build an OCaml package using - dune, OCaml and findlib and any additional dependencies provided as - buildInputs or propagatedBuildInputs. + Given that most of the OCaml ecosystem is now built with dune, nixpkgs includes a convenience build support function called buildDunePackage that will build an OCaml package using dune, OCaml and findlib and any additional dependencies provided as buildInputs or propagatedBuildInputs. - Here is a simple package example. It defines an (optional) attribute - minimumOCamlVersion that will be used to throw a - descriptive evaluation error if building with an older OCaml is attempted. It - uses the fetchFromGitHub fetcher to get its source. It - sets the doCheck (optional) attribute to - true which means that tests will be run with dune - runtest -p angstrom after the build (dune build -p - angstrom) is complete. It uses alcotest as a - build input (because it is needed to run the tests) and - bigstringaf and result as propagated - build inputs (thus they will also be available to libraries depending on this - library). The library will be installed using the - angstrom.install file that dune generates. + Here is a simple package example. It defines an (optional) attribute minimumOCamlVersion that will be used to throw a descriptive evaluation error if building with an older OCaml is attempted. It uses the fetchFromGitHub fetcher to get its source. It sets the doCheck (optional) attribute to true which means that tests will be run with dune runtest -p angstrom after the build (dune build -p angstrom) is complete. It uses alcotest as a build input (because it is needed to run the tests) and bigstringaf and result as propagated build inputs (thus they will also be available to libraries depending on this library). The library will be installed using the angstrom.install file that dune generates. @@ -65,11 +45,7 @@ buildDunePackage rec { - Here is a second example, this time using a source archive generated with - dune-release. It is a good idea to use this archive when - it is available as it will usually contain substituted variables such as a - %%VERSION%% field. This library does not depend on any - other OCaml library and no tests are run after building it. + Here is a second example, this time using a source archive generated with dune-release. It is a good idea to use this archive when it is available as it will usually contain substituted variables such as a %%VERSION%% field. This library does not depend on any other OCaml library and no tests are run after building it. diff --git a/doc/languages-frameworks/perl.xml b/doc/languages-frameworks/perl.xml index d5911cf67fd..d9b6b2721c6 100644 --- a/doc/languages-frameworks/perl.xml +++ b/doc/languages-frameworks/perl.xml @@ -4,24 +4,13 @@ Perl - Nixpkgs provides a function buildPerlPackage, a generic - package builder function for any Perl package that has a standard - Makefile.PL. It’s implemented in - buildPerlPackage, a generic package builder function for any Perl package that has a standard Makefile.PL. It’s implemented in pkgs/development/perl-modules/generic. - Perl packages from CPAN are defined in - pkgs/top-level/perl-packages.nix, - rather than pkgs/all-packages.nix. Most Perl packages - are so straight-forward to build that they are defined here directly, rather - than having a separate function for each package called from - perl-packages.nix. However, more complicated packages - should be put in a separate file, typically in - pkgs/development/perl-modules. Here is an example of the - former: + Perl packages from CPAN are defined in pkgs/top-level/perl-packages.nix, rather than pkgs/all-packages.nix. Most Perl packages are so straight-forward to build that they are defined here directly, rather than having a separate function for each package called from perl-packages.nix. However, more complicated packages should be put in a separate file, typically in pkgs/development/perl-modules. Here is an example of the former: ClassC3 = buildPerlPackage rec { name = "Class-C3-0.21"; @@ -31,32 +20,22 @@ ClassC3 = buildPerlPackage rec { }; }; - Note the use of mirror://cpan/, and the - ${name} in the URL definition to ensure that the name - attribute is consistent with the source that we’re actually downloading. - Perl packages are made available in all-packages.nix - through the variable perlPackages. For instance, if you - have a package that needs ClassC3, you would typically - write + Note the use of mirror://cpan/, and the ${name} in the URL definition to ensure that the name attribute is consistent with the source that we’re actually downloading. Perl packages are made available in all-packages.nix through the variable perlPackages. For instance, if you have a package that needs ClassC3, you would typically write foo = import ../path/to/foo.nix { inherit stdenv fetchurl ...; inherit (perlPackages) ClassC3; }; - in all-packages.nix. You can test building a Perl - package as follows: + in all-packages.nix. You can test building a Perl package as follows: $ nix-build -A perlPackages.ClassC3 - buildPerlPackage adds perl- to the - start of the name attribute, so the package above is actually called - perl-Class-C3-0.21. So to install it, you can say: + buildPerlPackage adds perl- to the start of the name attribute, so the package above is actually called perl-Class-C3-0.21. So to install it, you can say: $ nix-env -i perl-Class-C3 - (Of course you can also install using the attribute name: nix-env -i - -A perlPackages.ClassC3.) + (Of course you can also install using the attribute name: nix-env -i -A perlPackages.ClassC3.) @@ -64,40 +43,24 @@ foo = import ../path/to/foo.nix { - In the configure phase, it calls perl Makefile.PL to - generate a Makefile. You can set the variable - makeMakerFlags to pass flags to - Makefile.PL + In the configure phase, it calls perl Makefile.PL to generate a Makefile. You can set the variable makeMakerFlags to pass flags to Makefile.PL - It adds the contents of the PERL5LIB environment variable - to #! .../bin/perl line of Perl scripts as - -Idir flags. This ensures - that a script can find its dependencies. (This can cause this shebang line - to become too long for Darwin to handle; see the note below.) + It adds the contents of the PERL5LIB environment variable to #! .../bin/perl line of Perl scripts as -Idir flags. This ensures that a script can find its dependencies. (This can cause this shebang line to become too long for Darwin to handle; see the note below.) - In the fixup phase, it writes the propagated build inputs - (propagatedBuildInputs) to the file - $out/nix-support/propagated-user-env-packages. - nix-env recursively installs all packages listed in - this file when you install a package that has it. This ensures that a Perl - package can find its dependencies. + In the fixup phase, it writes the propagated build inputs (propagatedBuildInputs) to the file $out/nix-support/propagated-user-env-packages. nix-env recursively installs all packages listed in this file when you install a package that has it. This ensures that a Perl package can find its dependencies. - buildPerlPackage is built on top of - stdenv, so everything can be customised in the usual way. - For instance, the BerkeleyDB module has a - preConfigure hook to generate a configuration file used by - Makefile.PL: + buildPerlPackage is built on top of stdenv, so everything can be customised in the usual way. For instance, the BerkeleyDB module has a preConfigure hook to generate a configuration file used by Makefile.PL: { buildPerlPackage, fetchurl, db }: @@ -118,12 +81,7 @@ buildPerlPackage rec { - Dependencies on other Perl packages can be specified in the - buildInputs and propagatedBuildInputs - attributes. If something is exclusively a build-time dependency, use - buildInputs; if it’s (also) a runtime dependency, use - propagatedBuildInputs. For instance, this builds a Perl - module that has runtime dependencies on a bunch of other modules: + Dependencies on other Perl packages can be specified in the buildInputs and propagatedBuildInputs attributes. If something is exclusively a build-time dependency, use buildInputs; if it’s (also) a runtime dependency, use propagatedBuildInputs. For instance, this builds a Perl module that has runtime dependencies on a bunch of other modules: ClassC3Componentised = buildPerlPackage rec { name = "Class-C3-Componentised-1.0004"; @@ -139,11 +97,7 @@ ClassC3Componentised = buildPerlPackage rec { - On Darwin, if a script has too many - -Idir flags in its first line - (its “shebang line”), it will not run. This can be worked around by - calling the shortenPerlShebang function from the - postInstall phase: + On Darwin, if a script has too many -Idir flags in its first line (its “shebang line”), it will not run. This can be worked around by calling the shortenPerlShebang function from the postInstall phase: { stdenv, buildPerlPackage, fetchurl, shortenPerlShebang }: @@ -162,20 +116,14 @@ ImageExifTool = buildPerlPackage { ''; }; - This will remove the -I flags from the shebang line, - rewrite them in the use lib form, and put them on the next - line instead. This function can be given any number of Perl scripts as - arguments; it will modify them in-place. + This will remove the -I flags from the shebang line, rewrite them in the use lib form, and put them on the next line instead. This function can be given any number of Perl scripts as arguments; it will modify them in-place.
Generation from CPAN - Nix expressions for Perl packages can be generated (almost) automatically - from CPAN. This is done by the program - nix-generate-from-cpan, which can be installed as - follows: + Nix expressions for Perl packages can be generated (almost) automatically from CPAN. This is done by the program nix-generate-from-cpan, which can be installed as follows: @@ -183,9 +131,7 @@ ImageExifTool = buildPerlPackage { - This program takes a Perl module name, looks it up on CPAN, fetches and - unpacks the corresponding package, and prints a Nix expression on standard - output. For example: + This program takes a Perl module name, looks it up on CPAN, fetches and unpacks the corresponding package, and prints a Nix expression on standard output. For example: $ nix-generate-from-cpan XML::Simple XMLSimple = buildPerlPackage rec { @@ -201,9 +147,7 @@ ImageExifTool = buildPerlPackage { }; }; - The output can be pasted into - pkgs/top-level/perl-packages.nix or wherever else you - need it. + The output can be pasted into pkgs/top-level/perl-packages.nix or wherever else you need it.
@@ -211,13 +155,7 @@ ImageExifTool = buildPerlPackage { Cross-compiling modules - Nixpkgs has experimental support for cross-compiling Perl modules. In many - cases, it will just work out of the box, even for modules with native - extensions. Sometimes, however, the Makefile.PL for a module may - (indirectly) import a native module. In that case, you will need to make a - stub for that module that will satisfy the Makefile.PL and install it into - lib/perl5/site_perl/cross_perl/${perl.version}. See the - postInstall for DBI for an example. + Nixpkgs has experimental support for cross-compiling Perl modules. In many cases, it will just work out of the box, even for modules with native extensions. Sometimes, however, the Makefile.PL for a module may (indirectly) import a native module. In that case, you will need to make a stub for that module that will satisfy the Makefile.PL and install it into lib/perl5/site_perl/cross_perl/${perl.version}. See the postInstall for DBI for an example. diff --git a/doc/languages-frameworks/qt.xml b/doc/languages-frameworks/qt.xml index d6f3314ab08..8d97de504ad 100644 --- a/doc/languages-frameworks/qt.xml +++ b/doc/languages-frameworks/qt.xml @@ -4,11 +4,7 @@ Qt - This section describes the differences between Nix expressions for Qt - libraries and applications and Nix expressions for other C++ software. Some - knowledge of the latter is assumed. There are primarily two problems which - the Qt infrastructure is designed to address: ensuring consistent versioning - of all dependencies and finding dependencies at runtime. + This section describes the differences between Nix expressions for Qt libraries and applications and Nix expressions for other C++ software. Some knowledge of the latter is assumed. There are primarily two problems which the Qt infrastructure is designed to address: ensuring consistent versioning of all dependencies and finding dependencies at runtime. @@ -28,38 +24,26 @@ mkDerivation { - Import mkDerivation and Qt (such as - qtbase modules directly. Do not - import Qt package sets; the Qt versions of dependencies may not be - coherent, causing build and runtime failures. + Import mkDerivation and Qt (such as qtbase modules directly. Do not import Qt package sets; the Qt versions of dependencies may not be coherent, causing build and runtime failures. - Use mkDerivation instead of - stdenv.mkDerivation. mkDerivation is - a wrapper around stdenv.mkDerivation which applies some - Qt-specific settings. This deriver accepts the same arguments as - stdenv.mkDerivation; refer to - for details. + Use mkDerivation instead of stdenv.mkDerivation. mkDerivation is a wrapper around stdenv.mkDerivation which applies some Qt-specific settings. This deriver accepts the same arguments as stdenv.mkDerivation; refer to for details. - To use another deriver instead of stdenv.mkDerivation, - use mkDerivationWith: + To use another deriver instead of stdenv.mkDerivation, use mkDerivationWith: mkDerivationWith myDeriver { # ... } - If you cannot use mkDerivationWith, please refer to - . + If you cannot use mkDerivationWith, please refer to . - mkDerivation accepts the same arguments as - stdenv.mkDerivation, such as - buildInputs. + mkDerivation accepts the same arguments as stdenv.mkDerivation, such as buildInputs. @@ -67,10 +51,7 @@ mkDerivationWith myDeriver { Locating runtime dependencies - Qt applications need to be wrapped to find runtime dependencies. If you - cannot use mkDerivation or - mkDerivationWith above, include - wrapQtAppsHook in nativeBuildInputs: + Qt applications need to be wrapped to find runtime dependencies. If you cannot use mkDerivation or mkDerivationWith above, include wrapQtAppsHook in nativeBuildInputs: stdenv.mkDerivation { # ... @@ -82,9 +63,7 @@ stdenv.mkDerivation { - Entries added to qtWrapperArgs are used to modify the - wrappers created by wrapQtAppsHook. The entries are passed - as arguments to . + Entries added to qtWrapperArgs are used to modify the wrappers created by wrapQtAppsHook. The entries are passed as arguments to . mkDerivation { # ... @@ -95,10 +74,7 @@ mkDerivation { - Set dontWrapQtApps to stop applications from being wrapped - automatically. It is required to wrap applications manually with - wrapQtApp, using the syntax of - : + Set dontWrapQtApps to stop applications from being wrapped automatically. It is required to wrap applications manually with wrapQtApp, using the syntax of : mkDerivation { # ... @@ -113,17 +89,12 @@ mkDerivation { - wrapQtAppsHook ignores files that are non-ELF - executables. This means that scripts won't be automatically wrapped so - you'll need to manually wrap them as previously mentioned. An example of - when you'd always need to do this is with Python applications that use PyQT. + wrapQtAppsHook ignores files that are non-ELF executables. This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned. An example of when you'd always need to do this is with Python applications that use PyQT. - Libraries are built with every available version of Qt. Use the - meta.broken attribute to disable the package for - unsupported Qt versions: + Libraries are built with every available version of Qt. Use the meta.broken attribute to disable the package for unsupported Qt versions: mkDerivation { # ... @@ -137,9 +108,7 @@ mkDerivation { Adding a library to Nixpkgs - Add a Qt library to all-packages.nix by adding it to - the collection inside mkLibsForQt5. This ensures that the - library is built with every available version of Qt as needed. + Add a Qt library to all-packages.nix by adding it to the collection inside mkLibsForQt5. This ensures that the library is built with every available version of Qt as needed. Adding a Qt library to <filename>all-packages.nix</filename> @@ -162,10 +131,7 @@ mkDerivation { Adding an application to Nixpkgs - Add a Qt application to all-packages.nix using - libsForQt5.callPackage instead of the usual - callPackage. The former ensures that all dependencies are - built with the same version of Qt. + Add a Qt application to all-packages.nix using libsForQt5.callPackage instead of the usual callPackage. The former ensures that all dependencies are built with the same version of Qt. Adding a Qt application to <filename>all-packages.nix</filename> diff --git a/doc/languages-frameworks/ruby.xml b/doc/languages-frameworks/ruby.xml index df4e5acb22c..b28745fd6e2 100644 --- a/doc/languages-frameworks/ruby.xml +++ b/doc/languages-frameworks/ruby.xml @@ -4,11 +4,7 @@ Ruby - There currently is support to bundle applications that are packaged as Ruby - gems. The utility "bundix" allows you to write a - Gemfile, let bundler create a - Gemfile.lock, and then convert this into a nix - expression that contains all Gem dependencies automatically. + There currently is support to bundle applications that are packaged as Ruby gems. The utility "bundix" allows you to write a Gemfile, let bundler create a Gemfile.lock, and then convert this into a nix expression that contains all Gem dependencies automatically. @@ -45,9 +41,7 @@ bundlerEnv rec {
- Please check in the Gemfile, - Gemfile.lock and the gemset.nix so - future updates can be run easily. + Please check in the Gemfile, Gemfile.lock and the gemset.nix so future updates can be run easily. @@ -62,10 +56,7 @@ $ nix-shell -p bundix --run 'bundix'
- For tools written in Ruby - i.e. where the desire is to install a package and - then execute e.g. rake at the command line, there is an - alternative builder called bundlerApp. Set up the - gemset.nix the same way, and then, for example: + For tools written in Ruby - i.e. where the desire is to install a package and then execute e.g. rake at the command line, there is an alternative builder called bundlerApp. Set up the gemset.nix the same way, and then, for example: @@ -87,29 +78,11 @@ bundlerApp { - The chief advantage of bundlerApp over - bundlerEnv is the executables introduced in the - environment are precisely those selected in the exes list, - as opposed to bundlerEnv which adds all the executables - made available by gems in the gemset, which can mean e.g. - rspec or rake in unpredictable versions - available from various packages. + The chief advantage of bundlerApp over bundlerEnv is the executables introduced in the environment are precisely those selected in the exes list, as opposed to bundlerEnv which adds all the executables made available by gems in the gemset, which can mean e.g. rspec or rake in unpredictable versions available from various packages. - Resulting derivations for both builders also have two helpful attributes, - env and wrappedRuby. The first one - allows one to quickly drop into nix-shell with the - specified environment present. E.g. nix-shell -A sensu.env - would give you an environment with Ruby preset so it has all the libraries - necessary for sensu in its paths. The second one can be - used to make derivations from custom Ruby scripts which have - Gemfiles with their dependencies specified. It is a - derivation with ruby wrapped so it can find all the needed - dependencies. For example, to make a derivation my-script - for a my-script.rb (which should be placed in - bin) you should run bundix as - specified above and then use bundlerEnv like this: + Resulting derivations for both builders also have two helpful attributes, env and wrappedRuby. The first one allows one to quickly drop into nix-shell with the specified environment present. E.g. nix-shell -A sensu.env would give you an environment with Ruby preset so it has all the libraries necessary for sensu in its paths. The second one can be used to make derivations from custom Ruby scripts which have Gemfiles with their dependencies specified. It is a derivation with ruby wrapped so it can find all the needed dependencies. For example, to make a derivation my-script for a my-script.rb (which should be placed in bin) you should run bundix as specified above and then use bundlerEnv like this: diff --git a/doc/languages-frameworks/texlive.xml b/doc/languages-frameworks/texlive.xml index 97f274933be..7876cc213b6 100644 --- a/doc/languages-frameworks/texlive.xml +++ b/doc/languages-frameworks/texlive.xml @@ -4,8 +4,7 @@ TeX Live - Since release 15.09 there is a new TeX Live packaging that lives entirely - under attribute texlive. + Since release 15.09 there is a new TeX Live packaging that lives entirely under attribute texlive.
@@ -14,28 +13,23 @@ - For basic usage just pull texlive.combined.scheme-basic - for an environment with basic LaTeX support. + For basic usage just pull texlive.combined.scheme-basic for an environment with basic LaTeX support. - It typically won't work to use separately installed packages together. - Instead, you can build a custom set of packages like this: + It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this: texlive.combine { inherit (texlive) scheme-small collection-langkorean algorithms cm-super; } - There are all the schemes, collections and a few thousand packages, as - defined upstream (perhaps with tiny differences). + There are all the schemes, collections and a few thousand packages, as defined upstream (perhaps with tiny differences). - By default you only get executables and files needed during runtime, and a - little documentation for the core packages. To change that, you need to - add pkgFilter function to combine. + By default you only get executables and files needed during runtime, and a little documentation for the core packages. To change that, you need to add pkgFilter function to combine. texlive.combine { # inherit (texlive) whatever-you-want; @@ -59,10 +53,7 @@ nix-repl> texlive.collection- - Note that the wrapper assumes that the result has a chance to be useful. - For example, the core executables should be present, as well as some core - data files. The supported way of ensuring this is by including some - scheme, for example scheme-basic, into the combination. + Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example scheme-basic, into the combination. @@ -84,14 +75,12 @@ nix-repl> texlive.collection- - feature/bug: when a package is rejected by pkgFilter, - its dependencies are still propagated; + feature/bug: when a package is rejected by pkgFilter, its dependencies are still propagated; - in case of any bugs or feature requests, file a github issue or better a - pull request and /cc @vcunat. + in case of any bugs or feature requests, file a github issue or better a pull request and /cc @vcunat. diff --git a/doc/meta.xml b/doc/meta.xml index 49db73ab79e..9371196818a 100644 --- a/doc/meta.xml +++ b/doc/meta.xml @@ -3,10 +3,7 @@ xml:id="chap-meta"> Meta-attributes - Nix packages can declare meta-attributes that contain - information about a package such as a description, its homepage, its license, - and so on. For instance, the GNU Hello package has a meta - declaration like this: + Nix packages can declare meta-attributes that contain information about a package such as a description, its homepage, its license, and so on. For instance, the GNU Hello package has a meta declaration like this: meta = with stdenv.lib; { description = "A program that produces a familiar, friendly greeting"; @@ -22,13 +19,10 @@ meta = with stdenv.lib; { - Meta-attributes are not passed to the builder of the package. Thus, a change - to a meta-attribute doesn’t trigger a recompilation of the package. The - value of a meta-attribute must be a string. + Meta-attributes are not passed to the builder of the package. Thus, a change to a meta-attribute doesn’t trigger a recompilation of the package. The value of a meta-attribute must be a string. - The meta-attributes of a package can be queried from the command-line using - nix-env: + The meta-attributes of a package can be queried from the command-line using nix-env: $ nix-env -qa hello --json { @@ -67,8 +61,7 @@ meta = with stdenv.lib; { - nix-env knows about the description - field specifically: + nix-env knows about the description field specifically: $ nix-env -qa hello --description hello-2.3 A program that produces a familiar, friendly greeting @@ -88,18 +81,13 @@ hello-2.3 A program that produces a familiar, friendly greeting - A short (one-line) description of the package. This is shown by - nix-env -q --description and also on the Nixpkgs - release pages. + A short (one-line) description of the package. This is shown by nix-env -q --description and also on the Nixpkgs release pages. - Don’t include a period at the end. Don’t include newline characters. - Capitalise the first character. For brevity, don’t repeat the name of - package — just describe what it does. + Don’t include a period at the end. Don’t include newline characters. Capitalise the first character. For brevity, don’t repeat the name of package — just describe what it does. - Wrong: "libpng is a library that allows you to decode PNG - images." + Wrong: "libpng is a library that allows you to decode PNG images." Right: "A library for decoding PNG images" @@ -122,9 +110,7 @@ hello-2.3 A program that produces a familiar, friendly greeting - Release branch. Used to specify that a package is not going to receive - updates that are not in this branch; for example, Linux kernel 3.0 is - supposed to be updated to 3.0.X, not 3.1. + Release branch. Used to specify that a package is not going to receive updates that are not in this branch; for example, Linux kernel 3.0 is supposed to be updated to 3.0.X, not 3.1. @@ -134,8 +120,7 @@ hello-2.3 A program that produces a familiar, friendly greeting - The package’s homepage. Example: - https://www.gnu.org/software/hello/manual/ + The package’s homepage. Example: https://www.gnu.org/software/hello/manual/ @@ -145,8 +130,7 @@ hello-2.3 A program that produces a familiar, friendly greeting - The page where a link to the current version can be found. Example: - https://ftp.gnu.org/gnu/hello/ + The page where a link to the current version can be found. Example: https://ftp.gnu.org/gnu/hello/ @@ -156,10 +140,7 @@ hello-2.3 A program that produces a familiar, friendly greeting - A link or a list of links to the location of Changelog for a package. A - link may use expansion to refer to the correct changelog version. - Example: - "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${version}" + A link or a list of links to the location of Changelog for a package. A link may use expansion to refer to the correct changelog version. Example: "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${version}" @@ -169,46 +150,32 @@ hello-2.3 A program that produces a familiar, friendly greeting - The license, or licenses, for the package. One from the attribute set - defined in - - nixpkgs/lib/licenses.nix. At this moment - using both a list of licenses and a single license is valid. If the - license field is in the form of a list representation, then it means that - parts of the package are licensed differently. Each license should - preferably be referenced by their attribute. The non-list attribute value - can also be a space delimited string representation of the contained - attribute shortNames or spdxIds. The following are all valid examples: + The license, or licenses, for the package. One from the attribute set defined in nixpkgs/lib/licenses.nix. At this moment using both a list of licenses and a single license is valid. If the license field is in the form of a list representation, then it means that parts of the package are licensed differently. Each license should preferably be referenced by their attribute. The non-list attribute value can also be a space delimited string representation of the contained attribute shortNames or spdxIds. The following are all valid examples: - Single license referenced by attribute (preferred) - stdenv.lib.licenses.gpl3. + Single license referenced by attribute (preferred) stdenv.lib.licenses.gpl3. - Single license referenced by its attribute shortName (frowned upon) - "gpl3". + Single license referenced by its attribute shortName (frowned upon) "gpl3". - Single license referenced by its attribute spdxId (frowned upon) - "GPL-3.0". + Single license referenced by its attribute spdxId (frowned upon) "GPL-3.0". - Multiple licenses referenced by attribute (preferred) with - stdenv.lib.licenses; [ asl20 free ofl ]. + Multiple licenses referenced by attribute (preferred) with stdenv.lib.licenses; [ asl20 free ofl ]. - Multiple licenses referenced as a space delimited string of attribute - shortNames (frowned upon) "asl20 free ofl". + Multiple licenses referenced as a space delimited string of attribute shortNames (frowned upon) "asl20 free ofl". @@ -222,13 +189,8 @@ hello-2.3 A program that produces a familiar, friendly greeting - A list of names and e-mail addresses of the maintainers of this Nix - expression. If you would like to be a maintainer of a package, you may - want to add yourself to - nixpkgs/maintainers/maintainer-list.nix - and write something like [ stdenv.lib.maintainers.alice - stdenv.lib.maintainers.bob ]. + A list of names and e-mail addresses of the maintainers of this Nix expression. If you would like to be a maintainer of a package, you may want to add yourself to nixpkgs/maintainers/maintainer-list.nix and write something like [ stdenv.lib.maintainers.alice stdenv.lib.maintainers.bob ]. @@ -238,10 +200,7 @@ hello-2.3 A program that produces a familiar, friendly greeting - The priority of the package, used by - nix-env to resolve file name conflicts between - packages. See the Nix manual page for nix-env for - details. Example: "10" (a low-priority package). + The priority of the package, used by nix-env to resolve file name conflicts between packages. See the Nix manual page for nix-env for details. Example: "10" (a low-priority package). @@ -251,15 +210,11 @@ hello-2.3 A program that produces a familiar, friendly greeting - The list of Nix platform types on which the package is supported. Hydra - builds packages according to the platform specified. If no platform is - specified, the package does not have prebuilt binaries. An example is: + The list of Nix platform types on which the package is supported. Hydra builds packages according to the platform specified. If no platform is specified, the package does not have prebuilt binaries. An example is: meta.platforms = stdenv.lib.platforms.linux; - Attribute Set stdenv.lib.platforms defines - - various common lists of platforms types. + Attribute Set stdenv.lib.platforms defines various common lists of platforms types. @@ -270,23 +225,14 @@ meta.platforms = stdenv.lib.platforms.linux; - This attribute is special in that it is not actually under the - meta attribute set but rather under the - passthru attribute set. This is due to how - meta attributes work, and the fact that they are - supposed to contain only metadata, not derivations. + This attribute is special in that it is not actually under the meta attribute set but rather under the passthru attribute set. This is due to how meta attributes work, and the fact that they are supposed to contain only metadata, not derivations. - An attribute set with as values tests. A test is a derivation, which - builds successfully when the test passes, and fails to build otherwise. A - derivation that is a test needs to have meta.timeout - defined. + An attribute set with as values tests. A test is a derivation, which builds successfully when the test passes, and fails to build otherwise. A derivation that is a test needs to have meta.timeout defined. - The NixOS tests are available as nixosTests in - parameters of derivations. For instance, the OpenSMTPD derivation - includes lines similar to: + The NixOS tests are available as nixosTests in parameters of derivations. For instance, the OpenSMTPD derivation includes lines similar to: { /* ... */, nixosTests }: { @@ -305,13 +251,7 @@ meta.platforms = stdenv.lib.platforms.linux; - A timeout (in seconds) for building the derivation. If the derivation - takes longer than this time to build, it can fail due to breaking the - timeout. However, all computers do not have the same computing power, - hence some builders may decide to apply a multiplicative factor to this - value. When filling this value in, try to keep it approximately - consistent with other values already present in - nixpkgs. + A timeout (in seconds) for building the derivation. If the derivation takes longer than this time to build, it can fail due to breaking the timeout. However, all computers do not have the same computing power, hence some builders may decide to apply a multiplicative factor to this value. When filling this value in, try to keep it approximately consistent with other values already present in nixpkgs. @@ -321,13 +261,7 @@ meta.platforms = stdenv.lib.platforms.linux; - The list of Nix platform types for which the Hydra instance at - hydra.nixos.org will build the package. (Hydra is the - Nix-based continuous build system.) It defaults to the value of - meta.platforms. Thus, the only reason to set - meta.hydraPlatforms is if you want - hydra.nixos.org to build the package on a subset of - meta.platforms, or not at all, e.g. + The list of Nix platform types for which the Hydra instance at hydra.nixos.org will build the package. (Hydra is the Nix-based continuous build system.) It defaults to the value of meta.platforms. Thus, the only reason to set meta.hydraPlatforms is if you want hydra.nixos.org to build the package on a subset of meta.platforms, or not at all, e.g. meta.platforms = stdenv.lib.platforms.linux; meta.hydraPlatforms = []; @@ -341,10 +275,7 @@ meta.hydraPlatforms = []; - If set to true, the package is marked as “broken”, - meaning that it won’t show up in nix-env -qa, and - cannot be built or installed. Such packages should be removed from - Nixpkgs eventually unless they are fixed. + If set to true, the package is marked as “broken”, meaning that it won’t show up in nix-env -qa, and cannot be built or installed. Such packages should be removed from Nixpkgs eventually unless they are fixed. @@ -354,12 +285,7 @@ meta.hydraPlatforms = []; - 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. + 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. @@ -369,17 +295,11 @@ meta.hydraPlatforms = []; Licenses - The meta.license attribute should preferrably contain a - value from stdenv.lib.licenses defined in - - nixpkgs/lib/licenses.nix, or in-place license - description of the same format if the license is unlikely to be useful in - another expression. + The meta.license attribute should preferrably contain a value from stdenv.lib.licenses defined in nixpkgs/lib/licenses.nix, or in-place license description of the same format if the license is unlikely to be useful in another expression. - Although it's typically better to indicate the specific license, a few - generic options are available: + Although it's typically better to indicate the specific license, a few generic options are available: @@ -397,18 +317,10 @@ meta.hydraPlatforms = []; - Unfree package that can be redistributed in binary form. That is, it’s - legal to redistribute the output of the derivation. - This means that the package can be included in the Nixpkgs channel. + Unfree package that can be redistributed in binary form. That is, it’s legal to redistribute the output of the derivation. This means that the package can be included in the Nixpkgs channel. - Sometimes proprietary software can only be redistributed unmodified. - Make sure the builder doesn’t actually modify the original binaries; - otherwise we’re breaking the license. For instance, the NVIDIA X11 - drivers can be redistributed unmodified, but our builder applies - patchelf to make them work. Thus, its license is - "unfree" and it cannot be included in the Nixpkgs - channel. + Sometimes proprietary software can only be redistributed unmodified. Make sure the builder doesn’t actually modify the original binaries; otherwise we’re breaking the license. For instance, the NVIDIA X11 drivers can be redistributed unmodified, but our builder applies patchelf to make them work. Thus, its license is "unfree" and it cannot be included in the Nixpkgs channel. @@ -418,9 +330,7 @@ meta.hydraPlatforms = []; - Unfree package that cannot be redistributed. You can build it yourself, - but you cannot redistribute the output of the derivation. Thus it cannot - be included in the Nixpkgs channel. + Unfree package that cannot be redistributed. You can build it yourself, but you cannot redistribute the output of the derivation. Thus it cannot be included in the Nixpkgs channel. @@ -430,9 +340,7 @@ meta.hydraPlatforms = []; - This package supplies unfree, redistributable firmware. This is a - separate value from unfree-redistributable because - not everybody cares whether firmware is free. + This package supplies unfree, redistributable firmware. This is a separate value from unfree-redistributable because not everybody cares whether firmware is free. diff --git a/doc/multiple-output.xml b/doc/multiple-output.xml index d0247e081f9..83275bb2fbd 100644 --- a/doc/multiple-output.xml +++ b/doc/multiple-output.xml @@ -10,31 +10,16 @@ Introduction - The Nix language allows a derivation to produce multiple outputs, which is - similar to what is utilized by other Linux distribution packaging systems. - The outputs reside in separate Nix store paths, so they can be mostly - handled independently of each other, including passing to build inputs, - garbage collection or binary substitution. The exception is that building - from source always produces all the outputs. + The Nix language allows a derivation to produce multiple outputs, which is similar to what is utilized by other Linux distribution packaging systems. The outputs reside in separate Nix store paths, so they can be mostly handled independently of each other, including passing to build inputs, garbage collection or binary substitution. The exception is that building from source always produces all the outputs. - The main motivation is to save disk space by reducing runtime closure sizes; - consequently also sizes of substituted binaries get reduced. Splitting can - be used to have more granular runtime dependencies, for example the typical - reduction is to split away development-only files, as those are typically - not needed during runtime. As a result, closure sizes of many packages can - get reduced to a half or even much less. + The main motivation is to save disk space by reducing runtime closure sizes; consequently also sizes of substituted binaries get reduced. Splitting can be used to have more granular runtime dependencies, for example the typical reduction is to split away development-only files, as those are typically not needed during runtime. As a result, closure sizes of many packages can get reduced to a half or even much less. - The reduction effects could be instead achieved by building the parts in - completely separate derivations. That would often additionally reduce - build-time closures, but it tends to be much harder to write such - derivations, as build systems typically assume all parts are being built at - once. This compromise approach of single source package producing multiple - binary packages is also utilized often by rpm and deb. + The reduction effects could be instead achieved by building the parts in completely separate derivations. That would often additionally reduce build-time closures, but it tends to be much harder to write such derivations, as build systems typically assume all parts are being built at once. This compromise approach of single source package producing multiple binary packages is also utilized often by rpm and deb.
@@ -42,23 +27,18 @@ Installing a split package - When installing a package via systemPackages or - nix-env you have several options: + When installing a package via systemPackages or nix-env you have several options: - You can install particular outputs explicitly, as each is available in the - Nix language as an attribute of the package. The - outputs attribute contains a list of output names. + You can install particular outputs explicitly, as each is available in the Nix language as an attribute of the package. The outputs attribute contains a list of output names. - You can let it use the default outputs. These are handled by - meta.outputsToInstall attribute that contains a list of - output names. + You can let it use the default outputs. These are handled by meta.outputsToInstall attribute that contains a list of output names. TODO: more about tweaking the attribute, etc. @@ -66,19 +46,11 @@ - NixOS provides configuration option - environment.extraOutputsToInstall that allows adding - extra outputs of environment.systemPackages atop the - default ones. It's mainly meant for documentation and debug symbols, and - it's also modified by specific options. + NixOS provides configuration option environment.extraOutputsToInstall that allows adding extra outputs of environment.systemPackages atop the default ones. It's mainly meant for documentation and debug symbols, and it's also modified by specific options. - At this moment there is no similar configurability for packages installed - by nix-env. You can still use approach from - to override - meta.outputsToInstall attributes, but that's a rather - inconvenient way. + At this moment there is no similar configurability for packages installed by nix-env. You can still use approach from to override meta.outputsToInstall attributes, but that's a rather inconvenient way. @@ -88,25 +60,15 @@ Using a split package - In the Nix language the individual outputs can be reached explicitly as - attributes, e.g. coreutils.info, but the typical case is - just using packages as build inputs. + In the Nix language the individual outputs can be reached explicitly as attributes, e.g. coreutils.info, but the typical case is just using packages as build inputs. - When a multiple-output derivation gets into a build input of another - derivation, the dev output is added if it exists, - otherwise the first output is added. In addition to that, - propagatedBuildOutputs of that package which by default - contain $outputBin and $outputLib are - also added. (See .) + When a multiple-output derivation gets into a build input of another derivation, the dev output is added if it exists, otherwise the first output is added. In addition to that, propagatedBuildOutputs of that package which by default contain $outputBin and $outputLib are also added. (See .) - In some cases it may be desirable to combine different outputs under a - single store path. A function symlinkJoin can be used to - do this. (Note that it may negate some closure size benefits of using a - multiple-output package.) + In some cases it may be desirable to combine different outputs under a single store path. A function symlinkJoin can be used to do this. (Note that it may negate some closure size benefits of using a multiple-output package.)
@@ -117,29 +79,18 @@ - In nixpkgs there is a framework supporting multiple-output derivations. It - tries to cover most cases by default behavior. You can find the source - separated in - <nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh>; - it's relatively well-readable. The whole machinery is triggered by defining - the outputs attribute to contain the list of desired - output names (strings). + In nixpkgs there is a framework supporting multiple-output derivations. It tries to cover most cases by default behavior. You can find the source separated in <nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh>; it's relatively well-readable. The whole machinery is triggered by defining the outputs attribute to contain the list of desired output names (strings). outputs = [ "bin" "dev" "out" "doc" ]; - Often such a single line is enough. For each output an equally named - environment variable is passed to the builder and contains the path in nix - store for that output. Typically you also want to have the main - out output, as it catches any files that didn't get - elsewhere. + Often such a single line is enough. For each output an equally named environment variable is passed to the builder and contains the path in nix store for that output. Typically you also want to have the main out output, as it catches any files that didn't get elsewhere. - There is a special handling of the debug output, - described at . + There is a special handling of the debug output, described at . @@ -147,36 +98,15 @@ <quote>Binaries first</quote> - A commonly adopted convention in nixpkgs is that - executables provided by the package are contained within its first output. - This convention allows the dependent packages to reference the executables - provided by packages in a uniform manner. For instance, provided with the - knowledge that the perl package contains a - perl executable it can be referenced as - ${pkgs.perl}/bin/perl within a Nix derivation that needs - to execute a Perl script. + A commonly adopted convention in nixpkgs is that executables provided by the package are contained within its first output. This convention allows the dependent packages to reference the executables provided by packages in a uniform manner. For instance, provided with the knowledge that the perl package contains a perl executable it can be referenced as ${pkgs.perl}/bin/perl within a Nix derivation that needs to execute a Perl script. - The glibc package is a deliberate single exception to - the binaries first convention. The glibc - has libs as its first output allowing the libraries - provided by glibc to be referenced directly (e.g. - ${stdenv.glibc}/lib/ld-linux-x86-64.so.2). The - executables provided by glibc can be accessed via its - bin attribute (e.g. - ${stdenv.glibc.bin}/bin/ldd). + The glibc package is a deliberate single exception to the binaries first convention. The glibc has libs as its first output allowing the libraries provided by glibc to be referenced directly (e.g. ${stdenv.glibc}/lib/ld-linux-x86-64.so.2). The executables provided by glibc can be accessed via its bin attribute (e.g. ${stdenv.glibc.bin}/bin/ldd). - The reason for why glibc deviates from the convention is - because referencing a library provided by glibc is a - very common operation among Nix packages. For instance, third-party - executables packaged by Nix are typically patched and relinked with the - relevant version of glibc libraries from Nix packages - (please see the documentation on - patchelf for more - details). + The reason for why glibc deviates from the convention is because referencing a library provided by glibc is a very common operation among Nix packages. For instance, third-party executables packaged by Nix are typically patched and relinked with the relevant version of glibc libraries from Nix packages (please see the documentation on patchelf for more details).
@@ -184,13 +114,7 @@ File type groups - The support code currently recognizes some particular kinds of outputs and - either instructs the build system of the package to put files into their - desired outputs or it moves the files during the fixup phase. Each group of - file types has an outputFoo variable specifying the - output name where they should go. If that variable isn't defined by the - derivation writer, it is guessed – a default output name is defined, - falling back to other possibilities if the output isn't defined. + The support code currently recognizes some particular kinds of outputs and either instructs the build system of the package to put files into their desired outputs or it moves the files during the fixup phase. Each group of file types has an outputFoo variable specifying the output name where they should go. If that variable isn't defined by the derivation writer, it is guessed – a default output name is defined, falling back to other possibilities if the output isn't defined. @@ -200,9 +124,7 @@ - is for development-only files. These include C(++) headers, pkg-config, - cmake and aclocal files. They go to dev or - out by default. + is for development-only files. These include C(++) headers, pkg-config, cmake and aclocal files. They go to dev or out by default. @@ -212,8 +134,7 @@ - is meant for user-facing binaries, typically residing in bin/. They go - to bin or out by default. + is meant for user-facing binaries, typically residing in bin/. They go to bin or out by default. @@ -223,9 +144,7 @@ - is meant for libraries, typically residing in lib/ - and libexec/. They go to lib or - out by default. + is meant for libraries, typically residing in lib/ and libexec/. They go to lib or out by default. @@ -235,9 +154,7 @@ - is for user documentation, typically residing in - share/doc/. It goes to doc or - out by default. + is for user documentation, typically residing in share/doc/. It goes to doc or out by default. @@ -247,10 +164,7 @@ - is for developer documentation. Currently we count - gtk-doc and devhelp books in there. It goes to devdoc - or is removed (!) by default. This is because e.g. gtk-doc tends to be - rather large and completely unused by nixpkgs users. + is for developer documentation. Currently we count gtk-doc and devhelp books in there. It goes to devdoc or is removed (!) by default. This is because e.g. gtk-doc tends to be rather large and completely unused by nixpkgs users. @@ -260,8 +174,7 @@ - is for man pages (except for section 3). They go to - man or $outputBin by default. + is for man pages (except for section 3). They go to man or $outputBin by default. @@ -271,8 +184,7 @@ - is for section 3 man pages. They go to devman or - $outputMan by default. + is for section 3 man pages. They go to devman or $outputMan by default. @@ -282,8 +194,7 @@ - is for info pages. They go to info or - $outputBin by default. + is for info pages. They go to info or $outputBin by default. @@ -296,31 +207,22 @@ - Some configure scripts don't like some of the parameters passed by - default by the framework, e.g. --docdir=/foo/bar. You - can disable this by setting setOutputFlags = false;. + Some configure scripts don't like some of the parameters passed by default by the framework, e.g. --docdir=/foo/bar. You can disable this by setting setOutputFlags = false;. - The outputs of a single derivation can retain references to each other, - but note that circular references are not allowed. (And each - strongly-connected component would act as a single output anyway.) + The outputs of a single derivation can retain references to each other, but note that circular references are not allowed. (And each strongly-connected component would act as a single output anyway.) - Most of split packages contain their core functionality in libraries. - These libraries tend to refer to various kind of data that typically gets - into out, e.g. locale strings, so there is often no - advantage in separating the libraries into lib, as - keeping them in out is easier. + Most of split packages contain their core functionality in libraries. These libraries tend to refer to various kind of data that typically gets into out, e.g. locale strings, so there is often no advantage in separating the libraries into lib, as keeping them in out is easier. - Some packages have hidden assumptions on install paths, which complicates - splitting. + Some packages have hidden assumptions on install paths, which complicates splitting. diff --git a/doc/overlays.xml b/doc/overlays.xml index bff2339ca93..26a888368ab 100644 --- a/doc/overlays.xml +++ b/doc/overlays.xml @@ -3,47 +3,32 @@ xml:id="chap-overlays"> Overlays - This chapter describes how to extend and change Nixpkgs using overlays. - Overlays are used to add layers in the fixed-point used by Nixpkgs to compose - the set of all packages. + This chapter describes how to extend and change Nixpkgs using overlays. Overlays are used to add layers in the fixed-point used by Nixpkgs to compose the set of all packages. - Nixpkgs can be configured with a list of overlays, which are applied in - order. This means that the order of the overlays can be significant if - multiple layers override the same package. + Nixpkgs can be configured with a list of overlays, which are applied in order. This means that the order of the overlays can be significant if multiple layers override the same package.
Installing overlays - The list of overlays can be set either explicitly in a Nix expression, or - through <nixpkgs-overlays> or user configuration - files. + The list of overlays can be set either explicitly in a Nix expression, or through <nixpkgs-overlays> or user configuration files.
Set overlays in NixOS or Nix expressions - On a NixOS system the value of the nixpkgs.overlays - option, if present, is passed to the system Nixpkgs directly as an - argument. Note that this does not affect the overlays for non-NixOS - operations (e.g. nix-env), which are - looked up independently. + On a NixOS system the value of the nixpkgs.overlays option, if present, is passed to the system Nixpkgs directly as an argument. Note that this does not affect the overlays for non-NixOS operations (e.g. nix-env), which are looked up independently. - The list of overlays can be passed explicitly when importing nixpkgs, for - example import <nixpkgs> { overlays = [ overlay1 overlay2 ]; - }. + The list of overlays can be passed explicitly when importing nixpkgs, for example import <nixpkgs> { overlays = [ overlay1 overlay2 ]; }. - Further overlays can be added by calling the pkgs.extend - or pkgs.appendOverlays, although it is often preferable - to avoid these functions, because they recompute the Nixpkgs fixpoint, - which is somewhat expensive to do. + Further overlays can be added by calling the pkgs.extend or pkgs.appendOverlays, although it is often preferable to avoid these functions, because they recompute the Nixpkgs fixpoint, which is somewhat expensive to do.
@@ -58,30 +43,20 @@ - First, if an - overlays - argument to the Nixpkgs function itself is given, then that is - used and no path lookup will be performed. + First, if an overlays argument to the Nixpkgs function itself is given, then that is used and no path lookup will be performed. - Otherwise, if the Nix path entry - <nixpkgs-overlays> exists, we look for overlays at - that path, as described below. + Otherwise, if the Nix path entry <nixpkgs-overlays> exists, we look for overlays at that path, as described below. - See the section on NIX_PATH in the Nix manual for - more details on how to set a value for - <nixpkgs-overlays>. + See the section on NIX_PATH in the Nix manual for more details on how to set a value for <nixpkgs-overlays>. - If one of ~/.config/nixpkgs/overlays.nix and - ~/.config/nixpkgs/overlays/ exists, then we look - for overlays at that path, as described below. It is an error if both - exist. + If one of ~/.config/nixpkgs/overlays.nix and ~/.config/nixpkgs/overlays/ exists, then we look for overlays at that path, as described below. It is an error if both exist. @@ -92,15 +67,12 @@ - If the path is a file, then the file is imported as a Nix expression and - used as the list of overlays. + If the path is a file, then the file is imported as a Nix expression and used as the list of overlays. - If the path is a directory, then we take the content of the directory, - order it lexicographically, and attempt to interpret each as an overlay - by: + If the path is a directory, then we take the content of the directory, order it lexicographically, and attempt to interpret each as an overlay by: @@ -109,8 +81,7 @@ - Importing a top-level default.nix file, if it is - a directory. + Importing a top-level default.nix file, if it is a directory. @@ -120,12 +91,7 @@ - Because overlays that are set in NixOS configuration do not affect - non-NixOS operations such as nix-env, the - overlays.nix option provides a convenient way to use - the same overlays for a NixOS system configuration and user configuration: - the same file can be used as overlays.nix and imported - as the value of nixpkgs.overlays. + Because overlays that are set in NixOS configuration do not affect non-NixOS operations such as nix-env, the overlays.nix option provides a convenient way to use the same overlays for a NixOS system configuration and user configuration: the same file can be used as overlays.nix and imported as the value of nixpkgs.overlays.
Linux kernel - The Nix expressions to build the Linux kernel are in - pkgs/os-specific/linux/kernel. - The function that builds the kernel has an argument - kernelPatches which should be a list of {name, - patch, extraConfig} attribute sets, where name - is the name of the patch (which is included in the kernel’s - meta.description attribute), patch is - the patch itself (possibly compressed), and extraConfig - (optional) is a string specifying extra options to be concatenated to the - kernel configuration file (.config). + The function that builds the kernel has an argument kernelPatches which should be a list of {name, patch, extraConfig} attribute sets, where name is the name of the patch (which is included in the kernel’s meta.description attribute), patch is the patch itself (possibly compressed), and extraConfig (optional) is a string specifying extra options to be concatenated to the kernel configuration file (.config). - The kernel derivation exports an attribute features - specifying whether optional functionality is or isn’t enabled. This is - used in NixOS to implement kernel-specific behaviour. For instance, if the - kernel has the iwlwifi feature (i.e. has built-in support - for Intel wireless chipsets), then NixOS doesn’t have to build the - external iwlwifi package: + The kernel derivation exports an attribute features specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the iwlwifi feature (i.e. has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external iwlwifi package: modulesTree = [kernel] ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi @@ -47,45 +32,31 @@ modulesTree = [kernel] - Copy the old Nix expression (e.g. linux-2.6.21.nix) - to the new one (e.g. linux-2.6.22.nix) and update - it. + Copy the old Nix expression (e.g. linux-2.6.21.nix) to the new one (e.g. linux-2.6.22.nix) and update it. - Add the new kernel to all-packages.nix (e.g., create - an attribute kernel_2_6_22). + Add the new kernel to all-packages.nix (e.g., create an attribute kernel_2_6_22). - Now we’re going to update the kernel configuration. First unpack the - kernel. Then for each supported platform (i686, - x86_64, uml) do the following: + Now we’re going to update the kernel configuration. First unpack the kernel. Then for each supported platform (i686, x86_64, uml) do the following: - Make an copy from the old config (e.g. - config-2.6.21-i686-smp) to the new one (e.g. - config-2.6.22-i686-smp). + Make an copy from the old config (e.g. config-2.6.21-i686-smp) to the new one (e.g. config-2.6.22-i686-smp). - Copy the config file for this platform (e.g. - config-2.6.22-i686-smp) to - .config in the kernel source tree. + Copy the config file for this platform (e.g. config-2.6.22-i686-smp) to .config in the kernel source tree. - Run make oldconfig - ARCH={i386,x86_64,um} and answer - all questions. (For the uml configuration, also add - SHELL=bash.) Make sure to keep the configuration - consistent between platforms (i.e. don’t enable some feature on - i686 and disable it on x86_64). + Run make oldconfig ARCH={i386,x86_64,um} and answer all questions. (For the uml configuration, also add SHELL=bash.) Make sure to keep the configuration consistent between platforms (i.e. don’t enable some feature on i686 and disable it on x86_64). @@ -99,8 +70,7 @@ modulesTree = [kernel] - Copy .config over the new config file (e.g. - config-2.6.22-i686-smp). + Copy .config over the new config file (e.g. config-2.6.22-i686-smp). @@ -108,18 +78,12 @@ modulesTree = [kernel] - Test building the kernel: nix-build -A kernel_2_6_22. - If it compiles, ship it! For extra credit, try booting NixOS with it. + Test building the kernel: nix-build -A kernel_2_6_22. If it compiles, ship it! For extra credit, try booting NixOS with it. - It may be that the new kernel requires updating the external kernel - modules and kernel-dependent packages listed in the - linuxPackagesFor function in - all-packages.nix (such as the NVIDIA drivers, AUFS, - etc.). If the updated packages aren’t backwards compatible with older - kernels, you may need to keep the older versions around. + It may be that the new kernel requires updating the external kernel modules and kernel-dependent packages listed in the linuxPackagesFor function in all-packages.nix (such as the NVIDIA drivers, AUFS, etc.). If the updated packages aren’t backwards compatible with older kernels, you may need to keep the older versions around. @@ -130,13 +94,7 @@ modulesTree = [kernel] X.org - The Nix expressions for the X.org packages reside in - pkgs/servers/x11/xorg/default.nix. This file is - automatically generated from lists of tarballs in an X.org release. As such - it should not be modified directly; rather, you should modify the lists, the - generator script or the file - pkgs/servers/x11/xorg/overrides.nix, in which you can - override or add to the derivations produced by the generator. + The Nix expressions for the X.org packages reside in pkgs/servers/x11/xorg/default.nix. This file is automatically generated from lists of tarballs in an X.org release. As such it should not be modified directly; rather, you should modify the lists, the generator script or the file pkgs/servers/x11/xorg/overrides.nix, in which you can override or add to the derivations produced by the generator. @@ -146,37 +104,22 @@ modulesTree = [kernel] $ cat tarballs-7.5.list extra.list old.list \ | perl ./generate-expr-from-tarballs.pl - For each of the tarballs in the .list files, the script - downloads it, unpacks it, and searches its configure.ac - and *.pc.in files for dependencies. This information is - used to generate default.nix. The generator caches - downloaded tarballs between runs. Pay close attention to the NOT - FOUND: name messages at the end of the - run, since they may indicate missing dependencies. (Some might be optional - dependencies, however.) + For each of the tarballs in the .list files, the script downloads it, unpacks it, and searches its configure.ac and *.pc.in files for dependencies. This information is used to generate default.nix. The generator caches downloaded tarballs between runs. Pay close attention to the NOT FOUND: name messages at the end of the run, since they may indicate missing dependencies. (Some might be optional dependencies, however.) - A file like tarballs-7.5.list contains all tarballs in - a X.org release. It can be generated like this: + A file like tarballs-7.5.list contains all tarballs in a X.org release. It can be generated like this: $ export i="mirror://xorg/X11R7.4/src/everything/" $ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \ | perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' \ | sort > tarballs-7.4.list - extra.list contains libraries that aren’t part of - X.org proper, but are closely related to it, such as - libxcb. old.list contains some - packages that were removed from X.org, but are still needed by some people - or by other packages (such as imake). + extra.list contains libraries that aren’t part of X.org proper, but are closely related to it, such as libxcb. old.list contains some packages that were removed from X.org, but are still needed by some people or by other packages (such as imake). - If the expression for a package requires derivation attributes that the - generator cannot figure out automatically (say, patches - or a postInstall hook), you should modify - pkgs/servers/x11/xorg/overrides.nix. + If the expression for a package requires derivation attributes that the generator cannot figure out automatically (say, patches or a postInstall hook), you should modify pkgs/servers/x11/xorg/overrides.nix.
@@ -199,41 +142,19 @@ modulesTree = [kernel] Eclipse - The Nix expressions related to the Eclipse platform and IDE are in - pkgs/applications/editors/eclipse. + The Nix expressions related to the Eclipse platform and IDE are in pkgs/applications/editors/eclipse. - Nixpkgs provides a number of packages that will install Eclipse in its - various forms. These range from the bare-bones Eclipse Platform to the more - fully featured Eclipse SDK or Scala-IDE packages and multiple version are - often available. It is possible to list available Eclipse packages by - issuing the command: + Nixpkgs provides a number of packages that will install Eclipse in its various forms. These range from the bare-bones Eclipse Platform to the more fully featured Eclipse SDK or Scala-IDE packages and multiple version are often available. It is possible to list available Eclipse packages by issuing the command: $ nix-env -f '<nixpkgs>' -qaP -A eclipses --description - Once an Eclipse variant is installed it can be run using the - eclipse command, as expected. From within Eclipse it is - then possible to install plugins in the usual manner by either manually - specifying an Eclipse update site or by installing the Marketplace Client - plugin and using it to discover and install other plugins. This installation - method provides an Eclipse installation that closely resemble a manually - installed Eclipse. + Once an Eclipse variant is installed it can be run using the eclipse command, as expected. From within Eclipse it is then possible to install plugins in the usual manner by either manually specifying an Eclipse update site or by installing the Marketplace Client plugin and using it to discover and install other plugins. This installation method provides an Eclipse installation that closely resemble a manually installed Eclipse. - If you prefer to install plugins in a more declarative manner then Nixpkgs - also offer a number of Eclipse plugins that can be installed in an - Eclipse environment. This type of environment is - created using the function eclipseWithPlugins found - inside the nixpkgs.eclipses attribute set. This function - takes as argument { eclipse, plugins ? [], jvmArgs ? [] } - where eclipse is a one of the Eclipse packages described - above, plugins is a list of plugin derivations, and - jvmArgs is a list of arguments given to the JVM running - the Eclipse. For example, say you wish to install the latest Eclipse - Platform with the popular Eclipse Color Theme plugin and also allow Eclipse - to use more RAM. You could then add + If you prefer to install plugins in a more declarative manner then Nixpkgs also offer a number of Eclipse plugins that can be installed in an Eclipse environment. This type of environment is created using the function eclipseWithPlugins found inside the nixpkgs.eclipses attribute set. This function takes as argument { eclipse, plugins ? [], jvmArgs ? [] } where eclipse is a one of the Eclipse packages described above, plugins is a list of plugin derivations, and jvmArgs is a list of arguments given to the JVM running the Eclipse. For example, say you wish to install the latest Eclipse Platform with the popular Eclipse Color Theme plugin and also allow Eclipse to use more RAM. You could then add packageOverrides = pkgs: { myEclipse = with pkgs.eclipses; eclipseWithPlugins { @@ -243,38 +164,18 @@ packageOverrides = pkgs: { }; } - to your Nixpkgs configuration - (~/.config/nixpkgs/config.nix) and install it by - running nix-env -f '<nixpkgs>' -iA myEclipse and - afterward run Eclipse as usual. It is possible to find out which plugins are - available for installation using eclipseWithPlugins by - running + to your Nixpkgs configuration (~/.config/nixpkgs/config.nix) and install it by running nix-env -f '<nixpkgs>' -iA myEclipse and afterward run Eclipse as usual. It is possible to find out which plugins are available for installation using eclipseWithPlugins by running $ nix-env -f '<nixpkgs>' -qaP -A eclipses.plugins --description - If there is a need to install plugins that are not available in Nixpkgs then - it may be possible to define these plugins outside Nixpkgs using the - buildEclipseUpdateSite and - buildEclipsePlugin functions found in the - nixpkgs.eclipses.plugins attribute set. Use the - buildEclipseUpdateSite function to install a plugin - distributed as an Eclipse update site. This function takes { name, - src } as argument where src indicates the - Eclipse update site archive. All Eclipse features and plugins within the - downloaded update site will be installed. When an update site archive is not - available then the buildEclipsePlugin function can be - used to install a plugin that consists of a pair of feature and plugin JARs. - This function takes an argument { name, srcFeature, srcPlugin - } where srcFeature and - srcPlugin are the feature and plugin JARs, respectively. + If there is a need to install plugins that are not available in Nixpkgs then it may be possible to define these plugins outside Nixpkgs using the buildEclipseUpdateSite and buildEclipsePlugin functions found in the nixpkgs.eclipses.plugins attribute set. Use the buildEclipseUpdateSite function to install a plugin distributed as an Eclipse update site. This function takes { name, src } as argument where src indicates the Eclipse update site archive. All Eclipse features and plugins within the downloaded update site will be installed. When an update site archive is not available then the buildEclipsePlugin function can be used to install a plugin that consists of a pair of feature and plugin JARs. This function takes an argument { name, srcFeature, srcPlugin } where srcFeature and srcPlugin are the feature and plugin JARs, respectively. - Expanding the previous example with two plugins using the above functions we - have + Expanding the previous example with two plugins using the above functions we have packageOverrides = pkgs: { myEclipse = with pkgs.eclipses; eclipseWithPlugins { @@ -311,19 +212,15 @@ packageOverrides = pkgs: { Elm - To start a development environment do nix-shell -p elmPackages.elm - elmPackages.elm-format + To start a development environment do nix-shell -p elmPackages.elm elmPackages.elm-format - To update Elm compiler, see - nixpkgs/pkgs/development/compilers/elm/README.md. + To update Elm compiler, see nixpkgs/pkgs/development/compilers/elm/README.md. - To package Elm applications, - read about - elm2nix. + To package Elm applications, read about elm2nix.
@@ -342,11 +239,7 @@ packageOverrides = pkgs: { Interactive shell helpers - Some packages provide the shell integration to be more useful. But unlike - other systems, nix doesn't have a standard share directory location. This is - why a bunch PACKAGE-share scripts are shipped that print - the location of the corresponding shared folder. Current list of such - packages is as following: + Some packages provide the shell integration to be more useful. But unlike other systems, nix doesn't have a standard share directory location. This is why a bunch PACKAGE-share scripts are shipped that print the location of the corresponding shared folder. Current list of such packages is as following: @@ -369,31 +262,20 @@ packageOverrides = pkgs: { Weechat - Weechat can be configured to include your choice of plugins, reducing its - closure size from the default configuration which includes all available - plugins. To make use of this functionality, install an expression that - overrides its configuration such as + Weechat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration such as weechat.override {configure = {availablePlugins, ...}: { plugins = with availablePlugins; [ python perl ]; } } - If the configure function returns an attrset without the - plugins attribute, availablePlugins - will be used automatically. + If the configure function returns an attrset without the plugins attribute, availablePlugins will be used automatically. - The plugins currently available are python, - perl, ruby, guile, - tcl and lua. + The plugins currently available are python, perl, ruby, guile, tcl and lua. - The python and perl plugins allows the addition of extra libraries. For - instance, the inotify.py script in weechat-scripts - requires D-Bus or libnotify, and the fish.py script - requires pycrypto. To use these scripts, use the plugin's - withPackages attribute: + The python and perl plugins allows the addition of extra libraries. For instance, the inotify.py script in weechat-scripts requires D-Bus or libnotify, and the fish.py script requires pycrypto. To use these scripts, use the plugin's withPackages attribute: weechat.override { configure = {availablePlugins, ...}: { plugins = with availablePlugins; [ (python.withPackages (ps: with ps; [ pycrypto python-dbus ])) @@ -404,8 +286,7 @@ packageOverrides = pkgs: { - In order to also keep all default plugins installed, it is possible to use - the following method: + In order to also keep all default plugins installed, it is possible to use the following method: weechat.override { configure = { availablePlugins, ... }: { plugins = builtins.attrValues (availablePlugins // { python = availablePlugins.python.withPackages (ps: with ps; [ pycrypto python-dbus ]); @@ -415,9 +296,7 @@ packageOverrides = pkgs: { - WeeChat allows to set defaults on startup using the - --run-command. The configure method - can be used to pass commands to the program: + WeeChat allows to set defaults on startup using the --run-command. The configure method can be used to pass commands to the program: weechat.override { configure = { availablePlugins, ... }: { init = '' @@ -426,14 +305,11 @@ packageOverrides = pkgs: { ''; }; } - Further values can be added to the list of commands when running - weechat --run-command "your-commands". + Further values can be added to the list of commands when running weechat --run-command "your-commands". - Additionally it's possible to specify scripts to be loaded when starting - weechat. These will be loaded before the commands from - init: + Additionally it's possible to specify scripts to be loaded when starting weechat. These will be loaded before the commands from init: weechat.override { configure = { availablePlugins, ... }: { scripts = with pkgs.weechatScripts; [ @@ -447,11 +323,7 @@ packageOverrides = pkgs: { - In nixpkgs there's a subpackage which contains - derivations for WeeChat scripts. Such derivations expect a - passthru.scripts attribute which contains a list of all - scripts inside the store path. Furthermore all scripts have to live in - $out/share. An exemplary derivation looks like this: + In nixpkgs there's a subpackage which contains derivations for WeeChat scripts. Such derivations expect a passthru.scripts attribute which contains a list of all scripts inside the store path. Furthermore all scripts have to live in $out/share. An exemplary derivation looks like this: { stdenv, fetchurl }: stdenv.mkDerivation { @@ -480,18 +352,11 @@ stdenv.mkDerivation { Activating the engine - IBus needs to be configured accordingly to activate - typing-booster. The configuration depends on the desktop - manager in use. For detailed instructions, please refer to the - upstream - docs. + IBus needs to be configured accordingly to activate typing-booster. The configuration depends on the desktop manager in use. For detailed instructions, please refer to the upstream docs. - On NixOS you need to explicitly enable ibus with given - engines before customizing your desktop to use - typing-booster. This can be achieved using the - ibus module: + On NixOS you need to explicitly enable ibus with given engines before customizing your desktop to use typing-booster. This can be achieved using the ibus module: { pkgs, ... }: { i18n.inputMethod = { enabled = "ibus"; @@ -505,21 +370,14 @@ stdenv.mkDerivation { Using custom hunspell dictionaries - The IBus engine is based on hunspell to support - completion in many languages. By default the dictionaries - de-de, en-us, - fr-moderne es-es, - it-it, sv-se and - sv-fi are in use. To add another dictionary, the package - can be overridden like this: + The IBus engine is based on hunspell to support completion in many languages. By default the dictionaries de-de, en-us, fr-moderne es-es, it-it, sv-se and sv-fi are in use. To add another dictionary, the package can be overridden like this: ibus-engines.typing-booster.override { langs = [ "de-at" "en-gb" ]; } - Note: each language passed to langs must be an - attribute name in pkgs.hunspellDicts. + Note: each language passed to langs must be an attribute name in pkgs.hunspellDicts.
@@ -527,10 +385,7 @@ stdenv.mkDerivation { Built-in emoji picker - The ibus-engines.typing-booster package contains a - program named emoji-picker. To display all emojis - correctly, a special font such as noto-fonts-emoji is - needed: + The ibus-engines.typing-booster package contains a program named emoji-picker. To display all emojis correctly, a special font such as noto-fonts-emoji is needed: @@ -545,45 +400,22 @@ stdenv.mkDerivation { Nginx - Nginx is a reverse proxy and - lightweight webserver. + Nginx is a reverse proxy and lightweight webserver.
ETags on static files served from the Nix store - HTTP has a couple different mechanisms for caching to prevent clients from - having to download the same content repeatedly if a resource has not - changed since the last time it was requested. When nginx is used as a - server for static files, it implements the caching mechanism based on the - Last-Modified - response header automatically; unfortunately, it works by using filesystem - timestamps to determine the value of the Last-Modified - header. This doesn't give the desired behavior when the file is in the Nix - store, because all file timestamps are set to 0 (for reasons related to - build reproducibility). + HTTP has a couple different mechanisms for caching to prevent clients from having to download the same content repeatedly if a resource has not changed since the last time it was requested. When nginx is used as a server for static files, it implements the caching mechanism based on the Last-Modified response header automatically; unfortunately, it works by using filesystem timestamps to determine the value of the Last-Modified header. This doesn't give the desired behavior when the file is in the Nix store, because all file timestamps are set to 0 (for reasons related to build reproducibility). - Fortunately, HTTP supports an alternative (and more effective) caching - mechanism: the - ETag - response header. The value of the ETag header specifies - some identifier for the particular content that the server is sending (e.g. - a hash). When a client makes a second request for the same resource, it - sends that value back in an If-None-Match header. If the - ETag value is unchanged, then the server does not need to resend the - content. + Fortunately, HTTP supports an alternative (and more effective) caching mechanism: the ETag response header. The value of the ETag header specifies some identifier for the particular content that the server is sending (e.g. a hash). When a client makes a second request for the same resource, it sends that value back in an If-None-Match header. If the ETag value is unchanged, then the server does not need to resend the content. - As of NixOS 19.09, the nginx package in Nixpkgs is patched such that when - nginx serves a file out of /nix/store, the hash in the - store path is used as the ETag header in the HTTP - response, thus providing proper caching functionality. This happens - automatically; you do not need to do modify any configuration to get this - behavior. + As of NixOS 19.09, the nginx package in Nixpkgs is patched such that when nginx serves a file out of /nix/store, the hash in the store path is used as the ETag header in the HTTP response, thus providing proper caching functionality. This happens automatically; you do not need to do modify any configuration to get this behavior.
diff --git a/doc/package-specific-user-notes.xml b/doc/package-specific-user-notes.xml index 09af69bb15d..a3ee42dc7fa 100644 --- a/doc/package-specific-user-notes.xml +++ b/doc/package-specific-user-notes.xml @@ -1,46 +1,24 @@ Package-specific usage notes - These chapters includes some notes that apply to specific packages and should - answer some of the frequently asked questions related to Nixpkgs use. Some - useful information related to package use can be found in - package-specific development notes. + These chapters includes some notes that apply to specific packages and should answer some of the frequently asked questions related to Nixpkgs use. Some useful information related to package use can be found in package-specific development notes.
OpenGL - Packages that use OpenGL have NixOS desktop as their primary target. The - current solution for loading the GPU-specific drivers is based on - libglvnd and looks for the driver implementation in - LD_LIBRARY_PATH. If you are using a non-NixOS - GNU/Linux/X11 desktop with free software video drivers, consider launching - OpenGL-dependent programs from Nixpkgs with Nixpkgs versions of - libglvnd and mesa_drivers in - LD_LIBRARY_PATH. For proprietary video drivers you might - have luck with also adding the corresponding video driver package. + Packages that use OpenGL have NixOS desktop as their primary target. The current solution for loading the GPU-specific drivers is based on libglvnd and looks for the driver implementation in LD_LIBRARY_PATH. If you are using a non-NixOS GNU/Linux/X11 desktop with free software video drivers, consider launching OpenGL-dependent programs from Nixpkgs with Nixpkgs versions of libglvnd and mesa_drivers in LD_LIBRARY_PATH. For proprietary video drivers you might have luck with also adding the corresponding video driver package.
Locales - To allow simultaneous use of packages linked against different versions of - glibc with different locale archive formats Nixpkgs - patches glibc to rely on - LOCALE_ARCHIVE environment variable. + To allow simultaneous use of packages linked against different versions of glibc with different locale archive formats Nixpkgs patches glibc to rely on LOCALE_ARCHIVE environment variable. - On non-NixOS distributions this variable is obviously not set. This can - cause regressions in language support or even crashes in some - Nixpkgs-provided programs. The simplest way to mitigate this problem is - exporting the LOCALE_ARCHIVE variable pointing to - ${glibcLocales}/lib/locale/locale-archive. The drawback - (and the reason this is not the default) is the relatively large (a hundred - MiB) size of the full set of locales. It is possible to build a custom set - of locales by overriding parameters allLocales and - locales of the package. + On non-NixOS distributions this variable is obviously not set. This can cause regressions in language support or even crashes in some Nixpkgs-provided programs. The simplest way to mitigate this problem is exporting the LOCALE_ARCHIVE variable pointing to ${glibcLocales}/lib/locale/locale-archive. The drawback (and the reason this is not the default) is the relatively large (a hundred MiB) size of the full set of locales. It is possible to build a custom set of locales by overriding parameters allLocales and locales of the package.
@@ -50,15 +28,7 @@ Configuring Emacs - The Emacs package comes with some extra helpers to make it easier to - configure. emacsWithPackages allows you to manage - packages from ELPA. This means that you will not have to install that - packages from within Emacs. For instance, if you wanted to use - company, counsel, - flycheck, ivy, - magit, projectile, and - use-package you could use this as a - ~/.config/nixpkgs/config.nix override: + The Emacs package comes with some extra helpers to make it easier to configure. emacsWithPackages allows you to manage packages from ELPA. This means that you will not have to install that packages from within Emacs. For instance, if you wanted to use company, counsel, flycheck, ivy, magit, projectile, and use-package you could use this as a ~/.config/nixpkgs/config.nix override: @@ -78,15 +48,7 @@ - You can install it like any other packages via nix-env -iA - myEmacs. However, this will only install those packages. It will - not configure them for us. To do this, we need to - provide a configuration file. Luckily, it is possible to do this from - within Nix! By modifying the above example, we can make Emacs load a custom - config file. The key is to create a package that provide a - default.el file in - /share/emacs/site-start/. Emacs knows to load this - file automatically when it starts. + You can install it like any other packages via nix-env -iA myEmacs. However, this will only install those packages. It will not configure them for us. To do this, we need to provide a configuration file. Luckily, it is possible to do this from within Nix! By modifying the above example, we can make Emacs load a custom config file. The key is to create a package that provide a default.el file in /share/emacs/site-start/. Emacs knows to load this file automatically when it starts. @@ -168,22 +130,11 @@ cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el - This provides a fairly full Emacs start file. It will load in addition to - the user's presonal config. You can always disable it by passing - -q to the Emacs command. + This provides a fairly full Emacs start file. It will load in addition to the user's presonal config. You can always disable it by passing -q to the Emacs command. - Sometimes emacsWithPackages is not enough, as this - package set has some priorities imposed on packages (with the lowest - priority assigned to Melpa Unstable, and the highest for packages manually - defined in pkgs/top-level/emacs-packages.nix). But you - can't control this priorities when some package is installed as a - dependency. You can override it on per-package-basis, providing all the - required dependencies manually - but it's tedious and there is always a - possibility that an unwanted dependency will sneak in through some other - package. To completely override such a package you can use - overrideScope'. + Sometimes emacsWithPackages is not enough, as this package set has some priorities imposed on packages (with the lowest priority assigned to Melpa Unstable, and the highest for packages manually defined in pkgs/top-level/emacs-packages.nix). But you can't control this priorities when some package is installed as a dependency. You can override it on per-package-basis, providing all the required dependencies manually - but it's tedious and there is always a possibility that an unwanted dependency will sneak in through some other package. To completely override such a package you can use overrideScope'. @@ -203,23 +154,18 @@ overrides = self: super: rec { DLib - DLib is a modern, C++-based - toolkit which provides several machine learning algorithms. + DLib is a modern, C++-based toolkit which provides several machine learning algorithms.
Compiling without AVX support - Especially older CPUs don't support - AVX - (Advanced Vector Extensions) instructions that are used by - DLib to optimize their algorithms. + Especially older CPUs don't support AVX (Advanced Vector Extensions) instructions that are used by DLib to optimize their algorithms. - On the affected hardware errors like Illegal instruction - will occur. In those cases AVX support needs to be disabled: + On the affected hardware errors like Illegal instruction will occur. In those cases AVX support needs to be disabled: self: super: { dlib = super.dlib.override { avxSupport = false; }; } @@ -230,22 +176,11 @@ overrides = self: super: rec { Unfree software - All users of Nixpkgs are free software users, and many users (and - developers) of Nixpkgs want to limit and tightly control their exposure to - unfree software. At the same time, many users need (or want) to run some - specific pieces of proprietary software. Nixpkgs includes some expressions - for unfree software packages. By default unfree software cannot be installed - and doesn’t show up in searches. To allow installing unfree software in a - single Nix invocation one can export - NIXPKGS_ALLOW_UNFREE=1. For a persistent solution, users - can set allowUnfree in the Nixpkgs configuration. + All users of Nixpkgs are free software users, and many users (and developers) of Nixpkgs want to limit and tightly control their exposure to unfree software. At the same time, many users need (or want) to run some specific pieces of proprietary software. Nixpkgs includes some expressions for unfree software packages. By default unfree software cannot be installed and doesn’t show up in searches. To allow installing unfree software in a single Nix invocation one can export NIXPKGS_ALLOW_UNFREE=1. For a persistent solution, users can set allowUnfree in the Nixpkgs configuration. - Fine-grained control is possible by defining - allowUnfreePredicate function in config; it takes the - mkDerivation parameter attrset and returns - true for unfree packages that should be allowed. + Fine-grained control is possible by defining allowUnfreePredicate function in config; it takes the mkDerivation parameter attrset and returns true for unfree packages that should be allowed.
@@ -255,13 +190,7 @@ overrides = self: super: rec { Steam in Nix - Steam is distributed as a .deb file, for now only as - an i686 package (the amd64 package only has documentation). When unpacked, - it has a script called steam that in Ubuntu (their - target distro) would go to /usr/bin . When run for the - first time, this script copies some files to the user's home, which include - another script that is the ultimate responsible for launching the steam - binary, which is also in $HOME. + Steam is distributed as a .deb file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called steam that in Ubuntu (their target distro) would go to /usr/bin . When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in $HOME. @@ -269,8 +198,7 @@ overrides = self: super: rec { - We don't have /bin/bash and many scripts point - there. Similarly for /usr/bin/python . + We don't have /bin/bash and many scripts point there. Similarly for /usr/bin/python . @@ -280,8 +208,7 @@ overrides = self: super: rec { - The steam.sh script in $HOME can not be patched, as - it is checked and rewritten by steam. + The steam.sh script in $HOME can not be patched, as it is checked and rewritten by steam. @@ -293,11 +220,7 @@ overrides = self: super: rec { - The current approach to deploy Steam in NixOS is composing a FHS-compatible - chroot environment, as documented - here. - This allows us to have binaries in the expected paths without disrupting - the system, and to avoid patching them to work in a non FHS environment. + The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented here. This allows us to have binaries in the expected paths without disrupting the system, and to avoid patching them to work in a non FHS environment.
@@ -309,9 +232,7 @@ overrides = self: super: rec { hardware.opengl.driSupport32Bit = true; in your /etc/nixos/configuration.nix. You'll also need hardware.pulseaudio.support32Bit = true; - if you are using PulseAudio - this will enable 32bit ALSA apps integration. - To use the Steam controller or other Steam supported controllers such as - the DualShock 4 or Nintendo Switch Pro, you need to add + if you are using PulseAudio - this will enable 32bit ALSA apps integration. To use the Steam controller or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pro, you need to add hardware.steam-hardware.enable = true; to your configuration. @@ -342,19 +263,14 @@ overrides = self: super: rec { - The newStdcpp parameter was removed since NixOS - 17.09 and should not be needed anymore. + The newStdcpp parameter was removed since NixOS 17.09 and should not be needed anymore. - Steam ships statically linked with a version of libcrypto that - conflics with the one dynamically loaded by radeonsi_dri.so. If you - get the error + Steam ships statically linked with a version of libcrypto that conflics with the one dynamically loaded by radeonsi_dri.so. If you get the error steam.sh: line 713: 7842 Segmentation fault (core dumped) - have a look at - this - pull request. + have a look at this pull request. @@ -368,8 +284,7 @@ overrides = self: super: rec { - There is no java in steam chrootenv by default. If you get a message - like + There is no java in steam chrootenv by default. If you get a message like /home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found You need to add steam.override { withJava = true; }; @@ -387,8 +302,7 @@ overrides = self: super: rec { steam-run - The FHS-compatible chroot used for steam can also be used to run other - linux games that expect a FHS environment. To do it, add + The FHS-compatible chroot used for steam can also be used to run other linux games that expect a FHS environment. To do it, add pkgs.(steam.override { nativeOnly = true; newStdcpp = true; @@ -404,46 +318,23 @@ overrides = self: super: rec { - Please note that the citrix_receiver package has been - deprecated since its development was - discontinued - by upstream and has been replaced by - the - citrix workspace app. + Please note that the citrix_receiver package has been deprecated since its development was discontinued by upstream and has been replaced by the citrix workspace app. - Citrix - Receiver and - Citrix - Workspace App are a remote desktop viewers which provide access to - XenDesktop - installations. + Citrix Receiver and Citrix Workspace App are a remote desktop viewers which provide access to XenDesktop installations.
Basic usage - The tarball archive needs to be downloaded manually as the license - agreements of the vendor for - Citrix - Receiver or - Citrix - Workspace need to be accepted first. Then run - nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz. - With the archive available in the store the package can be built and - installed with Nix. + The tarball archive needs to be downloaded manually as the license agreements of the vendor for Citrix Receiver or Citrix Workspace need to be accepted first. Then run nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz. With the archive available in the store the package can be built and installed with Nix. Caution with <command>nix-shell</command> installs - It's recommended to install Citrix Receiver and/or - Citrix Workspace using nix-env -i or - globally to ensure that the .desktop files are - installed properly into $XDG_CONFIG_DIRS. Otherwise it - won't be possible to open .ica files automatically from - the browser to start a Citrix connection. + It's recommended to install Citrix Receiver and/or Citrix Workspace using nix-env -i or globally to ensure that the .desktop files are installed properly into $XDG_CONFIG_DIRS. Otherwise it won't be possible to open .ica files automatically from the browser to start a Citrix connection.
@@ -452,17 +343,7 @@ overrides = self: super: rec { Custom certificates - The Citrix Workspace App in nixpkgs - trust several certificates - from the - Mozilla database by default. However several companies using Citrix - might require their own corporate certificate. On distros with imperative - packaging these certs can be stored easily in - $ICAROOT, - however this directory is a store path in nixpkgs. In - order to work around this issue the package provides a simple mechanism to - add custom certificates without rebuilding the entire package using - symlinkJoin: + The Citrix Workspace App in nixpkgs trust several certificates from the Mozilla database by default. However several companies using Citrix might require their own corporate certificate. On distros with imperative packaging these certs can be stored easily in $ICAROOT, however this directory is a store path in nixpkgs. In order to work around this issue the package provides a simple mechanism to add custom certificates without rebuilding the entire package using symlinkJoin: { config.allowUnfree = true; }; let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in diff --git a/doc/platform-notes.xml b/doc/platform-notes.xml index 157d3fe2fcd..d8d7692fc9a 100644 --- a/doc/platform-notes.xml +++ b/doc/platform-notes.xml @@ -12,12 +12,7 @@ - The Darwin stdenv uses clang instead of gcc. When - referring to the compiler $CC or cc - will work in both cases. Some builds hardcode gcc/g++ in their build - scripts, that can usually be fixed with using something like - makeFlags = [ "CC=cc" ]; or by patching the build - scripts. + The Darwin stdenv uses clang instead of gcc. When referring to the compiler $CC or cc will work in both cases. Some builds hardcode gcc/g++ in their build scripts, that can usually be fixed with using something like makeFlags = [ "CC=cc" ]; or by patching the build scripts. stdenv.mkDerivation { @@ -31,12 +26,7 @@ stdenv.mkDerivation { - On Darwin, libraries are linked using absolute paths, libraries are - resolved by their install_name at link time. Sometimes - packages won't set this correctly causing the library lookups to fail at - runtime. This can be fixed by adding extra linker flags or by running - install_name_tool -id during the - fixupPhase. + On Darwin, libraries are linked using absolute paths, libraries are resolved by their install_name at link time. Sometimes packages won't set this correctly causing the library lookups to fail at runtime. This can be fixed by adding extra linker flags or by running install_name_tool -id during the fixupPhase. stdenv.mkDerivation { @@ -48,16 +38,10 @@ stdenv.mkDerivation { - Even if the libraries are linked using absolute paths and resolved via - their install_name correctly, tests can sometimes fail - to run binaries. This happens because the checkPhase - runs before the libraries are installed. + Even if the libraries are linked using absolute paths and resolved via their install_name correctly, tests can sometimes fail to run binaries. This happens because the checkPhase runs before the libraries are installed. - This can usually be solved by running the tests after the - installPhase or alternatively by using - DYLD_LIBRARY_PATH. More information about this variable - can be found in the + This can usually be solved by running the tests after the installPhase or alternatively by using DYLD_LIBRARY_PATH. More information about this variable can be found in the dyld 1 manpage. @@ -78,11 +62,7 @@ stdenv.mkDerivation { - Some packages assume xcode is available and use xcrun - to resolve build tools like clang, etc. This causes - errors like xcode-select: error: no developer tools were found at - '/Applications/Xcode.app' while the build doesn't actually depend - on xcode. + Some packages assume xcode is available and use xcrun to resolve build tools like clang, etc. This causes errors like xcode-select: error: no developer tools were found at '/Applications/Xcode.app' while the build doesn't actually depend on xcode. stdenv.mkDerivation { @@ -95,9 +75,7 @@ stdenv.mkDerivation { } - The package xcbuild can be used to build projects that - really depend on Xcode. However, this replacement is not 100% compatible - with Xcode and can occasionally cause issues. + The package xcbuild can be used to build projects that really depend on Xcode. However, this replacement is not 100% compatible with Xcode and can occasionally cause issues. diff --git a/doc/quick-start.xml b/doc/quick-start.xml index 39e3e7396bd..80514cba490 100644 --- a/doc/quick-start.xml +++ b/doc/quick-start.xml @@ -15,120 +15,75 @@
- Find a good place in the Nixpkgs tree to add the Nix expression for your - package. For instance, a library package typically goes into - pkgs/development/libraries/pkgname, - while a web browser goes into - pkgs/applications/networking/browsers/pkgname. - See for some hints on the tree - organisation. Create a directory for your package, e.g. + Find a good place in the Nixpkgs tree to add the Nix expression for your package. For instance, a library package typically goes into pkgs/development/libraries/pkgname, while a web browser goes into pkgs/applications/networking/browsers/pkgname. See for some hints on the tree organisation. Create a directory for your package, e.g. $ mkdir pkgs/development/libraries/libfoo - In the package directory, create a Nix expression — a piece of code that - describes how to build the package. In this case, it should be a - function that is called with the package dependencies - as arguments, and returns a build of the package in the Nix store. The - expression should usually be called default.nix. + In the package directory, create a Nix expression — a piece of code that describes how to build the package. In this case, it should be a function that is called with the package dependencies as arguments, and returns a build of the package in the Nix store. The expression should usually be called default.nix. $ emacs pkgs/development/libraries/libfoo/default.nix $ git add pkgs/development/libraries/libfoo/default.nix - You can have a look at the existing Nix expressions under - pkgs/ to see how it’s done. Here are some good - ones: + You can have a look at the existing Nix expressions under pkgs/ to see how it’s done. Here are some good ones: - GNU Hello: - pkgs/applications/misc/hello/default.nix. - Trivial package, which specifies some meta - attributes which is good practice. + GNU Hello: pkgs/applications/misc/hello/default.nix. Trivial package, which specifies some meta attributes which is good practice. - GNU cpio: - pkgs/tools/archivers/cpio/default.nix. - Also a simple package. The generic builder in stdenv - does everything for you. It has no dependencies beyond - stdenv. + GNU cpio: pkgs/tools/archivers/cpio/default.nix. Also a simple package. The generic builder in stdenv does everything for you. It has no dependencies beyond stdenv. - GNU Multiple Precision arithmetic library (GMP): - pkgs/development/libraries/gmp/5.1.x.nix. - Also done by the generic builder, but has a dependency on - m4. + GNU Multiple Precision arithmetic library (GMP): pkgs/development/libraries/gmp/5.1.x.nix. Also done by the generic builder, but has a dependency on m4. - Pan, a GTK-based newsreader: - pkgs/applications/networking/newsreaders/pan/default.nix. - Has an optional dependency on gtkspell, which is - only built if spellCheck is true. + Pan, a GTK-based newsreader: pkgs/applications/networking/newsreaders/pan/default.nix. Has an optional dependency on gtkspell, which is only built if spellCheck is true. - Apache HTTPD: - pkgs/servers/http/apache-httpd/2.4.nix. - A bunch of optional features, variable substitutions in the configure - flags, a post-install hook, and miscellaneous hackery. + Apache HTTPD: pkgs/servers/http/apache-httpd/2.4.nix. A bunch of optional features, variable substitutions in the configure flags, a post-install hook, and miscellaneous hackery. - Thunderbird: - pkgs/applications/networking/mailreaders/thunderbird/default.nix. - Lots of dependencies. + Thunderbird: pkgs/applications/networking/mailreaders/thunderbird/default.nix. Lots of dependencies. - JDiskReport, a Java utility: - pkgs/tools/misc/jdiskreport/default.nix - (and the - builder). - Nixpkgs doesn’t have a decent stdenv for Java yet - so this is pretty ad-hoc. + JDiskReport, a Java utility: pkgs/tools/misc/jdiskreport/default.nix (and the builder). Nixpkgs doesn’t have a decent stdenv for Java yet so this is pretty ad-hoc. - XML::Simple, a Perl module: - pkgs/top-level/perl-packages.nix - (search for the XMLSimple attribute). Most Perl - modules are so simple to build that they are defined directly in - perl-packages.nix; no need to make a separate file - for them. + XML::Simple, a Perl module: pkgs/top-level/perl-packages.nix (search for the XMLSimple attribute). Most Perl modules are so simple to build that they are defined directly in perl-packages.nix; no need to make a separate file for them. - Adobe Reader: - pkgs/applications/misc/adobe-reader/default.nix. - Shows how binary-only packages can be supported. In particular the - builder - uses patchelf to set the RUNPATH and ELF interpreter - of the executables so that the right libraries are found at runtime. + Adobe Reader: pkgs/applications/misc/adobe-reader/default.nix. Shows how binary-only packages can be supported. In particular the builder uses patchelf to set the RUNPATH and ELF interpreter of the executables so that the right libraries are found at runtime. @@ -138,67 +93,45 @@ - All meta attributes are - optional, but it’s still a good idea to provide at least the - description, homepage and - meta attributes are optional, but it’s still a good idea to provide at least the description, homepage and license. - You can use nix-prefetch-url - url to get the SHA-256 hash of source - distributions. There are similar commands as - nix-prefetch-git and - nix-prefetch-hg available in - nix-prefetch-scripts package. + You can use nix-prefetch-url url to get the SHA-256 hash of source distributions. There are similar commands as nix-prefetch-git and nix-prefetch-hg available in nix-prefetch-scripts package. - A list of schemes for mirror:// URLs can be found in - mirror:// URLs can be found in pkgs/build-support/fetchurl/mirrors.nix. - The exact syntax and semantics of the Nix expression language, including - the built-in function, are described in the Nix manual in the - chapter - on writing Nix expressions. + The exact syntax and semantics of the Nix expression language, including the built-in function, are described in the Nix manual in the chapter on writing Nix expressions. - Add a call to the function defined in the previous step to - pkgs/top-level/all-packages.nix - with some descriptive name for the variable, e.g. - libfoo. + Add a call to the function defined in the previous step to pkgs/top-level/all-packages.nix with some descriptive name for the variable, e.g. libfoo. $ emacs pkgs/top-level/all-packages.nix - The attributes in that file are sorted by category (like “Development / - Libraries”) that more-or-less correspond to the directory structure of - Nixpkgs, and then by attribute name. + The attributes in that file are sorted by category (like “Development / Libraries”) that more-or-less correspond to the directory structure of Nixpkgs, and then by attribute name. - To test whether the package builds, run the following command from the - root of the nixpkgs source tree: + To test whether the package builds, run the following command from the root of the nixpkgs source tree: $ nix-build -A libfoo - where libfoo should be the variable name defined in the - previous step. You may want to add the flag to keep - the temporary build directory in case something fails. If the build - succeeds, a symlink ./result to the package in the - Nix store is created. + where libfoo should be the variable name defined in the previous step. You may want to add the flag to keep the temporary build directory in case something fails. If the build succeeds, a symlink ./result to the package in the Nix store is created. @@ -210,14 +143,9 @@ - Optionally commit the new package and open a pull request - to - nixpkgs, or use - - the Patches category on Discourse for sending a patch without a - GitHub account. + Optionally commit the new package and open a pull request to nixpkgs, or use the Patches category on Discourse for sending a patch without a GitHub account.
diff --git a/doc/release-notes.xml b/doc/release-notes.xml index 8d9b1813010..b85f61da079 100644 --- a/doc/release-notes.xml +++ b/doc/release-notes.xml @@ -6,15 +6,11 @@ Release 0.14 (June 4, 2012) - In preparation for the switch from Subversion to Git, this release is mainly - the prevent the Nixpkgs version number from going backwards. (This would - happen because prerelease version numbers produced for the Git repository - are lower than those for the Subversion repository.) + In preparation for the switch from Subversion to Git, this release is mainly the prevent the Nixpkgs version number from going backwards. (This would happen because prerelease version numbers produced for the Git repository are lower than those for the Subversion repository.) - Since the last release, there have been thousands of changes and new - packages by numerous contributors. For details, see the commit logs. + Since the last release, there have been thousands of changes and new packages by numerous contributors. For details, see the commit logs.
@@ -55,14 +51,11 @@ Release 0.12 (April 24, 2009) - There are way too many additions to Nixpkgs since the last release to list - here: for example, the number of packages on Linux has increased from 1002 - to 2159. However, some specific improvements are worth listing: + There are way too many additions to Nixpkgs since the last release to list here: for example, the number of packages on Linux has increased from 1002 to 2159. However, some specific improvements are worth listing: - Nixpkgs now has a manual. In particular, it describes the standard build - environment in detail. + Nixpkgs now has a manual. In particular, it describes the standard build environment in detail. @@ -122,9 +115,7 @@ - Support for building derivations in a virtual machine, including RPM and - Debian builds in automatically generated VM images. See - pkgs/build-support/vm/default.nix for details. + Support for building derivations in a virtual machine, including RPM and Debian builds in automatically generated VM images. See pkgs/build-support/vm/default.nix for details. @@ -136,13 +127,7 @@ - The following people contributed to this release: Andres Löh, Arie - Middelkoop, Armijn Hemel, Eelco Dolstra, Lluís Batlle, Ludovic Courtès, - Marc Weber, Mart Kolthof, Martin Bravenboer, Michael Raskin, Nicolas - Pierron, Peter Simons, Pjotr Prins, Rob Vermaas, Sander van der Burg, Tobias - Hammerschmidt, Valentin David, Wouter den Breejen and Yury G. Kudryashov. In - addition, several people contributed patches on the - nix-dev mailing list. + The following people contributed to this release: Andres Löh, Arie Middelkoop, Armijn Hemel, Eelco Dolstra, Lluís Batlle, Ludovic Courtès, Marc Weber, Mart Kolthof, Martin Bravenboer, Michael Raskin, Nicolas Pierron, Peter Simons, Pjotr Prins, Rob Vermaas, Sander van der Burg, Tobias Hammerschmidt, Valentin David, Wouter den Breejen and Yury G. Kudryashov. In addition, several people contributed patches on the nix-dev mailing list.
@@ -153,25 +138,12 @@ - The standard build environment (stdenv) is now pure on - the x86_64-linux and powerpc-linux - platforms, just as on i686-linux. (Purity means that - building and using the standard environment has no dependencies outside - of the Nix store. For instance, it doesn’t require an external C - compiler such as /usr/bin/gcc.) Also, the statically - linked binaries used in the bootstrap process are now automatically - reproducible, making it easy to update the bootstrap tools and to add - support for other Linux platforms. See - pkgs/stdenv/linux/make-bootstrap-tools.nix for - details. + The standard build environment (stdenv) is now pure on the x86_64-linux and powerpc-linux platforms, just as on i686-linux. (Purity means that building and using the standard environment has no dependencies outside of the Nix store. For instance, it doesn’t require an external C compiler such as /usr/bin/gcc.) Also, the statically linked binaries used in the bootstrap process are now automatically reproducible, making it easy to update the bootstrap tools and to add support for other Linux platforms. See pkgs/stdenv/linux/make-bootstrap-tools.nix for details. - Hook variables in the generic builder are now executed using the - eval shell command. This has a major advantage: you - can write hooks directly in Nix expressions. For instance, rather than - writing a builder like this: + Hook variables in the generic builder are now executed using the eval shell command. This has a major advantage: you can write hooks directly in Nix expressions. For instance, rather than writing a builder like this: source $stdenv/setup @@ -182,91 +154,57 @@ postInstall() { } genericBuild - (the gzip builder), you can just add this attribute to - the derivation: + (the gzip builder), you can just add this attribute to the derivation: postInstall = "ln -sf gzip $out/bin/gunzip; ln -sf gzip $out/bin/zcat"; - and so a separate build script becomes unnecessary. This should allow us - to get rid of most builders in Nixpkgs. + and so a separate build script becomes unnecessary. This should allow us to get rid of most builders in Nixpkgs. - It is now possible to have the generic builder pass arguments to - configure and make that contain - whitespace. Previously, for example, you could say in a builder, + It is now possible to have the generic builder pass arguments to configure and make that contain whitespace. Previously, for example, you could say in a builder, configureFlags="CFLAGS=-O0" but not configureFlags="CFLAGS=-O0 -g" - since the -g would be interpreted as a separate - argument to configure. Now you can say + since the -g would be interpreted as a separate argument to configure. Now you can say configureFlagsArray=("CFLAGS=-O0 -g") or similarly configureFlagsArray=("CFLAGS=-O0 -g" "LDFLAGS=-L/foo -L/bar") - which does the right thing. Idem for makeFlags, - installFlags, checkFlags and - distFlags. + which does the right thing. Idem for makeFlags, installFlags, checkFlags and distFlags. - Unfortunately you can't pass arrays to Bash through the environment, so - you can't put the array above in a Nix expression, e.g., + Unfortunately you can't pass arrays to Bash through the environment, so you can't put the array above in a Nix expression, e.g., configureFlagsArray = ["CFLAGS=-O0 -g"]; - since it would just be flattened to a since string. However, you - can use the inline hooks described above: + since it would just be flattened to a since string. However, you can use the inline hooks described above: preConfigure = "configureFlagsArray=(\"CFLAGS=-O0 -g\")"; - The function fetchurl now has support for two - different kinds of mirroring of files. First, it has support for - content-addressable mirrors. For example, given the - fetchurl call + The function fetchurl now has support for two different kinds of mirroring of files. First, it has support for content-addressable mirrors. For example, given the fetchurl call fetchurl { url = http://releases.mozilla.org/.../firefox-2.0.0.6-source.tar.bz2; sha1 = "eb72f55e4a8bf08e8c6ef227c0ade3d068ba1082"; } - fetchurl will first try to download this file from - . - If that file doesn’t exist, it will try the original URL. In general, - the “content-addressed” location is - mirror/hash-type/hash. - There is currently only one content-addressable mirror - (), but more can be - specified in the hashedMirrors attribute in - pkgs/build-support/fetchurl/mirrors.nix, or by - setting the NIX_HASHED_MIRRORS environment variable to a - whitespace-separated list of URLs. + fetchurl will first try to download this file from . If that file doesn’t exist, it will try the original URL. In general, the “content-addressed” location is mirror/hash-type/hash. There is currently only one content-addressable mirror (), but more can be specified in the hashedMirrors attribute in pkgs/build-support/fetchurl/mirrors.nix, or by setting the NIX_HASHED_MIRRORS environment variable to a whitespace-separated list of URLs. - Second, fetchurl has support for widely-mirrored - distribution sites such as SourceForge or the Linux kernel archives. - Given a URL of the form - mirror://site/path, - it will try to download path from a - configurable list of mirrors for site. (This - idea was borrowed from Gentoo Linux.) Example: + Second, fetchurl has support for widely-mirrored distribution sites such as SourceForge or the Linux kernel archives. Given a URL of the form mirror://site/path, it will try to download path from a configurable list of mirrors for site. (This idea was borrowed from Gentoo Linux.) Example: fetchurl { url = mirror://gnu/gcc/gcc-4.2.0/gcc-core-4.2.0.tar.bz2; sha256 = "0ykhzxhr8857dr97z0j9wyybfz1kjr71xk457cfapfw5fjas4ny1"; } - Currently site can be - sourceforge, gnu and - kernel. The list of mirrors is defined in - pkgs/build-support/fetchurl/mirrors.nix. You can - override the list of mirrors for a particular site by setting the - environment variable - NIX_MIRRORS_site, e.g. + Currently site can be sourceforge, gnu and kernel. The list of mirrors is defined in pkgs/build-support/fetchurl/mirrors.nix. You can override the list of mirrors for a particular site by setting the environment variable NIX_MIRRORS_site, e.g. export NIX_MIRRORS_sourceforge=http://osdn.dl.sourceforge.net/sourceforge/ @@ -339,9 +277,7 @@ export NIX_MIRRORS_sourceforge=http://osdn.dl.sourceforge.net/sourceforge/ - The following people contributed to this release: Andres Löh, Arie - Middelkoop, Armijn Hemel, Eelco Dolstra, Marc Weber, Mart Kolthof, Martin - Bravenboer, Michael Raskin, Wouter den Breejen and Yury G. Kudryashov. + The following people contributed to this release: Andres Löh, Arie Middelkoop, Armijn Hemel, Eelco Dolstra, Marc Weber, Mart Kolthof, Martin Bravenboer, Michael Raskin, Wouter den Breejen and Yury G. Kudryashov.
@@ -349,10 +285,8 @@ export NIX_MIRRORS_sourceforge=http://osdn.dl.sourceforge.net/sourceforge/ - This release of Nixpkgs requires - Nix 0.10 - or higher. + This release of Nixpkgs requires Nix 0.10 or higher. @@ -363,32 +297,15 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10 - pkgs/system/all-packages-generic.nix is gone, we now - just have pkgs/top-level/all-packages.nix that - contains all available packages. This should cause much less confusion - with users. all-packages.nix is a function that by - default returns packages for the current platform, but you can override - this by specifying a different system argument. + pkgs/system/all-packages-generic.nix is gone, we now just have pkgs/top-level/all-packages.nix that contains all available packages. This should cause much less confusion with users. all-packages.nix is a function that by default returns packages for the current platform, but you can override this by specifying a different system argument. - Certain packages in Nixpkgs are now user-configurable through a - configuration file, i.e., without having to edit the Nix expressions in - Nixpkgs. For instance, the Firefox provided in the Nixpkgs channel is - built without the RealPlayer plugin (for legal reasons). Previously, you - could easily enable RealPlayer support by editing the call to the Firefox - function in all-packages.nix, but such changes are - not respected when Firefox is subsequently updated through the Nixpkgs - channel. + Certain packages in Nixpkgs are now user-configurable through a configuration file, i.e., without having to edit the Nix expressions in Nixpkgs. For instance, the Firefox provided in the Nixpkgs channel is built without the RealPlayer plugin (for legal reasons). Previously, you could easily enable RealPlayer support by editing the call to the Firefox function in all-packages.nix, but such changes are not respected when Firefox is subsequently updated through the Nixpkgs channel. - The Nixpkgs configuration file (found in - ~/.nixpkgs/config.nix or through the - NIXPKGS_CONFIG environment variable) is an attribute set - that contains configuration options that - all-packages.nix reads and uses for certain packages. - For instance, the following configuration file: + The Nixpkgs configuration file (found in ~/.nixpkgs/config.nix or through the NIXPKGS_CONFIG environment variable) is an attribute set that contains configuration options that all-packages.nix reads and uses for certain packages. For instance, the following configuration file: { firefox = { @@ -398,9 +315,7 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10 persistently enables RealPlayer support in the Firefox build. - (Actually, firefox.enableRealPlayer is the - only configuration option currently available, but - more are sure to be added.) + (Actually, firefox.enableRealPlayer is the only configuration option currently available, but more are sure to be added.) @@ -409,17 +324,8 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10 - i686-cygwin, i.e., Windows (using - Cygwin). The standard - environment on i686-cygwin by default builds - binaries for the Cygwin environment (i.e., it uses Cygwin tools and - produces executables that use the Cygwin library). However, there is - also a standard environment that produces binaries that use - MinGW. You can - use it by calling all-package.nix with the - stdenvType argument set to - "i686-mingw". + i686-cygwin, i.e., Windows (using Cygwin). The standard environment on i686-cygwin by default builds binaries for the Cygwin environment (i.e., it uses Cygwin tools and produces executables that use the Cygwin library). However, there is also a standard environment that produces binaries that use MinGW. You can use it by calling all-package.nix with the stdenvType argument set to "i686-mingw". @@ -434,9 +340,7 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10 - x86_64-linux, i.e., Linux on 64-bit AMD/Intel CPUs. - Unlike i686-linux, this platform doesn’t have a - pure stdenv yet. + x86_64-linux, i.e., Linux on 64-bit AMD/Intel CPUs. Unlike i686-linux, this platform doesn’t have a pure stdenv yet. @@ -472,21 +376,10 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix 0.10 - It is now much easier to override the default C - compiler and other tools in stdenv for specific - packages. all-packages.nix provides two utility - functions for this purpose: overrideGCC and - overrideInStdenv. Both take a - stdenv and return an augmented - stdenv; the formed changes the C compiler, and the - latter adds additional packages to the front of - stdenv’s initial PATH, allowing tools - to be overridden. + It is now much easier to override the default C compiler and other tools in stdenv for specific packages. all-packages.nix provides two utility functions for this purpose: overrideGCC and overrideInStdenv. Both take a stdenv and return an augmented stdenv; the formed changes the C compiler, and the latter adds additional packages to the front of stdenv’s initial PATH, allowing tools to be overridden. - For instance, the package strategoxt doesn’t build - with the GNU Make in stdenv (version 3.81), so we call - it with an augmented stdenv that uses GNU Make 3.80: + For instance, the package strategoxt doesn’t build with the GNU Make in stdenv (version 3.81), so we call it with an augmented stdenv that uses GNU Make 3.80: strategoxt = (import ../development/compilers/strategoxt) { inherit fetchurl pkgconfig sdf aterm; @@ -494,8 +387,7 @@ strategoxt = (import ../development/compilers/strategoxt) { }; gnumake380 = ...; - Likewise, there are many packages that don’t compile with the default - GCC (4.1.1), but that’s easily fixed: + Likewise, there are many packages that don’t compile with the default GCC (4.1.1), but that’s easily fixed: exult = import ../games/exult { inherit fetchurl SDL SDL_mixer zlib libpng unzip; @@ -505,13 +397,7 @@ exult = import ../games/exult { - It has also become much easier to experiment with changes to the - stdenv setup script (which notably contains the generic - builder). Since edits to pkgs/stdenv/generic/setup.sh - trigger a rebuild of everything, this was formerly - quite painful. But now stdenv contains a function to - “regenerate” stdenv with a different setup script, - allowing the use of a different setup script for specific packages: + It has also become much easier to experiment with changes to the stdenv setup script (which notably contains the generic builder). Since edits to pkgs/stdenv/generic/setup.sh trigger a rebuild of everything, this was formerly quite painful. But now stdenv contains a function to “regenerate” stdenv with a different setup script, allowing the use of a different setup script for specific packages: pkg = import ... { stdenv = stdenv.regenerate ./my-setup.sh; @@ -521,10 +407,7 @@ pkg = import ... { - Packages can now have a human-readable description - field. Package descriptions are shown by nix-env -qa - --description. In addition, they’re shown on the Nixpkgs - release page. A description can be added to a package as follows: + Packages can now have a human-readable description field. Package descriptions are shown by nix-env -qa --description. In addition, they’re shown on the Nixpkgs release page. A description can be added to a package as follows: stdenv.mkDerivation { name = "exult-1.2"; @@ -533,34 +416,26 @@ stdenv.mkDerivation { description = "A reimplementation of the Ultima VII game engine"; }; } - The meta attribute is not passed to the builder, so - changes to the description do not trigger a rebuild. Additional - meta attributes may be defined in the future (such as - the URL of the package’s homepage, the license, etc.). + The meta attribute is not passed to the builder, so changes to the description do not trigger a rebuild. Additional meta attributes may be defined in the future (such as the URL of the package’s homepage, the license, etc.). - The following people contributed to this release: Andres Löh, Armijn Hemel, - Christof Douma, Eelco Dolstra, Eelco Visser, Mart Kolthof, Martin - Bravenboer, Merijn de Jonge, Rob Vermaas and Roy van den Broek. + The following people contributed to this release: Andres Löh, Armijn Hemel, Christof Douma, Eelco Dolstra, Eelco Visser, Mart Kolthof, Martin Bravenboer, Merijn de Jonge, Rob Vermaas and Roy van den Broek.
Release 0.9 (January 31, 2006) - There have been zillions of changes since the last release of Nixpkgs. Many - packages have been added or updated. The following are some of the more - notable changes: + There have been zillions of changes since the last release of Nixpkgs. Many packages have been added or updated. The following are some of the more notable changes: - Distribution files have been moved to - . @@ -576,24 +451,17 @@ stdenv.mkDerivation { - The old, unofficial Xlibs has been replaced by the official modularised - X11 distribution from X.org, i.e., X11R7.0. X11R7.0 consists of 287 (!) - packages, all of which are in Nixpkgs though not all have been tested. It - is now possible to build a working X server (previously we only had X - client libraries). We use a fully Nixified X server on NixOS. + The old, unofficial Xlibs has been replaced by the official modularised X11 distribution from X.org, i.e., X11R7.0. X11R7.0 consists of 287 (!) packages, all of which are in Nixpkgs though not all have been tested. It is now possible to build a working X server (previously we only had X client libraries). We use a fully Nixified X server on NixOS. - The Sun JDK 5 has been purified, i.e., it doesn’t require any non-Nix - components such as /lib/ld-linux.so.2. This means - that Java applications such as Eclipse and Azureus can run on NixOS. + The Sun JDK 5 has been purified, i.e., it doesn’t require any non-Nix components such as /lib/ld-linux.so.2. This means that Java applications such as Eclipse and Azureus can run on NixOS. - Hardware-accelerated OpenGL support, used by games like Quake 3 (which is - now built from source). + Hardware-accelerated OpenGL support, used by games like Quake 3 (which is now built from source). @@ -608,8 +476,7 @@ stdenv.mkDerivation { - Some support for cross-compilation: cross-compiling builds of GCC and - Binutils, and cross-compiled builds of the C library uClibc. + Some support for cross-compilation: cross-compiling builds of GCC and Binutils, and cross-compiled builds of the C library uClibc. @@ -618,8 +485,7 @@ stdenv.mkDerivation { - teTeX, including support for building LaTeX documents using Nix (with - automatic dependency determination). + teTeX, including support for building LaTeX documents using Nix (with automatic dependency determination). @@ -629,14 +495,12 @@ stdenv.mkDerivation { - System-level packages to support NixOS, e.g. Grub, GNU - parted and so on. + System-level packages to support NixOS, e.g. Grub, GNU parted and so on. - ecj, the Eclipse Compiler for Java, so we finally - have a freely distributable compiler that supports Java 5.0. + ecj, the Eclipse Compiler for Java, so we finally have a freely distributable compiler that supports Java 5.0. @@ -661,8 +525,7 @@ stdenv.mkDerivation { - kdelibs. This allows us to add KDE-based packages - (such as kcachegrind). + kdelibs. This allows us to add KDE-based packages (such as kcachegrind). @@ -671,17 +534,14 @@ stdenv.mkDerivation { - The following people contributed to this release: Andres Löh, Armijn Hemel, - Bogdan Dumitriu, Christof Douma, Eelco Dolstra, Eelco Visser, Mart Kolthof, - Martin Bravenboer, Rob Vermaas and Roy van den Broek. + The following people contributed to this release: Andres Löh, Armijn Hemel, Bogdan Dumitriu, Christof Douma, Eelco Dolstra, Eelco Visser, Mart Kolthof, Martin Bravenboer, Rob Vermaas and Roy van den Broek.
Release 0.8 (April 11, 2005) - This release is mostly to remain synchronised with the changed hashing - scheme in Nix 0.8. + This release is mostly to remain synchronised with the changed hashing scheme in Nix 0.8. @@ -706,16 +566,10 @@ stdenv.mkDerivation { - The bootstrap process for the standard build environment on Linux - (stdenv-linux) has been improved. It is no longer dependent in its initial - bootstrap stages on the system Glibc, GCC, and other tools. Rather, - Nixpkgs contains a statically linked bash and curl, and uses that to - download other statically linked tools. These are then used to build a - Glibc and dynamically linked versions of all other tools. + The bootstrap process for the standard build environment on Linux (stdenv-linux) has been improved. It is no longer dependent in its initial bootstrap stages on the system Glibc, GCC, and other tools. Rather, Nixpkgs contains a statically linked bash and curl, and uses that to download other statically linked tools. These are then used to build a Glibc and dynamically linked versions of all other tools. - This change also makes the bootstrap process faster. For instance, GCC is - built only once instead of three times. + This change also makes the bootstrap process faster. For instance, GCC is built only once instead of three times. (Contributed by Armijn Hemel.) @@ -723,17 +577,13 @@ stdenv.mkDerivation { - Tarballs used by Nixpkgs are now obtained from the same server that hosts - Nixpkgs (). This - reduces the risk of packages being unbuildable due to moved or deleted - files on various servers. + Tarballs used by Nixpkgs are now obtained from the same server that hosts Nixpkgs (). This reduces the risk of packages being unbuildable due to moved or deleted files on various servers. - There now is a generic mechanism for building Perl modules. See the - various Perl modules defined in pkgs/system/all-packages-generic.nix. + There now is a generic mechanism for building Perl modules. See the various Perl modules defined in pkgs/system/all-packages-generic.nix. diff --git a/doc/reviewing-contributions.xml b/doc/reviewing-contributions.xml index 5aa950625ef..5a14684f9b1 100644 --- a/doc/reviewing-contributions.xml +++ b/doc/reviewing-contributions.xml @@ -6,68 +6,40 @@ Reviewing contributions - The following section is a draft, and the policy for reviewing is still - being discussed in issues such as - #11166 - and - #20836 - . + The following section is a draft, and the policy for reviewing is still being discussed in issues such as #11166 and #20836 . - The Nixpkgs project receives a fairly high number of contributions via GitHub - pull requests. Reviewing and approving these is an important task and a way - to contribute to the project. + The Nixpkgs project receives a fairly high number of contributions via GitHub pull requests. Reviewing and approving these is an important task and a way to contribute to the project. - The high change rate of Nixpkgs makes any pull request that remains open for - too long subject to conflicts that will require extra work from the submitter - or the merger. Reviewing pull requests in a timely manner and being - responsive to the comments is the key to avoid this issue. GitHub provides - sort filters that can be used to see the - most - recently and the - least - recently updated pull requests. We highly encourage looking at - - this list of ready to merge, unreviewed pull requests. + The high change rate of Nixpkgs makes any pull request that remains open for too long subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid this issue. GitHub provides sort filters that can be used to see the most recently and the least recently updated pull requests. We highly encourage looking at this list of ready to merge, unreviewed pull requests. - When reviewing a pull request, please always be nice and polite. - Controversial changes can lead to controversial opinions, but it is important - to respect every community member and their work. + When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community member and their work. - GitHub provides reactions as a simple and quick way to provide feedback to - pull requests or any comments. The thumb-down reaction should be used with - care and if possible accompanied with some explanation so the submitter has - directions to improve their contribution. + GitHub provides reactions as a simple and quick way to provide feedback to pull requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanation so the submitter has directions to improve their contribution. - pull request reviews should include a list of what has been reviewed in a - comment, so other reviewers and mergers can know the state of the review. + pull request reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review. - All the review template samples provided in this section are generic and - meant as examples. Their usage is optional and the reviewer is free to adapt - them to their liking. + All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to their liking.
Package updates - A package update is the most trivial and common type of pull request. These - pull requests mainly consist of updating the version part of the package - name and the source hash. + A package update is the most trivial and common type of pull request. These pull requests mainly consist of updating the version part of the package name and the source hash. - It can happen that non-trivial updates include patches or more complex - changes. + It can happen that non-trivial updates include patches or more complex changes. @@ -82,8 +54,7 @@ - 8.has: package (update) and any topic label that fit - the updated package. + 8.has: package (update) and any topic label that fit the updated package. @@ -105,9 +76,7 @@ - CODEOWNERS - will make GitHub notify users based on the submitted changes, but it can - happen that it misses some of the package maintainers. + CODEOWNERS will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers. @@ -119,15 +88,12 @@ - License can change with version updates, so it should be checked to - match the upstream license. + License can change with version updates, so it should be checked to match the upstream license. - If the package has no maintainer, a maintainer must be set. This can be - the update submitter or a community member that accepts to take - maintainership of the package. + If the package has no maintainer, a maintainer must be set. This can be the update submitter or a community member that accepts to take maintainership of the package. @@ -144,14 +110,10 @@ - pull requests are often targeted to the master or staging branch, and - building the pull request locally when it is submitted can trigger many - source builds. + pull requests are often targeted to the master or staging branch, and building the pull request locally when it is submitted can trigger many source builds. - It is possible to rebase the changes on nixos-unstable or - nixpkgs-unstable for easier review by running the following commands - from a nixpkgs clone. + It is possible to rebase the changes on nixos-unstable or nixpkgs-unstable for easier review by running the following commands from a nixpkgs clone. $ git remote add channels https://github.com/NixOS/nixpkgs-channels.git @@ -163,8 +125,7 @@ - This should be done only once to be able to fetch channel branches - from the nixpkgs-channels repository. + This should be done only once to be able to fetch channel branches from the nixpkgs-channels repository. @@ -174,9 +135,7 @@ - Fetching the pull request changes, PRNUMBER is the - number at the end of the pull request title and - BASEBRANCH the base branch of the pull request. + Fetching the pull request changes, PRNUMBER is the number at the end of the pull request title and BASEBRANCH the base branch of the pull request. @@ -189,12 +148,7 @@ - The - nix-review - tool can be used to review a pull request content in a single command. - PRNUMBER should be replaced by the number at the end - of the pull request title. You can also provide the full github pull - request url. + The nix-review tool can be used to review a pull request content in a single command. PRNUMBER should be replaced by the number at the end of the pull request title. You can also provide the full github pull request url. $ nix-shell -p nix-review --run "nix-review pr PRNUMBER" @@ -231,8 +185,7 @@ New packages - New packages are a common type of pull requests. These pull requests - consists in adding a new nix-expression for a package. + New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package. @@ -247,8 +200,7 @@ - 8.has: package (new) and any topic label that fit the - new package. + 8.has: package (new) and any topic label that fit the new package. @@ -280,8 +232,7 @@ - A maintainer must be set. This can be the package submitter or a - community member that accepts to take maintainership of the package. + A maintainer must be set. This can be the package submitter or a community member that accepts to take maintainership of the package. @@ -303,8 +254,7 @@ - The most appropriate function should be used (e.g. packages from GitHub - should use fetchFromGitHub). + The most appropriate function should be used (e.g. packages from GitHub should use fetchFromGitHub). @@ -351,8 +301,7 @@ Module updates - Module updates are submissions changing modules in some ways. These often - contains changes to the options or introduce new options. + Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options. @@ -367,8 +316,7 @@ - 8.has: module (update) and any topic label that fit - the module. + 8.has: module (update) and any topic label that fit the module. @@ -380,9 +328,7 @@ - CODEOWNERS - will make GitHub notify users based on the submitted changes, but it can - happen that it misses some of the package maintainers. + CODEOWNERS will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers. @@ -399,9 +345,7 @@ - Type should be appropriate (string related types differs in their - merging capabilities, optionSet and - string types are deprecated). + Type should be appropriate (string related types differs in their merging capabilities, optionSet and string types are deprecated). @@ -418,23 +362,19 @@ - mkRenamedOptionModule and - mkAliasOptionModule functions provide way to make - option changes backward compatible. + mkRenamedOptionModule and mkAliasOptionModule functions provide way to make option changes backward compatible. - Ensure that removed options are declared with - mkRemovedOptionModule + Ensure that removed options are declared with mkRemovedOptionModule - Ensure that changes that are not backward compatible are mentioned in - release notes. + Ensure that changes that are not backward compatible are mentioned in release notes. @@ -480,8 +420,7 @@ - 8.has: module (new) and any topic label that fit the - module. + 8.has: module (new) and any topic label that fit the module. @@ -498,9 +437,7 @@ - Type should be appropriate (string related types differs in their - merging capabilities, optionSet and - string types are deprecated). + Type should be appropriate (string related types differs in their merging capabilities, optionSet and string types are deprecated). @@ -522,8 +459,7 @@ - Module documentation should be declared with - meta.doc. + Module documentation should be declared with meta.doc. @@ -535,8 +471,7 @@ - For example, enabling a module should not open firewall ports by - default. + For example, enabling a module should not open firewall ports by default. @@ -573,25 +508,18 @@ - If you consider having enough knowledge and experience in a topic and would - like to be a long-term reviewer for related submissions, please contact the - current reviewers for that topic. They will give you information about the - reviewing process. The main reviewers for a topic can be hard to find as - there is no list, but checking past pull requests to see who reviewed or - git-blaming the code to see who committed to that topic can give some hints. + If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process. The main reviewers for a topic can be hard to find as there is no list, but checking past pull requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints. - Container system, boot system and library changes are some examples of the - pull requests fitting this category. + Container system, boot system and library changes are some examples of the pull requests fitting this category.
Merging pull requests - It is possible for community members that have enough knowledge and - experience on a special topic to contribute by merging pull requests. + It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests. @@ -608,12 +536,8 @@ policy. --> - In a case a contributor definitively leaves the Nix community, they should - create an issue or post on - Discourse with - references of packages and modules they maintain so the maintainership can - be taken over by other contributors. + In a case a contributor definitively leaves the Nix community, they should create an issue or post on Discourse with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
diff --git a/doc/stdenv.xml b/doc/stdenv.xml index a4bc2809be0..5495ce29ce3 100644 --- a/doc/stdenv.xml +++ b/doc/stdenv.xml @@ -3,22 +3,13 @@ xml:id="chap-stdenv"> The Standard Environment - The standard build environment in the Nix Packages collection provides an - environment for building Unix packages that does a lot of common build tasks - automatically. In fact, for Unix packages that use the standard - ./configure; make; make install build interface, you - don’t need to write a build script at all; the standard environment does - everything automatically. If stdenv doesn’t do what you - need automatically, you can easily customise or override the various build - phases. + The standard build environment in the Nix Packages collection provides an environment for building Unix packages that does a lot of common build tasks automatically. In fact, for Unix packages that use the standard ./configure; make; make install build interface, you don’t need to write a build script at all; the standard environment does everything automatically. If stdenv doesn’t do what you need automatically, you can easily customise or override the various build phases.
Using <literal>stdenv</literal> - To build a package with the standard environment, you use the function - stdenv.mkDerivation, instead of the primitive built-in - function derivation, e.g. + To build a package with the standard environment, you use the function stdenv.mkDerivation, instead of the primitive built-in function derivation, e.g. stdenv.mkDerivation { name = "libfoo-1.2.3"; @@ -27,17 +18,7 @@ stdenv.mkDerivation { sha256 = "0x2g1jqygyr5wiwg4ma1nd7w4ydpy82z9gkcv8vh2v8dn3y58v5m"; }; } - (stdenv needs to be in scope, so if you write this in a - separate Nix expression from pkgs/all-packages.nix, you - need to pass it as a function argument.) Specifying a - name and a src is the absolute minimum - Nix requires. For convenience, you can also use pname and - version attributes and mkDerivation - will automatically set name to - "${pname}-${version}" by default. Since - RFC 0035, - this is preferred for packages in Nixpkgs, as it allows us to reuse the - version easily: + (stdenv needs to be in scope, so if you write this in a separate Nix expression from pkgs/all-packages.nix, you need to pass it as a function argument.) Specifying a name and a src is the absolute minimum Nix requires. For convenience, you can also use pname and version attributes and mkDerivation will automatically set name to "${pname}-${version}" by default. Since RFC 0035, this is preferred for packages in Nixpkgs, as it allows us to reuse the version easily: stdenv.mkDerivation rec { pname = "libfoo"; @@ -50,31 +31,18 @@ stdenv.mkDerivation rec { - Many packages have dependencies that are not provided in the standard - environment. It’s usually sufficient to specify those dependencies in the - buildInputs attribute: + Many packages have dependencies that are not provided in the standard environment. It’s usually sufficient to specify those dependencies in the buildInputs attribute: stdenv.mkDerivation { name = "libfoo-1.2.3"; ... buildInputs = [libbar perl ncurses]; } - This attribute ensures that the bin subdirectories of - these packages appear in the PATH environment variable during - the build, that their include subdirectories are - searched by the C compiler, and so on. (See - for details.) + This attribute ensures that the bin subdirectories of these packages appear in the PATH environment variable during the build, that their include subdirectories are searched by the C compiler, and so on. (See for details.) - Often it is necessary to override or modify some aspect of the build. To - make this easier, the standard environment breaks the package build into a - number of phases, all of which can be overridden or - modified individually: unpacking the sources, applying patches, configuring, - building, and installing. (There are some others; see - .) For instance, a package that doesn’t - supply a makefile but instead has to be compiled “manually” could be - handled like this: + Often it is necessary to override or modify some aspect of the build. To make this easier, the standard environment breaks the package build into a number of phases, all of which can be overridden or modified individually: unpacking the sources, applying patches, configuring, building, and installing. (There are some others; see .) For instance, a package that doesn’t supply a makefile but instead has to be compiled “manually” could be handled like this: stdenv.mkDerivation { name = "fnord-4.5"; @@ -87,20 +55,15 @@ stdenv.mkDerivation { cp foo $out/bin ''; } - (Note the use of ''-style string literals, which are very - convenient for large multi-line script fragments because they don’t need - escaping of " and \, and because - indentation is intelligently removed.) + (Note the use of ''-style string literals, which are very convenient for large multi-line script fragments because they don’t need escaping of " and \, and because indentation is intelligently removed.) - There are many other attributes to customise the build. These are listed in - . + There are many other attributes to customise the build. These are listed in . - While the standard environment provides a generic builder, you can still - supply your own build script: + While the standard environment provides a generic builder, you can still supply your own build script: stdenv.mkDerivation { name = "libfoo-1.2.3"; @@ -111,9 +74,7 @@ stdenv.mkDerivation { source $stdenv/setup - to let stdenv set up the environment (e.g., process the - buildInputs). If you want, you can still use - stdenv’s generic builder: + to let stdenv set up the environment (e.g., process the buildInputs). If you want, you can still use stdenv’s generic builder: source $stdenv/setup @@ -179,23 +140,17 @@ genericBuild - gzip, bzip2 and - xz. + gzip, bzip2 and xz. - GNU Make. It has been patched to provide nested output - that can be fed into the nix-log2xml command and - log2html stylesheet to create a structured, readable - output of the build steps performed by Make. + GNU Make. It has been patched to provide nested output that can be fed into the nix-log2xml command and log2html stylesheet to create a structured, readable output of the build steps performed by Make. - Bash. This is the shell used for all builders in the Nix Packages - collection. Not using /bin/sh removes a large source - of portability problems. + Bash. This is the shell used for all builders in the Nix Packages collection. Not using /bin/sh removes a large source of portability problems. @@ -207,108 +162,52 @@ genericBuild - On Linux, stdenv also includes the - patchelf utility. + On Linux, stdenv also includes the patchelf utility.
Specifying dependencies - As described in the Nix manual, almost any *.drv store - path in a derivation's attribute set will induce a dependency on that - derivation. mkDerivation, however, takes a few attributes - intended to, between them, include all the dependencies of a package. This - is done both for structure and consistency, but also so that certain other - setup can take place. For example, certain dependencies need their bin - directories added to the PATH. That is built-in, but other - setup is done via a pluggable mechanism that works in conjunction with these - dependency attributes. See for details. + As described in the Nix manual, almost any *.drv store path in a derivation's attribute set will induce a dependency on that derivation. mkDerivation, however, takes a few attributes intended to, between them, include all the dependencies of a package. This is done both for structure and consistency, but also so that certain other setup can take place. For example, certain dependencies need their bin directories added to the PATH. That is built-in, but other setup is done via a pluggable mechanism that works in conjunction with these dependency attributes. See for details. - Dependencies can be broken down along three axes: their host and target - platforms relative to the new derivation's, and whether they are propagated. - The platform distinctions are motivated by cross compilation; see - for exactly what each platform means. + Dependencies can be broken down along three axes: their host and target platforms relative to the new derivation's, and whether they are propagated. The platform distinctions are motivated by cross compilation; see for exactly what each platform means. - The build platform is ignored because it is a mere implementation detail - of the package satisfying the dependency: As a general programming - principle, dependencies are always specified as - interfaces, not concrete implementation. + The build platform is ignored because it is a mere implementation detail of the package satisfying the dependency: As a general programming principle, dependencies are always specified as interfaces, not concrete implementation. - But even if one is not cross compiling, the platforms imply whether or not - the dependency is needed at run-time or build-time, a concept that makes - perfect sense outside of cross compilation. By default, the - run-time/build-time distinction is just a hint for mental clarity, but with - strictDeps set it is mostly enforced even in the native - case. + But even if one is not cross compiling, the platforms imply whether or not the dependency is needed at run-time or build-time, a concept that makes perfect sense outside of cross compilation. By default, the run-time/build-time distinction is just a hint for mental clarity, but with strictDeps set it is mostly enforced even in the native case. - The extension of PATH with dependencies, alluded to above, - proceeds according to the relative platforms alone. The process is carried - out only for dependencies whose host platform matches the new derivation's - build platform i.e. dependencies which run on the platform where the new - derivation will be built. + The extension of PATH with dependencies, alluded to above, proceeds according to the relative platforms alone. The process is carried out only for dependencies whose host platform matches the new derivation's build platform i.e. dependencies which run on the platform where the new derivation will be built. - Currently, this means for native builds all dependencies are put on the - PATH. But in the future that may not be the case for sake - of matching cross: the platforms would be assumed to be unique for native - and cross builds alike, so only the depsBuild* and - nativeBuildInputs would be added to the - PATH. + Currently, this means for native builds all dependencies are put on the PATH. But in the future that may not be the case for sake of matching cross: the platforms would be assumed to be unique for native and cross builds alike, so only the depsBuild* and nativeBuildInputs would be added to the PATH. - For each dependency dep of those dependencies, - dep/bin, if present, is - added to the PATH environment variable. + For each dependency dep of those dependencies, dep/bin, if present, is added to the PATH environment variable. - The dependency is propagated when it forces some of its other-transitive - (non-immediate) downstream dependencies to also take it on as an immediate - dependency. Nix itself already takes a package's transitive dependencies - into account, but this propagation ensures nixpkgs-specific infrastructure - like setup hooks (mentioned above) also are run as if the propagated - dependency. + The dependency is propagated when it forces some of its other-transitive (non-immediate) downstream dependencies to also take it on as an immediate dependency. Nix itself already takes a package's transitive dependencies into account, but this propagation ensures nixpkgs-specific infrastructure like setup hooks (mentioned above) also are run as if the propagated dependency. - It is important to note that dependencies are not necessarily propagated as - the same sort of dependency that they were before, but rather as the - corresponding sort so that the platform rules still line up. The exact rules - for dependency propagation can be given by assigning to each dependency two - integers based one how its host and target platforms are offset from the - depending derivation's platforms. Those offsets are given below in the - descriptions of each dependency list attribute. Algorithmically, we traverse - propagated inputs, accumulating every propagated dependency's propagated - dependencies and adjusting them to account for the "shift in perspective" - described by the current dependency's platform offsets. This results in sort - a transitive closure of the dependency relation, with the offsets being - approximately summed when two dependency links are combined. We also prune - transitive dependencies whose combined offsets go out-of-bounds, which can - be viewed as a filter over that transitive closure removing dependencies - that are blatantly absurd. + It is important to note that dependencies are not necessarily propagated as the same sort of dependency that they were before, but rather as the corresponding sort so that the platform rules still line up. The exact rules for dependency propagation can be given by assigning to each dependency two integers based one how its host and target platforms are offset from the depending derivation's platforms. Those offsets are given below in the descriptions of each dependency list attribute. Algorithmically, we traverse propagated inputs, accumulating every propagated dependency's propagated dependencies and adjusting them to account for the "shift in perspective" described by the current dependency's platform offsets. This results in sort a transitive closure of the dependency relation, with the offsets being approximately summed when two dependency links are combined. We also prune transitive dependencies whose combined offsets go out-of-bounds, which can be viewed as a filter over that transitive closure removing dependencies that are blatantly absurd. - We can define the process precisely with - Natural - Deduction using the inference rules. This probably seems a bit - obtuse, but so is the bash code that actually implements it! + We can define the process precisely with Natural Deduction using the inference rules. This probably seems a bit obtuse, but so is the bash code that actually implements it! - The findInputs function, currently residing in - pkgs/stdenv/generic/setup.sh, implements the - propagation logic. + The findInputs function, currently residing in pkgs/stdenv/generic/setup.sh, implements the propagation logic. - They're confusing in very different ways so... hopefully if something - doesn't make sense in one presentation, it will in the other! + They're confusing in very different ways so... hopefully if something doesn't make sense in one presentation, it will in the other! let mapOffset(h, t, i) = i + (if i <= 0 then h else t - 1) @@ -335,50 +234,22 @@ propagated-dep(mapOffset(h0, t0, h1), propagated-dep(h, t, A, B) ----------------------------- Propagated dependencies count as dependencies dep(h, t, A, B) - Some explanation of this monstrosity is in order. In the common case, the - target offset of a dependency is the successor to the target offset: - t = h + 1. That means that: + Some explanation of this monstrosity is in order. In the common case, the target offset of a dependency is the successor to the target offset: t = h + 1. That means that: let f(h, t, i) = i + (if i <= 0 then h else t - 1) let f(h, h + 1, i) = i + (if i <= 0 then h else (h + 1) - 1) let f(h, h + 1, i) = i + (if i <= 0 then h else h) let f(h, h + 1, i) = i + h - This is where "sum-like" comes in from above: We can just sum all of the - host offsets to get the host offset of the transitive dependency. The target - offset is the transitive dependency is simply the host offset + 1, just as - it was with the dependencies composed to make this transitive one; it can be - ignored as it doesn't add any new information. + This is where "sum-like" comes in from above: We can just sum all of the host offsets to get the host offset of the transitive dependency. The target offset is the transitive dependency is simply the host offset + 1, just as it was with the dependencies composed to make this transitive one; it can be ignored as it doesn't add any new information. - Because of the bounds checks, the uncommon cases are h = - t and h + 2 = t. In the former case, the - motivation for mapOffset is that since its host and - target platforms are the same, no transitive dependency of it should be able - to "discover" an offset greater than its reduced target offsets. - mapOffset effectively "squashes" all its transitive - dependencies' offsets so that none will ever be greater than the target - offset of the original h = t package. In the other case, - h + 1 is skipped over between the host and target - offsets. Instead of squashing the offsets, we need to "rip" them apart so no - transitive dependencies' offset is that one. + Because of the bounds checks, the uncommon cases are h = t and h + 2 = t. In the former case, the motivation for mapOffset is that since its host and target platforms are the same, no transitive dependency of it should be able to "discover" an offset greater than its reduced target offsets. mapOffset effectively "squashes" all its transitive dependencies' offsets so that none will ever be greater than the target offset of the original h = t package. In the other case, h + 1 is skipped over between the host and target offsets. Instead of squashing the offsets, we need to "rip" them apart so no transitive dependencies' offset is that one. - Overall, the unifying theme here is that propagation shouldn't be - introducing transitive dependencies involving platforms the depending - package is unaware of. [One can imagine the dependending package asking for - dependencies with the platforms it knows about; other platforms it doesn't - know how to ask for. The platform description in that scenario is a kind of - unforagable capability.] The offset bounds checking and definition of - mapOffset together ensure that this is the case. - Discovering a new offset is discovering a new platform, and since those - platforms weren't in the derivation "spec" of the needing package, they - cannot be relevant. From a capability perspective, we can imagine that the - host and target platforms of a package are the capabilities a package - requires, and the depending package must provide the capability to the - dependency. + Overall, the unifying theme here is that propagation shouldn't be introducing transitive dependencies involving platforms the depending package is unaware of. [One can imagine the dependending package asking for dependencies with the platforms it knows about; other platforms it doesn't know how to ask for. The platform description in that scenario is a kind of unforagable capability.] The offset bounds checking and definition of mapOffset together ensure that this is the case. Discovering a new offset is discovering a new platform, and since those platforms weren't in the derivation "spec" of the needing package, they cannot be relevant. From a capability perspective, we can imagine that the host and target platforms of a package are the capabilities a package requires, and the depending package must provide the capability to the dependency. @@ -389,23 +260,10 @@ let f(h, h + 1, i) = i + h - A list of dependencies whose host and target platforms are the new - derivation's build platform. This means a -1 host and - -1 target offset from the new derivation's platforms. - These are programs and libraries used at build time that produce programs - and libraries also used at build time. If the dependency doesn't care - about the target platform (i.e. isn't a compiler or similar tool), put it - in nativeBuildInputs instead. The most common use of - this buildPackages.stdenv.cc, the default C compiler - for this role. That example crops up more than one might think in old - commonly used C libraries. + A list of dependencies whose host and target platforms are the new derivation's build platform. This means a -1 host and -1 target offset from the new derivation's platforms. These are programs and libraries used at build time that produce programs and libraries also used at build time. If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it in nativeBuildInputs instead. The most common use of this buildPackages.stdenv.cc, the default C compiler for this role. That example crops up more than one might think in old commonly used C libraries. - Since these packages are able to be run at build-time, they are always - added to the PATH, as described above. But since these - packages are only guaranteed to be able to run then, they shouldn't - persist as run-time dependencies. This isn't currently enforced, but - could be in the future. + Since these packages are able to be run at build-time, they are always added to the PATH, as described above. But since these packages are only guaranteed to be able to run then, they shouldn't persist as run-time dependencies. This isn't currently enforced, but could be in the future. @@ -415,24 +273,10 @@ let f(h, h + 1, i) = i + h - A list of dependencies whose host platform is the new derivation's build - platform, and target platform is the new derivation's host platform. This - means a -1 host offset and 0 target - offset from the new derivation's platforms. These are programs and - libraries used at build-time that, if they are a compiler or similar - tool, produce code to run at run-time—i.e. tools used to build the new - derivation. If the dependency doesn't care about the target platform - (i.e. isn't a compiler or similar tool), put it here, rather than in - depsBuildBuild or depsBuildTarget. - This could be called depsBuildHost but - nativeBuildInputs is used for historical continuity. + A list of dependencies whose host platform is the new derivation's build platform, and target platform is the new derivation's host platform. This means a -1 host offset and 0 target offset from the new derivation's platforms. These are programs and libraries used at build-time that, if they are a compiler or similar tool, produce code to run at run-time—i.e. tools used to build the new derivation. If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it here, rather than in depsBuildBuild or depsBuildTarget. This could be called depsBuildHost but nativeBuildInputs is used for historical continuity. - Since these packages are able to be run at build-time, they are added to - the PATH, as described above. But since these packages are - only guaranteed to be able to run then, they shouldn't persist as - run-time dependencies. This isn't currently enforced, but could be in the - future. + Since these packages are able to be run at build-time, they are added to the PATH, as described above. But since these packages are only guaranteed to be able to run then, they shouldn't persist as run-time dependencies. This isn't currently enforced, but could be in the future. @@ -442,39 +286,13 @@ let f(h, h + 1, i) = i + h - A list of dependencies whose host platform is the new derivation's build - platform, and target platform is the new derivation's target platform. - This means a -1 host offset and 1 - target offset from the new derivation's platforms. These are programs - used at build time that produce code to run with code produced by the - depending package. Most commonly, these are tools used to build the - runtime or standard library that the currently-being-built compiler will - inject into any code it compiles. In many cases, the - currently-being-built-compiler is itself employed for that task, but when - that compiler won't run (i.e. its build and host platform differ) this is - not possible. Other times, the compiler relies on some other tool, like - binutils, that is always built separately so that the dependency is - unconditional. + A list of dependencies whose host platform is the new derivation's build platform, and target platform is the new derivation's target platform. This means a -1 host offset and 1 target offset from the new derivation's platforms. These are programs used at build time that produce code to run with code produced by the depending package. Most commonly, these are tools used to build the runtime or standard library that the currently-being-built compiler will inject into any code it compiles. In many cases, the currently-being-built-compiler is itself employed for that task, but when that compiler won't run (i.e. its build and host platform differ) this is not possible. Other times, the compiler relies on some other tool, like binutils, that is always built separately so that the dependency is unconditional. - This is a somewhat confusing concept to wrap one’s head around, and for - good reason. As the only dependency type where the platform offsets are - not adjacent integers, it requires thinking of a bootstrapping stage - two away from the current one. It and its use-case - go hand in hand and are both considered poor form: try to not need this - sort of dependency, and try to avoid building standard libraries and - runtimes in the same derivation as the compiler produces code using them. - Instead strive to build those like a normal library, using the - newly-built compiler just as a normal library would. In short, do not use - this attribute unless you are packaging a compiler and are sure it is - needed. + This is a somewhat confusing concept to wrap one’s head around, and for good reason. As the only dependency type where the platform offsets are not adjacent integers, it requires thinking of a bootstrapping stage two away from the current one. It and its use-case go hand in hand and are both considered poor form: try to not need this sort of dependency, and try to avoid building standard libraries and runtimes in the same derivation as the compiler produces code using them. Instead strive to build those like a normal library, using the newly-built compiler just as a normal library would. In short, do not use this attribute unless you are packaging a compiler and are sure it is needed. - Since these packages are able to run at build time, they are added to the - PATH, as described above. But since these packages are - only guaranteed to be able to run then, they shouldn't persist as - run-time dependencies. This isn't currently enforced, but could be in the - future. + Since these packages are able to run at build time, they are added to the PATH, as described above. But since these packages are only guaranteed to be able to run then, they shouldn't persist as run-time dependencies. This isn't currently enforced, but could be in the future. @@ -484,16 +302,7 @@ let f(h, h + 1, i) = i + h - A list of dependencies whose host and target platforms match the new - derivation's host platform. This means a 0 host offset - and 0 target offset from the new derivation's host - platform. These are packages used at run-time to generate code also used - at run-time. In practice, this would usually be tools used by compilers - for macros or a metaprogramming system, or libraries used by the macros - or metaprogramming code itself. It's always preferable to use a - depsBuildBuild dependency in the derivation being - built over a depsHostHost on the tool doing the - building for this purpose. + A list of dependencies whose host and target platforms match the new derivation's host platform. This means a 0 host offset and 0 target offset from the new derivation's host platform. These are packages used at run-time to generate code also used at run-time. In practice, this would usually be tools used by compilers for macros or a metaprogramming system, or libraries used by the macros or metaprogramming code itself. It's always preferable to use a depsBuildBuild dependency in the derivation being built over a depsHostHost on the tool doing the building for this purpose. @@ -503,21 +312,10 @@ let f(h, h + 1, i) = i + h - A list of dependencies whose host platform and target platform match the - new derivation's. This means a 0 host offset and a - 1 target offset from the new derivation's host - platform. This would be called depsHostTarget but for - historical continuity. If the dependency doesn't care about the target - platform (i.e. isn't a compiler or similar tool), put it here, rather - than in depsBuildBuild. + A list of dependencies whose host platform and target platform match the new derivation's. This means a 0 host offset and a 1 target offset from the new derivation's host platform. This would be called depsHostTarget but for historical continuity. If the dependency doesn't care about the target platform (i.e. isn't a compiler or similar tool), put it here, rather than in depsBuildBuild. - These are often programs and libraries used by the new derivation at - run-time, but that isn't always the case. For - example, the machine code in a statically-linked library is only used at - run-time, but the derivation containing the library is only needed at - build-time. Even in the dynamic case, the library may also be needed at - build-time to appease the linker. + These are often programs and libraries used by the new derivation at run-time, but that isn't always the case. For example, the machine code in a statically-linked library is only used at run-time, but the derivation containing the library is only needed at build-time. Even in the dynamic case, the library may also be needed at build-time to appease the linker. @@ -527,14 +325,7 @@ let f(h, h + 1, i) = i + h - A list of dependencies whose host platform matches the new derivation's - target platform. This means a 1 offset from the new - derivation's platforms. These are packages that run on the target - platform, e.g. the standard library or run-time deps of standard library - that a compiler insists on knowing about. It's poor form in almost all - cases for a package to depend on another from a future stage [future - stage corresponding to positive offset]. Do not use this attribute unless - you are packaging a compiler and are sure it is needed. + A list of dependencies whose host platform matches the new derivation's target platform. This means a 1 offset from the new derivation's platforms. These are packages that run on the target platform, e.g. the standard library or run-time deps of standard library that a compiler insists on knowing about. It's poor form in almost all cases for a package to depend on another from a future stage [future stage corresponding to positive offset]. Do not use this attribute unless you are packaging a compiler and are sure it is needed. @@ -544,9 +335,7 @@ let f(h, h + 1, i) = i + h - The propagated equivalent of depsBuildBuild. This - perhaps never ought to be used, but it is included for consistency [see - below for the others]. + The propagated equivalent of depsBuildBuild. This perhaps never ought to be used, but it is included for consistency [see below for the others]. @@ -556,18 +345,7 @@ let f(h, h + 1, i) = i + h - The propagated equivalent of nativeBuildInputs. This - would be called depsBuildHostPropagated but for - historical continuity. For example, if package Y has - propagatedNativeBuildInputs = [X], and package - Z has buildInputs = [Y], then - package Z will be built as if it included package - X in its nativeBuildInputs. If - instead, package Z has nativeBuildInputs = - [Y], then Z will be built as if it included - X in the depsBuildBuild of package - Z, because of the sum of the two -1 - host offsets. + The propagated equivalent of nativeBuildInputs. This would be called depsBuildHostPropagated but for historical continuity. For example, if package Y has propagatedNativeBuildInputs = [X], and package Z has buildInputs = [Y], then package Z will be built as if it included package X in its nativeBuildInputs. If instead, package Z has nativeBuildInputs = [Y], then Z will be built as if it included X in the depsBuildBuild of package Z, because of the sum of the two -1 host offsets. @@ -577,8 +355,7 @@ let f(h, h + 1, i) = i + h - The propagated equivalent of depsBuildTarget. This is - prefixed for the same reason of alerting potential users. + The propagated equivalent of depsBuildTarget. This is prefixed for the same reason of alerting potential users. @@ -598,9 +375,7 @@ let f(h, h + 1, i) = i + h - The propagated equivalent of buildInputs. This would - be called depsHostTargetPropagated but for historical - continuity. + The propagated equivalent of buildInputs. This would be called depsHostTargetPropagated but for historical continuity. @@ -610,8 +385,7 @@ let f(h, h + 1, i) = i + h - The propagated equivalent of depsTargetTarget. This is - prefixed for the same reason of alerting potential users. + The propagated equivalent of depsTargetTarget. This is prefixed for the same reason of alerting potential users. @@ -628,15 +402,7 @@ let f(h, h + 1, i) = i + h - A natural number indicating how much information to log. If set to 1 or - higher, stdenv will print moderate debugging - information during the build. In particular, the gcc - and ld wrapper scripts will print out the complete - command line passed to the wrapped tools. If set to 6 or higher, the - stdenv setup script will be run with set - -x tracing. If set to 7 or higher, the gcc - and ld wrapper scripts will also be run with - set -x tracing. + A natural number indicating how much information to log. If set to 1 or higher, stdenv will print moderate debugging information during the build. In particular, the gcc and ld wrapper scripts will print out the complete command line passed to the wrapped tools. If set to 6 or higher, the stdenv setup script will be run with set -x tracing. If set to 7 or higher, the gcc and ld wrapper scripts will also be run with set -x tracing. @@ -650,15 +416,10 @@ let f(h, h + 1, i) = i + h - If set to true, stdenv will pass - specific flags to make and other build tools to enable - parallel building with up to build-cores workers. + If set to true, stdenv will pass specific flags to make and other build tools to enable parallel building with up to build-cores workers. - Unless set to false, some build systems with good - support for parallel building including cmake, - meson, and qmake will set it to - true. + Unless set to false, some build systems with good support for parallel building including cmake, meson, and qmake will set it to true. @@ -672,8 +433,7 @@ let f(h, h + 1, i) = i + h - This is an attribute set which can be filled with arbitrary values. For - example: + This is an attribute set which can be filled with arbitrary values. For example: passthru = { foo = "bar"; @@ -685,17 +445,7 @@ passthru = { - Values inside it are not passed to the builder, so you can change them - without triggering a rebuild. However, they can be accessed outside of a - derivation directly, as if they were set inside a derivation itself, e.g. - hello.baz.value1. We don't specify any usage or schema - of passthru - it is meant for values that would be - useful outside the derivation in other parts of a Nix expression (e.g. in - other derivations). An example would be to convey some specific - dependency of your derivation which contains a program with plugins - support. Later, others who make derivations with plugins can use - passed-through dependency to ensure that their plugin would be - binary-compatible with built program. + Values inside it are not passed to the builder, so you can change them without triggering a rebuild. However, they can be accessed outside of a derivation directly, as if they were set inside a derivation itself, e.g. hello.baz.value1. We don't specify any usage or schema of passthru - it is meant for values that would be useful outside the derivation in other parts of a Nix expression (e.g. in other derivations). An example would be to convey some specific dependency of your derivation which contains a program with plugins support. Later, others who make derivations with plugins can use passed-through dependency to ensure that their plugin would be binary-compatible with built program. @@ -705,9 +455,7 @@ passthru = { - A script to be run by maintainers/scripts/update.nix - when the package is matched. It needs to be an executable file, either on - the file system: + A script to be run by maintainers/scripts/update.nix when the package is matched. It needs to be an executable file, either on the file system: passthru.updateScript = ./update.sh; @@ -723,21 +471,16 @@ passthru.updateScript = writeScript "update-zoom-us" '' update-source-version zoom-us "$version" ''; - The attribute can also contain a list, a script followed by arguments to - be passed to it: + The attribute can also contain a list, a script followed by arguments to be passed to it: passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]; - The script will be usually run from the root of the Nixpkgs repository - but you should not rely on that. Also note that the update scripts will - be run in parallel by default; you should avoid running git - commit or any other commands that cannot handle that. + The script will be usually run from the root of the Nixpkgs repository but you should not rely on that. Also note that the update scripts will be run in parallel by default; you should avoid running git commit or any other commands that cannot handle that. - For information about how to run the updates, execute nix-shell - maintainers/scripts/update.nix. + For information about how to run the updates, execute nix-shell maintainers/scripts/update.nix. @@ -747,33 +490,18 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] Phases - The generic builder has a number of phases. Package - builds are split into phases to make it easier to override specific parts of - the build (e.g., unpacking the sources or installing the binaries). - Furthermore, it allows a nicer presentation of build logs in the Nix build - farm. + The generic builder has a number of phases. Package builds are split into phases to make it easier to override specific parts of the build (e.g., unpacking the sources or installing the binaries). Furthermore, it allows a nicer presentation of build logs in the Nix build farm. - Each phase can be overridden in its entirety either by setting the - environment variable namePhase - to a string containing some shell commands to be executed, or by redefining - the shell function namePhase. - The former is convenient to override a phase from the derivation, while the - latter is convenient from a build script. However, typically one only wants - to add some commands to a phase, e.g. by defining - postInstall or preFixup, as skipping - some of the default actions may have unexpected consequences. The default - script for each phase is defined in the file - pkgs/stdenv/generic/setup.sh. + Each phase can be overridden in its entirety either by setting the environment variable namePhase to a string containing some shell commands to be executed, or by redefining the shell function namePhase. The former is convenient to override a phase from the derivation, while the latter is convenient from a build script. However, typically one only wants to add some commands to a phase, e.g. by defining postInstall or preFixup, as skipping some of the default actions may have unexpected consequences. The default script for each phase is defined in the file pkgs/stdenv/generic/setup.sh.
Controlling phases - There are a number of variables that control what phases are executed and - in what order: + There are a number of variables that control what phases are executed and in what order: Variables affecting phase control @@ -782,19 +510,10 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - Specifies the phases. You can change the order in which phases are - executed, or add new phases, by setting this variable. If it’s not - set, the default value is used, which is $prePhases - unpackPhase patchPhase $preConfigurePhases configurePhase - $preBuildPhases buildPhase checkPhase $preInstallPhases installPhase - fixupPhase installCheckPhase $preDistPhases distPhase - $postPhases. + Specifies the phases. You can change the order in which phases are executed, or add new phases, by setting this variable. If it’s not set, the default value is used, which is $prePhases unpackPhase patchPhase $preConfigurePhases configurePhase $preBuildPhases buildPhase checkPhase $preInstallPhases installPhase fixupPhase installCheckPhase $preDistPhases distPhase $postPhases. - Usually, if you just want to add a few phases, it’s more convenient - to set one of the variables below (such as - preInstallPhases), as you then don’t specify all - the normal phases. + Usually, if you just want to add a few phases, it’s more convenient to set one of the variables below (such as preInstallPhases), as you then don’t specify all the normal phases. @@ -876,11 +595,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] The unpack phase - The unpack phase is responsible for unpacking the source code of the - package. The default implementation of unpackPhase - unpacks the source files listed in the src environment - variable to the current directory. It supports the following files by - default: + The unpack phase is responsible for unpacking the source code of the package. The default implementation of unpackPhase unpacks the source files listed in the src environment variable to the current directory. It supports the following files by default: @@ -888,13 +603,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - These can optionally be compressed using gzip - (.tar.gz, .tgz or - .tar.Z), bzip2 - (.tar.bz2, .tbz2 or - .tbz) or xz - (.tar.xz, .tar.lzma or - .txz). + These can optionally be compressed using gzip (.tar.gz, .tgz or .tar.Z), bzip2 (.tar.bz2, .tbz2 or .tbz) or xz (.tar.xz, .tar.lzma or .txz). @@ -904,9 +613,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - Zip files are unpacked using unzip. However, - unzip is not in the standard environment, so you - should add it to nativeBuildInputs yourself. + Zip files are unpacked using unzip. However, unzip is not in the standard environment, so you should add it to nativeBuildInputs yourself. @@ -916,16 +623,12 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - These are simply copied to the current directory. The hash part of the - file name is stripped, e.g. - /nix/store/1wydxgby13cz...-my-sources would be - copied to my-sources. + These are simply copied to the current directory. The hash part of the file name is stripped, e.g. /nix/store/1wydxgby13cz...-my-sources would be copied to my-sources. - Additional file types can be supported by setting the - unpackCmd variable (see below). + Additional file types can be supported by setting the unpackCmd variable (see below). @@ -938,8 +641,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - The list of source files or directories to be unpacked or copied. One of - these must be set. + The list of source files or directories to be unpacked or copied. One of these must be set. @@ -949,10 +651,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - After running unpackPhase, the generic builder - changes the current directory to the directory created by unpacking the - sources. If there are multiple source directories, you should set - sourceRoot to the name of the intended directory. + After running unpackPhase, the generic builder changes the current directory to the directory created by unpacking the sources. If there are multiple source directories, you should set sourceRoot to the name of the intended directory. @@ -962,10 +661,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - Alternatively to setting sourceRoot, you can set - setSourceRoot to a shell command to be evaluated by - the unpack phase after the sources have been unpacked. This command must - set sourceRoot. + Alternatively to setting sourceRoot, you can set setSourceRoot to a shell command to be evaluated by the unpack phase after the sources have been unpacked. This command must set sourceRoot. @@ -1005,10 +701,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - If set to 1, the unpacked sources are - not made writable. By default, they are made - writable to prevent problems with read-only sources. For example, copied - store directories would be read-only without this. + If set to 1, the unpacked sources are not made writable. By default, they are made writable to prevent problems with read-only sources. For example, copied store directories would be read-only without this. @@ -1018,9 +711,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - The unpack phase evaluates the string $unpackCmd for - any unrecognised file. The path to the current source file is contained - in the curSrc variable. + The unpack phase evaluates the string $unpackCmd for any unrecognised file. The path to the current source file is contained in the curSrc variable. @@ -1031,8 +722,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] The patch phase - The patch phase applies the list of patches defined in the - patches variable. + The patch phase applies the list of patches defined in the patches variable. @@ -1043,11 +733,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - The list of patches. They must be in the format accepted by the - patch command, and may optionally be compressed using - gzip (.gz), - bzip2 (.bz2) or - xz (.xz). + The list of patches. They must be in the format accepted by the patch command, and may optionally be compressed using gzip (.gz), bzip2 (.bz2) or xz (.xz). @@ -1057,9 +743,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - Flags to be passed to patch. If not set, the argument - is used, which causes the leading directory - component to be stripped from the file names in each patch. + Flags to be passed to patch. If not set, the argument is used, which causes the leading directory component to be stripped from the file names in each patch. @@ -1090,9 +774,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] The configure phase - The configure phase prepares the source tree for building. The default - configurePhase runs ./configure - (typically an Autoconf-generated script) if it exists. + The configure phase prepares the source tree for building. The default configurePhase runs ./configure (typically an Autoconf-generated script) if it exists. @@ -1103,10 +785,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - The name of the configure script. It defaults to - ./configure if it exists; otherwise, the configure - phase is skipped. This can actually be a command (like perl - ./Configure.pl). + The name of the configure script. It defaults to ./configure if it exists; otherwise, the configure phase is skipped. This can actually be a command (like perl ./Configure.pl). @@ -1116,8 +795,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - A list of strings passed as additional arguments to the configure - script. + A list of strings passed as additional arguments to the configure script. @@ -1137,9 +815,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - A shell array containing additional arguments passed to the configure - script. You must use this instead of configureFlags - if the arguments contain spaces. + A shell array containing additional arguments passed to the configure script. You must use this instead of configureFlags if the arguments contain spaces. @@ -1149,8 +825,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - By default, the flag --prefix=$prefix is added to the - configure flags. If this is undesirable, set this variable to true. + By default, the flag --prefix=$prefix is added to the configure flags. If this is undesirable, set this variable to true. @@ -1160,9 +835,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - The prefix under which the package must be installed, passed via the - option to the configure script. It defaults to - . + The prefix under which the package must be installed, passed via the option to the configure script. It defaults to . @@ -1172,8 +845,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - The key to use when specifying the prefix. By default, this is set to - as that is used by the majority of packages. + The key to use when specifying the prefix. By default, this is set to as that is used by the majority of packages. @@ -1183,9 +855,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - By default, the flag --disable-dependency-tracking is - added to the configure flags to speed up Automake-based builds. If this - is undesirable, set this variable to true. + By default, the flag --disable-dependency-tracking is added to the configure flags to speed up Automake-based builds. If this is undesirable, set this variable to true. @@ -1195,15 +865,10 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - By default, the configure phase applies some special hackery to all - files called ltmain.sh before running the configure - script in order to improve the purity of Libtool-based packages + By default, the configure phase applies some special hackery to all files called ltmain.sh before running the configure script in order to improve the purity of Libtool-based packages - It clears the - sys_lib_*search_path - variables in the Libtool script to prevent Libtool from using - libraries in /usr/lib and such. + It clears the sys_lib_*search_path variables in the Libtool script to prevent Libtool from using libraries in /usr/lib and such. . If this is undesirable, set this variable to true. @@ -1216,9 +881,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - By default, when the configure script has - , the option - is added to the configure flags. + By default, when the configure script has , the option is added to the configure flags. If this is undesirable, set this variable to true. @@ -1231,16 +894,10 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - By default, when cross compiling, the configure script has - and passed. - Packages can instead pass [ "build" "host" "target" ] - or a subset to control exactly which platform flags are passed. - Compilers and other tools can use this to also pass the target platform. + By default, when cross compiling, the configure script has and passed. Packages can instead pass [ "build" "host" "target" ] or a subset to control exactly which platform flags are passed. Compilers and other tools can use this to also pass the target platform. - Eventually these will be passed building natively as well, to improve - determinism: build-time guessing, as is done today, is a risk of - impurity. + Eventually these will be passed building natively as well, to improve determinism: build-time guessing, as is done today, is a risk of impurity. @@ -1273,12 +930,7 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] The build phase - The build phase is responsible for actually building the package (e.g. - compiling it). The default buildPhase simply calls - make if a file named Makefile, - makefile or GNUmakefile exists in - the current directory (or the makefile is explicitly - set); otherwise it does nothing. + The build phase is responsible for actually building the package (e.g. compiling it). The default buildPhase simply calls make if a file named Makefile, makefile or GNUmakefile exists in the current directory (or the makefile is explicitly set); otherwise it does nothing. @@ -1309,17 +961,13 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ] - A list of strings passed as additional flags to make. - These flags are also used by the default install and check phase. For - setting make flags specific to the build phase, use - buildFlags (see below). + A list of strings passed as additional flags to make. These flags are also used by the default install and check phase. For setting make flags specific to the build phase, use buildFlags (see below). makeFlags = [ "PREFIX=$(out)" ]; - The flags are quoted in bash, but environment variables can be - specified by using the make syntax. + The flags are quoted in bash, but environment variables can be specified by using the make syntax. @@ -1331,18 +979,13 @@ makeFlags = [ "PREFIX=$(out)" ]; - A shell array containing additional arguments passed to - make. You must use this instead of - makeFlags if the arguments contain spaces, e.g. + A shell array containing additional arguments passed to make. You must use this instead of makeFlags if the arguments contain spaces, e.g. preBuild = '' makeFlagsArray+=(CFLAGS="-O0 -g" LDFLAGS="-lfoo -lbar") ''; - Note that shell arrays cannot be passed through environment variables, - so you cannot set makeFlagsArray in a derivation - attribute (because those are passed through environment variables): you - have to define them in shell code. + Note that shell arrays cannot be passed through environment variables, so you cannot set makeFlagsArray in a derivation attribute (because those are passed through environment variables): you have to define them in shell code. @@ -1352,9 +995,7 @@ preBuild = '' - A list of strings passed as additional flags to make. - Like makeFlags and makeFlagsArray, - but only used by the build phase. + A list of strings passed as additional flags to make. Like makeFlags and makeFlagsArray, but only used by the build phase. @@ -1381,14 +1022,11 @@ preBuild = '' - You can set flags for make through the - makeFlags variable. + You can set flags for make through the makeFlags variable. - Before and after running make, the hooks - preBuild and postBuild are called, - respectively. + Before and after running make, the hooks preBuild and postBuild are called, respectively.
@@ -1396,10 +1034,7 @@ preBuild = '' The check phase - The check phase checks whether the package was built correctly by running - its test suite. The default checkPhase calls - make check, but only if the doCheck - variable is enabled. + The check phase checks whether the package was built correctly by running its test suite. The default checkPhase calls make check, but only if the doCheck variable is enabled. @@ -1410,14 +1045,9 @@ preBuild = '' - Controls whether the check phase is executed. By default it is skipped, - but if doCheck is set to true, the check phase is - usually executed. Thus you should set + Controls whether the check phase is executed. By default it is skipped, but if doCheck is set to true, the check phase is usually executed. Thus you should set doCheck = true; - in the derivation to enable checks. The exception is cross compilation. - Cross compiled builds never run tests, no matter how - doCheck is set, as the newly-built program won't run - on the platform used to build it. + in the derivation to enable checks. The exception is cross compilation. Cross compiled builds never run tests, no matter how doCheck is set, as the newly-built program won't run on the platform used to build it. @@ -1437,8 +1067,7 @@ preBuild = '' - The make target that runs the tests. Defaults to - check. + The make target that runs the tests. Defaults to check. @@ -1448,9 +1077,7 @@ preBuild = '' - A list of strings passed as additional flags to make. - Like makeFlags and makeFlagsArray, - but only used by the check phase. + A list of strings passed as additional flags to make. Like makeFlags and makeFlagsArray, but only used by the check phase. @@ -1460,9 +1087,7 @@ preBuild = '' - A list of dependencies used by the phase. This gets included in - nativeBuildInputs when doCheck is - set. + A list of dependencies used by the phase. This gets included in nativeBuildInputs when doCheck is set. @@ -1493,10 +1118,7 @@ preBuild = '' The install phase - The install phase is responsible for installing the package in the Nix - store under out. The default - installPhase creates the directory - $out and calls make install. + The install phase is responsible for installing the package in the Nix store under out. The default installPhase creates the directory $out and calls make install. @@ -1517,8 +1139,7 @@ preBuild = '' - The make targets that perform the installation. Defaults to - install. Example: + The make targets that perform the installation. Defaults to install. Example: installTargets = "install-bin install-doc"; @@ -1530,9 +1151,7 @@ installTargets = "install-bin install-doc"; - A list of strings passed as additional flags to make. - Like makeFlags and makeFlagsArray, - but only used by the install phase. + A list of strings passed as additional flags to make. Like makeFlags and makeFlagsArray, but only used by the install phase. @@ -1563,15 +1182,11 @@ installTargets = "install-bin install-doc"; The fixup phase - The fixup phase performs some (Nix-specific) post-processing actions on the - files installed under $out by the install phase. The - default fixupPhase does the following: + The fixup phase performs some (Nix-specific) post-processing actions on the files installed under $out by the install phase. The default fixupPhase does the following: - It moves the man/, doc/ and - info/ subdirectories of $out to - share/. + It moves the man/, doc/ and info/ subdirectories of $out to share/. @@ -1581,19 +1196,12 @@ installTargets = "install-bin install-doc"; - On Linux, it applies the patchelf command to ELF - executables and libraries to remove unused directories from the - RPATH in order to prevent unnecessary runtime - dependencies. + On Linux, it applies the patchelf command to ELF executables and libraries to remove unused directories from the RPATH in order to prevent unnecessary runtime dependencies. - It rewrites the interpreter paths of shell scripts to paths found in - PATH. E.g., /usr/bin/perl will be - rewritten to - /nix/store/some-perl/bin/perl - found in PATH. + It rewrites the interpreter paths of shell scripts to paths found in PATH. E.g., /usr/bin/perl will be rewritten to /nix/store/some-perl/bin/perl found in PATH. @@ -1617,8 +1225,7 @@ installTargets = "install-bin install-doc"; - If set, libraries and executables are not stripped. By default, they - are. + If set, libraries and executables are not stripped. By default, they are. @@ -1628,10 +1235,7 @@ installTargets = "install-bin install-doc"; - Like dontStrip, but only affects the - strip command targetting the package's host platform. - Useful when supporting cross compilation, but otherwise feel free to - ignore. + Like dontStrip, but only affects the strip command targetting the package's host platform. Useful when supporting cross compilation, but otherwise feel free to ignore. @@ -1641,10 +1245,7 @@ installTargets = "install-bin install-doc"; - Like dontStrip, but only affects the - strip command targetting the packages' target - platform. Useful when supporting cross compilation, but otherwise feel - free to ignore. + Like dontStrip, but only affects the strip command targetting the packages' target platform. Useful when supporting cross compilation, but otherwise feel free to ignore. @@ -1654,8 +1255,7 @@ installTargets = "install-bin install-doc"; - If set, files in $out/sbin are not moved to - $out/bin. By default, they are. + If set, files in $out/sbin are not moved to $out/bin. By default, they are. @@ -1665,10 +1265,7 @@ installTargets = "install-bin install-doc"; - List of directories to search for libraries and executables from which - all symbols should be stripped. By default, it’s - empty. Stripping all symbols is risky, since it may remove not just - debug symbols but also ELF information necessary for normal execution. + List of directories to search for libraries and executables from which all symbols should be stripped. By default, it’s empty. Stripping all symbols is risky, since it may remove not just debug symbols but also ELF information necessary for normal execution. @@ -1678,9 +1275,7 @@ installTargets = "install-bin install-doc"; - Flags passed to the strip command applied to the - files in the directories listed in stripAllList. - Defaults to (i.e. ). + Flags passed to the strip command applied to the files in the directories listed in stripAllList. Defaults to (i.e. ). @@ -1690,9 +1285,7 @@ installTargets = "install-bin install-doc"; - List of directories to search for libraries and executables from which - only debugging-related symbols should be stripped. It defaults to - lib bin sbin. + List of directories to search for libraries and executables from which only debugging-related symbols should be stripped. It defaults to lib bin sbin. @@ -1702,9 +1295,7 @@ installTargets = "install-bin install-doc"; - Flags passed to the strip command applied to the - files in the directories listed in stripDebugList. - Defaults to (i.e. ). + Flags passed to the strip command applied to the files in the directories listed in stripDebugList. Defaults to (i.e. ). @@ -1714,8 +1305,7 @@ installTargets = "install-bin install-doc"; - If set, the patchelf command is not used to remove - unnecessary RPATH entries. Only applies to Linux. + If set, the patchelf command is not used to remove unnecessary RPATH entries. Only applies to Linux. @@ -1725,8 +1315,7 @@ installTargets = "install-bin install-doc"; - If set, scripts starting with #! do not have their - interpreter paths rewritten to paths in the Nix store. + If set, scripts starting with #! do not have their interpreter paths rewritten to paths in the Nix store. @@ -1736,9 +1325,7 @@ installTargets = "install-bin install-doc"; - If set, libtool .la files associated with shared - libraries won't have their dependency_libs field - cleared. + If set, libtool .la files associated with shared libraries won't have their dependency_libs field cleared. @@ -1748,9 +1335,7 @@ installTargets = "install-bin install-doc"; - The list of directories that must be moved from - $out to $out/share. Defaults - to man doc info. + The list of directories that must be moved from $out to $out/share. Defaults to man doc info. @@ -1760,11 +1345,7 @@ installTargets = "install-bin install-doc"; - A package can export a setup - hook by setting this variable. The setup hook, if defined, is - copied to $out/nix-support/setup-hook. Environment - variables are then substituted in it using - setup hook by setting this variable. The setup hook, if defined, is copied to $out/nix-support/setup-hook. Environment variables are then substituted in it using substituteAll. @@ -1795,25 +1376,14 @@ installTargets = "install-bin install-doc"; - If set to true, the standard environment will enable - debug information in C/C++ builds. After installation, the debug - information will be separated from the executables and stored in the - output named debug. (This output is enabled - automatically; you don’t need to set the outputs - attribute explicitly.) To be precise, the debug information is stored in - debug/lib/debug/.build-id/XX/YYYY…, - where XXYYYY… is the build - ID of the binary — a SHA-1 hash of the contents of the - binary. Debuggers like GDB use the build ID to look up the separated - debug information. + If set to true, the standard environment will enable debug information in C/C++ builds. After installation, the debug information will be separated from the executables and stored in the output named debug. (This output is enabled automatically; you don’t need to set the outputs attribute explicitly.) To be precise, the debug information is stored in debug/lib/debug/.build-id/XX/YYYY…, where XXYYYY… is the build ID of the binary — a SHA-1 hash of the contents of the binary. Debuggers like GDB use the build ID to look up the separated debug information. For example, with GDB, you can add set debug-file-directory ~/.nix-profile/lib/debug - to ~/.gdbinit. GDB will then be able to find debug - information installed via nix-env -i. + to ~/.gdbinit. GDB will then be able to find debug information installed via nix-env -i. @@ -1824,10 +1394,7 @@ set debug-file-directory ~/.nix-profile/lib/debug The installCheck phase - The installCheck phase checks whether the package was installed correctly - by running its test suite against the installed directories. The default - installCheck calls make - installcheck. + The installCheck phase checks whether the package was installed correctly by running its test suite against the installed directories. The default installCheck calls make installcheck. @@ -1838,14 +1405,9 @@ set debug-file-directory ~/.nix-profile/lib/debug - Controls whether the installCheck phase is executed. By default it is - skipped, but if doInstallCheck is set to true, the - installCheck phase is usually executed. Thus you should set + Controls whether the installCheck phase is executed. By default it is skipped, but if doInstallCheck is set to true, the installCheck phase is usually executed. Thus you should set doInstallCheck = true; - in the derivation to enable install checks. The exception is cross - compilation. Cross compiled builds never run tests, no matter how - doInstallCheck is set, as the newly-built program - won't run on the platform used to build it. + in the derivation to enable install checks. The exception is cross compilation. Cross compiled builds never run tests, no matter how doInstallCheck is set, as the newly-built program won't run on the platform used to build it. @@ -1855,8 +1417,7 @@ set debug-file-directory ~/.nix-profile/lib/debug - The make target that runs the install tests. Defaults to - installcheck. + The make target that runs the install tests. Defaults to installcheck. @@ -1866,9 +1427,7 @@ set debug-file-directory ~/.nix-profile/lib/debug - A list of strings passed as additional flags to make. - Like makeFlags and makeFlagsArray, - but only used by the installCheck phase. + A list of strings passed as additional flags to make. Like makeFlags and makeFlagsArray, but only used by the installCheck phase. @@ -1878,9 +1437,7 @@ set debug-file-directory ~/.nix-profile/lib/debug - A list of dependencies used by the phase. This gets included in - nativeBuildInputs when - doInstallCheck is set. + A list of dependencies used by the phase. This gets included in nativeBuildInputs when doInstallCheck is set. @@ -1911,11 +1468,7 @@ set debug-file-directory ~/.nix-profile/lib/debug The distribution phase - The distribution phase is intended to produce a source distribution of the - package. The default distPhase first calls - make dist, then it copies the resulting source tarballs - to $out/tarballs/. This phase is only executed if the - attribute doDist is set. + The distribution phase is intended to produce a source distribution of the package. The default distPhase first calls make dist, then it copies the resulting source tarballs to $out/tarballs/. This phase is only executed if the attribute doDist is set. @@ -1926,8 +1479,7 @@ set debug-file-directory ~/.nix-profile/lib/debug - The make target that produces the distribution. Defaults to - dist. + The make target that produces the distribution. Defaults to dist. @@ -1947,9 +1499,7 @@ set debug-file-directory ~/.nix-profile/lib/debug - The names of the source distribution files to be copied to - $out/tarballs/. It can contain shell wildcards. The - default is *.tar.gz. + The names of the source distribution files to be copied to $out/tarballs/. It can contain shell wildcards. The default is *.tar.gz. @@ -2000,8 +1550,7 @@ set debug-file-directory ~/.nix-profile/lib/debug - Constructs a wrapper for a program with various possible arguments. For - example: + Constructs a wrapper for a program with various possible arguments. For example: # adds `FOOBAR=baz` to `$out/bin/foo`’s environment makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz @@ -2011,12 +1560,10 @@ makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz # (via string replacements or in `configurePhase`). makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello git ]} - There’s many more kinds of arguments, they are documented in - nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh. + There’s many more kinds of arguments, they are documented in nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh. - wrapProgram is a convenience function you probably - want to use most of the time. + wrapProgram is a convenience function you probably want to use most of the time. @@ -2026,10 +1573,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello - Performs string substitution on the contents of - infile, writing the result to - outfile. The substitutions in - subs are of the following form: + Performs string substitution on the contents of infile, writing the result to outfile. The substitutions in subs are of the following form: @@ -2037,8 +1581,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello - Replace every occurrence of the string s1 - by s2. + Replace every occurrence of the string s1 by s2. @@ -2048,13 +1591,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello - Replace every occurrence of - @varName@ by the - contents of the environment variable - varName. This is useful for generating - files from templates, using - @...@ in the template - as placeholders. + Replace every occurrence of @varName@ by the contents of the environment variable varName. This is useful for generating files from templates, using @...@ in the template as placeholders. @@ -2064,9 +1601,7 @@ makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello - Replace every occurrence of - @varName@ by the string - s. + Replace every occurrence of @varName@ by the string s. @@ -2082,14 +1617,8 @@ substitute ./foo.in ./foo.out \ - substitute is implemented using the - replace - command. Unlike with the sed command, you don’t have - to worry about escaping special characters. It supports performing - substitutions on binary files (such as executables), though there - you’ll probably want to make sure that the replacement string is as - long as the replaced string. + substitute is implemented using the replace command. Unlike with the sed command, you don’t have to worry about escaping special characters. It supports performing substitutions on binary files (such as executables), though there you’ll probably want to make sure that the replacement string is as long as the replaced string. @@ -2099,8 +1628,7 @@ substitute ./foo.in ./foo.out \ - Like substitute, but performs the substitutions in - place on the file file. + Like substitute, but performs the substitutions in place on the file file. @@ -2110,22 +1638,13 @@ substitute ./foo.in ./foo.out \ - Replaces every occurrence of - @varName@, where - varName is any environment variable, in - infile, writing the result to - outfile. For instance, if - infile has the contents + Replaces every occurrence of @varName@, where varName is any environment variable, in infile, writing the result to outfile. For instance, if infile has the contents #! @bash@/bin/sh PATH=@coreutils@/bin echo @foo@ - and the environment contains - bash=/nix/store/bmwp0q28cf21...-bash-3.2-p39 and - coreutils=/nix/store/68afga4khv0w...-coreutils-6.12, - but does not contain the variable foo, then the output - will be + and the environment contains bash=/nix/store/bmwp0q28cf21...-bash-3.2-p39 and coreutils=/nix/store/68afga4khv0w...-coreutils-6.12, but does not contain the variable foo, then the output will be #! /nix/store/bmwp0q28cf21...-bash-3.2-p39/bin/sh PATH=/nix/store/68afga4khv0w...-coreutils-6.12/bin @@ -2134,13 +1653,7 @@ echo @foo@ That is, no substitution is performed for undefined variables. - Environment variables that start with an uppercase letter or an - underscore are filtered out, to prevent global variables (like - HOME) or private variables (like - __ETC_PROFILE_DONE) from accidentally getting - substituted. The variables also have to be valid bash “names”, as - defined in the bash manpage (alphanumeric or _, must - not start with a number). + Environment variables that start with an uppercase letter or an underscore are filtered out, to prevent global variables (like HOME) or private variables (like __ETC_PROFILE_DONE) from accidentally getting substituted. The variables also have to be valid bash “names”, as defined in the bash manpage (alphanumeric or _, must not start with a number). @@ -2150,8 +1663,7 @@ echo @foo@ - Like substituteAll, but performs the substitutions - in place on the file file. + Like substituteAll, but performs the substitutions in place on the file file. @@ -2161,14 +1673,12 @@ echo @foo@ - Strips the directory and hash part of a store path, outputting the name - part to stdout. For example: + Strips the directory and hash part of a store path, outputting the name part to stdout. For example: # prints coreutils-8.24 stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" - If you wish to store the result in another variable, then the following - idiom may be useful: + If you wish to store the result in another variable, then the following idiom may be useful: name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" someVar=$(stripHash $name) @@ -2182,13 +1692,10 @@ someVar=$(stripHash $name) - Convenience function for makeWrapper that - automatically creates a sane wrapper file It takes all the same arguments - as makeWrapper, except for --argv0. + Convenience function for makeWrapper that automatically creates a sane wrapper file It takes all the same arguments as makeWrapper, except for --argv0. - It cannot be applied multiple times, since it will overwrite the wrapper - file. + It cannot be applied multiple times, since it will overwrite the wrapper file. @@ -2198,85 +1705,34 @@ someVar=$(stripHash $name) Package setup hooks - Nix itself considers a build-time dependency as merely something that should - previously be built and accessible at build time—packages themselves are - on their own to perform any additional setup. In most cases, that is fine, - and the downstream derivation can deal with its own dependencies. But for a - few common tasks, that would result in almost every package doing the same - sort of setup work—depending not on the package itself, but entirely on - which dependencies were used. + Nix itself considers a build-time dependency as merely something that should previously be built and accessible at build time—packages themselves are on their own to perform any additional setup. In most cases, that is fine, and the downstream derivation can deal with its own dependencies. But for a few common tasks, that would result in almost every package doing the same sort of setup work—depending not on the package itself, but entirely on which dependencies were used. - In order to alleviate this burden, the setup hook - mechanism was written, where any package can include a shell script that [by - convention rather than enforcement by Nix], any downstream - reverse-dependency will source as part of its build process. That allows the - downstream dependency to merely specify its dependencies, and lets those - dependencies effectively initialize themselves. No boilerplate mirroring the - list of dependencies is needed. + In order to alleviate this burden, the setup hook mechanism was written, where any package can include a shell script that [by convention rather than enforcement by Nix], any downstream reverse-dependency will source as part of its build process. That allows the downstream dependency to merely specify its dependencies, and lets those dependencies effectively initialize themselves. No boilerplate mirroring the list of dependencies is needed. - The setup hook mechanism is a bit of a sledgehammer though: a powerful - feature with a broad and indiscriminate area of effect. The combination of - its power and implicit use may be expedient, but isn't without costs. Nix - itself is unchanged, but the spirit of added dependencies being effect-free - is violated even if the letter isn't. For example, if a derivation path is - mentioned more than once, Nix itself doesn't care and simply makes sure the - dependency derivation is already built just the same—depending is just - needing something to exist, and needing is idempotent. However, a dependency - specified twice will have its setup hook run twice, and that could easily - change the build environment (though a well-written setup hook will - therefore strive to be idempotent so this is in fact not observable). More - broadly, setup hooks are anti-modular in that multiple dependencies, whether - the same or different, should not interfere and yet their setup hooks may - well do so. + The setup hook mechanism is a bit of a sledgehammer though: a powerful feature with a broad and indiscriminate area of effect. The combination of its power and implicit use may be expedient, but isn't without costs. Nix itself is unchanged, but the spirit of added dependencies being effect-free is violated even if the letter isn't. For example, if a derivation path is mentioned more than once, Nix itself doesn't care and simply makes sure the dependency derivation is already built just the same—depending is just needing something to exist, and needing is idempotent. However, a dependency specified twice will have its setup hook run twice, and that could easily change the build environment (though a well-written setup hook will therefore strive to be idempotent so this is in fact not observable). More broadly, setup hooks are anti-modular in that multiple dependencies, whether the same or different, should not interfere and yet their setup hooks may well do so. - The most typical use of the setup hook is actually to add other hooks which - are then run (i.e. after all the setup hooks) on each dependency. For - example, the C compiler wrapper's setup hook feeds itself flags for each - dependency that contains relevant libraries and headers. This is done by - defining a bash function, and appending its name to one of - envBuildBuildHooks`, envBuildHostHooks`, - envBuildTargetHooks`, envHostHostHooks`, - envHostTargetHooks`, or envTargetTargetHooks`. - These 6 bash variables correspond to the 6 sorts of dependencies by platform - (there's 12 total but we ignore the propagated/non-propagated axis). + The most typical use of the setup hook is actually to add other hooks which are then run (i.e. after all the setup hooks) on each dependency. For example, the C compiler wrapper's setup hook feeds itself flags for each dependency that contains relevant libraries and headers. This is done by defining a bash function, and appending its name to one of envBuildBuildHooks`, envBuildHostHooks`, envBuildTargetHooks`, envHostHostHooks`, envHostTargetHooks`, or envTargetTargetHooks`. These 6 bash variables correspond to the 6 sorts of dependencies by platform (there's 12 total but we ignore the propagated/non-propagated axis). - Packages adding a hook should not hard code a specific hook, but rather - choose a variable relative to how they are included. - Returning to the C compiler wrapper example, if the wrapper itself is an - n dependency, then it only wants to accumulate flags from - n + 1 dependencies, as only those ones match the - compiler's target platform. The hostOffset variable is - defined with the current dependency's host offset - targetOffset with its target offset, before its setup hook is - sourced. Additionally, since most environment hooks don't care about the - target platform, that means the setup hook can append to the right bash - array by doing something like + Packages adding a hook should not hard code a specific hook, but rather choose a variable relative to how they are included. Returning to the C compiler wrapper example, if the wrapper itself is an n dependency, then it only wants to accumulate flags from n + 1 dependencies, as only those ones match the compiler's target platform. The hostOffset variable is defined with the current dependency's host offset targetOffset with its target offset, before its setup hook is sourced. Additionally, since most environment hooks don't care about the target platform, that means the setup hook can append to the right bash array by doing something like addEnvHooks "$hostOffset" myBashFunction - The existence of setups hooks has long been documented - and packages inside Nixpkgs are free to use this mechanism. Other packages, - however, should not rely on these mechanisms not changing between Nixpkgs - versions. Because of the existing issues with this system, there's little - benefit from mandating it be stable for any period of time. + The existence of setups hooks has long been documented and packages inside Nixpkgs are free to use this mechanism. Other packages, however, should not rely on these mechanisms not changing between Nixpkgs versions. Because of the existing issues with this system, there's little benefit from mandating it be stable for any period of time. - First, let’s cover some setup hooks that are part of Nixpkgs default - stdenv. This means that they are run for every package built using - stdenv.mkDerivation. Some of these are platform - specific, so they may run on Linux but not Darwin or vice-versa. + First, let’s cover some setup hooks that are part of Nixpkgs default stdenv. This means that they are run for every package built using stdenv.mkDerivation. Some of these are platform specific, so they may run on Linux but not Darwin or vice-versa. @@ -2284,10 +1740,7 @@ addEnvHooks "$hostOffset" myBashFunction - This setup hook moves any installed documentation to the - /share subdirectory directory. This includes the man, - doc and info directories. This is needed for legacy programs that do not - know how to use the share subdirectory. + This setup hook moves any installed documentation to the /share subdirectory directory. This includes the man, doc and info directories. This is needed for legacy programs that do not know how to use the share subdirectory. @@ -2297,9 +1750,7 @@ addEnvHooks "$hostOffset" myBashFunction - This setup hook compresses any man pages that have been installed. The - compression is done using the gzip program. This helps to reduce the - installed size of packages. + This setup hook compresses any man pages that have been installed. The compression is done using the gzip program. This helps to reduce the installed size of packages. @@ -2309,9 +1760,7 @@ addEnvHooks "$hostOffset" myBashFunction - This runs the strip command on installed binaries and libraries. This - removes unnecessary information like debug symbols when they are not - needed. This also helps to reduce the installed size of packages. + This runs the strip command on installed binaries and libraries. This removes unnecessary information like debug symbols when they are not needed. This also helps to reduce the installed size of packages. @@ -2321,12 +1770,7 @@ addEnvHooks "$hostOffset" myBashFunction - This setup hook patches installed scripts to use the full path to the - shebang interpreter. A shebang interpreter is the first commented line - of a script telling the operating system which program will run the - script (e.g #!/bin/bash). In Nix, we want an exact - path to that interpreter to be used. This often replaces - /bin/sh with a path in the Nix store. + This setup hook patches installed scripts to use the full path to the shebang interpreter. A shebang interpreter is the first commented line of a script telling the operating system which program will run the script (e.g #!/bin/bash). In Nix, we want an exact path to that interpreter to be used. This often replaces /bin/sh with a path in the Nix store. @@ -2336,10 +1780,7 @@ addEnvHooks "$hostOffset" myBashFunction - This verifies that no references are left from the install binaries to - the directory used to build those binaries. This ensures that the - binaries do not need things outside the Nix store. This is currently - supported in Linux only. + This verifies that no references are left from the install binaries to the directory used to build those binaries. This ensures that the binaries do not need things outside the Nix store. This is currently supported in Linux only. @@ -2349,12 +1790,7 @@ addEnvHooks "$hostOffset" myBashFunction - This setup hook adds configure flags that tell packages to install files - into any one of the proper outputs listed in outputs. - This behavior can be turned off by setting - setOutputFlags to false in the derivation - environment. See for more - information. + This setup hook adds configure flags that tell packages to install files into any one of the proper outputs listed in outputs. This behavior can be turned off by setting setOutputFlags to false in the derivation environment. See for more information. @@ -2364,9 +1800,7 @@ addEnvHooks "$hostOffset" myBashFunction - This setup hook moves any binaries installed in the sbin subdirectory - into bin. In addition, a link is provided from sbin to bin for - compatibility. + This setup hook moves any binaries installed in the sbin subdirectory into bin. In addition, a link is provided from sbin to bin for compatibility. @@ -2376,9 +1810,7 @@ addEnvHooks "$hostOffset" myBashFunction - This setup hook moves any libraries installed in the lib64 subdirectory - into lib. In addition, a link is provided from lib64 to lib for - compatibility. + This setup hook moves any libraries installed in the lib64 subdirectory into lib. In addition, a link is provided from lib64 to lib for compatibility. @@ -2388,8 +1820,7 @@ addEnvHooks "$hostOffset" myBashFunction - This sets SOURCE_DATE_EPOCH to the modification time - of the most recent file. + This sets SOURCE_DATE_EPOCH to the modification time of the most recent file. @@ -2399,70 +1830,22 @@ addEnvHooks "$hostOffset" myBashFunction - The Bintools Wrapper wraps the binary utilities for a bunch of - miscellaneous purposes. These are GNU Binutils when targetting Linux, - and a mix of cctools and GNU binutils for Darwin. [The "Bintools" name - is supposed to be a compromise between "Binutils" and "cctools" not - denoting any specific implementation.] Specifically, the underlying - bintools package, and a C standard library (glibc or Darwin's libSystem, - just for the dynamic loader) are all fed in, and dependency finding, - hardening (see below), and purity checks for each are handled by the - Bintools Wrapper. Packages typically depend on CC Wrapper, which in turn - (at run time) depends on the Bintools Wrapper. + The Bintools Wrapper wraps the binary utilities for a bunch of miscellaneous purposes. These are GNU Binutils when targetting Linux, and a mix of cctools and GNU binutils for Darwin. [The "Bintools" name is supposed to be a compromise between "Binutils" and "cctools" not denoting any specific implementation.] Specifically, the underlying bintools package, and a C standard library (glibc or Darwin's libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by the Bintools Wrapper. Packages typically depend on CC Wrapper, which in turn (at run time) depends on the Bintools Wrapper. - The Bintools Wrapper was only just recently split off from CC Wrapper, - so the division of labor is still being worked out. For example, it - shouldn't care about the C standard library, but just take a derivation - with the dynamic loader (which happens to be the glibc on linux). - Dependency finding however is a task both wrappers will continue to need - to share, and probably the most important to understand. It is currently - accomplished by collecting directories of host-platform dependencies - (i.e. buildInputs and - nativeBuildInputs) in environment variables. The - Bintools Wrapper's setup hook causes any lib and - lib64 subdirectories to be added to - NIX_LDFLAGS. Since the CC Wrapper and the Bintools - Wrapper use the same strategy, most of the Bintools Wrapper code is - sparsely commented and refers to the CC Wrapper. But the CC Wrapper's - code, by contrast, has quite lengthy comments. The Bintools Wrapper - merely cites those, rather than repeating them, to avoid falling out of - sync. + The Bintools Wrapper was only just recently split off from CC Wrapper, so the division of labor is still being worked out. For example, it shouldn't care about the C standard library, but just take a derivation with the dynamic loader (which happens to be the glibc on linux). Dependency finding however is a task both wrappers will continue to need to share, and probably the most important to understand. It is currently accomplished by collecting directories of host-platform dependencies (i.e. buildInputs and nativeBuildInputs) in environment variables. The Bintools Wrapper's setup hook causes any lib and lib64 subdirectories to be added to NIX_LDFLAGS. Since the CC Wrapper and the Bintools Wrapper use the same strategy, most of the Bintools Wrapper code is sparsely commented and refers to the CC Wrapper. But the CC Wrapper's code, by contrast, has quite lengthy comments. The Bintools Wrapper merely cites those, rather than repeating them, to avoid falling out of sync. - A final task of the setup hook is defining a number of standard - environment variables to tell build systems which executables fulfill - which purpose. They are defined to just be the base name of the tools, - under the assumption that the Bintools Wrapper's binaries will be on the - path. Firstly, this helps poorly-written packages, e.g. ones that look - for just gcc when CC isn't defined yet - clang is to be used. Secondly, this helps packages - not get confused when cross-compiling, in which case multiple Bintools - Wrappers may simultaneously be in use. + A final task of the setup hook is defining a number of standard environment variables to tell build systems which executables fulfill which purpose. They are defined to just be the base name of the tools, under the assumption that the Bintools Wrapper's binaries will be on the path. Firstly, this helps poorly-written packages, e.g. ones that look for just gcc when CC isn't defined yet clang is to be used. Secondly, this helps packages not get confused when cross-compiling, in which case multiple Bintools Wrappers may simultaneously be in use. - Each wrapper targets a single platform, so if binaries for multiple - platforms are needed, the underlying binaries must be wrapped multiple - times. As this is a property of the wrapper itself, the multiple - wrappings are needed whether or not the same underlying binaries can - target multiple platforms. + Each wrapper targets a single platform, so if binaries for multiple platforms are needed, the underlying binaries must be wrapped multiple times. As this is a property of the wrapper itself, the multiple wrappings are needed whether or not the same underlying binaries can target multiple platforms. - BUILD_- and TARGET_-prefixed versions of - the normal environment variable are defined for additional Bintools - Wrappers, properly disambiguating them. + BUILD_- and TARGET_-prefixed versions of the normal environment variable are defined for additional Bintools Wrappers, properly disambiguating them. - A problem with this final task is that the Bintools Wrapper is honest - and defines LD as ld. Most packages, - however, firstly use the C compiler for linking, secondly use - LD anyways, defining it as the C compiler, and thirdly, - only so define LD when it is undefined as a fallback. - This triple-threat means Bintools Wrapper will break those packages, as - LD is already defined as the actual linker which the package won't - override yet doesn't want to use. The workaround is to define, just for - the problematic package, LD as the C compiler. A good way - to do this would be preConfigure = "LD=$CC". + A problem with this final task is that the Bintools Wrapper is honest and defines LD as ld. Most packages, however, firstly use the C compiler for linking, secondly use LD anyways, defining it as the C compiler, and thirdly, only so define LD when it is undefined as a fallback. This triple-threat means Bintools Wrapper will break those packages, as LD is already defined as the actual linker which the package won't override yet doesn't want to use. The workaround is to define, just for the problematic package, LD as the C compiler. A good way to do this would be preConfigure = "LD=$CC". @@ -2472,31 +1855,13 @@ addEnvHooks "$hostOffset" myBashFunction - The CC Wrapper wraps a C toolchain for a bunch of miscellaneous - purposes. Specifically, a C compiler (GCC or Clang), wrapped binary - tools, and a C standard library (glibc or Darwin's libSystem, just for - the dynamic loader) are all fed in, and dependency finding, hardening - (see below), and purity checks for each are handled by the CC Wrapper. - Packages typically depend on the CC Wrapper, which in turn (at run-time) - depends on the Bintools Wrapper. + The CC Wrapper wraps a C toolchain for a bunch of miscellaneous purposes. Specifically, a C compiler (GCC or Clang), wrapped binary tools, and a C standard library (glibc or Darwin's libSystem, just for the dynamic loader) are all fed in, and dependency finding, hardening (see below), and purity checks for each are handled by the CC Wrapper. Packages typically depend on the CC Wrapper, which in turn (at run-time) depends on the Bintools Wrapper. - Dependency finding is undoubtedly the main task of the CC Wrapper. This - works just like the Bintools Wrapper, except that any - include subdirectory of any relevant dependency is - added to NIX_CFLAGS_COMPILE. The setup hook itself - contains some lengthy comments describing the exact convoluted mechanism - by which this is accomplished. + Dependency finding is undoubtedly the main task of the CC Wrapper. This works just like the Bintools Wrapper, except that any include subdirectory of any relevant dependency is added to NIX_CFLAGS_COMPILE. The setup hook itself contains some lengthy comments describing the exact convoluted mechanism by which this is accomplished. - Similarly, the CC Wrapper follows the Bintools Wrapper in defining - standard environment variables with the names of the tools it wraps, for - the same reasons described above. Importantly, while it includes a - cc symlink to the c compiler for portability, the - CC will be defined using the compiler's "real name" (i.e. - gcc or clang). This helps lousy - build systems that inspect on the name of the compiler rather than run - it. + Similarly, the CC Wrapper follows the Bintools Wrapper in defining standard environment variables with the names of the tools it wraps, for the same reasons described above. Importantly, while it includes a cc symlink to the c compiler for portability, the CC will be defined using the compiler's "real name" (i.e. gcc or clang). This helps lousy build systems that inspect on the name of the compiler rather than run it. @@ -2504,9 +1869,7 @@ addEnvHooks "$hostOffset" myBashFunction - Here are some more packages that provide a setup hook. Since the list of - hooks is extensible, this is not an exhaustive list the mechanism is only to - be used as a last resort, it might cover most uses. + Here are some more packages that provide a setup hook. Since the list of hooks is extensible, this is not an exhaustive list the mechanism is only to be used as a last resort, it might cover most uses. @@ -2514,11 +1877,7 @@ addEnvHooks "$hostOffset" myBashFunction - Adds the lib/site_perl subdirectory of each build - input to the PERL5LIB environment variable. For instance, - if buildInputs contains Perl, then the - lib/site_perl subdirectory of each input is added - to the PERL5LIB environment variable. + Adds the lib/site_perl subdirectory of each build input to the PERL5LIB environment variable. For instance, if buildInputs contains Perl, then the lib/site_perl subdirectory of each input is added to the PERL5LIB environment variable. @@ -2528,9 +1887,7 @@ addEnvHooks "$hostOffset" myBashFunction - Adds the lib/${python.libPrefix}/site-packages - subdirectory of each build input to the PYTHONPATH - environment variable. + Adds the lib/${python.libPrefix}/site-packages subdirectory of each build input to the PYTHONPATH environment variable. @@ -2540,9 +1897,7 @@ addEnvHooks "$hostOffset" myBashFunction - Adds the lib/pkgconfig and - share/pkgconfig subdirectories of each build input - to the PKG_CONFIG_PATH environment variable. + Adds the lib/pkgconfig and share/pkgconfig subdirectories of each build input to the PKG_CONFIG_PATH environment variable. @@ -2552,8 +1907,7 @@ addEnvHooks "$hostOffset" myBashFunction - Adds the share/aclocal subdirectory of each build - input to the ACLOCAL_PATH environment variable. + Adds the share/aclocal subdirectory of each build input to the ACLOCAL_PATH environment variable. @@ -2563,12 +1917,7 @@ addEnvHooks "$hostOffset" myBashFunction - The autoreconfHook derivation adds - autoreconfPhase, which runs autoreconf, libtoolize - and automake, essentially preparing the configure script in - autotools-based builds. Most autotools-based packages come with the - configure script pre-generated, but this hook is necessary for a few - packages and when you need to patch the package’s configure scripts. + The autoreconfHook derivation adds autoreconfPhase, which runs autoreconf, libtoolize and automake, essentially preparing the configure script in autotools-based builds. Most autotools-based packages come with the configure script pre-generated, but this hook is necessary for a few packages and when you need to patch the package’s configure scripts. @@ -2578,10 +1927,7 @@ addEnvHooks "$hostOffset" myBashFunction - Adds every file named catalog.xml found under the - xml/dtd and xml/xsl - subdirectories of each build input to the - XML_CATALOG_FILES environment variable. + Adds every file named catalog.xml found under the xml/dtd and xml/xsl subdirectories of each build input to the XML_CATALOG_FILES environment variable. @@ -2591,8 +1937,7 @@ addEnvHooks "$hostOffset" myBashFunction - Adds the share/texmf-nix subdirectory of each build - input to the TEXINPUTS environment variable. + Adds the share/texmf-nix subdirectory of each build input to the TEXINPUTS environment variable. @@ -2612,9 +1957,7 @@ addEnvHooks "$hostOffset" myBashFunction - Exports GDK_PIXBUF_MODULE_FILE environment variable to - the builder. Add librsvg package to buildInputs to - get svg support. + Exports GDK_PIXBUF_MODULE_FILE environment variable to the builder. Add librsvg package to buildInputs to get svg support. @@ -2624,8 +1967,7 @@ addEnvHooks "$hostOffset" myBashFunction - Creates a temporary package database and registers every Haskell build - input in it (TODO: how?). + Creates a temporary package database and registers every Haskell build input in it (TODO: how?). @@ -2635,8 +1977,7 @@ addEnvHooks "$hostOffset" myBashFunction - Hooks related to GNOME platform and related libraries like GLib, GTK and - GStreamer are described in . + Hooks related to GNOME platform and related libraries like GLib, GTK and GStreamer are described in . @@ -2646,15 +1987,10 @@ addEnvHooks "$hostOffset" myBashFunction - This is a special setup hook which helps in packaging proprietary - software in that it automatically tries to find missing shared library - dependencies of ELF files based on the given - buildInputs and nativeBuildInputs. + This is a special setup hook which helps in packaging proprietary software in that it automatically tries to find missing shared library dependencies of ELF files based on the given buildInputs and nativeBuildInputs. - You can also specify a runtimeDependencies environment - variable which lists dependencies that are unconditionally added to all - executables. + You can also specify a runtimeDependencies environment variable which lists dependencies that are unconditionally added to all executables. This is useful for programs that use @@ -2662,16 +1998,10 @@ addEnvHooks "$hostOffset" myBashFunction 3 to load libraries at runtime. - In certain situations you may want to run the main command - (autoPatchelf) of the setup hook on a file or a set - of directories instead of unconditionally patching all outputs. This can - be done by setting the dontAutoPatchelf environment - variable to a non-empty value. + In certain situations you may want to run the main command (autoPatchelf) of the setup hook on a file or a set of directories instead of unconditionally patching all outputs. This can be done by setting the dontAutoPatchelf environment variable to a non-empty value. - The autoPatchelf command also recognizes a - --no-recurse command line flag, - which prevents it from recursing into subdirectories. + The autoPatchelf command also recognizes a --no-recurse command line flag, which prevents it from recursing into subdirectories. @@ -2681,36 +2011,16 @@ addEnvHooks "$hostOffset" myBashFunction - This hook will make a build pause instead of stopping when a failure - happens. It prevents nix from cleaning up the build environment - immediately and allows the user to attach to a build environment using - the cntr command. Upon build error it will print - instructions on how to use cntr, which can be used to - enter the environment for debugging. Installing cntr and running the - command will provide shell access to the build sandbox of failed build. - At /var/lib/cntr the sandboxed filesystem is - mounted. All commands and files of the system are still accessible - within the shell. To execute commands from the sandbox use the cntr exec - subcommand. cntr is only supported on Linux-based - platforms. To use it first add cntr to your - environment.systemPackages on NixOS or alternatively - to the root user on non-NixOS systems. Then in the package that is - supposed to be inspected, add breakpointHook to - nativeBuildInputs. + This hook will make a build pause instead of stopping when a failure happens. It prevents nix from cleaning up the build environment immediately and allows the user to attach to a build environment using the cntr command. Upon build error it will print instructions on how to use cntr, which can be used to enter the environment for debugging. Installing cntr and running the command will provide shell access to the build sandbox of failed build. At /var/lib/cntr the sandboxed filesystem is mounted. All commands and files of the system are still accessible within the shell. To execute commands from the sandbox use the cntr exec subcommand. cntr is only supported on Linux-based platforms. To use it first add cntr to your environment.systemPackages on NixOS or alternatively to the root user on non-NixOS systems. Then in the package that is supposed to be inspected, add breakpointHook to nativeBuildInputs. nativeBuildInputs = [ breakpointHook ]; - When a build failure happens there will be an instruction printed that - shows how to attach with cntr to the build sandbox. + When a build failure happens there will be an instruction printed that shows how to attach with cntr to the build sandbox. Caution with remote builds - This won't work with remote builds as the build environment is on a - different machine and can't be accessed by cntr. - Remote builds can be turned off by setting --option builders - '' for nix-build or --builders - '' for nix build. + This won't work with remote builds as the build environment is on a different machine and can't be accessed by cntr. Remote builds can be turned off by setting --option builders '' for nix-build or --builders '' for nix build. @@ -2721,28 +2031,13 @@ nativeBuildInputs = [ breakpointHook ]; - This hook helps with installing manpages and shell completion files. It - exposes 2 shell functions installManPage and - installShellCompletion that can be used from your - postInstall hook. + This hook helps with installing manpages and shell completion files. It exposes 2 shell functions installManPage and installShellCompletion that can be used from your postInstall hook. - The installManPage function takes one or more paths - to manpages to install. The manpages must have a section suffix, and may - optionally be compressed (with .gz suffix). This - function will place them into the correct directory. + The installManPage function takes one or more paths to manpages to install. The manpages must have a section suffix, and may optionally be compressed (with .gz suffix). This function will place them into the correct directory. - The installShellCompletion function takes one or more - paths to shell completion files. By default it will autodetect the shell - type from the completion file extension, but you may also specify it by - passing one of --bash, --fish, or - --zsh. These flags apply to all paths listed after - them (up until another shell flag is given). Each path may also have a - custom installation name provided by providing a flag --name - NAME before the path. If this flag is not provided, zsh - completions will be renamed automatically such that - foobar.zsh becomes _foobar. + The installShellCompletion function takes one or more paths to shell completion files. By default it will autodetect the shell type from the completion file extension, but you may also specify it by passing one of --bash, --fish, or --zsh. These flags apply to all paths listed after them (up until another shell flag is given). Each path may also have a custom installation name provided by providing a flag --name NAME before the path. If this flag is not provided, zsh completions will be renamed automatically such that foobar.zsh becomes _foobar. nativeBuildInputs = [ installShellFiles ]; postInstall = '' @@ -2764,13 +2059,7 @@ postInstall = '' - A few libraries automatically add to NIX_LDFLAGS - their library, making their symbols automatically available to the - linker. This includes libiconv and libintl (gettext). This is done to - provide compatibility between GNU Linux, where libiconv and libintl are - bundled in, and other systems where that might not be the case. - Sometimes, this behavior is not desired. To disable this behavior, set - dontAddExtraLibs. + A few libraries automatically add to NIX_LDFLAGS their library, making their symbols automatically available to the linker. This includes libiconv and libintl (gettext). This is done to provide compatibility between GNU Linux, where libiconv and libintl are bundled in, and other systems where that might not be the case. Sometimes, this behavior is not desired. To disable this behavior, set dontAddExtraLibs. @@ -2780,16 +2069,7 @@ postInstall = '' - Overrides the default configure phase to run the CMake command. By - default, we use the Make generator of CMake. In addition, dependencies - are added automatically to CMAKE_PREFIX_PATH so that packages are - correctly detected by CMake. Some additional flags are passed in to give - similar behavior to configure-based packages. You can disable this - hook’s behavior by setting configurePhase to a custom value, or by - setting dontUseCmakeConfigure. cmakeFlags controls flags passed only to - CMake. By default, parallel building is enabled as CMake supports - parallel building almost everywhere. When Ninja is also in use, CMake - will detect that and use the ninja generator. + Overrides the default configure phase to run the CMake command. By default, we use the Make generator of CMake. In addition, dependencies are added automatically to CMAKE_PREFIX_PATH so that packages are correctly detected by CMake. Some additional flags are passed in to give similar behavior to configure-based packages. You can disable this hook’s behavior by setting configurePhase to a custom value, or by setting dontUseCmakeConfigure. cmakeFlags controls flags passed only to CMake. By default, parallel building is enabled as CMake supports parallel building almost everywhere. When Ninja is also in use, CMake will detect that and use the ninja generator. @@ -2799,11 +2079,7 @@ postInstall = '' - Overrides the build and install phases to run the “xcbuild” command. - This hook is needed when a project only comes with build files for the - XCode build system. You can disable this behavior by setting buildPhase - and configurePhase to a custom value. xcbuildFlags controls flags passed - only to xcbuild. + Overrides the build and install phases to run the “xcbuild” command. This hook is needed when a project only comes with build files for the XCode build system. You can disable this behavior by setting buildPhase and configurePhase to a custom value. xcbuildFlags controls flags passed only to xcbuild. @@ -2813,10 +2089,7 @@ postInstall = '' - Overrides the configure phase to run meson to generate Ninja files. To - run these files, you should accompany Meson with ninja. By default, - enableParallelBuilding is enabled as Meson supports - parallel building almost everywhere. + Overrides the configure phase to run meson to generate Ninja files. To run these files, you should accompany Meson with ninja. By default, enableParallelBuilding is enabled as Meson supports parallel building almost everywhere. Variables controlling Meson @@ -2836,10 +2109,8 @@ postInstall = '' - Which - --buildtype - to pass to Meson. We default to plain. + Which --buildtype to pass to Meson. We default to plain. @@ -2849,10 +2120,8 @@ postInstall = '' - What value to set - -Dauto_features= - to. We default to enabled. + What value to set -Dauto_features= to. We default to enabled. @@ -2862,11 +2131,8 @@ postInstall = '' - What value to set - -Dwrap_mode= - to. We default to nodownload as we disallow - network access. + What value to set -Dwrap_mode= to. We default to nodownload as we disallow network access. @@ -2889,10 +2155,7 @@ postInstall = '' - Overrides the build, install, and check phase to run ninja instead of - make. You can disable this behavior with the dontUseNinjaBuild, - dontUseNinjaInstall, and dontUseNinjaCheck, respectively. Parallel - building is enabled by default in Ninja. + Overrides the build, install, and check phase to run ninja instead of make. You can disable this behavior with the dontUseNinjaBuild, dontUseNinjaInstall, and dontUseNinjaCheck, respectively. Parallel building is enabled by default in Ninja. @@ -2902,8 +2165,7 @@ postInstall = '' - This setup hook will allow you to unzip .zip files specified in $src. - There are many similar packages like unrar, undmg, etc. + This setup hook will allow you to unzip .zip files specified in $src. There are many similar packages like unrar, undmg, etc. @@ -2913,10 +2175,7 @@ postInstall = '' - Overrides the configure, build, and install phases. This will run the - "waf" script used by many projects. If wafPath (default ./waf) doesn’t - exist, it will copy the version of waf available in Nixpkgs. wafFlags - can be used to pass flags to the waf script. + Overrides the configure, build, and install phases. This will run the "waf" script used by many projects. If wafPath (default ./waf) doesn’t exist, it will copy the version of waf available in Nixpkgs. wafFlags can be used to pass flags to the waf script. @@ -2926,9 +2185,7 @@ postInstall = '' - Overrides the build, install, and check phases. This uses the scons - build system as a replacement for make. scons does not provide a - configure phase, so everything is managed at build and install time. + Overrides the build, install, and check phases. This uses the scons build system as a replacement for make. scons does not provide a configure phase, so everything is managed at build and install time. @@ -2939,40 +2196,26 @@ postInstall = '' Purity in Nixpkgs - [measures taken to prevent dependencies on packages outside the store, and - what you can do to prevent them] + [measures taken to prevent dependencies on packages outside the store, and what you can do to prevent them] - GCC doesn't search in locations such as /usr/include. - In fact, attempts to add such directories through the - flag are filtered out. Likewise, the linker (from GNU binutils) doesn't - search in standard locations such as /usr/lib. Programs - built on Linux are linked against a GNU C Library that likewise doesn't - search in the default system locations. + GCC doesn't search in locations such as /usr/include. In fact, attempts to add such directories through the flag are filtered out. Likewise, the linker (from GNU binutils) doesn't search in standard locations such as /usr/lib. Programs built on Linux are linked against a GNU C Library that likewise doesn't search in the default system locations.
Hardening in Nixpkgs - There are flags available to harden packages at compile or link-time. These - can be toggled using the stdenv.mkDerivation parameters - hardeningDisable and hardeningEnable. + There are flags available to harden packages at compile or link-time. These can be toggled using the stdenv.mkDerivation parameters hardeningDisable and hardeningEnable. - Both parameters take a list of flags as strings. The special - "all" flag can be passed to - hardeningDisable to turn off all hardening. These flags - can also be used as environment variables for testing or development - purposes. + Both parameters take a list of flags as strings. The special "all" flag can be passed to hardeningDisable to turn off all hardening. These flags can also be used as environment variables for testing or development purposes. - The following flags are enabled by default and might require disabling with - hardeningDisable if the program to package is - incompatible. + The following flags are enabled by default and might require disabling with hardeningDisable if the program to package is incompatible. @@ -2982,13 +2225,7 @@ postInstall = '' - Adds the compiler options. At present, this warns - about calls to printf and scanf - functions where the format string is not a string literal and there are - no format arguments, as in printf(foo);. This may be a - security hole if the format string came from untrusted input and contains - %n. + Adds the compiler options. At present, this warns about calls to printf and scanf functions where the format string is not a string literal and there are no format arguments, as in printf(foo);. This may be a security hole if the format string came from untrusted input and contains %n. This needs to be turned off or fixed for errors similar to: @@ -3007,12 +2244,7 @@ cc1plus: some warnings being treated as errors - Adds the compiler options. This adds safety checks - against stack overwrites rendering many potential code injection attacks - into aborting situations. In the best case this turns code injection - vulnerabilities into denial of service or into non-issues (depending on - the application). + Adds the compiler options. This adds safety checks against stack overwrites rendering many potential code injection attacks into aborting situations. In the best case this turns code injection vulnerabilities into denial of service or into non-issues (depending on the application). This needs to be turned off or fixed for errors similar to: @@ -3029,19 +2261,10 @@ bin/blib.a(bios_console.o): In function `bios_handle_cup': - Adds the compiler options. - During code generation the compiler knows a great deal of information - about buffer sizes (where possible), and attempts to replace insecure - unlimited length buffer function calls with length-limited ones. This is - especially useful for old, crufty code. Additionally, format strings in - writable memory that contain '%n' are blocked. If an application depends - on such a format string, it will need to be worked around. + Adds the compiler options. During code generation the compiler knows a great deal of information about buffer sizes (where possible), and attempts to replace insecure unlimited length buffer function calls with length-limited ones. This is especially useful for old, crufty code. Additionally, format strings in writable memory that contain '%n' are blocked. If an application depends on such a format string, it will need to be worked around. - Additionally, some warnings are enabled which might trigger build - failures if compiler warnings are treated as errors in the package build. - In this case, set to - . + Additionally, some warnings are enabled which might trigger build failures if compiler warnings are treated as errors in the package build. In this case, set to . This needs to be turned off or fixed for errors similar to: @@ -3070,15 +2293,10 @@ fcntl2.h:50:4: error: call to '__open_missing_mode' declared with attribute erro - Adds the compiler options. This options adds - support for position independent code in shared libraries and thus making - ASLR possible. + Adds the compiler options. This options adds support for position independent code in shared libraries and thus making ASLR possible. - Most notably, the Linux kernel, kernel modules and other code not running - in an operating system environment like boot loaders won't build with PIC - enabled. The compiler will is most cases complain that PIC is not - supported for a specific build. + Most notably, the Linux kernel, kernel modules and other code not running in an operating system environment like boot loaders won't build with PIC enabled. The compiler will is most cases complain that PIC is not supported for a specific build. This needs to be turned off or fixed for assembler errors similar to: @@ -3095,13 +2313,7 @@ ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_le - Signed integer overflow is undefined behaviour according to the C - standard. If it happens, it is an error in the program as it should check - for overflow before it can happen, not afterwards. GCC provides built-in - functions to perform arithmetic with overflow checking, which are correct - and faster than any custom implementation. As a workaround, the option - makes gcc behave as if signed - integer overflows were defined. + Signed integer overflow is undefined behaviour according to the C standard. If it happens, it is an error in the program as it should check for overflow before it can happen, not afterwards. GCC provides built-in functions to perform arithmetic with overflow checking, which are correct and faster than any custom implementation. As a workaround, the option makes gcc behave as if signed integer overflows were defined. This flag should not trigger any build or runtime errors. @@ -3114,18 +2326,10 @@ ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_le - Adds the linker option. During program load, - several ELF memory sections need to be written to by the linker, but can - be turned read-only before turning over control to the program. This - prevents some GOT (and .dtors) overwrite attacks, but at least the part - of the GOT used by the dynamic linker (.got.plt) is still vulnerable. + Adds the linker option. During program load, several ELF memory sections need to be written to by the linker, but can be turned read-only before turning over control to the program. This prevents some GOT (and .dtors) overwrite attacks, but at least the part of the GOT used by the dynamic linker (.got.plt) is still vulnerable. - This flag can break dynamic shared object loading. For instance, the - module systems of Xorg and OpenCV are incompatible with this flag. In - almost all cases the bindnow flag must also be - disabled and incompatible programs typically fail with similar errors at - runtime. + This flag can break dynamic shared object loading. For instance, the module systems of Xorg and OpenCV are incompatible with this flag. In almost all cases the bindnow flag must also be disabled and incompatible programs typically fail with similar errors at runtime. @@ -3135,18 +2339,10 @@ ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_le - Adds the linker option. During program load, - all dynamic symbols are resolved, allowing for the complete GOT to be - marked read-only (due to relro). This prevents GOT - overwrite attacks. For very large applications, this can incur some - performance loss during initial load while symbols are resolved, but this - shouldn't be an issue for daemons. + Adds the linker option. During program load, all dynamic symbols are resolved, allowing for the complete GOT to be marked read-only (due to relro). This prevents GOT overwrite attacks. For very large applications, this can incur some performance loss during initial load while symbols are resolved, but this shouldn't be an issue for daemons. - This flag can break dynamic shared object loading. For instance, the - module systems of Xorg and PHP are incompatible with this flag. Programs - incompatible with this flag often fail at runtime due to missing symbols, - like: + This flag can break dynamic shared object loading. For instance, the module systems of Xorg and PHP are incompatible with this flag. Programs incompatible with this flag often fail at runtime due to missing symbols, like: intel_drv.so: undefined symbol: vgaHWFreeHWRec @@ -3156,9 +2352,7 @@ intel_drv.so: undefined symbol: vgaHWFreeHWRec - The following flags are disabled by default and should be enabled with - hardeningEnable for packages that take untrusted input - like network services. + The following flags are disabled by default and should be enabled with hardeningEnable for packages that take untrusted input like network services. @@ -3168,31 +2362,14 @@ intel_drv.so: undefined symbol: vgaHWFreeHWRec - Adds the compiler and linker - options. Position Independent Executables are needed to take advantage of - Address Space Layout Randomization, supported by modern kernel versions. - While ASLR can already be enforced for data areas in the stack and heap - (brk and mmap), the code areas must be compiled as position-independent. - Shared libraries already do this with the pic flag, so - they gain ASLR automatically, but binary .text regions need to be build - with pie to gain ASLR. When this happens, ROP attacks - are much harder since there are no static locations to bounce off of - during a memory corruption attack. + Adds the compiler and linker options. Position Independent Executables are needed to take advantage of Address Space Layout Randomization, supported by modern kernel versions. While ASLR can already be enforced for data areas in the stack and heap (brk and mmap), the code areas must be compiled as position-independent. Shared libraries already do this with the pic flag, so they gain ASLR automatically, but binary .text regions need to be build with pie to gain ASLR. When this happens, ROP attacks are much harder since there are no static locations to bounce off of during a memory corruption attack. - For more in-depth information on these hardening flags and hardening in - general, refer to the - Debian Wiki, - Ubuntu - Wiki, - Gentoo - Wiki, and the - - Arch Wiki. + For more in-depth information on these hardening flags and hardening in general, refer to the Debian Wiki, Ubuntu Wiki, Gentoo Wiki, and the Arch Wiki.
diff --git a/doc/submitting-changes.xml b/doc/submitting-changes.xml index a04ec08b048..9c98abbe87a 100644 --- a/doc/submitting-changes.xml +++ b/doc/submitting-changes.xml @@ -8,8 +8,7 @@ - Read Manual (How to - write packages for Nix). + Read Manual (How to write packages for Nix). @@ -23,15 +22,11 @@ - You can make branch from a commit of your local - nixos-version. That will help you to avoid - additional local compilations. Because you will receive packages from - binary cache. + You can make branch from a commit of your local nixos-version. That will help you to avoid additional local compilations. Because you will receive packages from binary cache. - For example: nixos-version returns - 15.05.git.0998212 (Dingo). So you can do: + For example: nixos-version returns 15.05.git.0998212 (Dingo). So you can do: @@ -55,9 +50,7 @@ - If you removed pkgs, made some major NixOS changes etc., write about - them in - nixos/doc/manual/release-notes/rl-unstable.xml. + If you removed pkgs, made some major NixOS changes etc., write about them in nixos/doc/manual/release-notes/rl-unstable.xml. @@ -65,8 +58,7 @@ - Check for unnecessary whitespace with git diff --check - before committing. + Check for unnecessary whitespace with git diff --check before committing. @@ -121,8 +113,7 @@ Additional information. - nix-env -i pkg-name -f <path to your local nixpkgs - folder> + nix-env -i pkg-name -f <path to your local nixpkgs folder> @@ -134,14 +125,12 @@ Additional information. - Make sure it's in - pkgs/top-level/all-packages.nix + Make sure it's in pkgs/top-level/all-packages.nix - nix-env -i pkg-name -f <path to your local nixpkgs - folder> + nix-env -i pkg-name -f <path to your local nixpkgs folder> @@ -149,15 +138,11 @@ Additional information. - If you don't want to install pkg in you - profile. + If you don't want to install pkg in you profile. - nix-build -A pkg-attribute-name <path to your local - nixpkgs folder>/default.nix and check results in the - folder result. It will appear in the same - directory where you did nix-build. + nix-build -A pkg-attribute-name <path to your local nixpkgs folder>/default.nix and check results in the folder result. It will appear in the same directory where you did nix-build. @@ -165,9 +150,7 @@ Additional information. - If you did nix-env -i pkg-name you can do - nix-env -e pkg-name to uninstall it from your - system. + If you did nix-env -i pkg-name you can do nix-env -e pkg-name to uninstall it from your system. @@ -179,10 +162,7 @@ Additional information. - You can add new module to your NixOS configuration file (usually - it's /etc/nixos/configuration.nix). And do - sudo nixos-rebuild test -I nixpkgs=<path to your local - nixpkgs folder> --fast. + You can add new module to your NixOS configuration file (usually it's /etc/nixos/configuration.nix). And do sudo nixos-rebuild test -I nixpkgs=<path to your local nixpkgs folder> --fast. @@ -193,9 +173,7 @@ Additional information. - If you have commits pkg-name: oh, forgot to insert - whitespace: squash commits in this case. Use git rebase - -i. + If you have commits pkg-name: oh, forgot to insert whitespace: squash commits in this case. Use git rebase -i. @@ -220,8 +198,7 @@ Additional information. - Write the title in format (pkg-name | nixos/<module>): - improvement. + Write the title in format (pkg-name | nixos/<module>): improvement. @@ -233,8 +210,7 @@ Additional information. - Write in comment if you have tested your patch. Do not rely much on - TravisCI. + Write in comment if you have tested your patch. Do not rely much on TravisCI. @@ -244,8 +220,7 @@ Additional information. - Notify maintainers of the package. For example add to the message: - cc @jagajaga @domenkozar. + Notify maintainers of the package. For example add to the message: cc @jagajaga @domenkozar. @@ -257,64 +232,39 @@ Additional information. Pull Request Template - The pull request template helps determine what steps have been made for a - contribution so far, and will help guide maintainers on the status of a - change. The motivation section of the PR should include any extra details - the title does not address and link any existing issues related to the pull - request. + The pull request template helps determine what steps have been made for a contribution so far, and will help guide maintainers on the status of a change. The motivation section of the PR should include any extra details the title does not address and link any existing issues related to the pull request. - When a PR is created, it will be pre-populated with some checkboxes detailed - below: + When a PR is created, it will be pre-populated with some checkboxes detailed below:
Tested using sandboxing - When sandbox builds are enabled, Nix will setup an isolated environment for - each build process. It is used to remove further hidden dependencies set by - the build environment to improve reproducibility. This includes access to - the network during the build outside of fetch* - functions and files outside the Nix store. Depending on the operating - system access to other resources are blocked as well (ex. inter process - communication is isolated on Linux); see - build-use-sandbox - in Nix manual for details. + When sandbox builds are enabled, Nix will setup an isolated environment for each build process. It is used to remove further hidden dependencies set by the build environment to improve reproducibility. This includes access to the network during the build outside of fetch* functions and files outside the Nix store. Depending on the operating system access to other resources are blocked as well (ex. inter process communication is isolated on Linux); see build-use-sandbox in Nix manual for details. - Sandboxing is not enabled by default in Nix due to a small performance hit - on each build. In pull requests for - nixpkgs - people are asked to test builds with sandboxing enabled (see - Tested using sandboxing in the pull request template) - because - inhttps://nixos.org/hydra/ - sandboxing is also used. + Sandboxing is not enabled by default in Nix due to a small performance hit on each build. In pull requests for nixpkgs people are asked to test builds with sandboxing enabled (see Tested using sandboxing in the pull request template) because inhttps://nixos.org/hydra/ sandboxing is also used. - Depending if you use NixOS or other platforms you can use one of the - following methods to enable sandboxing - before building the package: + Depending if you use NixOS or other platforms you can use one of the following methods to enable sandboxing before building the package: - Globally enable sandboxing on NixOS: - add the following to configuration.nix + Globally enable sandboxing on NixOS: add the following to configuration.nix nix.useSandbox = true; - Globally enable sandboxing on non-NixOS - platforms: add the following to: - /etc/nix/nix.conf + Globally enable sandboxing on non-NixOS platforms: add the following to: /etc/nix/nix.conf build-use-sandbox = true @@ -326,11 +276,7 @@ Additional information. Built on platform(s) - Many Nix packages are designed to run on multiple platforms. As such, it's - important to let the maintainer know which platforms your changes have been - tested on. It's not always practical to test a change on all platforms, and - is not required for a pull request to be merged. Only check the systems you - tested the build on in this section. + Many Nix packages are designed to run on multiple platforms. As such, it's important to let the maintainer know which platforms your changes have been tested on. It's not always practical to test a change on all platforms, and is not required for a pull request to be merged. Only check the systems you tested the build on in this section.
@@ -338,15 +284,8 @@ Additional information. Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests) - Packages with automated tests are much more likely to be merged in a timely - fashion because it doesn't require as much manual testing by the maintainer - to verify the functionality of the package. If there are existing tests for - the package, they should be run to verify your changes do not break the - tests. Tests only apply to packages with NixOS modules defined and can only - be run on Linux. For more details on writing and running tests, see the - section - in the NixOS manual. + Packages with automated tests are much more likely to be merged in a timely fashion because it doesn't require as much manual testing by the maintainer to verify the functionality of the package. If there are existing tests for the package, they should be run to verify your changes do not break the tests. Tests only apply to packages with NixOS modules defined and can only be run on Linux. For more details on writing and running tests, see the section in the NixOS manual.
@@ -354,11 +293,7 @@ Additional information. Tested compilation of all pkgs that depend on this change using <command>nix-review</command> - If you are updating a package's version, you can use nix-review to make - sure all packages that depend on the updated package still compile - correctly. The nix-review utility can look for and build - all dependencies either based on uncommited changes with the - wip option or specifying a github pull request number. + If you are updating a package's version, you can use nix-review to make sure all packages that depend on the updated package still compile correctly. The nix-review utility can look for and build all dependencies either based on uncommited changes with the wip option or specifying a github pull request number. @@ -376,13 +311,7 @@ Additional information. Tested execution of all binary files (usually in <filename>./result/bin/</filename>) - It's important to test any executables generated by a build when you change - or create a package in nixpkgs. This can be done by looking in - ./result/bin and running any files in there, or at a - minimum, the main executable for the package. For example, if you make a - change to texlive, you probably would only check the - binaries associated with the change you made rather than testing all of - them. + It's important to test any executables generated by a build when you change or create a package in nixpkgs. This can be done by looking in ./result/bin and running any files in there, or at a minimum, the main executable for the package. For example, if you make a change to texlive, you probably would only check the binaries associated with the change you made rather than testing all of them. @@ -390,14 +319,8 @@ Additional information. Meets Nixpkgs contribution standards - The last checkbox is fits - CONTRIBUTING.md. - The contributing document has detailed information on standards the Nix - community has for commit messages, reviews, licensing of contributions you - make to the project, etc... Everyone should read and understand the - standards the community has for contributing before submitting a pull - request. + The last checkbox is fits CONTRIBUTING.md. The contributing document has detailed information on standards the Nix community has for commit messages, reviews, licensing of contributions you make to the project, etc... Everyone should read and understand the standards the community has for contributing before submitting a pull request. @@ -435,22 +358,17 @@ Additional information. - Commits must be sufficiently tested before being merged, both for the - master and staging branches. + Commits must be sufficiently tested before being merged, both for the master and staging branches. - Hydra builds for master and staging should not be used as testing - platform, it's a build farm for changes that have been already tested. + Hydra builds for master and staging should not be used as testing platform, it's a build farm for changes that have been already tested. - When changing the bootloader installation process, extra care must be - taken. Grub installations cannot be rolled back, hence changes may break - people's installations forever. For any non-trivial change to the - bootloader please file a PR asking for review, especially from @edolstra. + When changing the bootloader installation process, extra care must be taken. Grub installations cannot be rolled back, hence changes may break people's installations forever. For any non-trivial change to the bootloader please file a PR asking for review, especially from @edolstra. @@ -473,20 +391,12 @@ Additional information. - It's only for non-breaking mass-rebuild commits. That means it's not to - be used for testing, and changes must have been well tested already. - Read - policy here. + It's only for non-breaking mass-rebuild commits. That means it's not to be used for testing, and changes must have been well tested already. Read policy here. - If the branch is already in a broken state, please refrain from adding - extra new breakages. Stabilize it for a few days, merge into master, then - resume development on staging. - Keep - an eye on the staging evaluations here. If any fixes for staging - happen to be already in master, then master can be merged into staging. + If the branch is already in a broken state, please refrain from adding extra new breakages. Stabilize it for a few days, merge into master, then resume development on staging. Keep an eye on the staging evaluations here. If any fixes for staging happen to be already in master, then master can be merged into staging. @@ -498,10 +408,7 @@ Additional information. - If you're cherry-picking a commit to a stable release branch, always use - git cherry-pick -xe and ensure the message contains a - clear description about why this needs to be included in the stable - branch. + If you're cherry-picking a commit to a stable release branch, always use git cherry-pick -xe and ensure the message contains a clear description about why this needs to be included in the stable branch. An example of a cherry-picked commit would look like this:
Possible dependency types