diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-06-22 15:01:47 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-06-22 16:57:59 +0000 |
commit | 633cab0ecb07627706c6b523e219490f019eaab5 (patch) | |
tree | 4fb472bdfe2723037dad53dc1b8a87c939015f5e /nixpkgs/doc/functions | |
parent | ffb691c199e7e0cbc4e45e5310779c9e3f7c2a73 (diff) | |
parent | 432fc2d9a67f92e05438dff5fdc2b39d33f77997 (diff) | |
download | nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.gz nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.bz2 nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.lz nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.xz nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.zst nixlib-633cab0ecb07627706c6b523e219490f019eaab5.zip |
Merge commit '432fc2d9a67f92e05438dff5fdc2b39d33f77997'
# Conflicts: # nixpkgs/pkgs/applications/editors/emacs/elisp-packages/elpa-generated.nix # nixpkgs/pkgs/applications/networking/mailreaders/thunderbird/default.nix # nixpkgs/pkgs/applications/window-managers/sway/default.nix # nixpkgs/pkgs/build-support/rust/default.nix # nixpkgs/pkgs/development/go-modules/generic/default.nix
Diffstat (limited to 'nixpkgs/doc/functions')
-rw-r--r-- | nixpkgs/doc/functions/debug.section.md | 5 | ||||
-rw-r--r-- | nixpkgs/doc/functions/debug.xml | 14 | ||||
-rw-r--r-- | nixpkgs/doc/functions/library/attrsets.xml | 6 | ||||
-rw-r--r-- | nixpkgs/doc/functions/nix-gitignore.section.md | 49 | ||||
-rw-r--r-- | nixpkgs/doc/functions/nix-gitignore.xml | 70 | ||||
-rw-r--r-- | nixpkgs/doc/functions/prefer-remote-fetch.section.md | 17 | ||||
-rw-r--r-- | nixpkgs/doc/functions/prefer-remote-fetch.xml | 21 |
7 files changed, 74 insertions, 108 deletions
diff --git a/nixpkgs/doc/functions/debug.section.md b/nixpkgs/doc/functions/debug.section.md new file mode 100644 index 000000000000..b2d8589431ab --- /dev/null +++ b/nixpkgs/doc/functions/debug.section.md @@ -0,0 +1,5 @@ +# Debugging Nix Expressions {#sec-debug} + +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 running. 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/nixpkgs/doc/functions/debug.xml b/nixpkgs/doc/functions/debug.xml deleted file mode 100644 index c27421f12e76..000000000000 --- a/nixpkgs/doc/functions/debug.xml +++ /dev/null @@ -1,14 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - xml:id="sec-debug"> - <title>Debugging Nix Expressions</title> - - <para> - 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. - </para> - - <para> - In the <literal>lib/debug.nix</literal> 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 <literal>lib/debug.nix</literal> for usage information. - </para> -</section> diff --git a/nixpkgs/doc/functions/library/attrsets.xml b/nixpkgs/doc/functions/library/attrsets.xml index de8414249abf..ef132514da11 100644 --- a/nixpkgs/doc/functions/library/attrsets.xml +++ b/nixpkgs/doc/functions/library/attrsets.xml @@ -166,7 +166,7 @@ lib.attrsets.setAttrByPath [ "a" "b" ] 3 <xi:include href="./locations.xml" xpointer="lib.attrsets.getAttrFromPath" /> <para> - Like <xref linkend="function-library-lib.attrsets.attrByPath" /> except without a default, and it will throw if the value doesn't exist. + Like [](#function-library-lib.attrsets.attrByPath) except without a default, and it will throw if the value doesn't exist. </para> <variablelist> @@ -855,7 +855,7 @@ lib.attrsets.mapAttrs' (name: value: lib.attrsets.nameValuePair ("foo_" + name) <title><function>lib.attrsets.mapAttrsToList</function></title> <subtitle><literal>mapAttrsToList :: (String -> Any -> Any) -> - AttrSet -> Any</literal> + AttrSet -> [Any]</literal> </subtitle> <xi:include href="./locations.xml" xpointer="lib.attrsets.mapAttrsToList" /> @@ -1480,7 +1480,7 @@ lib.attrsets.zipAttrsWith <xi:include href="./locations.xml" xpointer="lib.attrsets.zipAttrs" /> <para> - Merge sets of attributes and combine each attribute value in to a list. Similar to <xref linkend="function-library-lib.attrsets.zipAttrsWith" /> 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 [](#function-library-lib.attrsets.zipAttrsWith) where the merge function returns a list of all values. </para> <variablelist> diff --git a/nixpkgs/doc/functions/nix-gitignore.section.md b/nixpkgs/doc/functions/nix-gitignore.section.md new file mode 100644 index 000000000000..2fb833b23000 --- /dev/null +++ b/nixpkgs/doc/functions/nix-gitignore.section.md @@ -0,0 +1,49 @@ +# pkgs.nix-gitignore {#sec-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. + +## Usage {#sec-pkgs-nix-gitignore-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. + +```nix +{ pkgs ? import <nixpkgs> {} }: + + nix-gitignore.gitignoreSource [] ./source + # Simplest version + + nix-gitignore.gitignoreSource "supplemental-ignores\n" ./source + # This one reads the ./source/.gitignore and concats the auxiliary ignores + + nix-gitignore.gitignoreSourcePure "ignore-this\nignore-that\n" ./source + # Use this string as gitignore, don't read ./source/.gitignore. + + nix-gitignore.gitignoreSourcePure ["ignore-this\nignore-that\n", ~/.gitignore] ./source + # It also accepts a list (of strings and paths) that will be concatenated + # once the paths are turned to strings via readFile. +``` + +These functions are derived from the `Filter` functions by setting the first filter argument to `(_: _: true)`: + +```nix +gitignoreSourcePure = gitignoreFilterSourcePure (_: _: true); +gitignoreSource = gitignoreFilterSource (_: _: 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 if it\'s blacklisted by either your filter or the gitignoreFilter. + +If you want to make your own filter from scratch, you may use + +```nix +gitignoreFilter = ign: root: filterPattern (gitignoreToPatterns ign) root; +``` + +## gitignore files in subdirectories {#sec-pkgs-nix-gitignore-usage-recursive} + +If you wish to use a filter that would search for .gitignore files in subdirectories, just like git does by default, use this function: + +```nix +gitignoreFilterRecursiveSource = filter: patterns: root: +# OR +gitignoreRecursiveSource = gitignoreFilterSourcePure (_: _: true); +``` diff --git a/nixpkgs/doc/functions/nix-gitignore.xml b/nixpkgs/doc/functions/nix-gitignore.xml deleted file mode 100644 index 37a82b196ccf..000000000000 --- a/nixpkgs/doc/functions/nix-gitignore.xml +++ /dev/null @@ -1,70 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - xml:id="sec-pkgs-nix-gitignore"> - <title>pkgs.nix-gitignore</title> - - <para> - <function>pkgs.nix-gitignore</function> is a function that acts similarly to <literal>builtins.filterSource</literal> but also allows filtering with the help of the gitignore format. - </para> - - <section xml:id="sec-pkgs-nix-gitignore-usage"> - <title>Usage</title> - - <para> - <literal>pkgs.nix-gitignore</literal> exports a number of functions, but you'll most likely need either <literal>gitignoreSource</literal> or <literal>gitignoreSourcePure</literal>. 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. - </para> - -<programlisting><![CDATA[ -{ pkgs ? import <nixpkgs> {} }: - - nix-gitignore.gitignoreSource [] ./source - # Simplest version - - nix-gitignore.gitignoreSource "supplemental-ignores\n" ./source - # This one reads the ./source/.gitignore and concats the auxiliary ignores - - nix-gitignore.gitignoreSourcePure "ignore-this\nignore-that\n" ./source - # Use this string as gitignore, don't read ./source/.gitignore. - - nix-gitignore.gitignoreSourcePure ["ignore-this\nignore-that\n", ~/.gitignore] ./source - # It also accepts a list (of strings and paths) that will be concatenated - # once the paths are turned to strings via readFile. - ]]></programlisting> - - <para> - These functions are derived from the <literal>Filter</literal> functions by setting the first filter argument to <literal>(_: _: true)</literal>: - </para> - -<programlisting><![CDATA[ -gitignoreSourcePure = gitignoreFilterSourcePure (_: _: true); -gitignoreSource = gitignoreFilterSource (_: _: true); - ]]></programlisting> - - <para> - Those filter functions accept the same arguments the <literal>builtins.filterSource</literal> function would pass to its filters, thus <literal>fn: gitignoreFilterSourcePure fn ""</literal> should be extensionally equivalent to <literal>filterSource</literal>. The file is blacklisted iff it's blacklisted by either your filter or the gitignoreFilter. - </para> - - <para> - If you want to make your own filter from scratch, you may use - </para> - -<programlisting><![CDATA[ -gitignoreFilter = ign: root: filterPattern (gitignoreToPatterns ign) root; - ]]></programlisting> - </section> - - <section xml:id="sec-pkgs-nix-gitignore-usage-recursive"> - <title>gitignore files in subdirectories</title> - - <para> - If you wish to use a filter that would search for .gitignore files in subdirectories, just like git does by default, use this function: - </para> - -<programlisting><![CDATA[ -gitignoreFilterRecursiveSource = filter: patterns: root: -# OR -gitignoreRecursiveSource = gitignoreFilterSourcePure (_: _: true); - ]]></programlisting> - </section> -</section> diff --git a/nixpkgs/doc/functions/prefer-remote-fetch.section.md b/nixpkgs/doc/functions/prefer-remote-fetch.section.md new file mode 100644 index 000000000000..8760c100224a --- /dev/null +++ b/nixpkgs/doc/functions/prefer-remote-fetch.section.md @@ -0,0 +1,17 @@ +# prefer-remote-fetch overlay {#sec-prefer-remote-fetch} + +`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: + +```nix +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 + +```ShellSession +$ mkdir ~/.config/nixpkgs/overlays/ +$ cat > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix <<EOF + self: super: super.prefer-remote-fetch self super +EOF +``` diff --git a/nixpkgs/doc/functions/prefer-remote-fetch.xml b/nixpkgs/doc/functions/prefer-remote-fetch.xml deleted file mode 100644 index 94d25d3d3aeb..000000000000 --- a/nixpkgs/doc/functions/prefer-remote-fetch.xml +++ /dev/null @@ -1,21 +0,0 @@ -<section xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/xinclude" - xml:id="sec-prefer-remote-fetch"> - <title>prefer-remote-fetch overlay</title> - - <para> - <function>prefer-remote-fetch</function> 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: -<programlisting> -self: super: - (super.prefer-remote-fetch self super) -</programlisting> - A full configuration example for that sets the overlay up for your own account, could look like this -<screen> -<prompt>$ </prompt>mkdir ~/.config/nixpkgs/overlays/ -<prompt>$ </prompt>cat > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix <<EOF - self: super: super.prefer-remote-fetch self super -EOF -</screen> - </para> -</section> |