24751 files changed+1234136−559311
21751 more files changed are not listed.
.editorconfig+5−14
@@ -55,13 +55,15 @@ trim_trailing_whitespace = unset
5555[*.lock]
5656indent_size = unset
5757
58−[eggs.nix]
58+# trailing whitespace is an actual syntax element of classic Markdown/
59+# CommonMark to enforce a line break
60+[*.md]
5961trim_trailing_whitespace = unset
6062
61−[nixos/modules/services/networking/ircd-hybrid/*.{conf,in}]
63+[eggs.nix]
6264trim_trailing_whitespace = unset
6365
64−[nixos/tests/systemd-networkd-vrf.nix]
66+[nixos/modules/services/networking/ircd-hybrid/*.{conf,in}]
6567trim_trailing_whitespace = unset
6668
6769[pkgs/build-support/dotnetenv/Wrapper/**]
@@ -70,10 +72,6 @@ indent_style = unset
7072insert_final_newline = unset
7173trim_trailing_whitespace = unset
7274
73−[pkgs/build-support/upstream-updater/**]
74−indent_style = unset
75−trim_trailing_whitespace = unset
76−
7775[pkgs/development/compilers/elm/registry.dat]
7876end_of_line = unset
7977insert_final_newline = unset
@@ -87,10 +85,3 @@ trim_trailing_whitespace = unset
8785
8886[pkgs/tools/misc/timidity/timidity.cfg]
8987trim_trailing_whitespace = unset
90−
91−[pkgs/tools/security/enpass/data.json]
92−insert_final_newline = unset
93−trim_trailing_whitespace = unset
94−
95−[pkgs/top-level/emscripten-packages.nix]
96−trim_trailing_whitespace = unset
.git-blame-ignore-revsnew file+32
@@ -0,0 +1,32 @@
1+# This file contains a list of commits that are not likely what you
2+# are looking for in a blame, such as mass reformatting or renaming.
3+# You can set this file as a default ignore file for blame by running
4+# the following command.
5+#
6+# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
7+#
8+# To temporarily not use this file add
9+# --ignore-revs-file=""
10+# to your blame command.
11+#
12+# The ignoreRevsFile can't be set globally due to blame failing if the file isn't present.
13+# To not have to set the option in every repository it is needed in,
14+# save the following script in your path with the name "git-bblame"
15+# now you can run
16+# $ git bblame $FILE
17+# to use the .git-blame-ignore-revs file if it is present.
18+#
19+# #!/usr/bin/env bash
20+# repo_root=$(git rev-parse --show-toplevel)
21+# if [[ -e $repo_root/.git-blame-ignore-revs ]]; then
22+# git blame --ignore-revs-file="$repo_root/.git-blame-ignore-revs" $@
23+# else
24+# git blame $@
25+# fi
26+
27+
28+# nixos/modules/rename: Sort alphabetically
29+1f71224fe86605ef4cd23ed327b3da7882dad382
30+
31+# nixos: fix module paths in rename.nix
32+d08ede042b74b8199dc748323768227b88efcf7c
.github/CODEOWNERS+127−63
@@ -6,12 +6,16 @@
66#
77# For documentation on this file, see https://help.github.com/articles/about-codeowners/
88# Mentioned users will get code review requests.
9+#
10+# IMPORTANT NOTE: in order to actually get pinged, commit access is required.
11+# This also holds true for GitHub teams. Since almost none of our teams have write
12+# permissions, you need to list all members of the team with commit access individually.
913
1014# This file
1115/.github/CODEOWNERS @edolstra
1216
1317# GitHub actions
14−/.github/workflows @Mic92 @zowoq
18+/.github/workflows @NixOS/Security @Mic92 @zowoq
1519/.github/workflows/merge-staging @FRidh
1620
1721# EditorConfig
@@ -19,7 +23,7 @@
1923
2024# Libraries
2125/lib @edolstra @nbp @infinisil
22−/lib/systems @nbp @ericson2314 @matthewbauer
26+/lib/systems @alyssais @nbp @ericson2314 @matthewbauer
2327/lib/generators.nix @edolstra @nbp @Profpatsch
2428/lib/cli.nix @edolstra @nbp @Profpatsch
2529/lib/debug.nix @edolstra @nbp @Profpatsch
@@ -34,14 +38,21 @@
3438/pkgs/top-level/release-cross.nix @Ericson2314 @matthewbauer
3539/pkgs/stdenv/generic @Ericson2314 @matthewbauer
3640/pkgs/stdenv/cross @Ericson2314 @matthewbauer
37−/pkgs/build-support/cc-wrapper @Ericson2314 @orivej
38−/pkgs/build-support/bintools-wrapper @Ericson2314 @orivej
41+/pkgs/build-support/cc-wrapper @Ericson2314
42+/pkgs/build-support/bintools-wrapper @Ericson2314
3943/pkgs/build-support/setup-hooks @Ericson2314
40−/pkgs/build-support/setup-hooks/auto-patchelf.sh @aszlig
44+/pkgs/build-support/setup-hooks/auto-patchelf.sh @layus
45+/pkgs/build-support/setup-hooks/auto-patchelf.py @layus
4146
4247# Nixpkgs build-support
4348/pkgs/build-support/writers @lassulus @Profpatsch
4449
50+# Nixpkgs documentation
51+/maintainers/scripts/db-to-md.sh @jtojnar @ryantm
52+/maintainers/scripts/doc @jtojnar @ryantm
53+/doc/build-aux/pandoc-filters @jtojnar
54+/doc/contributing/contributing-to-documentation.chapter.md @jtojnar
55+
4556# NixOS Internals
4657/nixos/default.nix @nbp @infinisil
4758/nixos/lib/from-env.nix @nbp @infinisil
@@ -59,10 +70,17 @@
5970/nixos/doc/manual/development/writing-modules.xml @nbp
6071/nixos/doc/manual/man-nixos-option.xml @nbp
6172/nixos/modules/installer/tools/nixos-option.sh @nbp
73+/nixos/modules/system @dasJ
6274
6375# NixOS integration test driver
6476/nixos/lib/test-driver @tfc
6577
78+# Systemd
79+/nixos/modules/system/boot/systemd.nix @NixOS/systemd
80+/nixos/modules/system/boot/systemd @NixOS/systemd
81+/nixos/lib/systemd-*.nix @NixOS/systemd
82+/pkgs/os-specific/linux/systemd @NixOS/systemd
83+
6684# Updaters
6785## update.nix
6886/maintainers/scripts/update.nix @jtojnar
@@ -71,40 +89,40 @@
7189/pkgs/common-updater/scripts/update-source-version @jtojnar
7290
7391# Python-related code and docs
74−/maintainers/scripts/update-python-libraries @FRidh
75−/pkgs/top-level/python-packages.nix @FRidh @jonringer
76−/pkgs/development/interpreters/python @FRidh
77−/pkgs/development/python-modules @FRidh @jonringer
78−/doc/languages-frameworks/python.section.md @FRidh
79−/pkgs/development/tools/poetry2nix @adisbladis
92+/maintainers/scripts/update-python-libraries @FRidh
93+/pkgs/top-level/python-packages.nix @FRidh @jonringer
94+/pkgs/development/interpreters/python @FRidh
95+/pkgs/development/python-modules @FRidh @jonringer
96+/doc/languages-frameworks/python.section.md @FRidh
97+/pkgs/development/tools/poetry2nix @adisbladis
98+/pkgs/development/interpreters/python/hooks @FRidh @jonringer
8099
81100# Haskell
82−/pkgs/development/compilers/ghc @cdepillabout
83−/pkgs/development/haskell-modules @cdepillabout
84−/pkgs/development/haskell-modules/default.nix @cdepillabout
85−/pkgs/development/haskell-modules/generic-builder.nix @cdepillabout
86−/pkgs/development/haskell-modules/hoogle.nix @cdepillabout
101+/doc/languages-frameworks/haskell.section.md @cdepillabout @sternenseemann @maralorn @expipiplus1
102+/maintainers/scripts/haskell @cdepillabout @sternenseemann @maralorn @expipiplus1
103+/pkgs/development/compilers/ghc @cdepillabout @sternenseemann @maralorn @expipiplus1
104+/pkgs/development/haskell-modules @cdepillabout @sternenseemann @maralorn @expipiplus1
105+/pkgs/test/haskell @cdepillabout @sternenseemann @maralorn @expipiplus1
106+/pkgs/top-level/release-haskell.nix @cdepillabout @sternenseemann @maralorn @expipiplus1
107+/pkgs/top-level/haskell-packages.nix @cdepillabout @sternenseemann @maralorn @expipiplus1
87108
88109# Perl
89−/pkgs/development/interpreters/perl @volth @stigtsp
90−/pkgs/top-level/perl-packages.nix @volth @stigtsp
91−/pkgs/development/perl-modules @volth @stigtsp
110+/pkgs/development/interpreters/perl @stigtsp @zakame
111+/pkgs/top-level/perl-packages.nix @stigtsp @zakame
112+/pkgs/development/perl-modules @stigtsp @zakame
92113
93114# R
94−/pkgs/applications/science/math/R @peti
95−/pkgs/development/r-modules @peti
115+/pkgs/applications/science/math/R @jbedo
116+/pkgs/development/r-modules @jbedo
96117
97118# Ruby
98−/pkgs/development/interpreters/ruby @alyssais
99−/pkgs/development/ruby-modules @alyssais
119+/pkgs/development/interpreters/ruby @marsam
120+/pkgs/development/ruby-modules @marsam
100121
101122# Rust
102123/pkgs/development/compilers/rust @Mic92 @LnL7 @zowoq
103−/pkgs/build-support/rust @andir @danieldk @zowoq
104−
105−# Darwin-related
106−/pkgs/stdenv/darwin @NixOS/darwin-maintainers
107−/pkgs/os-specific/darwin @NixOS/darwin-maintainers
124+/pkgs/build-support/rust @zowoq
125+/doc/languages-frameworks/rust.section.md @zowoq
108126
109127# C compilers
110128/pkgs/development/compilers/gcc @matthewbauer
@@ -114,21 +132,18 @@
114132/pkgs/top-level/unix-tools.nix @matthewbauer
115133/pkgs/development/tools/xcbuild @matthewbauer
116134
117−# Beam-related (Erlang, Elixir, LFE, etc)
118−/pkgs/development/beam-modules @gleber
119−/pkgs/development/interpreters/erlang @gleber
120−/pkgs/development/interpreters/lfe @gleber
121−/pkgs/development/interpreters/elixir @gleber
122−/pkgs/development/tools/build-managers/rebar @gleber
123−/pkgs/development/tools/build-managers/rebar3 @gleber
124−/pkgs/development/tools/erlang @gleber
135+# Audio
136+/nixos/modules/services/audio/botamusique.nix @mweinelt
137+/nixos/modules/services/audio/snapserver.nix @mweinelt
138+/nixos/tests/modules/services/audio/botamusique.nix @mweinelt
139+/nixos/tests/snapcast.nix @mweinelt
140+
141+# Browsers
142+/pkgs/applications/networking/browsers/firefox @mweinelt
125143
126144# Jetbrains
127145/pkgs/applications/editors/jetbrains @edwtjo
128146
129−# Eclipse
130−/pkgs/applications/editors/eclipse @rycee
131−
132147# Licenses
133148/lib/licenses.nix @alyssais
134149
@@ -139,7 +154,7 @@
139154/pkgs/development/libraries/qt-5 @ttuegel
140155
141156# PostgreSQL and related stuff
142−/pkgs/servers/sql/postgresql @thoughtpolice
157+/pkgs/servers/sql/postgresql @thoughtpolice @marsam
143158/nixos/modules/services/databases/postgresql.xml @thoughtpolice
144159/nixos/modules/services/databases/postgresql.nix @thoughtpolice
145160/nixos/tests/postgresql.nix @thoughtpolice
@@ -152,12 +167,30 @@
152167/nixos/tests/hardened.nix @joachifm
153168/pkgs/os-specific/linux/kernel/hardened-config.nix @joachifm
154169
170+# Home Automation
171+/nixos/modules/services/misc/home-assistant.nix @mweinelt
172+/nixos/modules/services/misc/zigbee2mqtt.nix @mweinelt
173+/nixos/tests/home-assistant.nix @mweinelt
174+/nixos/tests/zigbee2mqtt.nix @mweinelt
175+/pkgs/servers/home-assistant @mweinelt
176+/pkgs/tools/misc/esphome @mweinelt
177+
155178# Network Time Daemons
156179/pkgs/tools/networking/chrony @thoughtpolice
157180/pkgs/tools/networking/ntp @thoughtpolice
158181/pkgs/tools/networking/openntpd @thoughtpolice
159182/nixos/modules/services/networking/ntp @thoughtpolice
160183
184+# Network
185+/pkgs/tools/networking/kea/default.nix @mweinelt
186+/pkgs/tools/networking/babeld/default.nix @mweinelt
187+/nixos/modules/services/networking/babeld.nix @mweinelt
188+/nixos/modules/services/networking/kea.nix @mweinelt
189+/nixos/modules/services/networking/knot.nix @mweinelt
190+/nixos/tests/babeld.nix @mweinelt
191+/nixos/tests/kea.nix @mweinelt
192+/nixos/tests/knot.nix @mweinelt
193+
161194# Dhall
162195/pkgs/development/dhall-modules @Gabriel439 @Profpatsch @ehmry
163196/pkgs/development/interpreters/dhall @Gabriel439 @Profpatsch @ehmry
@@ -166,7 +199,7 @@
166199/pkgs/development/idris-modules @Infinisil
167200
168201# Bazel
169−/pkgs/development/tools/build-managers/bazel @mboes @Profpatsch
202+/pkgs/development/tools/build-managers/bazel @Profpatsch
170203
171204# NixOS modules for e-mail and dns services
172205/nixos/modules/services/mail/mailman.nix @peti
@@ -175,19 +208,18 @@
175208/nixos/modules/services/mail/rspamd.nix @peti
176209
177210# Emacs
178−/pkgs/applications/editors/emacs-modes @adisbladis
179−/pkgs/applications/editors/emacs @adisbladis
180−/pkgs/top-level/emacs-packages.nix @adisbladis
211+/pkgs/applications/editors/emacs/elisp-packages @adisbladis
212+/pkgs/applications/editors/emacs @adisbladis
213+/pkgs/top-level/emacs-packages.nix @adisbladis
181214
182215# Neovim
183−/pkgs/applications/editors/neovim @jonringer
184−/pkgs/applications/editors/neovim @teto
216+/pkgs/applications/editors/neovim @jonringer @teto
185217
186218# VimPlugins
187−/pkgs/misc/vim-plugins @jonringer @softinio
219+/pkgs/applications/editors/vim/plugins @jonringer
188220
189221# VsCode Extensions
190−/pkgs/misc/vscode-extensions @jonringer
222+/pkgs/applications/editors/vscode/extensions @jonringer
191223
192224# Prometheus exporter modules and tests
193225/nixos/modules/services/monitoring/prometheus/exporters.nix @WilliButz
@@ -195,33 +227,65 @@
195227/nixos/tests/prometheus-exporters.nix @WilliButz
196228
197229# PHP interpreter, packages, extensions, tests and documentation
198−/doc/languages-frameworks/php.section.md @NixOS/php
199−/nixos/tests/php @NixOS/php
200−/pkgs/build-support/build-pecl.nix @NixOS/php
201−/pkgs/development/interpreters/php @NixOS/php
202−/pkgs/development/php-packages @NixOS/php
203−/pkgs/top-level/php-packages.nix @NixOS/php
230+/doc/languages-frameworks/php.section.md @aanderse @etu @globin @ma27 @talyz
231+/nixos/tests/php @aanderse @etu @globin @ma27 @talyz
232+/pkgs/build-support/build-pecl.nix @aanderse @etu @globin @ma27 @talyz
233+/pkgs/development/interpreters/php @jtojnar @aanderse @etu @globin @ma27 @talyz
234+/pkgs/development/php-packages @aanderse @etu @globin @ma27 @talyz
235+/pkgs/top-level/php-packages.nix @jtojnar @aanderse @etu @globin @ma27 @talyz
204236
205237# Podman, CRI-O modules and related
206−/nixos/modules/virtualisation/containers.nix @NixOS/podman @zowoq
207−/nixos/modules/virtualisation/cri-o.nix @NixOS/podman @zowoq
208−/nixos/modules/virtualisation/podman.nix @NixOS/podman @zowoq
209−/nixos/tests/cri-o.nix @NixOS/podman @zowoq
210−/nixos/tests/podman.nix @NixOS/podman @zowoq
238+/nixos/modules/virtualisation/containers.nix @zowoq @adisbladis
239+/nixos/modules/virtualisation/cri-o.nix @zowoq @adisbladis
240+/nixos/modules/virtualisation/podman @zowoq @adisbladis
241+/nixos/tests/cri-o.nix @zowoq @adisbladis
242+/nixos/tests/podman @zowoq @adisbladis
211243
212244# Docker tools
213−/pkgs/build-support/docker @roberth @utdemir
214−/nixos/tests/docker-tools-overlay.nix @roberth
215−/nixos/tests/docker-tools.nix @roberth
216−/doc/builders/images/dockertools.xml @roberth
245+/pkgs/build-support/docker @roberth
246+/nixos/tests/docker-tools* @roberth
247+/doc/builders/images/dockertools.section.md @roberth
217248
218249# Blockchains
219250/pkgs/applications/blockchains @mmahut @RaghavSood
220251
221252# Go
253+/doc/languages-frameworks/go.section.md @kalbasit @Mic92 @zowoq
222254/pkgs/development/compilers/go @kalbasit @Mic92 @zowoq
223255/pkgs/development/go-modules @kalbasit @Mic92 @zowoq
224256/pkgs/development/go-packages @kalbasit @Mic92 @zowoq
225257
258+# GNOME
259+/pkgs/desktops/gnome @jtojnar @hedning
260+/pkgs/desktops/gnome/extensions @piegamesde @jtojnar @hedning
261+
226262# Cinnamon
227263/pkgs/desktops/cinnamon @mkg20001
264+
265+# nim
266+/pkgs/development/compilers/nim @ehmry
267+/pkgs/development/nim-packages @ehmry
268+/pkgs/top-level/nim-packages.nix @ehmry
269+
270+# terraform providers
271+/pkgs/applications/networking/cluster/terraform-providers @zowoq
272+
273+# kubernetes
274+/nixos/doc/manual/configuration/kubernetes.chapter.md @zowoq
275+/nixos/modules/services/cluster/kubernetes @zowoq
276+/nixos/tests/kubernetes @zowoq
277+/pkgs/applications/networking/cluster/kubernetes @zowoq
278+
279+# Matrix
280+/pkgs/servers/heisenbridge @piegamesde
281+/pkgs/servers/matrix-conduit @piegamesde
282+/pkgs/servers/matrix-synapse/matrix-appservice-irc @piegamesde
283+/nixos/modules/services/misc/heisenbridge.nix @piegamesde
284+/nixos/modules/services/misc/matrix-appservice-irc.nix @piegamesde
285+/nixos/modules/services/misc/matrix-conduit.nix @piegamesde
286+/nixos/tests/matrix-appservice-irc.nix @piegamesde
287+/nixos/tests/matrix-conduit.nix @piegamesde
288+
289+# Dotnet
290+/pkgs/build-support/dotnet @IvarWithoutBones
291+/pkgs/development/compilers/dotnet @IvarWithoutBones
.github/CONTRIBUTING.mddeleted−64
@@ -1,64 +0,0 @@
1−# How to contribute
2−
3−Note: contributing implies licensing those contributions
4−under the terms of [COPYING](../COPYING), which is an MIT-like license.
5−
6−## Opening issues
7−
8−* Make sure you have a [GitHub account](https://github.com/signup/free)
9−* Make sure there is no open issue on the topic
10−* [Submit a new issue](https://github.com/NixOS/nixpkgs/issues/new/choose) by choosing the kind of topic and fill out the template
11−
12−## Submitting changes
13−
14−* Format the commit messages in the following way:
15−
16− ```
17− (pkg-name | nixos/<module>): (from -> to | init at version | refactor | etc)
18−
19− (Motivation for change. Additional information.)
20− ```
21−
22− For consistency, there should not be a period at the end of the commit message's summary line (the first line of the commit message).
23−
24− Examples:
25−
26− * nginx: init at 2.0.1
27− * firefox: 54.0.1 -> 55.0
28− * nixos/hydra: add bazBaz option
29−
30− Dual baz behavior is needed to do foo.
31− * nixos/nginx: refactor config generation
32−
33− The old config generation system used impure shell scripts and could break in specific circumstances (see #1234).
34−
35−* `meta.description` should:
36− * Be capitalized.
37− * Not start with the package name.
38− * Not have a period at the end.
39−* `meta.license` must be set and fit the upstream license.
40− * If there is no upstream license, `meta.license` should default to `lib.licenses.unfree`.
41−* `meta.maintainers` must be set.
42−
43−See the nixpkgs manual for more details on [standard meta-attributes](https://nixos.org/nixpkgs/manual/#sec-standard-meta-attributes) and on how to [submit changes to nixpkgs](https://nixos.org/nixpkgs/manual/#chap-submitting-changes).
44−
45−## Writing good commit messages
46−
47−In addition to writing properly formatted commit messages, it's important to include relevant information so other developers can later understand *why* a change was made. While this information usually can be found by digging code, mailing list/Discourse archives, pull request discussions or upstream changes, it may require a lot of work.
48−
49−For package version upgrades and such a one-line commit message is usually sufficient.
50−
51−## Backporting changes
52−
53−Follow these steps to backport a change into a release branch in compliance with the [commit policy](https://nixos.org/nixpkgs/manual/#submitting-changes-stable-release-branches).
54−
55−1. Take note of the commits in which the change was introduced into `master` branch.
56−2. Check out the target _release branch_, e.g. `release-20.09`. Do not use a _channel branch_ like `nixos-20.09` or `nixpkgs-20.09`.
57−3. Create a branch for your change, e.g. `git checkout -b backport`.
58−4. When the reason to backport is not obvious from the original commit message, use `git cherry-pick -xe <original commit>` and add a reason. Otherwise use `git cherry-pick -x <original commit>`. That's fine for minor version updates that only include security and bug fixes, commits that fixes an otherwise broken package or similar. Please also ensure the commits exists on the master branch; in the case of squashed or rebased merges, the commit hash will change and the new commits can be found in the merge message at the bottom of the master pull request.
59−5. Push to GitHub and open a backport pull request. Make sure to select the release branch (e.g. `release-20.09`) as the target branch of the pull request, and link to the pull request in which the original change was comitted to `master`. The pull request title should be the commit title with the release version as prefix, e.g. `[20.09]`.
60−6. When the backport pull request is merged and you have the necessary privileges you can also replace the label `9.needs: port to stable` with `8.has: port to stable` on the original pull request. This way maintainers can keep track of missing backports easier.
61−
62−## Reviewing contributions
63−
64−See the nixpkgs manual for more details on how to [Review contributions](https://nixos.org/nixpkgs/manual/#chap-reviewing-contributions).
.github/ISSUE_TEMPLATE/bug_report.md+10−13
@@ -7,37 +7,34 @@ assignees: ''
77
88---
99
10−**Describe the bug**
10+### Describe the bug
1111A clear and concise description of what the bug is.
1212
13−**To Reproduce**
13+### Steps To Reproduce
1414Steps to reproduce the behavior:
15151. ...
16162. ...
17173. ...
1818
19−**Expected behavior**
19+### Expected behavior
2020A clear and concise description of what you expected to happen.
2121
22−**Screenshots**
22+### Screenshots
2323If applicable, add screenshots to help explain your problem.
2424
25−**Additional context**
25+### Additional context
2626Add any other context about the problem here.
2727
28−**Notify maintainers**
28+### Notify maintainers
2929<!--
3030Please @ people who are in the `meta.maintainers` list of the offending package or module.
3131If in doubt, check `git blame` for whoever last touched something.
3232-->
3333
34−**Metadata**
34+### Metadata
3535Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result.
3636
37−Maintainer information:
38−```yaml
39−# a list of nixpkgs attributes affected by the problem
40−attribute:
41−# a list of nixos modules affected by the problem
42−module:
37+```console
38+[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
39+output here
4340```
.github/ISSUE_TEMPLATE/out_of_date_package_report.md+3−3
@@ -13,10 +13,10 @@ assignees: ''
1313<!-- Note that these are hard requirements -->
1414
1515<!--
16−You can use the "Go to file" functionality on github to find the package
16+You can use the "Go to file" functionality on GitHub to find the package
1717Then you can go to the history for this package
1818Find the latest "package_name: old_version -> new_version" commit
19−The "new_version" is the the current version of the package
19+The "new_version" is the current version of the package
2020-->
2121- [ ] Checked the [nixpkgs master branch](https://github.com/NixOS/nixpkgs)
2222<!--
@@ -29,7 +29,7 @@ There's a high chance that you'll have the new version right away while helping
2929###### Project name
3030`nix search` name:
3131<!--
32−The current version can be found easily with the same process than above for checking the master branch
32+The current version can be found easily with the same process as above for checking the master branch
3333If an open PR is present for the package, take this version as the current one and link to the PR
3434-->
3535current version:
.github/PULL_REQUEST_TEMPLATE.md+32−19
@@ -1,28 +1,41 @@
1+###### Description of changes
2+
3+<!--
4+For package updates please link to a changelog or describe changes, this helps your fellow maintainers discover breaking updates.
5+For new packages please briefly describe the package or provide a link to its homepage.
6+-->
7+
8+###### Things done
9+
10+<!-- Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers. -->
11+
12+- Built on platform(s)
13+ - [ ] x86_64-linux
14+ - [ ] aarch64-linux
15+ - [ ] x86_64-darwin
16+ - [ ] aarch64-darwin
17+- [ ] For non-Linux: Is `sandbox = true` set in `nix.conf`? (See [Nix manual](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
18+- [ ] Tested, as applicable:
19+ - [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
20+ - and/or [package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests)
21+ - or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
22+ - made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
23+- [ ] Tested compilation of all packages that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"`. Note: all changes have to be committed, also see [nixpkgs-review usage](https://github.com/Mic92/nixpkgs-review#usage)
24+- [ ] Tested basic functionality of all binary files (usually in `./result/bin/`)
25+- [22.05 Release Notes (or backporting 21.11 Release notes)](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#generating-2205-release-notes)
26+ - [ ] (Package updates) Added a release notes entry if the change is major or breaking
27+ - [ ] (Module updates) Added a release notes entry if the change is significant
28+ - [ ] (Module addition) Added a release notes entry if adding a new NixOS module
29+ - [ ] (Release notes changes) Ran `nixos/doc/manual/md-to-db.sh` to update generated release notes
30+- [ ] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
31+
132<!--
233To help with the large amounts of pull requests, we would appreciate your
334reviews of other pull requests, especially simple package updates. Just leave a
435comment describing what you have tested in the relevant package/service.
536Reviewing helps to reduce the average time-to-merge for everyone.
637Thanks a lot if you do!
38+
739List of open PRs: https://github.com/NixOS/nixpkgs/pulls
840Reviewing guidelines: https://nixos.org/manual/nixpkgs/unstable/#chap-reviewing-contributions
941-->
10−
11−###### Motivation for this change
12−
13−
14−###### Things done
15−
16−<!-- Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers. -->
17−
18−- [ ] Tested using sandboxing ([nix.useSandbox](https://nixos.org/nixos/manual/options.html#opt-nix.useSandbox) on NixOS, or option `sandbox` in [`nix.conf`](https://nixos.org/nix/manual/#sec-conf-file) on non-NixOS linux)
19−- Built on platform(s)
20− - [ ] NixOS
21− - [ ] macOS
22− - [ ] other Linux distributions
23−- [ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
24−- [ ] Tested compilation of all pkgs that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review wip"`
25−- [ ] Tested execution of all binary files (usually in `./result/bin/`)
26−- [ ] Determined the impact on package closure size (by running `nix path-info -S` before and after)
27−- [ ] Ensured that relevant documentation is up to date
28−- [ ] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md).
.github/STALE-BOT.md+1−1
@@ -3,7 +3,7 @@
33- Thanks for your contribution!
44- To remove the stale label, just leave a new comment.
55- _How to find the right people to ping?_ → [`git blame`](https://git-scm.com/docs/git-blame) to the rescue! (or GitHub's history and blame buttons.)
6−- You can always ask for help on [our Discourse Forum](https://discourse.nixos.org/) or on the [#nixos IRC channel](https://webchat.freenode.net/#nixos).
6+- You can always ask for help on [our Discourse Forum](https://discourse.nixos.org/), [our Matrix room](https://matrix.to/#/#nix:nixos.org), or on the [#nixos IRC channel](https://web.libera.chat/#nixos).
77
88## Suggestions for PRs
99
.github/labeler.yml+20−7
@@ -12,7 +12,7 @@
1212 - nixos/modules/services/editors/emacs.nix
1313 - nixos/modules/services/editors/emacs.xml
1414 - nixos/tests/emacs-daemon.nix
15− - pkgs/applications/editors/emacs-modes/**/*
15+ - pkgs/applications/editors/emacs/elisp-packages/**/*
1616 - pkgs/applications/editors/emacs/**/*
1717 - pkgs/build-support/emacs/**/*
1818 - pkgs/top-level/emacs-packages.nix
@@ -32,11 +32,11 @@
3232
3333"6.topic: GNOME":
3434 - doc/languages-frameworks/gnome.section.md
35− - nixos/modules/services/desktops/gnome3/**/*
36− - nixos/modules/services/x11/desktop-managers/gnome3.nix
37− - nixos/tests/gnome3-xorg.nix
38− - nixos/tests/gnome3.nix
39− - pkgs/desktops/gnome-3/**/*
35+ - nixos/modules/services/desktops/gnome/**/*
36+ - nixos/modules/services/x11/desktop-managers/gnome.nix
37+ - nixos/tests/gnome-xorg.nix
38+ - nixos/tests/gnome.nix
39+ - pkgs/desktops/gnome/**/*
4040
4141"6.topic: golang":
4242 - doc/languages-frameworks/go.section.md
@@ -46,13 +46,17 @@
4646
4747"6.topic: haskell":
4848 - doc/languages-frameworks/haskell.section.md
49+ - maintainers/scripts/haskell/**/*
4950 - pkgs/development/compilers/ghc/**/*
5051 - pkgs/development/haskell-modules/**/*
5152 - pkgs/development/tools/haskell/**/*
53+ - pkgs/test/haskell/**/*
5254 - pkgs/top-level/haskell-packages.nix
55+ - pkgs/top-level/release-haskell.nix
5356
5457"6.topic: kernel":
5558 - pkgs/build-support/kernel/**/*
59+ - pkgs/os-specific/linux/kernel/**/*
5660
5761"6.topic: lua":
5862 - pkgs/development/interpreters/lua-5/**/*
@@ -62,6 +66,13 @@
6266
6367"6.topic: nixos":
6468 - nixos/**/*
69+ - pkgs/os-specific/linux/nixos-rebuild/**/*
70+
71+"6.topic: nim":
72+ - doc/languages-frameworks/nim.section.md
73+ - pkgs/development/compilers/nim/*
74+ - pkgs/development/nim-packages/**/*
75+ - pkgs/top-level/nim-packages.nix
6576
6677"6.topic: ocaml":
6778 - doc/languages-frameworks/ocaml.section.md
@@ -127,7 +138,9 @@
127138"6.topic: vim":
128139 - doc/languages-frameworks/vim.section.md
129140 - pkgs/applications/editors/vim/**/*
130− - pkgs/misc/vim-plugins/**/*
141+ - pkgs/applications/editors/vim/plugins/**/*
142+ - nixos/modules/programs/neovim.nix
143+ - pkgs/applications/editors/neovim/**/*
131144
132145"6.topic: xfce":
133146 - nixos/doc/manual/configuration/xfce.xml
.github/workflows/backport.ymlnew file+35
@@ -0,0 +1,35 @@
1+name: Backport
2+on:
3+ pull_request_target:
4+ types: [closed, labeled]
5+
6+# WARNING:
7+# When extending this action, be aware that $GITHUB_TOKEN allows write access to
8+# the GitHub repository. This means that it should not evaluate user input in a
9+# way that allows code injection.
10+
11+jobs:
12+ backport:
13+ name: Backport Pull Request
14+ if: github.repository_owner == 'NixOS' && github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith('backport', github.event.label.name))
15+ runs-on: ubuntu-latest
16+ steps:
17+ - uses: actions/checkout@v3
18+ with:
19+ # required to find all branches
20+ fetch-depth: 0
21+ ref: ${{ github.event.pull_request.head.sha }}
22+ - name: Create backport PRs
23+ # should be kept in sync with `version`
24+ uses: zeebe-io/backport-action@v0.0.5
25+ with:
26+ # Config README: https://github.com/zeebe-io/backport-action#backport-action
27+ github_token: ${{ secrets.GITHUB_TOKEN }}
28+ github_workspace: ${{ github.workspace }}
29+ # should be kept in sync with `uses`
30+ version: v0.0.5
31+ pull_description: |-
32+ Bot-based backport to `${target_branch}`, triggered by a label in #${pull_number}.
33+
34+ * [ ] Before merging, ensure that this backport complies with the [Criteria for Backporting](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#criteria-for-backporting-changes).
35+ * Even as a non-commiter, if you find that it does not comply, leave a comment.
.github/workflows/basic-eval.ymlnew file+26
@@ -0,0 +1,26 @@
1+name: Basic evaluation checks
2+
3+on:
4+ workflow_dispatch
5+ # pull_request:
6+ # branches:
7+ # - master
8+ # - release-**
9+ # push:
10+ # branches:
11+ # - master
12+ # - release-**
13+jobs:
14+ tests:
15+ runs-on: ubuntu-latest
16+ # we don't limit this action to only NixOS repo since the checks are cheap and useful developer feedback
17+ steps:
18+ - uses: actions/checkout@v3
19+ - uses: cachix/install-nix-action@v17
20+ - uses: cachix/cachix-action@v10
21+ with:
22+ # This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
23+ name: nixpkgs-ci
24+ signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
25+ # explicit list of supportedSystems is needed until aarch64-darwin becomes part of the trunk jobset
26+ - run: nix-build pkgs/top-level/release.nix -A tarball.nixpkgs-basic-release-checks --arg supportedSystems '[ "aarch64-darwin" "aarch64-linux" "x86_64-linux" "x86_64-darwin" ]'
.github/workflows/direct-push.ymlnew file+32
@@ -0,0 +1,32 @@
1+name: "Direct Push Warning"
2+on:
3+ push:
4+ branches:
5+ - master
6+ - release-**
7+jobs:
8+ build:
9+ runs-on: ubuntu-latest
10+ if: github.repository_owner == 'NixOS'
11+ env:
12+ GITHUB_SHA: ${{ github.sha }}
13+ GITHUB_REPOSITORY: ${{ github.repository }}
14+ steps:
15+ - name: Check if commit is a merge commit
16+ id: ismerge
17+ run: |
18+ ISMERGE=$(curl -H 'Accept: application/vnd.github.groot-preview+json' -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.GITHUB_REPOSITORY }}/commits/${{ env.GITHUB_SHA }}/pulls | jq -r '.[] | select(.merge_commit_sha == "${{ env.GITHUB_SHA }}") | any')
19+ echo "::set-output name=ismerge::$ISMERGE"
20+ # github events are eventually consistent, so wait until changes propagate to thier DB
21+ - run: sleep 60
22+ if: steps.ismerge.outputs.ismerge != 'true'
23+ - name: Warn if the commit was a direct push
24+ if: steps.ismerge.outputs.ismerge != 'true'
25+ uses: peter-evans/commit-comment@v2
26+ with:
27+ body: |
28+ @${{ github.actor }}, you pushed a commit directly to master/release branch
29+ instead of going through a Pull Request.
30+
31+ That's highly discouraged beyond the few exceptions listed
32+ on https://github.com/NixOS/nixpkgs/issues/118661
.github/workflows/editorconfig.yml+23−17
@@ -1,37 +1,43 @@
11name: "Checking EditorConfig"
22
3+permissions: read-all
4+
35on:
4− pull_request:
6+ # avoids approving first time contributors
7+ pull_request_target:
58 branches-ignore:
69 - 'release-**'
710
811jobs:
912 tests:
1013 runs-on: ubuntu-latest
11− if: github.repository_owner == 'NixOS'
14+ if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip editorconfig]')"
1215 steps:
1316 - name: Get list of changed files from PR
1417 env:
1518 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1619 run: |
17− echo 'PR_DIFF<<EOF' >> $GITHUB_ENV
1820 gh api \
1921 repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \
2022 | jq '.[] | select(.status != "removed") | .filename' \
21− >> $GITHUB_ENV
22− echo 'EOF' >> $GITHUB_ENV
23− - uses: actions/checkout@v2
24− if: env.PR_DIFF
25− - name: Fetch editorconfig-checker
26− if: env.PR_DIFF
27− env:
28− ECC_VERSION: "2.3.1"
29− ECC_URL: "https://github.com/editorconfig-checker/editorconfig-checker/releases/download"
23+ > "$HOME/changed_files"
24+ - name: print list of changed files
3025 run: |
31− curl -sSf -O -L -C - "$ECC_URL/$ECC_VERSION/ec-linux-amd64.tar.gz" && \
32− tar xzf ec-linux-amd64.tar.gz && \
33− mv ./bin/ec-linux-amd64 ./bin/editorconfig-checker
26+ cat "$HOME/changed_files"
27+ - uses: actions/checkout@v3
28+ with:
29+ # pull_request_target checks out the base branch by default
30+ ref: refs/pull/${{ github.event.pull_request.number }}/merge
31+ - uses: cachix/install-nix-action@v17
32+ with:
33+ # nixpkgs commit is pinned so that it doesn't break
34+ # editorconfig-checker 2.4.0
35+ nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz
36+ - name: install editorconfig-checker
37+ run: nix-env -iA editorconfig-checker -f '<nixpkgs>'
3438 - name: Checking EditorConfig
35− if: env.PR_DIFF
3639 run: |
37− echo "$PR_DIFF" | xargs ./bin/editorconfig-checker -disable-indent-size
40+ cat "$HOME/changed_files" | xargs -r editorconfig-checker -disable-indent-size
41+ - if: ${{ failure() }}
42+ run: |
43+ echo "::error :: Hey! It looks like your changes don't follow our editorconfig settings. Read https://editorconfig.org/#download to configure your editor so you never see this error again."
.github/workflows/labels.yml+11−1
@@ -2,13 +2,23 @@ name: "Label PR"
22
33on:
44 pull_request_target:
5+ types: [edited, opened, synchronize, reopened]
6+
7+# WARNING:
8+# When extending this action, be aware that $GITHUB_TOKEN allows some write
9+# access to the GitHub API. This means that it should not evaluate user input in
10+# a way that allows code injection.
11+
12+permissions:
13+ contents: read
14+ pull-requests: write
515
616jobs:
717 labels:
818 runs-on: ubuntu-latest
919 if: github.repository_owner == 'NixOS'
1020 steps:
11− - uses: actions/labeler@v3
21+ - uses: actions/labeler@v4
1222 with:
1323 repo-token: ${{ secrets.GITHUB_TOKEN }}
1424 sync-labels: true
.github/workflows/manual-nixos.yml+7−4
@@ -1,5 +1,7 @@
11name: "Build NixOS manual"
22
3+permissions: read-all
4+
35on:
46 pull_request_target:
57 branches:
@@ -10,18 +12,19 @@ on:
1012jobs:
1113 nixos:
1214 runs-on: ubuntu-latest
15+ if: github.repository_owner == 'NixOS'
1316 steps:
14− - uses: actions/checkout@v2
17+ - uses: actions/checkout@v3
1518 with:
1619 # pull_request_target checks out the base branch by default
1720 ref: refs/pull/${{ github.event.pull_request.number }}/merge
18− - uses: cachix/install-nix-action@v12
21+ - uses: cachix/install-nix-action@v17
1922 with:
2023 # explicitly enable sandbox
2124 extra_nix_config: sandbox = true
22− - uses: cachix/cachix-action@v8
25+ - uses: cachix/cachix-action@v10
2326 with:
24− # This cache is for the nixos/nixpkgs manual builds and should not be trusted or used elsewhere.
27+ # This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
2528 name: nixpkgs-ci
2629 signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
2730 - name: Building NixOS manual
.github/workflows/manual-nixpkgs.yml+7−4
@@ -1,5 +1,7 @@
11name: "Build Nixpkgs manual"
22
3+permissions: read-all
4+
35on:
46 pull_request_target:
57 branches:
@@ -10,18 +12,19 @@ on:
1012jobs:
1113 nixpkgs:
1214 runs-on: ubuntu-latest
15+ if: github.repository_owner == 'NixOS'
1316 steps:
14− - uses: actions/checkout@v2
17+ - uses: actions/checkout@v3
1518 with:
1619 # pull_request_target checks out the base branch by default
1720 ref: refs/pull/${{ github.event.pull_request.number }}/merge
18− - uses: cachix/install-nix-action@v12
21+ - uses: cachix/install-nix-action@v17
1922 with:
2023 # explicitly enable sandbox
2124 extra_nix_config: sandbox = true
22− - uses: cachix/cachix-action@v8
25+ - uses: cachix/cachix-action@v10
2326 with:
24− # This cache is for the nixos/nixpkgs manual builds and should not be trusted or used elsewhere.
27+ # This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
2528 name: nixpkgs-ci
2629 signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
2730 - name: Building Nixpkgs manual
.github/workflows/merge-staging.ymldeleted−39
@@ -1,39 +0,0 @@
1−name: "merge staging(-next)"
2−
3−on:
4− schedule:
5− # * is a special character in YAML so you have to quote this string
6− # Merge every 6 hours
7− - cron: '0 */6 * * *'
8−
9−jobs:
10− sync-branch:
11− if: github.repository == 'NixOS/nixpkgs'
12− runs-on: ubuntu-latest
13− steps:
14− - uses: actions/checkout@v2
15−
16− - name: Merge master into staging-next
17− uses: devmasx/merge-branch@v1.3.1
18− with:
19− type: now
20− from_branch: master
21− target_branch: staging-next
22− github_token: ${{ secrets.GITHUB_TOKEN }}
23−
24− - name: Merge staging-next into staging
25− uses: devmasx/merge-branch@v1.3.1
26− with:
27− type: now
28− from_branch: staging-next
29− target_branch: staging
30− github_token: ${{ secrets.GITHUB_TOKEN }}
31−
32− - name: Comment on failure
33− uses: peter-evans/create-or-update-comment@v1
34− if: ${{ failure() }}
35− with:
36− issue-number: 105153
37− body: |
38− An automatic merge [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).
39−
.github/workflows/nixos-manual.ymlnew file+26
@@ -0,0 +1,26 @@
1+name: NixOS manual checks
2+
3+permissions: read-all
4+
5+on:
6+ pull_request_target:
7+ branches-ignore:
8+ - 'release-**'
9+ paths:
10+ - 'nixos/**/*.xml'
11+ - 'nixos/**/*.md'
12+
13+jobs:
14+ tests:
15+ runs-on: ubuntu-latest
16+ if: github.repository_owner == 'NixOS'
17+ steps:
18+ - uses: actions/checkout@v3
19+ with:
20+ # pull_request_target checks out the base branch by default
21+ ref: refs/pull/${{ github.event.pull_request.number }}/merge
22+ - uses: cachix/install-nix-action@v17
23+ - name: Check DocBook files generated from Markdown are consistent
24+ run: |
25+ nixos/doc/manual/md-to-db.sh
26+ git diff --exit-code
.github/workflows/no-channel.ymlnew file+21
@@ -0,0 +1,21 @@
1+name: "No channel PR"
2+
3+on:
4+ pull_request:
5+ branches:
6+ - 'nixos-**'
7+ - 'nixpkgs-**'
8+
9+jobs:
10+ fail:
11+ name: "This PR is is targeting a channel branch"
12+ runs-on: ubuntu-latest
13+ steps:
14+ - run: |
15+ cat <<EOF
16+ The nixos-* and nixpkgs-* branches are pushed to by the channel
17+ release script and should not be merged into directly.
18+
19+ Please target the equivalent release-* branch or master instead.
20+ EOF
21+ exit 1
.github/workflows/pending-set.yml+5
@@ -3,6 +3,11 @@ name: "set pending status"
33on:
44 pull_request_target:
55
6+# WARNING:
7+# When extending this action, be aware that $GITHUB_TOKEN allows write access to
8+# the GitHub repository. This means that it should not evaluate user input in a
9+# way that allows code injection.
10+
611jobs:
712 action:
813 runs-on: ubuntu-latest
.github/workflows/periodic-merge-24h.ymlnew file+57
@@ -0,0 +1,57 @@
1+# This action periodically merges base branches into staging branches.
2+# This is done to
3+# * prevent conflicts or rather resolve them early
4+# * make all potential breakage happen on the staging branch
5+# * and make sure that all major rebuilds happen before the staging
6+# branch get’s merged back into its base branch.
7+
8+name: "Periodic Merges (24h)"
9+
10+
11+on:
12+ schedule:
13+ # * is a special character in YAML so you have to quote this string
14+ # Merge every 24 hours
15+ - cron: '0 0 * * *'
16+
17+jobs:
18+ periodic-merge:
19+ if: github.repository_owner == 'NixOS'
20+ runs-on: ubuntu-latest
21+ strategy:
22+ # don't fail fast, so that all pairs are tried
23+ fail-fast: false
24+ # certain branches need to be merged in order, like master->staging-next->staging
25+ # and disabling parallelism ensures the order of the pairs below.
26+ max-parallel: 1
27+ matrix:
28+ pairs:
29+ - from: master
30+ into: haskell-updates
31+ - from: release-21.05
32+ into: staging-next-21.05
33+ - from: staging-next-21.05
34+ into: staging-21.05
35+ - from: release-21.11
36+ into: staging-next-21.11
37+ - from: staging-next-21.11
38+ into: staging-21.11
39+ name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
40+ steps:
41+ - uses: actions/checkout@v3
42+
43+ - name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
44+ uses: devmasx/merge-branch@1.4.0
45+ with:
46+ type: now
47+ from_branch: ${{ matrix.pairs.from }}
48+ target_branch: ${{ matrix.pairs.into }}
49+ github_token: ${{ secrets.GITHUB_TOKEN }}
50+
51+ - name: Comment on failure
52+ uses: peter-evans/create-or-update-comment@v2
53+ if: ${{ failure() }}
54+ with:
55+ issue-number: 105153
56+ body: |
57+ Periodic merge from `${{ matrix.pairs.from }}` into `${{ matrix.pairs.into }}` has [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).
.github/workflows/periodic-merge-6h.ymlnew file+51
@@ -0,0 +1,51 @@
1+# This action periodically merges base branches into staging branches.
2+# This is done to
3+# * prevent conflicts or rather resolve them early
4+# * make all potential breakage happen on the staging branch
5+# * and make sure that all major rebuilds happen before the staging
6+# branch get’s merged back into its base branch.
7+
8+name: "Periodic Merges (6h)"
9+
10+
11+on:
12+ schedule:
13+ # * is a special character in YAML so you have to quote this string
14+ # Merge every 6 hours
15+ - cron: '0 */6 * * *'
16+
17+jobs:
18+ periodic-merge:
19+ if: github.repository_owner == 'NixOS'
20+ runs-on: ubuntu-latest
21+ strategy:
22+ # don't fail fast, so that all pairs are tried
23+ fail-fast: false
24+ # certain branches need to be merged in order, like master->staging-next->staging
25+ # and disabling parallelism ensures the order of the pairs below.
26+ max-parallel: 1
27+ matrix:
28+ pairs:
29+ - from: master
30+ into: staging-next
31+ - from: staging-next
32+ into: staging
33+ name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
34+ steps:
35+ - uses: actions/checkout@v3
36+
37+ - name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
38+ uses: devmasx/merge-branch@1.4.0
39+ with:
40+ type: now
41+ from_branch: ${{ matrix.pairs.from }}
42+ target_branch: ${{ matrix.pairs.into }}
43+ github_token: ${{ secrets.GITHUB_TOKEN }}
44+
45+ - name: Comment on failure
46+ uses: peter-evans/create-or-update-comment@v2
47+ if: ${{ failure() }}
48+ with:
49+ issue-number: 105153
50+ body: |
51+ Periodic merge from `${{ matrix.pairs.from }}` into `${{ matrix.pairs.into }}` has [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).
.github/workflows/rebase.ymldeleted−134
@@ -1,134 +0,0 @@
1−on:
2− issue_comment:
3− types:
4− - created
5−
6−# This action allows people with write access to the repo to rebase a PRs base branch
7−# by commenting `/rebase ${branch}` on the PR while avoiding CODEOWNER notifications.
8−
9−jobs:
10− rebase:
11− runs-on: ubuntu-latest
12− if: github.repository_owner == 'NixOS' && github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
13− steps:
14− - uses: peter-evans/create-or-update-comment@v1
15− with:
16− comment-id: ${{ github.event.comment.id }}
17− reactions: eyes
18− - uses: scherermichael-oss/action-has-permission@1.0.6
19− id: check-write-access
20− with:
21− required-permission: write
22− env:
23− GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24− - name: check permissions
25− run: |
26− echo "Commenter doesn't have write access to the repo"
27− exit 1
28− if: "! steps.check-write-access.outputs.has-permission"
29− - name: setup
30− run: |
31− curl "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}" 2>/dev/null >pr.json
32− cat <<EOF >>"$GITHUB_ENV"
33− CAN_MODIFY=$(jq -r '.maintainer_can_modify' pr.json)
34− COMMITS=$(jq -r '.commits' pr.json)
35− CURRENT_BASE=$(jq -r '.base.ref' pr.json)
36− PR_BRANCH=$(jq -r '.head.ref' pr.json)
37− COMMENT_BRANCH=$(echo ${{ github.event.comment.body }} | awk "/^\/rebase / {print \$2}")
38− PULL_REQUEST=${{ github.event.issue.number }}
39− EOF
40− rm pr.json
41− - name: check branch
42− env:
43− PERMANENT_BRANCHES: "haskell-updates|master|nixos|nixpkgs|python-unstable|release|staging"
44− VALID_BRANCHES: "haskell-updates|master|python-unstable|release-20.09|staging|staging-20.09|staging-next"
45− run: |
46− message() {
47− cat <<EOF
48− Can't rebase $PR_BRANCH from $CURRENT_BASE onto $COMMENT_BRANCH (PR:$PULL_REQUEST COMMITS:$COMMITS)
49− EOF
50− }
51− if ! [[ "$COMMENT_BRANCH" =~ ^($VALID_BRANCHES)$ ]]; then
52− cat <<EOF
53− Check that the branch from the comment is valid:
54−
55− $(message)
56−
57− This action can only rebase onto these branches:
58−
59− $VALID_BRANCHES
60−
61− \`/rebase \${branch}\` must be at the start of the line
62− EOF
63− exit 1
64− fi
65− if [[ "$COMMENT_BRANCH" == "$CURRENT_BASE" ]]; then
66− cat <<EOF
67− Check that the branch from the comment isn't the current base branch:
68−
69− $(message)
70− EOF
71− exit 1
72− fi
73− if [[ "$COMMENT_BRANCH" == "$PR_BRANCH" ]]; then
74− cat <<EOF
75− Check that the branch from the comment isn't the current branch:
76−
77− $(message)
78− EOF
79− exit 1
80− fi
81− if [[ "$PR_BRANCH" =~ ^($PERMANENT_BRANCHES) ]]; then
82− cat <<EOF
83− Check that the PR branch isn't a permanent branch:
84−
85− $(message)
86− EOF
87− exit 1
88− fi
89− if [[ "$CAN_MODIFY" != "true" ]]; then
90− cat <<EOF
91− Check that maintainers can edit the PR branch:
92−
93− $(message)
94− EOF
95− exit 1
96− fi
97− - uses: actions/checkout@v2
98− with:
99− fetch-depth: 0
100− - name: rebase pull request
101− env:
102− GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103− run: |
104− git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
105− git config --global user.name "github-actions[bot]"
106− git fetch origin
107− gh pr checkout "$PULL_REQUEST"
108− git rebase \
109− --onto="$(git merge-base origin/"$CURRENT_BASE" origin/"$COMMENT_BRANCH")" \
110− "HEAD~$COMMITS"
111− git push --force
112− curl \
113− -X POST \
114− -H "Accept: application/vnd.github.v3+json" \
115− -H "Authorization: token $GITHUB_TOKEN" \
116− -d "{ \"base\": \"$COMMENT_BRANCH\" }" \
117− "https://api.github.com/repos/${{ github.repository }}/pulls/$PULL_REQUEST"
118− curl \
119− -X PATCH \
120− -H "Accept: application/vnd.github.v3+json" \
121− -H "Authorization: token $GITHUB_TOKEN" \
122− -d '{ "state": "closed" }' \
123− "https://api.github.com/repos/${{ github.repository }}/pulls/$PULL_REQUEST"
124− - uses: peter-evans/create-or-update-comment@v1
125− with:
126− issue-number: ${{ github.event.issue.number }}
127− body: |
128− Rebased, please reopen the pull request to restart CI
129− - uses: peter-evans/create-or-update-comment@v1
130− if: failure()
131− with:
132− issue-number: ${{ github.event.issue.number }}
133− body: |
134− [Failed to rebase](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
.github/workflows/update-terraform-providers.ymlnew file+48
@@ -0,0 +1,48 @@
1+name: "Update terraform-providers"
2+
3+on:
4+ schedule:
5+ - cron: "14 3 * * 1"
6+ workflow_dispatch:
7+
8+jobs:
9+ tf-providers:
10+ if: github.repository_owner == 'NixOS' && github.ref == 'refs/heads/master' # ensure workflow_dispatch only runs on master
11+ runs-on: ubuntu-latest
12+ steps:
13+ - uses: actions/checkout@v3
14+ - uses: cachix/install-nix-action@v17
15+ - name: setup
16+ id: setup
17+ run: |
18+ echo ::set-output name=title::"terraform-providers: update $(date -u +"%Y-%m-%d")"
19+ - name: update terraform-providers
20+ run: |
21+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
22+ git config user.name "github-actions[bot]"
23+ pushd pkgs/applications/networking/cluster/terraform-providers
24+ ./update-all-providers --no-build
25+ git commit -m "${{ steps.setup.outputs.title }}" providers.json
26+ popd
27+ - name: create PR
28+ uses: peter-evans/create-pull-request@v4
29+ with:
30+ body: |
31+ Automatic update by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action.
32+
33+ Check that all providers build with:
34+ ```
35+ @ofborg build terraform-full
36+ ```
37+ branch: terraform-providers-update
38+ delete-branch: false
39+ labels: "2.status: work-in-progress"
40+ title: ${{ steps.setup.outputs.title }}
41+ token: ${{ secrets.GITHUB_TOKEN }}
42+ - name: comment on failure
43+ uses: peter-evans/create-or-update-comment@v2
44+ if: ${{ failure() }}
45+ with:
46+ issue-number: 153416
47+ body: |
48+ Automatic update of terraform providers [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).
.gitignore+7
@@ -2,8 +2,12 @@
22,*
33.*.swp
44.*.swo
5+.idea/
6+.vscode/
7+outputs/
58result
69result-*
10+source/
711/doc/NEWS.html
812/doc/NEWS.txt
913/doc/manual.html
@@ -20,3 +24,6 @@ __pycache__
2024
2125# generated by pkgs/common-updater/update-script.nix
2226update-git-commits.txt
27+
28+# JetBrains IDEA module declaration file
29+/nixpkgs.iml
.version+1−1
@@ -1 +1 @@
1−21.05
1+22.05
CONTRIBUTING.mdnew file+130
@@ -0,0 +1,130 @@
1+# How to contribute
2+
3+Note: contributing implies licensing those contributions
4+under the terms of [COPYING](COPYING), which is an MIT-like license.
5+
6+## Opening issues
7+
8+* Make sure you have a [GitHub account](https://github.com/signup/free)
9+* Make sure there is no open issue on the topic
10+* [Submit a new issue](https://github.com/NixOS/nixpkgs/issues/new/choose) by choosing the kind of topic and fill out the template
11+
12+## Submitting changes
13+
14+Read the ["Submitting changes"](https://nixos.org/nixpkgs/manual/#chap-submitting-changes) section of the nixpkgs manual. It explains how to write, test, and iterate on your change, and which branch to base your pull request against.
15+
16+Below is a short excerpt of some points in there:
17+
18+* Format the commit messages in the following way:
19+
20+ ```
21+ (pkg-name | nixos/<module>): (from -> to | init at version | refactor | etc)
22+
23+ (Motivation for change. Link to release notes. Additional information.)
24+ ```
25+
26+ For consistency, there should not be a period at the end of the commit message's summary line (the first line of the commit message).
27+
28+ Examples:
29+
30+ * nginx: init at 2.0.1
31+ * firefox: 54.0.1 -> 55.0
32+ https://www.mozilla.org/en-US/firefox/55.0/releasenotes/
33+ * nixos/hydra: add bazBaz option
34+
35+ Dual baz behavior is needed to do foo.
36+ * nixos/nginx: refactor config generation
37+
38+ The old config generation system used impure shell scripts and could break in specific circumstances (see #1234).
39+
40+* `meta.description` should:
41+ * Be capitalized.
42+ * Not start with the package name.
43+ * Not have a period at the end.
44+* `meta.license` must be set and fit the upstream license.
45+ * If there is no upstream license, `meta.license` should default to `lib.licenses.unfree`.
46+* `meta.maintainers` must be set.
47+
48+See the nixpkgs manual for more details on [standard meta-attributes](https://nixos.org/nixpkgs/manual/#sec-standard-meta-attributes).
49+
50+## Writing good commit messages
51+
52+In addition to writing properly formatted commit messages, it's important to include relevant information so other developers can later understand *why* a change was made. While this information usually can be found by digging code, mailing list/Discourse archives, pull request discussions or upstream changes, it may require a lot of work.
53+
54+For package version upgrades and such a one-line commit message is usually sufficient.
55+
56+## Rebasing between branches (i.e. from master to staging)
57+
58+From time to time, changes between branches must be rebased, for example, if the
59+number of new rebuilds they would cause is too large for the target branch. When
60+rebasing, care must be taken to include only the intended changes, otherwise
61+many CODEOWNERS will be inadvertently requested for review. To achieve this,
62+rebasing should not be performed directly on the target branch, but on the merge
63+base between the current and target branch.
64+
65+In the following example, we see a rebase from `master` onto the merge base
66+between `master` and `staging`, so that a change can eventually be retargeted to
67+`staging`. The example uses `upstream` as the remote for `NixOS/nixpkgs.git`
68+while the `origin` remote is used for the remote you are pushing to.
69+
70+
71+```console
72+# Find the common base between two branches
73+common=$(git merge-base upstream/master upstream/staging)
74+# Find the common base between your feature branch and master
75+commits=$(git merge-base $(git branch --show-current) upstream/master)
76+# Rebase all commits onto the common base
77+git rebase --onto=$common $commits
78+# Force push your changes
79+git push origin $(git branch --show-current) --force-with-lease
80+```
81+
82+Then change the base branch in the GitHub PR using the *Edit* button in the upper
83+right corner, and switch from `master` to `staging`. After the PR has been
84+retargeted it might be necessary to do a final rebase onto the target branch, to
85+resolve any outstanding merge conflicts.
86+
87+```console
88+# Rebase onto target branch
89+git rebase upstream/staging
90+# Review and fixup possible conflicts
91+git status
92+# Force push your changes
93+git push origin $(git branch --show-current) --force-with-lease
94+```
95+
96+## Backporting changes
97+
98+Follow these steps to backport a change into a release branch in compliance with the [commit policy](https://nixos.org/nixpkgs/manual/#submitting-changes-stable-release-branches).
99+
100+1. Take note of the commits in which the change was introduced into `master` branch.
101+2. Check out the target _release branch_, e.g. `release-21.11`. Do not use a _channel branch_ like `nixos-21.11` or `nixpkgs-21.11-darwin`.
102+3. Create a branch for your change, e.g. `git checkout -b backport`.
103+4. When the reason to backport is not obvious from the original commit message, use `git cherry-pick -xe <original commit>` and add a reason. Otherwise use `git cherry-pick -x <original commit>`. That's fine for minor version updates that only include security and bug fixes, commits that fixes an otherwise broken package or similar. Please also ensure the commits exists on the master branch; in the case of squashed or rebased merges, the commit hash will change and the new commits can be found in the merge message at the bottom of the master pull request.
104+5. Push to GitHub and open a backport pull request. Make sure to select the release branch (e.g. `release-21.11`) as the target branch of the pull request, and link to the pull request in which the original change was comitted to `master`. The pull request title should be the commit title with the release version as prefix, e.g. `[21.11]`.
105+6. When the backport pull request is merged and you have the necessary privileges you can also replace the label `9.needs: port to stable` with `8.has: port to stable` on the original pull request. This way maintainers can keep track of missing backports easier.
106+
107+## Criteria for Backporting changes
108+
109+Anything that does not cause user or downstream dependency regressions can be backported. This includes:
110+- New Packages / Modules
111+- Security / Patch updates
112+- Version updates which include new functionality (but no breaking changes)
113+- Services which require a client to be up-to-date regardless. (E.g. `spotify`, `steam`, or `discord`)
114+- Security critical applications (E.g. `firefox`)
115+
116+## Generating 22.05 Release Notes
117+
118+(This section also applies to backporting 21.11 release notes: substitute "rl-2205" for "rl-2111".)
119+
120+Documentation in nixpkgs is transitioning to a markdown-centric workflow. Release notes now require a translation step to convert from markdown to a compatible docbook document.
121+
122+Steps for updating 22.05 Release notes:
123+
124+1. Edit `nixos/doc/manual/release-notes/rl-2205.section.md` with the desired changes
125+2. Run `./nixos/doc/manual/md-to-db.sh` to render `nixos/doc/manual/from_md/release-notes/rl-2205.section.xml`
126+3. Include changes to `rl-2205.section.md` and `rl-2205.section.xml` in the same commit.
127+
128+## Reviewing contributions
129+
130+See the nixpkgs manual for more details on how to [Review contributions](https://nixos.org/nixpkgs/manual/#chap-reviewing-contributions).
COPYING+1−1
@@ -1,4 +1,4 @@
1−Copyright (c) 2003-2021 Eelco Dolstra and the Nixpkgs/NixOS contributors
1+Copyright (c) 2003-2022 Eelco Dolstra and the Nixpkgs/NixOS contributors
22
33Permission is hereby granted, free of charge, to any person obtaining
44a copy of this software and associated documentation files (the
README.md+17−11
@@ -1,14 +1,19 @@
11<p align="center">
2− <a href="https://nixos.org/nixos"><img src="https://nixos.org/logo/nixos-hires.png" width="500px" alt="NixOS logo" /></a>
2+ <a href="https://nixos.org#gh-light-mode-only">
3+ <img src="https://raw.githubusercontent.com/NixOS/nixos-homepage/master/logo/nixos-hires.png" width="500px" alt="NixOS logo"/>
4+ </a>
5+ <a href="https://nixos.org#gh-dark-mode-only">
6+ <img src="https://raw.githubusercontent.com/NixOS/nixos-artwork/master/logo/nixos-white.png" width="500px" alt="NixOS logo"/>
7+ </a>
38</p>
49
510<p align="center">
6− <a href="https://www.codetriage.com/nixos/nixpkgs"><img src="https://www.codetriage.com/nixos/nixpkgs/badges/users.svg" alt="Code Triagers badge" /></a>
7− <a href="https://opencollective.com/nixos"><img src="https://opencollective.com/nixos/tiers/supporter/badge.svg?label=Supporter&color=brightgreen" alt="Open Collective supporters" /></a>
11+ <a href="https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md"><img src="https://img.shields.io/github/contributors-anon/NixOS/nixpkgs" alt="Contributors badge" /></a>
12+ <a href="https://opencollective.com/nixos"><img src="https://opencollective.com/nixos/tiers/supporter/badge.svg?label=supporters&color=brightgreen" alt="Open Collective supporters" /></a>
813</p>
914
1015[Nixpkgs](https://github.com/nixos/nixpkgs) is a collection of over
11−60,000 software packages that can be installed with the
16+80,000 software packages that can be installed with the
1217[Nix](https://nixos.org/nix/) package manager. It also implements
1318[NixOS](https://nixos.org/nixos/), a purely-functional Linux distribution.
1419
@@ -21,10 +26,10 @@
2126# Community
2227
2328* [Discourse Forum](https://discourse.nixos.org/)
24−* [IRC - #nixos on freenode.net](irc://irc.freenode.net/#nixos)
29+* [Matrix Chat](https://matrix.to/#/#community:nixos.org)
2530* [NixOS Weekly](https://weekly.nixos.org/)
2631* [Community-maintained wiki](https://nixos.wiki/)
27−* [Community-maintained list of ways to get in touch](https://nixos.wiki/wiki/Get_In_Touch#Chat) (Discord, Matrix, Telegram, other IRC channels, etc.)
32+* [Community-maintained list of ways to get in touch](https://nixos.wiki/wiki/Get_In_Touch#Chat) (Discord, Telegram, IRC, etc.)
2833
2934# Other Project Repositories
3035
@@ -46,14 +51,14 @@ Nixpkgs and NixOS are built and tested by our continuous integration
4651system, [Hydra](https://hydra.nixos.org/).
4752
4853* [Continuous package builds for unstable/master](https://hydra.nixos.org/jobset/nixos/trunk-combined)
49−* [Continuous package builds for the NixOS 20.09 release](https://hydra.nixos.org/jobset/nixos/release-20.09)
54+* [Continuous package builds for the NixOS 21.11 release](https://hydra.nixos.org/jobset/nixos/release-21.11)
5055* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
51−* [Tests for the NixOS 20.09 release](https://hydra.nixos.org/job/nixos/release-20.09/tested#tabs-constituents)
56+* [Tests for the NixOS 21.11 release](https://hydra.nixos.org/job/nixos/release-21.11/tested#tabs-constituents)
5257
5358Artifacts successfully built with Hydra are published to cache at
5459https://cache.nixos.org/. When successful build and test criteria are
5560met, the Nixpkgs expressions are distributed via [Nix
56−channels](https://nixos.org/nix/manual/#sec-channels).
61+channels](https://nixos.org/manual/nix/stable/package-management/channels.html).
5762
5863# Contributing
5964
@@ -87,7 +92,7 @@ Most contributions are based on and merged into these branches:
8792 deemed of sufficiently high quality
8893
8994For more information about contributing to the project, please visit
90−the [contributing page](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md).
95+the [contributing page](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
9196
9297# Donations
9398
@@ -97,7 +102,8 @@ Foundation](https://nixos.org/nixos/foundation.html). To ensure the
97102continuity and expansion of the NixOS infrastructure, we are looking
98103for donations to our organization.
99104
100−You can donate to the NixOS foundation by using Open Collective:
105+You can donate to the NixOS foundation through [SEPA bank
106+transfers](https://nixos.org/donate.html) or by using Open Collective:
101107
102108<a href="https://opencollective.com/nixos#support"><img src="https://opencollective.com/nixos/tiers/supporter.svg?width=890" /></a>
103109
doc/Makefile+25−13
@@ -1,5 +1,21 @@
11MD_TARGETS=$(addsuffix .xml, $(basename $(shell find . -type f -regex '.*\.md$$' -not -name README.md)))
22
3+PANDOC ?= pandoc
4+
5+pandoc_media_dir = media
6+# NOTE: Keep in sync with NixOS manual (/nixos/doc/manual/md-to-db.sh) and conversion script (/maintainers/scripts/db-to-md.sh).
7+# TODO: Remove raw-attribute when we can get rid of DocBook altogether.
8+pandoc_commonmark_enabled_extensions = +attributes+fenced_divs+footnotes+bracketed_spans+definition_lists+pipe_tables+raw_attribute
9+# Not needed:
10+# - docbook-reader/citerefentry-to-rst-role.lua (only relevant for DocBook → MarkDown/rST/MyST)
11+pandoc_flags = --extract-media=$(pandoc_media_dir) \
12+ --lua-filter=$(PANDOC_LUA_FILTERS_DIR)/diagram-generator.lua \
13+ --lua-filter=build-aux/pandoc-filters/myst-reader/roles.lua \
14+ --lua-filter=build-aux/pandoc-filters/link-unix-man-references.lua \
15+ --lua-filter=build-aux/pandoc-filters/docbook-writer/rst-roles.lua \
16+ --lua-filter=build-aux/pandoc-filters/docbook-writer/labelless-link-is-xref.lua \
17+ -f commonmark$(pandoc_commonmark_enabled_extensions)+smart
18+
319.PHONY: all
420all: validate format out/html/index.html out/epub/manual.epub
521
@@ -22,7 +38,7 @@ fix-misc-xml:
2238.PHONY: clean
2339clean:
2440 rm -f ${MD_TARGETS} doc-support/result .version manual-full.xml functions/library/locations.xml functions/library/generated
25− rm -rf ./out/ ./highlightjs
41+ rm -rf ./out/ ./highlightjs ./media
2642
2743.PHONY: validate
2844validate: manual-full.xml doc-support/result
@@ -39,7 +55,7 @@ out/html/index.html: doc-support/result manual-full.xml style.css highlightjs
3955 mkdir -p out/html/highlightjs/
4056 cp -r highlightjs out/html/
4157
42− cp -r media out/html/
58+ cp -r $(pandoc_media_dir) out/html/
4359 cp ./overrides.css out/html/
4460 cp ./style.css out/html/style.css
4561
@@ -54,7 +70,7 @@ out/epub/manual.epub: manual-full.xml
5470 doc-support/result/epub.xsl \
5571 ./manual-full.xml
5672
57− cp -r media out/epub/scratch/OEBPS
73+ cp -r $(pandoc_media_dir) out/epub/scratch/OEBPS
5874 cp ./overrides.css out/epub/scratch/OEBPS
5975 cp ./style.css out/epub/scratch/OEBPS
6076 mkdir -p out/epub/scratch/OEBPS/images/callouts/
@@ -89,16 +105,12 @@ functions/library/generated: doc-support/result
89105 ln -rfs ./doc-support/result/function-docs functions/library/generated
90106
91107%.section.xml: %.section.md
92− pandoc $^ -t docbook \
93− --extract-media=media \
94− --lua-filter=$(PANDOC_LUA_FILTERS_DIR)/diagram-generator.lua \
95− -f markdown+smart \
96− | cat > $@
108+ $(PANDOC) $^ -t docbook \
109+ $(pandoc_flags) \
110+ -o $@
97111
98112%.chapter.xml: %.chapter.md
99− pandoc $^ -t docbook \
113+ $(PANDOC) $^ -t docbook \
100114 --top-level-division=chapter \
101− --extract-media=media \
102− --lua-filter=$(PANDOC_LUA_FILTERS_DIR)/diagram-generator.lua \
103− -f markdown+smart \
104− | cat > $@
115+ $(pandoc_flags) \
116+ -o $@
doc/build-aux/pandoc-filters/docbook-reader/citerefentry-to-rst-role.luanew file+23
@@ -0,0 +1,23 @@
1+--[[
2+Converts Code AST nodes produced by pandoc’s DocBook reader
3+from citerefentry elements into AST for corresponding role
4+for reStructuredText.
5+
6+We use subset of MyST syntax (CommonMark with features from rST)
7+so let’s use the rST AST for rST features.
8+
9+Reference: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-manpage
10+]]
11+
12+function Code(elem)
13+ elem.classes = elem.classes:map(function (x)
14+ if x == 'citerefentry' then
15+ elem.attributes['role'] = 'manpage'
16+ return 'interpreted-text'
17+ else
18+ return x
19+ end
20+ end)
21+
22+ return elem
23+end
doc/build-aux/pandoc-filters/docbook-writer/labelless-link-is-xref.luanew file+34
@@ -0,0 +1,34 @@
1+--[[
2+Converts Link AST nodes with empty label to DocBook xref elements.
3+
4+This is a temporary script to be able use cross-references conveniently
5+using syntax taken from MyST, while we still use docbook-xsl
6+for generating the documentation.
7+
8+Reference: https://myst-parser.readthedocs.io/en/latest/using/syntax.html#targets-and-cross-referencing
9+]]
10+
11+local function starts_with(start, str)
12+ return str:sub(1, #start) == start
13+end
14+
15+local function escape_xml_arg(arg)
16+ amps = arg:gsub('&', '&')
17+ amps_quotes = amps:gsub('"', '"')
18+ amps_quotes_lt = amps_quotes:gsub('<', '<')
19+
20+ return amps_quotes_lt
21+end
22+
23+function Link(elem)
24+ has_no_content = #elem.content == 0
25+ targets_anchor = starts_with('#', elem.target)
26+ has_no_attributes = elem.title == '' and elem.identifier == '' and #elem.classes == 0 and #elem.attributes == 0
27+
28+ if has_no_content and targets_anchor and has_no_attributes then
29+ -- xref expects idref without the pound-sign
30+ target_without_hash = elem.target:sub(2, #elem.target)
31+
32+ return pandoc.RawInline('docbook', '<xref linkend="' .. escape_xml_arg(target_without_hash) .. '" />')
33+ end
34+end
doc/build-aux/pandoc-filters/docbook-writer/rst-roles.luanew file+36
@@ -0,0 +1,36 @@
1+--[[
2+Converts AST for reStructuredText roles into corresponding
3+DocBook elements.
4+
5+Currently, only a subset of roles is supported.
6+
7+Reference:
8+ List of roles:
9+ https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html
10+ manpage:
11+ https://tdg.docbook.org/tdg/5.1/citerefentry.html
12+ file:
13+ https://tdg.docbook.org/tdg/5.1/filename.html
14+]]
15+
16+function Code(elem)
17+ if elem.classes:includes('interpreted-text') then
18+ local tag = nil
19+ local content = elem.text
20+ if elem.attributes['role'] == 'manpage' then
21+ tag = 'citerefentry'
22+ local title, volnum = content:match('^(.+)%((%w+)%)$')
23+ if title == nil then
24+ -- No volnum in parentheses.
25+ title = content
26+ end
27+ content = '<refentrytitle>' .. title .. '</refentrytitle>' .. (volnum ~= nil and ('<manvolnum>' .. volnum .. '</manvolnum>') or '')
28+ elseif elem.attributes['role'] == 'file' then
29+ tag = 'filename'
30+ end
31+
32+ if tag ~= nil then
33+ return pandoc.RawInline('docbook', '<' .. tag .. '>' .. content .. '</' .. tag .. '>')
34+ end
35+ end
36+end
doc/build-aux/pandoc-filters/link-unix-man-references.luanew file+17
@@ -0,0 +1,17 @@
1+--[[
2+Turns a manpage reference into a link, when a mapping is defined below.
3+]]
4+
5+local man_urls = {
6+ ["tmpfiles.d(5)"] = "https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html",
7+ ["nix.conf(5)"] = "https://nixos.org/manual/nix/stable/#sec-conf-file",
8+ ["systemd.time(7)"] = "https://www.freedesktop.org/software/systemd/man/systemd.time.html",
9+ ["systemd.timer(5)"] = "https://www.freedesktop.org/software/systemd/man/systemd.timer.html",
10+}
11+
12+function Code(elem)
13+ local is_man_role = elem.classes:includes('interpreted-text') and elem.attributes['role'] == 'manpage'
14+ if is_man_role and man_urls[elem.text] ~= nil then
15+ return pandoc.Link(elem, man_urls[elem.text])
16+ end
17+end
doc/build-aux/pandoc-filters/myst-reader/roles.luanew file+29
@@ -0,0 +1,29 @@
1+--[[
2+Replaces Str AST nodes containing {role}, followed by a Code node
3+by a Code node with attrs that would be produced by rST reader
4+from the role syntax.
5+
6+This is to emulate MyST syntax in Pandoc.
7+(MyST is a CommonMark flavour with rST features mixed in.)
8+
9+Reference: https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html#roles-an-in-line-extension-point
10+]]
11+
12+function Inlines(inlines)
13+ for i = #inlines-1,1,-1 do
14+ local first = inlines[i]
15+ local second = inlines[i+1]
16+ local correct_tags = first.tag == 'Str' and second.tag == 'Code'
17+ if correct_tags then
18+ -- docutils supports alphanumeric strings separated by [-._:]
19+ -- We are slightly more liberal for simplicity.
20+ local role = first.text:match('^{([-._+:%w]+)}$')
21+ if role ~= nil then
22+ inlines:remove(i)
23+ second.attributes['role'] = role
24+ second.classes:insert('interpreted-text')
25+ end
26+ end
27+ end
28+ return inlines
29+end
doc/build-aux/pandoc-filters/myst-writer/roles.luanew file+25
@@ -0,0 +1,25 @@
1+--[[
2+Replaces Code nodes with attrs that would be produced by rST reader
3+from the role syntax by a Str AST node containing {role}, followed by a Code node.
4+
5+This is to emulate MyST syntax in Pandoc.
6+(MyST is a CommonMark flavour with rST features mixed in.)
7+
8+Reference: https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html#roles-an-in-line-extension-point
9+]]
10+
11+function Code(elem)
12+ local role = elem.attributes['role']
13+
14+ if elem.classes:includes('interpreted-text') and role ~= nil then
15+ elem.classes = elem.classes:filter(function (c)
16+ return c ~= 'interpreted-text'
17+ end)
18+ elem.attributes['role'] = nil
19+
20+ return {
21+ pandoc.Str('{' .. role .. '}'),
22+ elem,
23+ }
24+ end
25+end
doc/builders/fetchers.chapter.md+61−25
@@ -1,8 +1,16 @@
11# Fetchers {#chap-pkgs-fetchers}
22
3−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.
3+When using Nix, you will frequently need to download source code and other files from the internet. For this purpose, Nix provides the [_fixed output derivation_](https://nixos.org/manual/nix/stable/#fixed-output-drvs) feature and Nixpkgs provides various functions that implement the actual fetching from various protocols and services.
44
5−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.
5+## Caveats
6+
7+Because fixed output derivations are _identified_ by their hash, a common mistake is to update a fetcher's URL or a version parameter, without updating the hash. **This will cause the old contents to be used.** So remember to always invalidate the hash argument.
8+
9+For those who develop and maintain fetchers, a similar problem arises with changes to the implementation of a fetcher. These may cause a fixed output derivation to fail, but won't normally be caught by tests because the supposed output is already in the store or cache. For the purpose of testing, you can use a trick that is embodied by the [`invalidateFetcherByDrvHash`](#tester-invalidateFetcherByDrvHash) function. It uses the derivation `name` to create a unique output path per fetcher implementation, defeating the caching precisely where it would be harmful.
10+
11+## `fetchurl` and `fetchzip` {#fetchurl}
12+
13+Two basic fetchers 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.
614
715```nix
816{ stdenv, fetchurl }:
@@ -16,63 +24,91 @@ stdenv.mkDerivation {
1624}
1725```
1826
19−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.
20−
21−`fetchpatch` works very similarly to `fetchurl` with the same arguments expected. It expects patch files as a source 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.
27+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.
2228
29+`fetchpatch` works very similarly to `fetchurl` with the same arguments expected. It expects patch files as a source 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.
2330
24−Other fetcher functions allow you to add source code directly from a VCS such as subversion or git. These are mostly straightforward nambes based on the name of the command used with the VCS system. Because they give you a working repository, they act most like `fetchzip`.
31+Most other fetchers return a directory rather than a single file.
2532
26−## `fetchsvn`
33+## `fetchsvn` {#fetchsvn}
2734
2835Used with Subversion. Expects `url` to a Subversion directory, `rev`, and `sha256`.
2936
30−## `fetchgit`
37+## `fetchgit` {#fetchgit}
3138
3239Used 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`.
3340
34−Additionally the following optional arguments can be given: `fetchSubmodules = true` makes `fetchgit` also fetch the submodules of a repository. If `deepClone` is set to true, the entire repository is cloned as opposing to just creating a shallow clone. `deepClone = true` also implies `leaveDotGit = true` which means that the `.git` directory of the clone won't be removed after checkout.
41+Additionally, the following optional arguments can be given: `fetchSubmodules = true` makes `fetchgit` also fetch the submodules of a repository. If `deepClone` is set to true, the entire repository is cloned as opposing to just creating a shallow clone. `deepClone = true` also implies `leaveDotGit = true` which means that the `.git` directory of the clone won't be removed after checkout.
3542
36−## `fetchfossil`
43+If only parts of the repository are needed, `sparseCheckout` can be used. This will prevent git from fetching unnecessary blobs from server, see [git sparse-checkout](https://git-scm.com/docs/git-sparse-checkout) and [git clone --filter](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---filterltfilter-specgt) for more information:
44+
45+```nix
46+{ stdenv, fetchgit }:
47+
48+stdenv.mkDerivation {
49+ name = "hello";
50+ src = fetchgit {
51+ url = "https://...";
52+ sparseCheckout = ''
53+ path/to/be/included
54+ another/path
55+ '';
56+ sha256 = "0000000000000000000000000000000000000000000000000000";
57+ };
58+}
59+```
60+
61+## `fetchfossil` {#fetchfossil}
3762
3863Used with Fossil. Expects `url` to a Fossil archive, `rev`, and `sha256`.
3964
40−## `fetchcvs`
65+## `fetchcvs` {#fetchcvs}
4166
4267Used with CVS. Expects `cvsRoot`, `tag`, and `sha256`.
4368
44−## `fetchhg`
69+## `fetchhg` {#fetchhg}
4570
4671Used with Mercurial. Expects `url`, `rev`, and `sha256`.
4772
4873A 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.
4974
50−## `fetchFromGitHub`
75+## `fetchFromGitea` {#fetchfromgitea}
76+
77+`fetchFromGitea` expects five arguments. `domain` is the gitea server name. `owner` is a string corresponding to the Gitea user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every Gitea 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.
5178
52−`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.
79+## `fetchFromGitHub` {#fetchfromgithub}
80+
81+`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.
5382
5483`fetchFromGitHub` uses `fetchzip` to download the source archive generated by GitHub for the specified revision. If `leaveDotGit`, `deepClone` or `fetchSubmodules` are set to `true`, `fetchFromGitHub` will use `fetchgit` instead. Refer to its section for documentation of these options.
5584
56−## `fetchFromGitLab`
85+## `fetchFromGitLab` {#fetchfromgitlab}
5786
58−This is used with GitLab repositories. The arguments expected are very similar to fetchFromGitHub above.
87+This is used with GitLab repositories. The arguments expected are very similar to `fetchFromGitHub` above.
5988
60−## `fetchFromGitiles`
89+## `fetchFromGitiles` {#fetchfromgitiles}
6190
62−This is used with Gitiles repositories. The arguments expected are similar to fetchgit.
91+This is used with Gitiles repositories. The arguments expected are similar to `fetchgit`.
6392
64−## `fetchFromBitbucket`
93+## `fetchFromBitbucket` {#fetchfrombitbucket}
6594
6695This is used with BitBucket repositories. The arguments expected are very similar to fetchFromGitHub above.
6796
68−## `fetchFromSavannah`
97+## `fetchFromSavannah` {#fetchfromsavannah}
98+
99+This is used with Savannah repositories. The arguments expected are very similar to `fetchFromGitHub` above.
69100
70−This is used with Savannah repositories. The arguments expected are very similar to fetchFromGitHub above.
101+## `fetchFromRepoOrCz` {#fetchfromrepoorcz}
71102
72−## `fetchFromRepoOrCz`
103+This is used with repo.or.cz repositories. The arguments expected are very similar to `fetchFromGitHub` above.
73104
74−This is used with repo.or.cz repositories. The arguments expected are very similar to fetchFromGitHub above.
105+## `fetchFromSourcehut` {#fetchfromsourcehut}
75106
76−## `fetchFromSourcehut`
107+This is used with sourcehut repositories. Similar to `fetchFromGitHub` above,
108+it expects `owner`, `repo`, `rev` and `sha256`, but don't forget the tilde (~)
109+in front of the username! Expected arguments also include `vc` ("git" (default)
110+or "hg"), `domain` and `fetchSubmodules`.
77111
78−This is used with sourcehut repositories. The arguments expected are very similar to fetchFromGitHub above. Don't forget the tilde (~) in front of the user name!
112+If `fetchSubmodules` is `true`, `fetchFromSourcehut` uses `fetchgit`
113+or `fetchhg` with `fetchSubmodules` or `fetchSubrepos` set to `true`,
114+respectively. Otherwise, the fetcher uses `fetchzip`.
doc/builders/images.xml+3−3
@@ -5,8 +5,8 @@
55 <para>
66 This chapter describes tools for creating various types of images.
77 </para>
8− <xi:include href="images/appimagetools.xml" />
8+ <xi:include href="images/appimagetools.section.xml" />
99 <xi:include href="images/dockertools.section.xml" />
10− <xi:include href="images/ocitools.xml" />
11− <xi:include href="images/snaptools.xml" />
10+ <xi:include href="images/ocitools.section.xml" />
11+ <xi:include href="images/snaptools.section.xml" />
1212</chapter>
doc/builders/images/appimagetools.section.mdnew file+48
@@ -0,0 +1,48 @@
1+# pkgs.appimageTools {#sec-pkgs-appimageTools}
2+
3+`pkgs.appimageTools` is a set of functions for extracting and wrapping [AppImage](https://appimage.org/) 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.
4+
5+::: {.warning}
6+The `appimageTools` API is unstable and may be subject to backwards-incompatible changes in the future.
7+:::
8+
9+## AppImage formats {#ssec-pkgs-appimageTools-formats}
10+
11+There are different formats for AppImages, see [the specification](https://github.com/AppImage/AppImageSpec/blob/74ad9ca2f94bf864a4a0dac1f369dd4f00bd1c28/draft.md#image-format) for details.
12+
13+- Type 1 images are ISO 9660 files that are also ELF executables.
14+- Type 2 images are ELF executables with an appended filesystem.
15+
16+They can be told apart with `file -k`:
17+
18+```ShellSession
19+$ file -k type1.AppImage
20+type1.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) ISO 9660 CD-ROM filesystem data 'AppImage' (Lepton 3.x), scale 0-0,
21+spot sensor temperature 0.000000, unit celsius, color scheme 0, calibration: offset 0.000000, slope 0.000000, dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=d629f6099d2344ad82818172add1d38c5e11bc6d, stripped\012- data
22+
23+$ file -k type2.AppImage
24+type2.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (Lepton 3.x), scale 232-60668, spot sensor temperature -4.187500, color scheme 15, show scale bar, calibration: offset -0.000000, slope 0.000000 (Lepton 2.x), scale 4111-45000, spot sensor temperature 412442.250000, color scheme 3, minimum point enabled, calibration: offset -75402534979642766821519867692934234112.000000, slope 5815371847733706829839455140374904832.000000, dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=79dcc4e55a61c293c5e19edbd8d65b202842579f, stripped\012- data
25+```
26+
27+Note how the type 1 AppImage is described as an `ISO 9660 CD-ROM filesystem`, and the type 2 AppImage is not.
28+
29+## Wrapping {#ssec-pkgs-appimageTools-wrapping}
30+
31+Depending on the type of AppImage you're wrapping, you'll have to use `wrapType1` or `wrapType2`.
32+
33+```nix
34+appimageTools.wrapType2 { # or wrapType1
35+ name = "patchwork";
36+ src = fetchurl {
37+ url = "https://github.com/ssbc/patchwork/releases/download/v3.11.4/Patchwork-3.11.4-linux-x86_64.AppImage";
38+ sha256 = "1blsprpkvm0ws9b96gb36f0rbf8f5jgmw4x6dsb1kswr4ysf591s";
39+ };
40+ extraPkgs = pkgs: with pkgs; [ ];
41+}
42+```
43+
44+- `name` specifies the name of the resulting image.
45+- `src` specifies the AppImage file to extract.
46+- `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:
47+ - 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`.
48+ - Running `strace -vfefile` on the wrapped executable, looking for libraries that can't be found.
doc/builders/images/appimagetools.xmldeleted−102
@@ -1,102 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/XInclude"
4− xml:id="sec-pkgs-appimageTools">
5− <title>pkgs.appimageTools</title>
6−
7− <para>
8− <varname>pkgs.appimageTools</varname> is a set of functions for extracting and wrapping <link xlink:href="https://appimage.org/">AppImage</link> 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, <literal>pkgs.appimage-run</literal> can be used as well.
9− </para>
10−
11− <warning>
12− <para>
13− The <varname>appimageTools</varname> API is unstable and may be subject to backwards-incompatible changes in the future.
14− </para>
15− </warning>
16−
17− <section xml:id="ssec-pkgs-appimageTools-formats">
18− <title>AppImage formats</title>
19−
20− <para>
21− There are different formats for AppImages, see <link xlink:href="https://github.com/AppImage/AppImageSpec/blob/74ad9ca2f94bf864a4a0dac1f369dd4f00bd1c28/draft.md#image-format">the specification</link> for details.
22− </para>
23−
24− <itemizedlist>
25− <listitem>
26− <para>
27− Type 1 images are ISO 9660 files that are also ELF executables.
28− </para>
29− </listitem>
30− <listitem>
31− <para>
32− Type 2 images are ELF executables with an appended filesystem.
33− </para>
34− </listitem>
35− </itemizedlist>
36−
37− <para>
38− They can be told apart with <command>file -k</command>:
39− </para>
40−
41−<screen>
42−<prompt>$ </prompt>file -k type1.AppImage
43−type1.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) ISO 9660 CD-ROM filesystem data 'AppImage' (Lepton 3.x), scale 0-0,
44−spot sensor temperature 0.000000, unit celsius, color scheme 0, calibration: offset 0.000000, slope 0.000000, dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=d629f6099d2344ad82818172add1d38c5e11bc6d, stripped\012- data
45−
46−<prompt>$ </prompt>file -k type2.AppImage
47−type2.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (Lepton 3.x), scale 232-60668, spot sensor temperature -4.187500, color scheme 15, show scale bar, calibration: offset -0.000000, slope 0.000000 (Lepton 2.x), scale 4111-45000, spot sensor temperature 412442.250000, color scheme 3, minimum point enabled, calibration: offset -75402534979642766821519867692934234112.000000, slope 5815371847733706829839455140374904832.000000, dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=79dcc4e55a61c293c5e19edbd8d65b202842579f, stripped\012- data
48−</screen>
49−
50− <para>
51− Note how the type 1 AppImage is described as an <literal>ISO 9660 CD-ROM filesystem</literal>, and the type 2 AppImage is not.
52− </para>
53− </section>
54−
55− <section xml:id="ssec-pkgs-appimageTools-wrapping">
56− <title>Wrapping</title>
57−
58− <para>
59− Depending on the type of AppImage you're wrapping, you'll have to use <varname>wrapType1</varname> or <varname>wrapType2</varname>.
60− </para>
61−
62−<programlisting>
63−appimageTools.wrapType2 { # or wrapType1
64− name = "patchwork"; <co xml:id='ex-appimageTools-wrapping-1' />
65− src = fetchurl { <co xml:id='ex-appimageTools-wrapping-2' />
66− url = "https://github.com/ssbc/patchwork/releases/download/v3.11.4/Patchwork-3.11.4-linux-x86_64.AppImage";
67− sha256 = "1blsprpkvm0ws9b96gb36f0rbf8f5jgmw4x6dsb1kswr4ysf591s";
68− };
69− extraPkgs = pkgs: with pkgs; [ ]; <co xml:id='ex-appimageTools-wrapping-3' />
70−}</programlisting>
71−
72− <calloutlist>
73− <callout arearefs='ex-appimageTools-wrapping-1'>
74− <para>
75− <varname>name</varname> specifies the name of the resulting image.
76− </para>
77− </callout>
78− <callout arearefs='ex-appimageTools-wrapping-2'>
79− <para>
80− <varname>src</varname> specifies the AppImage file to extract.
81− </para>
82− </callout>
83− <callout arearefs='ex-appimageTools-wrapping-3'>
84− <para>
85− <varname>extraPkgs</varname> 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:
86− <itemizedlist>
87− <listitem>
88− <para>
89− Looking through the extracted AppImage files, reading its scripts and running <command>patchelf</command> and <command>ldd</command> on its executables. This can also be done in <command>appimage-run</command>, by setting <command>APPIMAGE_DEBUG_EXEC=bash</command>.
90− </para>
91− </listitem>
92− <listitem>
93− <para>
94− Running <command>strace -vfefile</command> on the wrapped executable, looking for libraries that can't be found.
95− </para>
96− </listitem>
97− </itemizedlist>
98− </para>
99− </callout>
100− </calloutlist>
101− </section>
102−</section>
doc/builders/images/dockertools.section.md+26−10
@@ -1,6 +1,6 @@
11# pkgs.dockerTools {#sec-pkgs-dockerTools}
22
3−`pkgs.dockerTools` is a set of functions for creating and manipulating Docker images according to the [ Docker Image Specification v1.2.0 ](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#docker-image-specification-v120). Docker itself is not used to perform any of the operations done by these functions.
3+`pkgs.dockerTools` is a set of functions for creating and manipulating Docker images according to the [Docker Image Specification v1.2.0](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#docker-image-specification-v120). Docker itself is not used to perform any of the operations done by these functions.
44
55## buildImage {#ssec-pkgs-dockerTools-buildImage}
66
@@ -52,13 +52,13 @@ The above example will build a Docker image `redis/latest` from the given base i
5252
5353> **_NOTE:_** Using this parameter requires the `kvm` device to be available.
5454
55−- `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 ](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions).
55+- `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](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions).
5656
5757After 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.
5858
5959At the end of the process, only one new single layer will be produced and added to the resulting image.
6060
61−The resulting repository will only list the single image `image/tag`. In the case of [the `buildImage` example](#ex-dockerTools-buildImage) it would be `redis/latest`.
61+The resulting repository will only list the single image `image/tag`. In the case of [the `buildImage` example](#ex-dockerTools-buildImage), it would be `redis/latest`.
6262
6363It is possible to inspect the arguments with which an image was built using its `buildArgs` attribute.
6464
@@ -87,7 +87,7 @@ pkgs.dockerTools.buildImage {
8787}
8888```
8989
90−and now the Docker CLI will display a reasonable date and sort the images as expected:
90+Now the Docker CLI will display a reasonable date and sort the images as expected:
9191
9292```ShellSession
9393$ docker images
@@ -95,7 +95,7 @@ REPOSITORY TAG IMAGE ID CREATED SIZE
9595hello latest de2bf4786de6 About a minute ago 25.2MB
9696```
9797
98−however, the produced images will not be binary reproducible.
98+However, the produced images will not be binary reproducible.
9999
100100## buildLayeredImage {#ssec-pkgs-dockerTools-buildLayeredImage}
101101
@@ -111,15 +111,21 @@ Create a Docker image with many of the store paths being on their own layer to i
111111
112112 *Default:* the output path's hash
113113
114+`fromImage` _optional_
115+
116+: The repository tarball containing the base image. It must be a valid Docker image, such as one exported by `docker save`.
117+
118+ *Default:* `null`, which can be seen as equivalent to `FROM scratch` of a `Dockerfile`.
119+
114120`contents` _optional_
115121
116−: Top level paths in the container. Either a single derivation, or a list of derivations.
122+: Top-level paths in the container. Either a single derivation, or a list of derivations.
117123
118124 *Default:* `[]`
119125
120126`config` _optional_
121127
122−: Run-time configuration of the container. A full list of the options are available at in the [ Docker Image Specification v1.2.0 ](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions).
128+: Run-time configuration of the container. A full list of the options are available at in the [Docker Image Specification v1.2.0](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions).
123129
124130 *Default:* `{}`
125131
@@ -141,6 +147,16 @@ Create a Docker image with many of the store paths being on their own layer to i
141147
142148: 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.
143149
150+`fakeRootCommands` _optional_
151+
152+: Shell commands to run while creating the archive for the final layer in a fakeroot environment. Unlike `extraCommands`, you can run `chown` to change the owners of the files in the archive, changing fakeroot's state instead of the real filesystem. The latter would require privileges that the build user does not have. Static binaries do not interact with the fakeroot environment. By default all files in the archive will be owned by root.
153+
154+`enableFakechroot` _optional_
155+
156+: Whether to run in `fakeRootCommands` in `fakechroot`, making programs behave as though `/` is the root of the image being created, while files in the Nix store are available as usual. This allows scripts that perform installation in `/` to work as expected. Considering that `fakechroot` is implemented via the same mechanism as `fakeroot`, the same caveats apply.
157+
158+ *Default:* `false`
159+
144160### Behavior of `contents` in the final image {#dockerTools-buildLayeredImage-arg-contents}
145161
146162Each path directly listed in `contents` will have a symlink in the root of the image.
@@ -179,9 +195,9 @@ pkgs.dockerTools.buildLayeredImage {
179195
180196Increasing the `maxLayers` increases the number of layers which have a chance to be shared between different images.
181197
182−Modern Docker installations support up to 128 layers, however older versions support as few as 42.
198+Modern Docker installations support up to 128 layers, but older versions support as few as 42.
183199
184−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.
200+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.
185201
186202The 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.
187203
@@ -197,7 +213,7 @@ The image produced by running the output script can be piped directly into `dock
197213$(nix-build) | docker load
198214```
199215
200−Alternatively, the image be piped via `gzip` into `skopeo`, e.g. to copy it into a registry:
216+Alternatively, the image be piped via `gzip` into `skopeo`, e.g., to copy it into a registry:
201217
202218```ShellSession
203219$(nix-build) | gzip --fast | skopeo copy docker-archive:/dev/stdin docker://some_docker_registry/myimage:tag
doc/builders/images/ocitools.section.mdnew file+37
@@ -0,0 +1,37 @@
1+# pkgs.ociTools {#sec-pkgs-ociTools}
2+
3+`pkgs.ociTools` is a set of functions for creating containers according to the [OCI container specification v1.0.0](https://github.com/opencontainers/runtime-spec). Beyond that, it makes no assumptions about the container runner you choose to use to run the created container.
4+
5+## buildContainer {#ssec-pkgs-ociTools-buildContainer}
6+
7+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.
8+
9+The parameters of `buildContainer` with an example value are described below:
10+
11+```nix
12+buildContainer {
13+ args = [
14+ (with pkgs;
15+ writeScript "run.sh" ''
16+ #!${bash}/bin/bash
17+ exec ${bash}/bin/bash
18+ '').outPath
19+ ];
20+
21+ mounts = {
22+ "/data" = {
23+ type = "none";
24+ source = "/var/lib/mydata";
25+ options = [ "bind" ];
26+ };
27+ };
28+
29+ readonly = false;
30+}
31+```
32+
33+- `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.
34+
35+- `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)
36+
37+- `readonly` makes the container\'s rootfs read-only if it is set to true. The default value is false `false`.
doc/builders/images/ocitools.xmldeleted−61
@@ -1,61 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/XInclude"
4− xml:id="sec-pkgs-ociTools">
5− <title>pkgs.ociTools</title>
6−
7− <para>
8− <varname>pkgs.ociTools</varname> is a set of functions for creating containers according to the <link xlink:href="https://github.com/opencontainers/runtime-spec">OCI container specification v1.0.0</link>. Beyond that it makes no assumptions about the container runner you choose to use to run the created container.
9− </para>
10−
11− <section xml:id="ssec-pkgs-ociTools-buildContainer">
12− <title>buildContainer</title>
13−
14− <para>
15− This function creates a simple OCI container that runs a single command inside of it. An OCI container consists of a <varname>config.json</varname> and a rootfs directory.The nix store of the container will contain all referenced dependencies of the given command.
16− </para>
17−
18− <para>
19− The parameters of <varname>buildContainer</varname> with an example value are described below:
20− </para>
21−
22− <example xml:id='ex-ociTools-buildContainer'>
23− <title>Build Container</title>
24−<programlisting>
25−buildContainer {
26− args = [ (with pkgs; writeScript "run.sh" ''
27− #!${bash}/bin/bash
28− exec ${bash}/bin/bash
29− '').outPath ]; <co xml:id='ex-ociTools-buildContainer-1' />
30−
31− mounts = {
32− "/data" = {
33− type = "none";
34− source = "/var/lib/mydata";
35− options = [ "bind" ];
36− };
37− };<co xml:id='ex-ociTools-buildContainer-2' />
38−
39− readonly = false; <co xml:id='ex-ociTools-buildContainer-3' />
40−}
41−</programlisting>
42− <calloutlist>
43− <callout arearefs='ex-ociTools-buildContainer-1'>
44− <para>
45− <varname>args</varname> specifies a set of arguments to run inside the container. This is the only required argument for <varname>buildContainer</varname>. All referenced packages inside the derivation will be made available inside the container
46− </para>
47− </callout>
48− <callout arearefs='ex-ociTools-buildContainer-2'>
49− <para>
50− <varname>mounts</varname> 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)
51− </para>
52− </callout>
53− <callout arearefs='ex-ociTools-buildContainer-3'>
54− <para>
55− <varname>readonly</varname> makes the container's rootfs read-only if it is set to true. The default value is false <literal>false</literal>.
56− </para>
57− </callout>
58− </calloutlist>
59− </example>
60− </section>
61−</section>
doc/builders/images/snap/example-firefox.nixdeleted−28
@@ -1,28 +0,0 @@
1−let
2− inherit (import <nixpkgs> { }) snapTools firefox;
3−in snapTools.makeSnap {
4− meta = {
5− name = "nix-example-firefox";
6− summary = firefox.meta.description;
7− architectures = [ "amd64" ];
8− apps.nix-example-firefox = {
9− command = "${firefox}/bin/firefox";
10− plugs = [
11− "pulseaudio"
12− "camera"
13− "browser-support"
14− "avahi-observe"
15− "cups-control"
16− "desktop"
17− "desktop-legacy"
18− "gsettings"
19− "home"
20− "network"
21− "mount-observe"
22− "removable-media"
23− "x11"
24− ];
25− };
26− confinement = "strict";
27− };
28−}
doc/builders/images/snap/example-hello.nixdeleted−12
@@ -1,12 +0,0 @@
1−let
2− inherit (import <nixpkgs> { }) snapTools hello;
3−in snapTools.makeSnap {
4− meta = {
5− name = "hello";
6− summary = hello.meta.description;
7− description = hello.meta.longDescription;
8− architectures = [ "amd64" ];
9− confinement = "strict";
10− apps.hello.command = "${hello}/bin/hello";
11− };
12−}
doc/builders/images/snaptools.section.mdnew file+71
@@ -0,0 +1,71 @@
1+# pkgs.snapTools {#sec-pkgs-snapTools}
2+
3+`pkgs.snapTools` is a set of functions for creating Snapcraft images. Snap and Snapcraft is not used to perform these operations.
4+
5+## The makeSnap Function {#ssec-pkgs-snapTools-makeSnap-signature}
6+
7+`makeSnap` takes a single named argument, `meta`. This argument mirrors [the upstream `snap.yaml` format](https://docs.snapcraft.io/snap-format) exactly.
8+
9+The `base` should not be specified, as `makeSnap` will force set it.
10+
11+Currently, `makeSnap` does not support creating GUI stubs.
12+
13+## Build a Hello World Snap {#ssec-pkgs-snapTools-build-a-snap-hello}
14+
15+The following expression packages GNU Hello as a Snapcraft snap.
16+
17+``` {#ex-snapTools-buildSnap-hello .nix}
18+let
19+ inherit (import <nixpkgs> { }) snapTools hello;
20+in snapTools.makeSnap {
21+ meta = {
22+ name = "hello";
23+ summary = hello.meta.description;
24+ description = hello.meta.longDescription;
25+ architectures = [ "amd64" ];
26+ confinement = "strict";
27+ apps.hello.command = "${hello}/bin/hello";
28+ };
29+}
30+```
31+
32+`nix-build` this expression and install it with `snap install ./result --dangerous`. `hello` will now be the Snapcraft version of the package.
33+
34+## Build a Graphical Snap {#ssec-pkgs-snapTools-build-a-snap-firefox}
35+
36+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.
37+
38+``` {#ex-snapTools-buildSnap-firefox .nix}
39+let
40+ inherit (import <nixpkgs> { }) snapTools firefox;
41+in snapTools.makeSnap {
42+ meta = {
43+ name = "nix-example-firefox";
44+ summary = firefox.meta.description;
45+ architectures = [ "amd64" ];
46+ apps.nix-example-firefox = {
47+ command = "${firefox}/bin/firefox";
48+ plugs = [
49+ "pulseaudio"
50+ "camera"
51+ "browser-support"
52+ "avahi-observe"
53+ "cups-control"
54+ "desktop"
55+ "desktop-legacy"
56+ "gsettings"
57+ "home"
58+ "network"
59+ "mount-observe"
60+ "removable-media"
61+ "x11"
62+ ];
63+ };
64+ confinement = "strict";
65+ };
66+}
67+```
68+
69+`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.
70+
71+The specific meaning behind plugs can be looked up in the [Snapcraft interface documentation](https://docs.snapcraft.io/supported-interfaces).
doc/builders/images/snaptools.xmldeleted−59
@@ -1,59 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/XInclude"
4− xml:id="sec-pkgs-snapTools">
5− <title>pkgs.snapTools</title>
6−
7− <para>
8− <varname>pkgs.snapTools</varname> is a set of functions for creating Snapcraft images. Snap and Snapcraft is not used to perform these operations.
9− </para>
10−
11− <section xml:id="ssec-pkgs-snapTools-makeSnap-signature">
12− <title>The makeSnap Function</title>
13−
14− <para>
15− <function>makeSnap</function> takes a single named argument, <parameter>meta</parameter>. This argument mirrors <link xlink:href="https://docs.snapcraft.io/snap-format">the upstream <filename>snap.yaml</filename> format</link> exactly.
16− </para>
17−
18− <para>
19− The <parameter>base</parameter> should not be specified, as <function>makeSnap</function> will force set it.
20− </para>
21−
22− <para>
23− Currently, <function>makeSnap</function> does not support creating GUI stubs.
24− </para>
25− </section>
26−
27− <section xml:id="ssec-pkgs-snapTools-build-a-snap-hello">
28− <title>Build a Hello World Snap</title>
29−
30− <example xml:id="ex-snapTools-buildSnap-hello">
31− <title>Making a Hello World Snap</title>
32− <para>
33− The following expression packages GNU Hello as a Snapcraft snap.
34− </para>
35−<programlisting><xi:include href="./snap/example-hello.nix" parse="text" /></programlisting>
36− <para>
37− <command>nix-build</command> this expression and install it with <command>snap install ./result --dangerous</command>. <command>hello</command> will now be the Snapcraft version of the package.
38− </para>
39− </example>
40− </section>
41−
42− <section xml:id="ssec-pkgs-snapTools-build-a-snap-firefox">
43− <title>Build a Hello World Snap</title>
44−
45− <example xml:id="ex-snapTools-buildSnap-firefox">
46− <title>Making a Graphical Snap</title>
47− <para>
48− 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.
49− </para>
50−<programlisting><xi:include href="./snap/example-firefox.nix" parse="text" /></programlisting>
51− <para>
52− <command>nix-build</command> this expression and install it with <command>snap install ./result --dangerous</command>. <command>nix-example-firefox</command> will now be the Snapcraft version of the Firefox package.
53− </para>
54− <para>
55− The specific meaning behind plugs can be looked up in the <link xlink:href="https://docs.snapcraft.io/supported-interfaces">Snapcraft interface documentation</link>.
56− </para>
57− </example>
58− </section>
59−</section>
doc/builders/packages/cataclysm-dda.section.md+37−2
@@ -1,6 +1,6 @@
11# Cataclysm: Dark Days Ahead {#cataclysm-dark-days-ahead}
22
3−## How to install Cataclysm DDA
3+## How to install Cataclysm DDA {#how-to-install-cataclysm-dda}
44
55To install the latest stable release of Cataclysm DDA to your profile, execute
66`nix-env -f "<nixpkgs>" -iA cataclysm-dda`. For the curses build (build
@@ -34,7 +34,42 @@ cataclysm-dda.override {
3434}
3535```
3636
37−## Customizing with mods
37+## Important note for overriding packages {#important-note-for-overriding-packages}
38+
39+After applying `overrideAttrs`, you need to fix `passthru.pkgs` and
40+`passthru.withMods` attributes either manually or by using `attachPkgs`:
41+
42+```nix
43+let
44+ # You enabled parallel building.
45+ myCDDA = cataclysm-dda-git.overrideAttrs (_: {
46+ enableParallelBuilding = true;
47+ });
48+
49+ # Unfortunately, this refers to the package before overriding and
50+ # parallel building is still disabled.
51+ badExample = myCDDA.withMods (_: []);
52+
53+ inherit (cataclysmDDA) attachPkgs pkgs wrapCDDA;
54+
55+ # You can fix it by hand
56+ goodExample1 = myCDDA.overrideAttrs (old: {
57+ passthru = old.passthru // {
58+ pkgs = pkgs.override { build = goodExample1; };
59+ withMods = wrapCDDA goodExample1;
60+ };
61+ });
62+
63+ # or by using a helper function `attachPkgs`.
64+ goodExample2 = attachPkgs pkgs myCDDA;
65+in
66+
67+# badExample # parallel building disabled
68+# goodExample1.withMods (_: []) # parallel building enabled
69+goodExample2.withMods (_: []) # parallel building enabled
70+```
71+
72+## Customizing with mods {#customizing-with-mods}
3873
3974To install Cataclysm DDA with mods of your choice, you can use `withMods`
4075attribute:
doc/builders/packages/citrix.section.mdnew file+32
@@ -0,0 +1,32 @@
1+# Citrix Workspace {#sec-citrix}
2+
3+The [Citrix Workspace App](https://www.citrix.com/products/workspace-app/) is a remote desktop viewer which provides access to [XenDesktop](https://www.citrix.com/products/xenapp-xendesktop/) installations.
4+
5+## Basic usage {#sec-citrix-base}
6+
7+The tarball archive needs to be downloaded manually, as the license agreements of the vendor for [Citrix Workspace](https://www.citrix.de/downloads/workspace-app/linux/workspace-app-for-linux-latest.html) needs 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.
8+
9+## Citrix Self-service {#sec-citrix-selfservice}
10+
11+The [self-service](https://support.citrix.com/article/CTX200337) is an application managing Citrix desktops and applications. Please note that this feature only works with at least citrix_workspace_20_06_0 and later versions.
12+
13+In order to set this up, you first have to [download the `.cr` file from the Netscaler Gateway](https://its.uiowa.edu/support/article/102186). After that, you can configure the `selfservice` like this:
14+
15+```ShellSession
16+$ storebrowse -C ~/Downloads/receiverconfig.cr
17+$ selfservice
18+```
19+
20+## Custom certificates {#sec-citrix-custom-certs}
21+
22+The `Citrix Workspace App` in `nixpkgs` trusts several certificates [from the Mozilla database](https://curl.haxx.se/docs/caextract.html) 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`](https://developer-docs.citrix.com/projects/receiver-for-linux-command-reference/en/13.7/), 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`:
23+
24+```nix
25+with import <nixpkgs> { config.allowUnfree = true; };
26+let
27+ extraCerts = [
28+ ./custom-cert-1.pem
29+ ./custom-cert-2.pem # ...
30+ ];
31+in citrix_workspace.override { inherit extraCerts; }
32+```
doc/builders/packages/citrix.xmldeleted−48
@@ -1,48 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="sec-citrix">
4− <title>Citrix Workspace</title>
5−
6− <para>
7− The <link xlink:href="https://www.citrix.com/products/workspace-app/">Citrix Workspace App</link> is a remote desktop viewer which provides access to <link xlink:href="https://www.citrix.com/products/xenapp-xendesktop/">XenDesktop</link> installations.
8− </para>
9−
10− <section xml:id="sec-citrix-base">
11− <title>Basic usage</title>
12−
13− <para>
14− The tarball archive needs to be downloaded manually as the license agreements of the vendor for <link xlink:href="https://www.citrix.de/downloads/workspace-app/linux/workspace-app-for-linux-latest.html">Citrix Workspace</link> needs to be accepted first. Then run <command>nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz</command>. With the archive available in the store the package can be built and installed with Nix.
15− </para>
16− </section>
17−
18− <section xml:id="sec-citrix-selfservice">
19− <title>Citrix Selfservice</title>
20−
21− <para>
22− The <link xlink:href="https://support.citrix.com/article/CTX200337">selfservice</link> is an application managing Citrix desktops and applications. Please note that this feature only works with at least <package>citrix_workspace_20_06_0</package> and later versions.
23− </para>
24−
25− <para>
26− In order to set this up, you first have to <link xlink:href="https://its.uiowa.edu/support/article/102186">download the <literal>.cr</literal> file from the Netscaler Gateway</link>. After that you can configure the <command>selfservice</command> like this:
27−<screen>
28−<prompt>$ </prompt>storebrowse -C ~/Downloads/receiverconfig.cr
29−<prompt>$ </prompt>selfservice
30−</screen>
31− </para>
32− </section>
33−
34− <section xml:id="sec-citrix-custom-certs">
35− <title>Custom certificates</title>
36−
37− <para>
38− The <literal>Citrix Workspace App</literal> in <literal>nixpkgs</literal> trusts several certificates <link xlink:href="https://curl.haxx.se/docs/caextract.html">from the Mozilla database</link> 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 <link xlink:href="https://developer-docs.citrix.com/projects/receiver-for-linux-command-reference/en/13.7/"><literal>$ICAROOT</literal></link>, however this directory is a store path in <literal>nixpkgs</literal>. In order to work around this issue the package provides a simple mechanism to add custom certificates without rebuilding the entire package using <literal>symlinkJoin</literal>:
39−<programlisting>
40−<![CDATA[with import <nixpkgs> { config.allowUnfree = true; };
41−let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in
42−citrix_workspace.override {
43− inherit extraCerts;
44−}]]>
45−</programlisting>
46− </para>
47− </section>
48−</section>
doc/builders/packages/dlib.section.mdnew file+13
@@ -0,0 +1,13 @@
1+# DLib {#dlib}
2+
3+[DLib](http://dlib.net/) is a modern, C++-based toolkit which provides several machine learning algorithms.
4+
5+## Compiling without AVX support {#compiling-without-avx-support}
6+
7+Especially older CPUs don\'t support [AVX](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) (Advanced Vector Extensions) instructions that are used by DLib to optimize their algorithms.
8+
9+On the affected hardware errors like `Illegal instruction` will occur. In those cases AVX support needs to be disabled:
10+
11+```nix
12+self: super: { dlib = super.dlib.override { avxSupport = false; }; }
13+```
doc/builders/packages/dlib.xmldeleted−24
@@ -1,24 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="dlib">
4− <title>DLib</title>
5−
6− <para>
7− <link xlink:href="http://dlib.net/">DLib</link> is a modern, C++-based toolkit which provides several machine learning algorithms.
8− </para>
9−
10− <section xml:id="compiling-without-avx-support">
11− <title>Compiling without AVX support</title>
12−
13− <para>
14− Especially older CPUs don't support <link xlink:href="https://en.wikipedia.org/wiki/Advanced_Vector_Extensions">AVX</link> (<abbrev>Advanced Vector Extensions</abbrev>) instructions that are used by DLib to optimize their algorithms.
15− </para>
16−
17− <para>
18− On the affected hardware errors like <literal>Illegal instruction</literal> will occur. In those cases AVX support needs to be disabled:
19−<programlisting>self: super: {
20− dlib = super.dlib.override { avxSupport = false; };
21−}</programlisting>
22− </para>
23− </section>
24−</section>
doc/builders/packages/eclipse.section.md+5−5
@@ -8,9 +8,9 @@ Nixpkgs provides a number of packages that will install Eclipse in its various f
88$ nix-env -f '<nixpkgs>' -qaP -A eclipses --description
99```
1010
11−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.
11+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.
1212
13−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
13+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:
1414
1515```nix
1616packageOverrides = pkgs: {
@@ -22,15 +22,15 @@ packageOverrides = pkgs: {
2222}
2323```
2424
25−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
25+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:
2626
2727```ShellSession
2828$ nix-env -f '<nixpkgs>' -qaP -A eclipses.plugins --description
2929```
3030
31−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.
31+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.
3232
33−Expanding the previous example with two plugins using the above functions we have
33+Expanding the previous example with two plugins using the above functions, we have:
3434
3535```nix
3636packageOverrides = pkgs: {
doc/builders/packages/elm.section.md+2−2
@@ -1,11 +1,11 @@
11# Elm {#sec-elm}
22
3−To start a development environment do
3+To start a development environment, run:
44
55```ShellSession
66nix-shell -p elmPackages.elm elmPackages.elm-format
77```
88
9−To update the Elm compiler, see <filename>nixpkgs/pkgs/development/compilers/elm/README.md</filename>.
9+To update the Elm compiler, see `nixpkgs/pkgs/development/compilers/elm/README.md`.
1010
1111To package Elm applications, [read about elm2nix](https://github.com/hercules-ci/elm2nix#elm2nix).
doc/builders/packages/emacs.section.md+4−4
@@ -20,7 +20,7 @@ The Emacs package comes with some extra helpers to make it easier to configure.
2020}
2121```
2222
23−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.
23+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 provides a `default.el` file in `/share/emacs/site-start/`. Emacs knows to load this file automatically when it starts.
2424
2525```nix
2626{
@@ -101,16 +101,16 @@ You can install it like any other packages via `nix-env -iA myEmacs`. However, t
101101}
102102```
103103
104−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.
104+This provides a fairly full Emacs start file. It will load in addition to the user's personal config. You can always disable it by passing `-q` to the Emacs command.
105105
106−Sometimes `emacs.pkgs.withPackages` 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'`.
106+Sometimes `emacs.pkgs.withPackages` 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 these priorities when some package is installed as a dependency. You can override it on a 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'`.
107107
108108```nix
109109overrides = self: super: rec {
110110 haskell-mode = self.melpaPackages.haskell-mode;
111111 ...
112112};
113−((emacsPackagesFor emacs).overrideScope' overrides).emacs.pkgs.withPackages
113+((emacsPackagesFor emacs).overrideScope' overrides).withPackages
114114 (p: with p; [
115115 # here both these package will use haskell-mode of our own choice
116116 ghc-mod
doc/builders/packages/etc-files.section.mdnew file+18
@@ -0,0 +1,18 @@
1+# /etc files {#etc}
2+
3+Certain calls in glibc require access to runtime files found in `/etc` such as `/etc/protocols` or `/etc/services` -- [getprotobyname](https://linux.die.net/man/3/getprotobyname) is one such function.
4+
5+On non-NixOS distributions these files are typically provided by packages (i.e., [netbase](https://packages.debian.org/sid/netbase)) if not already pre-installed in your distribution. This can cause non-reproducibility for code if they rely on these files being present.
6+
7+If [iana-etc](https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.iana-etc.x86_64-linux) is part of your `buildInputs`, then it will set the environment variables `NIX_ETC_PROTOCOLS` and `NIX_ETC_SERVICES` to the corresponding files in the package through a setup hook.
8+
9+
10+```bash
11+> nix-shell -p iana-etc
12+
13+[nix-shell:~]$ env | grep NIX_ETC
14+NIX_ETC_SERVICES=/nix/store/aj866hr8fad8flnggwdhrldm0g799ccz-iana-etc-20210225/etc/services
15+NIX_ETC_PROTOCOLS=/nix/store/aj866hr8fad8flnggwdhrldm0g799ccz-iana-etc-20210225/etc/protocols
16+```
17+
18+Nixpkg's version of [glibc](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/glibc/default.nix) has been patched to check for the existence of these environment variables. If the environment variables are *not* set, then it will attempt to find the files at the default location within `/etc`.
doc/builders/packages/firefox.section.md+10−8
@@ -1,12 +1,13 @@
11# Firefox {#sec-firefox}
22
3−## Build wrapped Firefox with extensions and policies
3+## Build wrapped Firefox with extensions and policies {#build-wrapped-firefox-with-extensions-and-policies}
44
5−The `wrapFirefox` function allows to pass policies, preferences and extension that are available to firefox. With the help of `fetchFirefoxAddon` this allows build a firefox version that already comes with addons pre-installed:
5+The `wrapFirefox` function allows to pass policies, preferences and extensions that are available to Firefox. With the help of `fetchFirefoxAddon` this allows to build a Firefox version that already comes with add-ons pre-installed:
66
77```nix
88{
9− myFirefox = wrapFirefox firefox-unwrapped {
9+ # Nix firefox addons only work with the firefox-esr package.
10+ myFirefox = wrapFirefox firefox-esr-unwrapped {
1011 nixExtensions = [
1112 (fetchFirefoxAddon {
1213 name = "ublock"; # Has to be unique!
@@ -39,11 +40,12 @@ The `wrapFirefox` function allows to pass policies, preferences and extension th
3940}
4041```
4142
42−If `nixExtensions != null` then all manually installed addons will be uninstalled from your browser profile.
43−To view available enterprise policies visit [enterprise policies](https://github.com/mozilla/policy-templates#enterprisepoliciesenabled)
44−or type into the Firefox url bar: `about:policies#documentation`.
45−Nix installed addons do not have a valid signature, which is why signature verification is disabled. This does not compromise security because downloaded addons are checksumed and manual addons can't be installed. Also make sure that the `name` field of fetchFirefoxAddon is unique. If you remove an addon from the nixExtensions array, rebuild and start Firefox the removed addon will be completly removed with all of its settings.
43+If `nixExtensions != null`, then all manually installed add-ons will be uninstalled from your browser profile.
44+To view available enterprise policies, visit [enterprise policies](https://github.com/mozilla/policy-templates#enterprisepoliciesenabled)
45+or type into the Firefox URL bar: `about:policies#documentation`.
46+Nix installed add-ons do not have a valid signature, which is why signature verification is disabled. This does not compromise security because downloaded add-ons are checksummed and manual add-ons can't be installed. Also, make sure that the `name` field of `fetchFirefoxAddon` is unique. If you remove an add-on from the `nixExtensions` array, rebuild and start Firefox: the removed add-on will be completely removed with all of its settings.
4647
4748## Troubleshooting {#sec-firefox-troubleshooting}
48−If addons do not appear installed although they have been defined in your nix configuration file reset the local addon state of your Firefox profile by clicking `help -> restart with addons disabled -> restart -> refresh firefox`. This can happen if you switch from manual addon mode to nix addon mode and then back to manual mode and then again to nix addon mode.
49+If add-ons are marked as broken or the signature is invalid, make sure you have Firefox ESR installed. Normal Firefox does not provide the ability anymore to disable signature verification for add-ons thus nix add-ons get disabled by the normal Firefox binary.
4950
51+If add-ons do not appear installed despite being defined in your nix configuration file, reset the local add-on state of your Firefox profile by clicking `Help -> More Troubleshooting Information -> Refresh Firefox`. This can happen if you switch from manual add-on mode to nix add-on mode and then back to manual mode and then again to nix add-on mode.
doc/builders/packages/fish.section.md+1−1
@@ -36,7 +36,7 @@ using `buildFishPlugin` and running unit tests with the `fishtape` test runner.
3636## Fish wrapper {#sec-fish-wrapper}
3737
3838The `wrapFish` package is a wrapper around Fish which can be used to create
39−Fish shells initialised with some plugins as well as completions, configuration
39+Fish shells initialized with some plugins as well as completions, configuration
4040snippets and functions sourced from the given paths. This provides a convenient
4141way to test Fish plugins and scripts without having to alter the environment.
4242
doc/builders/packages/fuse.section.mdnew file+45
@@ -0,0 +1,45 @@
1+# FUSE {#sec-fuse}
2+
3+Some packages rely on
4+[FUSE](https://www.kernel.org/doc/html/latest/filesystems/fuse.html) to provide
5+support for additional filesystems not supported by the kernel.
6+
7+In general, FUSE software are primarily developed for Linux but many of them can
8+also run on macOS. Nixpkgs supports FUSE packages on macOS, but it requires
9+[macFUSE](https://osxfuse.github.io) to be installed outside of Nix. macFUSE
10+currently isn't packaged in Nixpkgs mainly because it includes a kernel
11+extension, which isn't supported by Nix outside of NixOS.
12+
13+If a package fails to run on macOS with an error message similar to the
14+following, it's a likely sign that you need to have macFUSE installed.
15+
16+ dyld: Library not loaded: /usr/local/lib/libfuse.2.dylib
17+ Referenced from: /nix/store/w8bi72bssv0bnxhwfw3xr1mvn7myf37x-sshfs-fuse-2.10/bin/sshfs
18+ Reason: image not found
19+ [1] 92299 abort /nix/store/w8bi72bssv0bnxhwfw3xr1mvn7myf37x-sshfs-fuse-2.10/bin/sshfs
20+
21+Package maintainers may often encounter the following error when building FUSE
22+packages on macOS:
23+
24+ checking for fuse.h... no
25+ configure: error: No fuse.h found.
26+
27+This happens on autoconf based projects that use `AC_CHECK_HEADERS` or
28+`AC_CHECK_LIBS` to detect libfuse, and will occur even when the `fuse` package
29+is included in `buildInputs`. It happens because libfuse headers throw an error
30+on macOS if the `FUSE_USE_VERSION` macro is undefined. Many projects do define
31+`FUSE_USE_VERSION`, but only inside C source files. This results in the above
32+error at configure time because the configure script would attempt to compile
33+sample FUSE programs without defining `FUSE_USE_VERSION`.
34+
35+There are two possible solutions for this problem in Nixpkgs:
36+
37+1. Pass `FUSE_USE_VERSION` to the configure script by adding
38+ `CFLAGS=-DFUSE_USE_VERSION=25` in `configureFlags`. The actual value would
39+ have to match the definition used in the upstream source code.
40+2. Remove `AC_CHECK_HEADERS` / `AC_CHECK_LIBS` for libfuse.
41+
42+However, a better solution might be to fix the build script upstream to use
43+`PKG_CHECK_MODULES` instead. This approach wouldn't suffer from the problem that
44+`AC_CHECK_HEADERS`/`AC_CHECK_LIBS` has at the price of introducing a dependency
45+on pkg-config.
doc/builders/packages/ibus.section.md+3−3
@@ -6,7 +6,7 @@ This package is an ibus-based completion method to speed up typing.
66
77IBus 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](https://mike-fabian.github.io/ibus-typing-booster/documentation.html).
88
9−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:
9+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:
1010
1111```nix
1212{ pkgs, ... }: {
@@ -19,7 +19,7 @@ On NixOS you need to explicitly enable `ibus` with given engines before customiz
1919
2020## Using custom hunspell dictionaries {#sec-ibus-typing-booster-customize-hunspell}
2121
22−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:
22+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:
2323
2424```nix
2525ibus-engines.typing-booster.override { langs = [ "de-at" "en-gb" ]; }
@@ -31,7 +31,7 @@ _Note: each language passed to `langs` must be an attribute name in `pkgs.hunspe
3131
3232The `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:
3333
34−On NixOS it can be installed using the following expression:
34+On NixOS, it can be installed using the following expression:
3535
3636```nix
3737{ pkgs, ... }: { fonts.fonts = with pkgs; [ noto-fonts-emoji ]; }
doc/builders/packages/index.xml+4−2
@@ -5,17 +5,19 @@
55 <para>
66 This chapter contains information about how to use and maintain the Nix expressions for a number of specific packages, such as the Linux kernel or X.org.
77 </para>
8− <xi:include href="citrix.xml" />
9− <xi:include href="dlib.xml" />
8+ <xi:include href="citrix.section.xml" />
9+ <xi:include href="dlib.section.xml" />
1010 <xi:include href="eclipse.section.xml" />
1111 <xi:include href="elm.section.xml" />
1212 <xi:include href="emacs.section.xml" />
1313 <xi:include href="firefox.section.xml" />
1414 <xi:include href="fish.section.xml" />
15+ <xi:include href="fuse.section.xml" />
1516 <xi:include href="ibus.section.xml" />
1617 <xi:include href="kakoune.section.xml" />
1718 <xi:include href="linux.section.xml" />
1819 <xi:include href="locales.section.xml" />
20+ <xi:include href="etc-files.section.xml" />
1921 <xi:include href="nginx.section.xml" />
2022 <xi:include href="opengl.section.xml" />
2123 <xi:include href="shell-helpers.section.xml" />
doc/builders/packages/linux.section.md+11−11
@@ -4,7 +4,7 @@ The Nix expressions to build the Linux kernel are in [`pkgs/os-specific/linux/ke
44
55The 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`).
66
7−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:
7+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:
88
99```nix
1010modulesTree = [kernel]
@@ -14,28 +14,28 @@ modulesTree = [kernel]
1414
1515How to add a new (major) version of the Linux kernel to Nixpkgs:
1616
17−1. 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.
17+1. 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.
1818
19−2. Add the new kernel to `all-packages.nix` (e.g., create an attribute `kernel_2_6_22`).
19+2. Add the new kernel to the `kernels` attribute set in `linux-kernels.nix` (e.g., create an attribute `kernel_2_6_22`).
2020
21213. 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:
2222
23− 1. 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`).
23+ 1. Make a 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`).
2424
25− 2. Copy the config file for this platform (e.g. `config-2.6.22-i686-smp`) to `.config` in the kernel source tree.
25+ 2. Copy the config file for this platform (e.g., `config-2.6.22-i686-smp`) to `.config` in the kernel source tree.
2626
27− 3. 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`).
27+ 3. 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`).
2828
29− 4. If needed you can also run `make menuconfig`:
29+ 4. If needed, you can also run `make menuconfig`:
3030
3131 ```ShellSession
32− $ nix-env -i ncurses
32+ $ nix-env -f "<nixpkgs>" -iA ncurses
3333 $ export NIX_CFLAGS_LINK=-lncurses
3434 $ make menuconfig ARCH=arch
3535 ```
3636
37− 5. Copy `.config` over the new config file (e.g. `config-2.6.22-i686-smp`).
37+ 5. Copy `.config` over the new config file (e.g., `config-2.6.22-i686-smp`).
3838
39−4. Test building the kernel: `nix-build -A kernel_2_6_22`. If it compiles, ship it! For extra credit, try booting NixOS with it.
39+4. Test building the kernel: `nix-build -A linuxKernel.kernels.kernel_2_6_22`. If it compiles, ship it! For extra credit, try booting NixOS with it.
4040
41−5. 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.
41+5. It may be that the new kernel requires updating the external kernel modules and kernel-dependent packages listed in the `linuxPackagesFor` function in `linux-kernels.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.
doc/builders/packages/locales.section.md+2−2
@@ -1,5 +1,5 @@
11# Locales {#locales}
22
3−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.
3+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.
44
5−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.
5+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.
doc/builders/packages/nginx.section.md+2−2
@@ -4,8 +4,8 @@
44
55## ETags on static files served from the Nix store {#sec-nginx-etag}
66
7−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`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/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).
7+HTTP has a couple of 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`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/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).
88
9−Fortunately, HTTP supports an alternative (and more effective) caching mechanism: the [`ETag`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/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.
9+Fortunately, HTTP supports an alternative (and more effective) caching mechanism: the [`ETag`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/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.
1010
1111As 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.
doc/builders/packages/opengl.section.md+3−3
@@ -4,12 +4,12 @@ OpenGL support varies depending on which hardware is used and which drivers are
44
55Broadly, we support both GL vendors: Mesa and NVIDIA.
66
7−## NixOS Desktop
7+## NixOS Desktop {#nixos-desktop}
88
99The NixOS desktop or other non-headless configurations are the primary target for OpenGL libraries and applications. The current solution for discovering which drivers are available is based on [libglvnd](https://gitlab.freedesktop.org/glvnd/libglvnd). `libglvnd` performs "vendor-neutral dispatch", trying a variety of techniques to find the system's GL implementation. In practice, this will be either via standard GLX for X11 users or EGL for Wayland users, and supporting either NVIDIA or Mesa extensions.
1010
11−## Nix on GNU/Linux
11+## Nix on GNU/Linux {#nix-on-gnulinux}
1212
1313If 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 Mesa drivers, the Linux kernel version doesn't have to match nixpkgs.
1414
15−For proprietary video drivers you might have luck with also adding the corresponding video driver package.
15+For proprietary video drivers, you might have luck with also adding the corresponding video driver package.
doc/builders/packages/shell-helpers.section.md+1−1
@@ -4,7 +4,7 @@ Some packages provide the shell integration to be more useful. But unlike other
44
55- `fzf` : `fzf-share`
66
7−E.g. `fzf` can then used in the `.bashrc` like this:
7+E.g. `fzf` can then be used in the `.bashrc` like this:
88
99```bash
1010source "$(fzf-share)/completion.bash"
doc/builders/packages/steam.section.md+17−23
@@ -2,24 +2,25 @@
22
33## Steam in Nix {#sec-steam-nix}
44
5−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.
5+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`.
66
77Nix problems and constraints:
88
9−- We don't have `/bin/bash` and many scripts point there. Similarly for `/usr/bin/python`.
9+- We don't have `/bin/bash` and many scripts point there. Same thing for `/usr/bin/python`.
1010- We don't have the dynamic loader in `/lib`.
11−- The `steam.sh` script in \$HOME can not be patched, as it is checked and rewritten by steam.
11+- The `steam.sh` script in `$HOME` cannot be patched, as it is checked and rewritten by steam.
1212- The steam binary cannot be patched, it's also checked.
1313
1414The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented [here](http://sandervanderburg.blogspot.nl/2013/09/composing-fhs-compatible-chroot.html). 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.
1515
1616## How to play {#sec-steam-play}
1717
18−Use `programs.steam.enable = true;` if you want to add steam to systemPackages and also enable a few workarrounds aswell as Steam controller support or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pr.
18+Use `programs.steam.enable = true;` if you want to add steam to `systemPackages` and also enable a few workarounds as well as Steam controller support or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pro Controller.
1919
2020## Troubleshooting {#sec-steam-troub}
2121
2222- **Steam fails to start. What do I do?**
23+
2324 Try to run
2425
2526 ```ShellSession
@@ -31,38 +32,31 @@ Use `programs.steam.enable = true;` if you want to add steam to systemPackages a
3132- **Using the FOSS Radeon or nouveau (nvidia) drivers**
3233
3334 - The `newStdcpp` parameter was removed since NixOS 17.09 and should not be needed anymore.
34− - 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
35+ - Steam ships statically linked with a version of `libcrypto` that conflicts with the one dynamically loaded by radeonsi_dri.so. If you get the error:
36+
3537 ```
3638 steam.sh: line 713: 7842 Segmentation fault (core dumped)
3739 ```
40+
3841 have a look at [this pull request](https://github.com/NixOS/nixpkgs/pull/20269).
3942
4043- **Java**
4144
42− 1. There is no java in steam chrootenv by default. If you get a message like
45+ 1. There is no java in steam chrootenv by default. If you get a message like:
4346
44− ```
45− /home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found
46− ```
47+ ```
48+ /home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found
49+ ```
4750
48− You need to add
51+ you need to add:
4952
50− ```nix
51− steam.override { withJava = true; };
52− ```
53+ ```nix
54+ steam.override { withJava = true; };
55+ ```
5356
5457## steam-run {#sec-steam-run}
5558
56−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
57−
58−```nix
59−pkgs.steam.override ({
60− nativeOnly = true;
61− newStdcpp = true;
62− }).run
63−```
64−
65−to your configuration, rebuild, and run the game with
59+The FHS-compatible chroot used for Steam can also be used to run other Linux games that expect a FHS environment. To use it, install the `steam-run` package and run the game with:
6660
6761```
6862steam-run ./foo
doc/builders/packages/urxvt.section.md+4−4
@@ -4,7 +4,7 @@ Urxvt, also known as rxvt-unicode, is a highly customizable terminal emulator.
44
55## Configuring urxvt {#sec-urxvt-conf}
66
7−In `nixpkgs`, urxvt is provided by the package `rxvt-unicode`. It 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, use an overlay or directly install an expression that overrides its configuration, such as
7+In `nixpkgs`, urxvt is provided by the package `rxvt-unicode`. It 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, use an overlay or directly install an expression that overrides its configuration, such as:
88
99```nix
1010rxvt-unicode.override {
@@ -58,14 +58,14 @@ rxvt-unicode.override {
5858
5959## Packaging urxvt plugins {#sec-urxvt-pkg}
6060
61−Urxvt plugins resides in `pkgs/applications/misc/rxvt-unicode-plugins`. To add a new plugin create an expression in a subdirectory and add the package to the set in `pkgs/applications/misc/rxvt-unicode-plugins/default.nix`.
61+Urxvt plugins resides in `pkgs/applications/misc/rxvt-unicode-plugins`. To add a new plugin, create an expression in a subdirectory and add the package to the set in `pkgs/applications/misc/rxvt-unicode-plugins/default.nix`.
6262
6363A plugin can be any kind of derivation, the only requirement is that it should always install perl scripts in `$out/lib/urxvt/perl`. Look for existing plugins for examples.
6464
65−If the plugin is itself a perl package that needs to be imported from other plugins or scripts, add the following passthrough:
65+If the plugin is itself a Perl package that needs to be imported from other plugins or scripts, add the following passthrough:
6666
6767```nix
6868passthru.perlPackages = [ "self" ];
6969```
7070
71−This will make the urxvt wrapper pick up the dependency and set up the perl path accordingly.
71+This will make the urxvt wrapper pick up the dependency and set up the Perl path accordingly.
doc/builders/packages/weechat.section.md+6−6
@@ -1,6 +1,6 @@
1−# Weechat {#sec-weechat}
1+# WeeChat {#sec-weechat}
22
3−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
3+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:
44
55```nix
66weechat.override {configure = {availablePlugins, ...}: {
@@ -13,7 +13,7 @@ If the `configure` function returns an attrset without the `plugins` attribute,
1313
1414The plugins currently available are `python`, `perl`, `ruby`, `guile`, `tcl` and `lua`.
1515
16−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:
16+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:
1717
1818```nix
1919weechat.override { configure = {availablePlugins, ...}: {
@@ -41,7 +41,7 @@ weechat.override {
4141 configure = { availablePlugins, ... }: {
4242 init = ''
4343 /set foo bar
44− /server add freenode chat.freenode.org
44+ /server add libera irc.libera.chat
4545 '';
4646 };
4747}
@@ -49,7 +49,7 @@ weechat.override {
4949
5050Further values can be added to the list of commands when running `weechat --run-command "your-commands"`.
5151
52−Additionally it's possible to specify scripts to be loaded when starting `weechat`. These will be loaded before the commands from `init`:
52+Additionally, it's possible to specify scripts to be loaded when starting `weechat`. These will be loaded before the commands from `init`:
5353
5454```nix
5555weechat.override {
@@ -64,7 +64,7 @@ weechat.override {
6464}
6565```
6666
67−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:
67+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:
6868
6969```nix
7070{ stdenv, fetchurl }:
doc/builders/packages/xorg.section.md+4−4
@@ -2,7 +2,7 @@
22
33The 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.
44
5−## Katamari Tarballs
5+## Katamari Tarballs {#katamari-tarballs}
66
77X.org upstream releases used to include [katamari](https://en.wiktionary.org/wiki/%E3%81%8B%E3%81%9F%E3%81%BE%E3%82%8A) releases, which included a holistic recommended version for each tarball, up until 7.7. To create a list of tarballs in a katamari release:
88
@@ -14,11 +14,11 @@ cat $(PRINT_PATH=1 nix-prefetch-url $url | tail -n 1) \
1414 | sort > "tarballs-$release.list"
1515```
1616
17−## Individual Tarballs
17+## Individual Tarballs {#individual-tarballs}
1818
1919The upstream release process for [X11R7.8](https://x.org/wiki/Releases/7.8/) does not include a planned katamari. Instead, each component of X.org is released as its own tarball. We maintain `pkgs/servers/x11/xorg/tarballs.list` as a list of tarballs for each individual package. This list includes X.org core libraries and protocol descriptions, extra newer X11 interface libraries, like `xorg.libxcb`, and classic utilities which are largely unused but still available if needed, like `xorg.imake`.
2020
21−## Generating Nix Expressions
21+## Generating Nix Expressions {#generating-nix-expressions}
2222
2323The generator is invoked as follows:
2424
@@ -29,6 +29,6 @@ cd pkgs/servers/x11/xorg
2929
3030For 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.)
3131
32−## Overriding the Generator
32+## Overriding the Generator {#overriding-the-generator}
3333
3434If 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`.
doc/builders/special/fhs-environments.section.md+6−2
@@ -18,6 +18,8 @@
1818 Additional commands to be executed for finalizing the derivation with runner script.
1919- `runScript`
2020 A command that would be executed inside the sandbox and passed all the command line arguments. It defaults to `bash`.
21+- `profile`
22+ Optional script for `/etc/profile` within the sandbox.
2123
2224One can create a simple environment using a `shell.nix` like that:
2325
@@ -28,7 +30,7 @@ One can create a simple environment using a `shell.nix` like that:
2830 name = "simple-x11-env";
2931 targetPkgs = pkgs: (with pkgs;
3032 [ udev
31− alsaLib
33+ alsa-lib
3234 ]) ++ (with pkgs.xorg;
3335 [ libX11
3436 libXcursor
@@ -36,10 +38,12 @@ One can create a simple environment using a `shell.nix` like that:
3638 ]);
3739 multiPkgs = pkgs: (with pkgs;
3840 [ udev
39− alsaLib
41+ alsa-lib
4042 ]);
4143 runScript = "bash";
4244}).env
4345```
4446
4547Running `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.
48+
49+Additionally, the FHS builder links all relocated gsettings-schemas (the glib setup-hook moves them to `share/gsettings-schemas/${name}/glib-2.0/schemas`) to their standard FHS location. This means you don't need to wrap binaries with `wrapGAppsHook`.
doc/builders/special/mkshell.section.md+27−5
@@ -1,15 +1,37 @@
11# pkgs.mkShell {#sec-pkgs-mkShell}
22
3−`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`.
3+`pkgs.mkShell` is a specialized `stdenv.mkDerivation` that removes some
4+repetition when using it with `nix-shell` (or `nix develop`).
45
56## Usage {#sec-pkgs-mkShell-usage}
67
8+Here is a common usage example:
9+
710```nix
811{ pkgs ? import <nixpkgs> {} }:
912pkgs.mkShell {
10− # this will make all the build inputs from hello and gnutar
11− # available to the shell environment
12− inputsFrom = with pkgs; [ hello gnutar ];
13− buildInputs = [ pkgs.gnumake ];
13+ packages = [ pkgs.gnumake ];
14+
15+ inputsFrom = [ pkgs.hello pkgs.gnutar ];
16+
17+ shellHook = ''
18+ export DEBUG=1
19+ '';
1420}
1521```
22+
23+## Attributes
24+
25+* `name` (default: `nix-shell`). Set the name of the derivation.
26+* `packages` (default: `[]`). Add executable packages to the `nix-shell` environment.
27+* `inputsFrom` (default: `[]`). Add build dependencies of the listed derivations to the `nix-shell` environment.
28+* `shellHook` (default: `""`). Bash statements that are executed by `nix-shell`.
29+
30+... all the attributes of `stdenv.mkDerivation`.
31+
32+## Building the shell
33+
34+This derivation output will contain a text file that contains a reference to
35+all the build inputs. This is useful in CI where we want to make sure that
36+every derivation, and its dependencies, build properly. Or when creating a GC
37+root so that the build dependencies don't get garbage-collected.
doc/builders/testers.chapter.mdnew file+82
@@ -0,0 +1,82 @@
1+# Testers {#chap-testers}
2+This chapter describes several testing builders which are available in the <literal>testers</literal> namespace.
3+
4+## `testVersion` {#tester-testVersion}
5+
6+Checks the command output contains the specified version
7+
8+Although simplistic, this test assures that the main program
9+can run. While there's no substitute for a real test case,
10+it does catch dynamic linking errors and such. It also provides
11+some protection against accidentally building the wrong version,
12+for example when using an 'old' hash in a fixed-output derivation.
13+
14+Examples:
15+
16+```nix
17+passthru.tests.version = testVersion { package = hello; };
18+
19+passthru.tests.version = testVersion {
20+ package = seaweedfs;
21+ command = "weed version";
22+};
23+
24+passthru.tests.version = testVersion {
25+ package = key;
26+ command = "KeY --help";
27+ # Wrong '2.5' version in the code. Drop on next version.
28+ version = "2.5";
29+};
30+```
31+
32+## `testEqualDerivation` {#tester-testEqualDerivation}
33+
34+Checks that two packages produce the exact same build instructions.
35+
36+This can be used to make sure that a certain difference of configuration,
37+such as the presence of an overlay does not cause a cache miss.
38+
39+When the derivations are equal, the return value is an empty file.
40+Otherwise, the build log explains the difference via `nix-diff`.
41+
42+Example:
43+
44+```nix
45+testEqualDerivation
46+ "The hello package must stay the same when enabling checks."
47+ hello
48+ (hello.overrideAttrs(o: { doCheck = true; }))
49+```
50+
51+## `invalidateFetcherByDrvHash` {#tester-invalidateFetcherByDrvHash}
52+
53+Use the derivation hash to invalidate the output via name, for testing.
54+
55+Type: `(a@{ name, ... } -> Derivation) -> a -> Derivation`
56+
57+Normally, fixed output derivations can and should be cached by their output
58+hash only, but for testing we want to re-fetch everytime the fetcher changes.
59+
60+Changes to the fetcher become apparent in the drvPath, which is a hash of
61+how to fetch, rather than a fixed store path.
62+By inserting this hash into the name, we can make sure to re-run the fetcher
63+every time the fetcher changes.
64+
65+This relies on the assumption that Nix isn't clever enough to reuse its
66+database of local store contents to optimize fetching.
67+
68+You might notice that the "salted" name derives from the normal invocation,
69+not the final derivation. `invalidateFetcherByDrvHash` has to invoke the fetcher
70+function twice: once to get a derivation hash, and again to produce the final
71+fixed output derivation.
72+
73+Example:
74+
75+```nix
76+tests.fetchgit = invalidateFetcherByDrvHash fetchgit {
77+ name = "nix-source";
78+ url = "https://github.com/NixOS/nix";
79+ rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
80+ sha256 = "sha256-7DszvbCNTjpzGRmpIVAWXk20P0/XTrWZ79KSOGLrUWY=";
81+};
82+```
doc/builders/trivial-builders.chapter.md+174−3
@@ -35,10 +35,10 @@ This works just like `runCommand`. The only difference is that it also provides
3535
3636## `runCommandLocal` {#trivial-builder-runCommandLocal}
3737
38−Variant of `runCommand` that forces the derivation to be built locally, it is not substituted. This is intended for very cheap commands (<1s execution time). It saves on the network roundrip and can speed up a build.
38+Variant of `runCommand` that forces the derivation to be built locally, it is not substituted. This is intended for very cheap commands (<1s execution time). It saves on the network round-trip and can speed up a build.
3939
40−::: note
41−This sets [`allowSubstitutes` to `false`](https://nixos.org/nix/manual/#adv-attr-allowSubstitutes), so only use `runCommandLocal` if you are certain the user will always have a builder for the `system` of the derivation. This should be true for most trivial use cases (e.g. just copying some files to a different location or adding symlinks), because there the `system` is usually the same as `builtins.currentSystem`.
40+::: {.note}
41+This sets [`allowSubstitutes` to `false`](https://nixos.org/nix/manual/#adv-attr-allowSubstitutes), so only use `runCommandLocal` if you are certain the user will always have a builder for the `system` of the derivation. This should be true for most trivial use cases (e.g., just copying some files to a different location or adding symlinks) because there the `system` is usually the same as `builtins.currentSystem`.
4242:::
4343
4444## `writeTextFile`, `writeText`, `writeTextDir`, `writeScript`, `writeScriptBin` {#trivial-builder-writeText}
@@ -47,6 +47,177 @@ These functions write `text` to the Nix store. This is useful for creating scrip
4747
4848Many more commands wrap `writeTextFile` including `writeText`, `writeTextDir`, `writeScript`, and `writeScriptBin`. These are convenience functions over `writeTextFile`.
4949
50+Here are a few examples:
51+```nix
52+# Writes my-file to /nix/store/<store path>
53+writeTextFile {
54+ name = "my-file";
55+ text = ''
56+ Contents of File
57+ '';
58+}
59+# See also the `writeText` helper function below.
60+
61+# Writes executable my-file to /nix/store/<store path>/bin/my-file
62+writeTextFile {
63+ name = "my-file";
64+ text = ''
65+ Contents of File
66+ '';
67+ executable = true;
68+ destination = "/bin/my-file";
69+}
70+# Writes contents of file to /nix/store/<store path>
71+writeText "my-file"
72+ ''
73+ Contents of File
74+ '';
75+# Writes contents of file to /nix/store/<store path>/share/my-file
76+writeTextDir "share/my-file"
77+ ''
78+ Contents of File
79+ '';
80+# Writes my-file to /nix/store/<store path> and makes executable
81+writeScript "my-file"
82+ ''
83+ Contents of File
84+ '';
85+# Writes my-file to /nix/store/<store path>/bin/my-file and makes executable.
86+writeScriptBin "my-file"
87+ ''
88+ Contents of File
89+ '';
90+# Writes my-file to /nix/store/<store path> and makes executable.
91+writeShellScript "my-file"
92+ ''
93+ Contents of File
94+ '';
95+# Writes my-file to /nix/store/<store path>/bin/my-file and makes executable.
96+writeShellScriptBin "my-file"
97+ ''
98+ Contents of File
99+ '';
100+
101+```
102+
103+## `concatTextFile`, `concatText`, `concatScript` {#trivial-builder-concatText}
104+
105+These functions concatenate `files` to the Nix store in a single file. This is useful for configuration files structured in lines of text. `concatTextFile` takes an attribute set and expects two arguments, `name` and `files`. `name` corresponds to the name used in the Nix store path. `files` will be the files to be concatenated. You can also set `executable` to true to make this file have the executable bit set.
106+`concatText` and`concatScript` are simple wrappers over `concatTextFile`.
107+
108+Here are a few examples:
109+```nix
110+
111+# Writes my-file to /nix/store/<store path>
112+concatTextFile {
113+ name = "my-file";
114+ files = [ drv1 "${drv2}/path/to/file" ];
115+}
116+# See also the `concatText` helper function below.
117+
118+# Writes executable my-file to /nix/store/<store path>/bin/my-file
119+concatTextFile {
120+ name = "my-file";
121+ files = [ drv1 "${drv2}/path/to/file" ];
122+ executable = true;
123+ destination = "/bin/my-file";
124+}
125+# Writes contents of files to /nix/store/<store path>
126+concatText "my-file" [ file1 file2 ]
127+
128+# Writes contents of files to /nix/store/<store path>
129+concatScript "my-file" [ file1 file2 ]
130+```
131+
132+## `writeShellApplication` {#trivial-builder-writeShellApplication}
133+
134+This can be used to easily produce a shell script that has some dependencies (`runtimeInputs`). It automatically sets the `PATH` of the script to contain all of the listed inputs, sets some sanity shellopts (`errexit`, `nounset`, `pipefail`), and checks the resulting script with [`shellcheck`](https://github.com/koalaman/shellcheck).
135+
136+For example, look at the following code:
137+
138+```nix
139+writeShellApplication {
140+ name = "show-nixos-org";
141+
142+ runtimeInputs = [ curl w3m ];
143+
144+ text = ''
145+ curl -s 'https://nixos.org' | w3m -dump -T text/html
146+ '';
147+}
148+```
149+
150+Unlike with normal `writeShellScriptBin`, there is no need to manually write out `${curl}/bin/curl`, setting the PATH
151+was handled by `writeShellApplication`. Moreover, the script is being checked with `shellcheck` for more strict
152+validation.
153+
50154## `symlinkJoin` {#trivial-builder-symlinkJoin}
51155
52156This 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.
157+Here is an example:
158+```nix
159+# adds symlinks of hello and stack to current build and prints "links added"
160+symlinkJoin { name = "myexample"; paths = [ pkgs.hello pkgs.stack ]; postBuild = "echo links added"; }
161+```
162+This creates a derivation with a directory structure like the following:
163+```
164+/nix/store/sglsr5g079a5235hy29da3mq3hv8sjmm-myexample
165+|-- bin
166+| |-- hello -> /nix/store/qy93dp4a3rqyn2mz63fbxjg228hffwyw-hello-2.10/bin/hello
167+| `-- stack -> /nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/bin/stack
168+`-- share
169+ |-- bash-completion
170+ | `-- completions
171+ | `-- stack -> /nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/share/bash-completion/completions/stack
172+ |-- fish
173+ | `-- vendor_completions.d
174+ | `-- stack.fish -> /nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/share/fish/vendor_completions.d/stack.fish
175+...
176+```
177+
178+## `writeReferencesToFile` {#trivial-builder-writeReferencesToFile}
179+
180+Writes the closure of transitive dependencies to a file.
181+
182+This produces the equivalent of `nix-store -q --requisites`.
183+
184+For example,
185+
186+```nix
187+writeReferencesToFile (writeScriptBin "hi" ''${hello}/bin/hello'')
188+```
189+
190+produces an output path `/nix/store/<hash>-runtime-deps` containing
191+
192+```nix
193+/nix/store/<hash>-hello-2.10
194+/nix/store/<hash>-hi
195+/nix/store/<hash>-libidn2-2.3.0
196+/nix/store/<hash>-libunistring-0.9.10
197+/nix/store/<hash>-glibc-2.32-40
198+```
199+
200+You can see that this includes `hi`, the original input path,
201+`hello`, which is a direct reference, but also
202+the other paths that are indirectly required to run `hello`.
203+
204+## `writeDirectReferencesToFile` {#trivial-builder-writeDirectReferencesToFile}
205+
206+Writes the set of references to the output file, that is, their immediate dependencies.
207+
208+This produces the equivalent of `nix-store -q --references`.
209+
210+For example,
211+
212+```nix
213+writeDirectReferencesToFile (writeScriptBin "hi" ''${hello}/bin/hello'')
214+```
215+
216+produces an output path `/nix/store/<hash>-runtime-references` containing
217+
218+```nix
219+/nix/store/<hash>-hello-2.10
220+```
221+
222+but none of `hello`'s dependencies because those are not referenced directly
223+by `hi`'s output.
doc/contributing/coding-conventions.chapter.mdnew file+665
@@ -0,0 +1,665 @@
1+# Coding conventions {#chap-conventions}
2+
3+## Syntax {#sec-syntax}
4+
5+- Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts.
6+
7+- 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.
8+
9+- Use `lowerCamelCase` for variable names, not `UpperCamelCase`. Note, this rule does not apply to package attribute names, which instead follow the rules in [](#sec-package-naming).
10+
11+- Function calls with attribute set arguments are written as
12+
13+ ```nix
14+ foo {
15+ arg = ...;
16+ }
17+ ```
18+
19+ not
20+
21+ ```nix
22+ foo
23+ {
24+ arg = ...;
25+ }
26+ ```
27+
28+ Also fine is
29+
30+ ```nix
31+ foo { arg = ...; }
32+ ```
33+
34+ if it's a short call.
35+
36+- In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned:
37+
38+ ```nix
39+ # A long list.
40+ list = [
41+ elem1
42+ elem2
43+ elem3
44+ ];
45+
46+ # A long attribute set.
47+ attrs = {
48+ attr1 = short_expr;
49+ attr2 =
50+ if true then big_expr else big_expr;
51+ };
52+
53+ # Combined
54+ listOfAttrs = [
55+ {
56+ attr1 = 3;
57+ attr2 = "fff";
58+ }
59+ {
60+ attr1 = 5;
61+ attr2 = "ggg";
62+ }
63+ ];
64+ ```
65+
66+- Short lists or attribute sets can be written on one line:
67+
68+ ```nix
69+ # A short list.
70+ list = [ elem1 elem2 elem3 ];
71+
72+ # A short set.
73+ attrs = { x = 1280; y = 1024; };
74+ ```
75+
76+- Breaking in the middle of a function argument can give hard-to-read code, like
77+
78+ ```nix
79+ someFunction { x = 1280;
80+ y = 1024; } otherArg
81+ yetAnotherArg
82+ ```
83+
84+ (especially if the argument is very large, spanning multiple lines).
85+
86+ Better:
87+
88+ ```nix
89+ someFunction
90+ { x = 1280; y = 1024; }
91+ otherArg
92+ yetAnotherArg
93+ ```
94+
95+ or
96+
97+ ```nix
98+ let res = { x = 1280; y = 1024; };
99+ in someFunction res otherArg yetAnotherArg
100+ ```
101+
102+- The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e.
103+
104+ ```nix
105+ { arg1, arg2 }:
106+ assert system == "i686-linux";
107+ stdenv.mkDerivation { ...
108+ ```
109+
110+ not
111+
112+ ```nix
113+ { arg1, arg2 }:
114+ assert system == "i686-linux";
115+ stdenv.mkDerivation { ...
116+ ```
117+
118+- Function formal arguments are written as:
119+
120+ ```nix
121+ { arg1, arg2, arg3 }:
122+ ```
123+
124+ but if they don't fit on one line they're written as:
125+
126+ ```nix
127+ { arg1, arg2, arg3
128+ , arg4, ...
129+ , # Some comment...
130+ argN
131+ }:
132+ ```
133+
134+- Functions should list their expected arguments as precisely as possible. That is, write
135+
136+ ```nix
137+ { stdenv, fetchurl, perl }: ...
138+ ```
139+
140+ instead of
141+
142+ ```nix
143+ args: with args; ...
144+ ```
145+
146+ or
147+
148+ ```nix
149+ { stdenv, fetchurl, perl, ... }: ...
150+ ```
151+
152+ 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:
153+
154+ ```nix
155+ { stdenv, doCoverageAnalysis ? false, ... } @ args:
156+
157+ stdenv.mkDerivation (args // {
158+ ... if doCoverageAnalysis then "bla" else "" ...
159+ })
160+ ```
161+
162+ instead of
163+
164+ ```nix
165+ args:
166+
167+ args.stdenv.mkDerivation (args // {
168+ ... if args ? doCoverageAnalysis && args.doCoverageAnalysis then "bla" else "" ...
169+ })
170+ ```
171+
172+- Unnecessary string conversions should be avoided. Do
173+
174+ ```nix
175+ rev = version;
176+ ```
177+
178+ instead of
179+
180+ ```nix
181+ rev = "${version}";
182+ ```
183+
184+- Building lists conditionally _should_ be done with `lib.optional(s)` instead of using `if cond then [ ... ] else null` or `if cond then [ ... ] else [ ]`.
185+
186+ ```nix
187+ buildInputs = lib.optional stdenv.isDarwin iconv;
188+ ```
189+
190+ instead of
191+
192+ ```nix
193+ buildInputs = if stdenv.isDarwin then [ iconv ] else null;
194+ ```
195+
196+ As an exception, an explicit conditional expression with null can be used when fixing a important bug without triggering a mass rebuild.
197+ If this is done a follow up pull request _should_ be created to change the code to `lib.optional(s)`.
198+
199+- Arguments should be listed in the order they are used, with the exception of `lib`, which always goes first.
200+
201+## Package naming {#sec-package-naming}
202+
203+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](https://tools.ietf.org/html/rfc2119). Only _emphasized_ words are to be interpreted in this way.
204+
205+In Nixpkgs, there are generally three different names associated with a package:
206+
207+- The `name` attribute of the derivation (excluding the version part). This is what most users see, in particular when using `nix-env`.
208+
209+- 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`.
210+
211+- The filename for (the directory containing) the Nix expression.
212+
213+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`.
214+
215+There are a few naming guidelines:
216+
217+- The `pname` attribute _should_ be identical to the upstream package name.
218+
219+- The `pname` and the `version` attribute _must not_ contain uppercase letters — e.g., `"mplayer" instead of `"MPlayer"`.
220+
221+- The `version` attribute _must_ start with a digit e.g`"0.3.1rc2".
222+
223+- If a package is not a release but a commit from a repository, then the `version` attribute _must_ be the date of that (fetched) commit. The date _must_ be in `"unstable-YYYY-MM-DD"` format.
224+
225+- Dashes in the package `pname` _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.
226+
227+- 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 [](#sec-versioning)
228+
229+## File naming and organisation {#sec-organisation}
230+
231+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`.
232+
233+### Hierarchy {#sec-hierarchy}
234+
235+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`.
236+
237+When in doubt, consider refactoring the `pkgs/` tree, e.g. creating new categories or splitting up an existing category.
238+
239+**If it’s used to support _software development_:**
240+
241+- **If it’s a _library_ used by other packages:**
242+
243+ - `development/libraries` (e.g. `libxml2`)
244+
245+- **If it’s a _compiler_:**
246+
247+ - `development/compilers` (e.g. `gcc`)
248+
249+- **If it’s an _interpreter_:**
250+
251+ - `development/interpreters` (e.g. `guile`)
252+
253+- **If it’s a (set of) development _tool(s)_:**
254+
255+ - **If it’s a _parser generator_ (including lexers):**
256+
257+ - `development/tools/parsing` (e.g. `bison`, `flex`)
258+
259+ - **If it’s a _build manager_:**
260+
261+ - `development/tools/build-managers` (e.g. `gnumake`)
262+
263+ - **Else:**
264+
265+ - `development/tools/misc` (e.g. `binutils`)
266+
267+- **Else:**
268+
269+ - `development/misc`
270+
271+**If it’s a (set of) _tool(s)_:**
272+
273+(A tool is a relatively small program, especially one intended to be used non-interactively.)
274+
275+- **If it’s for _networking_:**
276+
277+ - `tools/networking` (e.g. `wget`)
278+
279+- **If it’s for _text processing_:**
280+
281+ - `tools/text` (e.g. `diffutils`)
282+
283+- **If it’s a _system utility_, i.e., something related or essential to the operation of a system:**
284+
285+ - `tools/system` (e.g. `cron`)
286+
287+- **If it’s an _archiver_ (which may include a compression function):**
288+
289+ - `tools/archivers` (e.g. `zip`, `tar`)
290+
291+- **If it’s a _compression_ program:**
292+
293+ - `tools/compression` (e.g. `gzip`, `bzip2`)
294+
295+- **If it’s a _security_-related program:**
296+
297+ - `tools/security` (e.g. `nmap`, `gnupg`)
298+
299+- **Else:**
300+
301+ - `tools/misc`
302+
303+**If it’s a _shell_:**
304+
305+- `shells` (e.g. `bash`)
306+
307+**If it’s a _server_:**
308+
309+- **If it’s a web server:**
310+
311+ - `servers/http` (e.g. `apache-httpd`)
312+
313+- **If it’s an implementation of the X Windowing System:**
314+
315+ - `servers/x11` (e.g. `xorg` — this includes the client libraries and programs)
316+
317+- **Else:**
318+
319+ - `servers/misc`
320+
321+**If it’s a _desktop environment_:**
322+
323+- `desktops` (e.g. `kde`, `gnome`, `enlightenment`)
324+
325+**If it’s a _window manager_:**
326+
327+- `applications/window-managers` (e.g. `awesome`, `stumpwm`)
328+
329+**If it’s an _application_:**
330+
331+A (typically large) program with a distinct user interface, primarily used interactively.
332+
333+- **If it’s a _version management system_:**
334+
335+ - `applications/version-management` (e.g. `subversion`)
336+
337+- **If it’s a _terminal emulator_:**
338+
339+ - `applications/terminal-emulators` (e.g. `alacritty` or `rxvt` or `termite`)
340+
341+- **If it’s for _video playback / editing_:**
342+
343+ - `applications/video` (e.g. `vlc`)
344+
345+- **If it’s for _graphics viewing / editing_:**
346+
347+ - `applications/graphics` (e.g. `gimp`)
348+
349+- **If it’s for _networking_:**
350+
351+ - **If it’s a _mailreader_:**
352+
353+ - `applications/networking/mailreaders` (e.g. `thunderbird`)
354+
355+ - **If it’s a _newsreader_:**
356+
357+ - `applications/networking/newsreaders` (e.g. `pan`)
358+
359+ - **If it’s a _web browser_:**
360+
361+ - `applications/networking/browsers` (e.g. `firefox`)
362+
363+ - **Else:**
364+
365+ - `applications/networking/misc`
366+
367+- **Else:**
368+
369+ - `applications/misc`
370+
371+**If it’s _data_ (i.e., does not have a straight-forward executable semantics):**
372+
373+- **If it’s a _font_:**
374+
375+ - `data/fonts`
376+
377+- **If it’s an _icon theme_:**
378+
379+ - `data/icons`
380+
381+- **If it’s related to _SGML/XML processing_:**
382+
383+ - **If it’s an _XML DTD_:**
384+
385+ - `data/sgml+xml/schemas/xml-dtd` (e.g. `docbook`)
386+
387+ - **If it’s an _XSLT stylesheet_:**
388+
389+ (Okay, these are executable...)
390+
391+ - `data/sgml+xml/stylesheets/xslt` (e.g. `docbook-xsl`)
392+
393+- **If it’s a _theme_ for a _desktop environment_, a _window manager_ or a _display manager_:**
394+
395+ - `data/themes`
396+
397+**If it’s a _game_:**
398+
399+- `games`
400+
401+**Else:**
402+
403+- `misc`
404+
405+### Versioning {#sec-versioning}
406+
407+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.
408+
409+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`.
410+
411+All versions of a package _must_ be included in `all-packages.nix` to make sure that they evaluate correctly.
412+
413+## Fetching Sources {#sec-sources}
414+
415+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.
416+
417+You can find many source fetch helpers in `pkgs/build-support/fetch*`.
418+
419+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:
420+
421+- Bad: Uses `git://` which won't be proxied.
422+
423+ ```nix
424+ src = fetchgit {
425+ url = "git://github.com/NixOS/nix.git";
426+ rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
427+ sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
428+ }
429+ ```
430+
431+- Better: This is ok, but an archive fetch will still be faster.
432+
433+ ```nix
434+ src = fetchgit {
435+ url = "https://github.com/NixOS/nix.git";
436+ rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
437+ sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
438+ }
439+ ```
440+
441+- Best: Fetches a snapshot archive and you get the rev you want.
442+
443+ ```nix
444+ src = fetchFromGitHub {
445+ owner = "NixOS";
446+ repo = "nix";
447+ rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
448+ sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc";
449+ }
450+ ```
451+
452+ 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`.
453+
454+## Obtaining source hash {#sec-source-hashes}
455+
456+Preferred source hash type is sha256. There are several ways to get it.
457+
458+1. Prefetch URL (with `nix-prefetch-XXX URL`, where `XXX` is one of `url`, `git`, `hg`, `cvs`, `bzr`, `svn`). Hash is printed to stdout.
459+
460+2. Prefetch by package source (with `nix-prefetch-url '<nixpkgs>' -A PACKAGE.src`, where `PACKAGE` is package attribute name). Hash is printed to stdout.
461+
462+ 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).
463+
464+3. Upstream provided hash: use it when upstream provides `sha256` or `sha512` (when upstream provides `md5`, don't use it, compute `sha256` instead).
465+
466+ 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.
467+
468+ You can convert between formats with nix-hash, for example:
469+
470+ ```ShellSession
471+ $ nix-hash --type sha256 --to-base32 HASH
472+ ```
473+
474+4. Extracting hash from local source tarball can be done with `sha256sum`. Use `nix-prefetch-url file:///path/to/tarball` if you want base32 hash.
475+
476+5. Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints.
477+
478+ 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.
479+
480+ 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](https://github.com/NixOS/nixpkgs/blob/d2ab091dd308b99e4912b805a5eb088dd536adb9/pkgs/applications/video/kodi/default.nix#L73)). 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.
481+
482+::: {.warning}
483+This method has security problems. Check below for details.
484+:::
485+
486+### Obtaining hashes securely {#sec-source-hashes-security}
487+
488+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:
489+
490+- `http://` URLs are not secure to prefetch hash from;
491+
492+- hashes from upstream (in method 3) should be obtained via secure protocol;
493+
494+- `https://` URLs are secure in methods 1, 2, 3;
495+
496+- `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.
497+
498+## Patches {#sec-patches}
499+
500+Patches available online should be retrieved using `fetchpatch`.
501+
502+```nix
503+patches = [
504+ (fetchpatch {
505+ name = "fix-check-for-using-shared-freetype-lib.patch";
506+ url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285";
507+ sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr";
508+ })
509+];
510+```
511+
512+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.
513+
514+```nix
515+patches = [ ./0001-changes.patch ];
516+```
517+
518+If you do need to do create this sort of patch file, one way to do so is with git:
519+
520+1. Move to the root directory of the source code you're patching.
521+
522+ ```ShellSession
523+ $ cd the/program/source
524+ ```
525+
526+2. If a git repository is not already present, create one and stage all of the source files.
527+
528+ ```ShellSession
529+ $ git init
530+ $ git add .
531+ ```
532+
533+3. Edit some files to make whatever changes need to be included in the patch.
534+
535+4. Use git to create a diff, and pipe the output to a patch file:
536+
537+ ```ShellSession
538+ $ git diff -a > nixpkgs/pkgs/the/package/0001-changes.patch
539+ ```
540+
541+If a patch is available online but does not cleanly apply, it can be modified in some fixed ways by using additional optional arguments for `fetchpatch`:
542+
543+- `relative`: Similar to using `git-diff`'s `--relative` flag, only keep changes inside the specified directory, making paths relative to it.
544+- `stripLen`: Remove the first `stripLen` components of pathnames in the patch.
545+- `extraPrefix`: Prefix pathnames by this string.
546+- `excludes`: Exclude files matching these patterns (applies after the above arguments).
547+- `includes`: Include only files matching these patterns (applies after the above arguments).
548+- `revert`: Revert the patch.
549+
550+Note that because the checksum is computed after applying these effects, using or modifying these arguments will have no effect unless the `sha256` argument is changed as well.
551+
552+## Package tests {#sec-package-tests}
553+
554+Tests are important to ensure quality and make reviews and automatic updates easy.
555+
556+The following types of tests exists:
557+
558+* [NixOS **module tests**](https://nixos.org/manual/nixos/stable/#sec-nixos-tests), which spawn one or more NixOS VMs. They exercise both NixOS modules and the packaged programs used within them. For example, a NixOS module test can start a web server VM running the `nginx` module, and a client VM running `curl` or a graphical `firefox`, and test that they can talk to each other and display the correct content.
559+* Nix **package tests** are a lightweight alternative to NixOS module tests. They should be used to create simple integration tests for packages, but cannot test NixOS services, and some programs with graphical user interfaces may also be difficult to test with them.
560+* The **`checkPhase` of a package**, which should execute the unit tests that are included in the source code of a package.
561+
562+Here in the nixpkgs manual we describe mostly _package tests_; for _module tests_ head over to the corresponding [section in the NixOS manual](https://nixos.org/manual/nixos/stable/#sec-nixos-tests).
563+
564+### Writing inline package tests {#ssec-inline-package-tests-writing}
565+
566+For very simple tests, they can be written inline:
567+
568+```nix
569+{ …, yq-go }:
570+
571+buildGoModule rec {
572+ …
573+
574+ passthru.tests = {
575+ simple = runCommand "${pname}-test" {} ''
576+ echo "test: 1" | ${yq-go}/bin/yq eval -j > $out
577+ [ "$(cat $out | tr -d $'\n ')" = '{"test":1}' ]
578+ '';
579+ };
580+}
581+```
582+
583+### Writing larger package tests {#ssec-package-tests-writing}
584+
585+This is an example using the `phoronix-test-suite` package with the current best practices.
586+
587+Add the tests in `passthru.tests` to the package definition like this:
588+
589+```nix
590+{ stdenv, lib, fetchurl, callPackage }:
591+
592+stdenv.mkDerivation {
593+ …
594+
595+ passthru.tests = {
596+ simple-execution = callPackage ./tests.nix { };
597+ };
598+
599+ meta = { … };
600+}
601+```
602+
603+Create `tests.nix` in the package directory:
604+
605+```nix
606+{ runCommand, phoronix-test-suite }:
607+
608+let
609+ inherit (phoronix-test-suite) pname version;
610+in
611+
612+runCommand "${pname}-tests" { meta.timeout = 60; }
613+ ''
614+ # automatic initial setup to prevent interactive questions
615+ ${phoronix-test-suite}/bin/phoronix-test-suite enterprise-setup >/dev/null
616+ # get version of installed program and compare with package version
617+ if [[ `${phoronix-test-suite}/bin/phoronix-test-suite version` != *"${version}"* ]]; then
618+ echo "Error: program version does not match package version"
619+ exit 1
620+ fi
621+ # run dummy command
622+ ${phoronix-test-suite}/bin/phoronix-test-suite dummy_module.dummy-command >/dev/null
623+ # needed for Nix to register the command as successful
624+ touch $out
625+ ''
626+```
627+
628+### Running package tests {#ssec-package-tests-running}
629+
630+You can run these tests with:
631+
632+```ShellSession
633+$ cd path/to/nixpkgs
634+$ nix-build -A phoronix-test-suite.tests
635+```
636+
637+### Examples of package tests {#ssec-package-tests-examples}
638+
639+Here are examples of package tests:
640+
641+- [Jasmin compile test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/jasmin/test-assemble-hello-world/default.nix)
642+- [Lobster compile test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/lobster/test-can-run-hello-world.nix)
643+- [Spacy annotation test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/spacy/annotation-test/default.nix)
644+- [Libtorch test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/science/math/libtorch/test/default.nix)
645+- [Multiple tests for nanopb](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/nanopb/default.nix)
646+
647+### Linking NixOS module tests to a package {#ssec-nixos-tests-linking}
648+
649+Like [package tests](#ssec-package-tests-writing) as shown above, [NixOS module tests](https://nixos.org/manual/nixos/stable/#sec-nixos-tests) can also be linked to a package, so that the tests can be easily run when changing the related package.
650+
651+For example, assuming we're packaging `nginx`, we can link its module test via `passthru.tests`:
652+
653+```nix
654+{ stdenv, lib, nixosTests }:
655+
656+stdenv.mkDerivation {
657+ ...
658+
659+ passthru.tests = {
660+ nginx = nixosTests.nginx;
661+ };
662+
663+ ...
664+}
665+```
doc/contributing/coding-conventions.xmldeleted−943
@@ -1,943 +0,0 @@
1−<chapter xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="chap-conventions">
4− <title>Coding conventions</title>
5− <section xml:id="sec-syntax">
6− <title>Syntax</title>
7−
8− <itemizedlist>
9− <listitem>
10− <para>
11− Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts.
12− </para>
13− </listitem>
14− <listitem>
15− <para>
16− Do not use tab characters, i.e. configure your editor to use soft tabs. For instance, use <literal>(setq-default indent-tabs-mode nil)</literal> in Emacs. Everybody has different tab settings so it’s asking for trouble.
17− </para>
18− </listitem>
19− <listitem>
20− <para>
21− Use <literal>lowerCamelCase</literal> for variable names, not <literal>UpperCamelCase</literal>. Note, this rule does not apply to package attribute names, which instead follow the rules in <xref linkend="sec-package-naming"/>.
22− </para>
23− </listitem>
24− <listitem>
25− <para>
26− Function calls with attribute set arguments are written as
27−<programlisting>
28−foo {
29− arg = ...;
30−}
31−</programlisting>
32− not
33−<programlisting>
34−foo
35−{
36− arg = ...;
37−}
38−</programlisting>
39− Also fine is
40−<programlisting>
41−foo { arg = ...; }
42−</programlisting>
43− if it's a short call.
44− </para>
45− </listitem>
46− <listitem>
47− <para>
48− In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned:
49−<programlisting>
50−# A long list.
51−list = [
52− elem1
53− elem2
54− elem3
55−];
56−
57−# A long attribute set.
58−attrs = {
59− attr1 = short_expr;
60− attr2 =
61− if true then big_expr else big_expr;
62−};
63−
64−# Combined
65−listOfAttrs = [
66− {
67− attr1 = 3;
68− attr2 = "fff";
69− }
70− {
71− attr1 = 5;
72− attr2 = "ggg";
73− }
74−];
75−</programlisting>
76− </para>
77− </listitem>
78− <listitem>
79− <para>
80− Short lists or attribute sets can be written on one line:
81−<programlisting>
82−# A short list.
83−list = [ elem1 elem2 elem3 ];
84−
85−# A short set.
86−attrs = { x = 1280; y = 1024; };
87−</programlisting>
88− </para>
89− </listitem>
90− <listitem>
91− <para>
92− Breaking in the middle of a function argument can give hard-to-read code, like
93−<programlisting>
94−someFunction { x = 1280;
95− y = 1024; } otherArg
96− yetAnotherArg
97−</programlisting>
98− (especially if the argument is very large, spanning multiple lines).
99− </para>
100− <para>
101− Better:
102−<programlisting>
103−someFunction
104− { x = 1280; y = 1024; }
105− otherArg
106− yetAnotherArg
107−</programlisting>
108− or
109−<programlisting>
110−let res = { x = 1280; y = 1024; };
111−in someFunction res otherArg yetAnotherArg
112−</programlisting>
113− </para>
114− </listitem>
115− <listitem>
116− <para>
117− The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e.
118−<programlisting>
119−{ arg1, arg2 }:
120−assert system == "i686-linux";
121−stdenv.mkDerivation { ...
122−</programlisting>
123− not
124−<programlisting>
125−{ arg1, arg2 }:
126− assert system == "i686-linux";
127− stdenv.mkDerivation { ...
128−</programlisting>
129− </para>
130− </listitem>
131− <listitem>
132− <para>
133− Function formal arguments are written as:
134−<programlisting>
135−{ arg1, arg2, arg3 }:
136−</programlisting>
137− but if they don't fit on one line they're written as:
138−<programlisting>
139−{ arg1, arg2, arg3
140−, arg4, ...
141−, # Some comment...
142− argN
143−}:
144−</programlisting>
145− </para>
146− </listitem>
147− <listitem>
148− <para>
149− Functions should list their expected arguments as precisely as possible. That is, write
150−<programlisting>
151−{ stdenv, fetchurl, perl }: <replaceable>...</replaceable>
152−</programlisting>
153− instead of
154−<programlisting>
155−args: with args; <replaceable>...</replaceable>
156−</programlisting>
157− or
158−<programlisting>
159−{ stdenv, fetchurl, perl, ... }: <replaceable>...</replaceable>
160−</programlisting>
161− </para>
162− <para>
163− For functions that are truly generic in the number of arguments (such as wrappers around <varname>mkDerivation</varname>) that have some required arguments, you should write them using an <literal>@</literal>-pattern:
164−<programlisting>
165−{ stdenv, doCoverageAnalysis ? false, ... } @ args:
166−
167−stdenv.mkDerivation (args // {
168− <replaceable>...</replaceable> if doCoverageAnalysis then "bla" else "" <replaceable>...</replaceable>
169−})
170−</programlisting>
171− instead of
172−<programlisting>
173−args:
174−
175−args.stdenv.mkDerivation (args // {
176− <replaceable>...</replaceable> if args ? doCoverageAnalysis && args.doCoverageAnalysis then "bla" else "" <replaceable>...</replaceable>
177−})
178−</programlisting>
179− </para>
180− </listitem>
181− <listitem>
182− <para>
183− Arguments should be listed in the order they are used, with the exception of <varname>lib</varname>, which always goes first.
184− </para>
185− </listitem>
186− <listitem>
187− <para>
188− Prefer using the top-level <varname>lib</varname> over its alias <literal>stdenv.lib</literal>. <varname>lib</varname> is unrelated to <varname>stdenv</varname>, and so <literal>stdenv.lib</literal> should only be used as a convenience alias when developing to avoid having to modify the function inputs just to test something out.
189− </para>
190− </listitem>
191− </itemizedlist>
192− </section>
193− <section xml:id="sec-package-naming">
194− <title>Package naming</title>
195−
196− <para>
197− The key words <emphasis>must</emphasis>, <emphasis>must not</emphasis>, <emphasis>required</emphasis>, <emphasis>shall</emphasis>, <emphasis>shall not</emphasis>, <emphasis>should</emphasis>, <emphasis>should not</emphasis>, <emphasis>recommended</emphasis>, <emphasis>may</emphasis>, and <emphasis>optional</emphasis> in this section are to be interpreted as described in <link xlink:href="https://tools.ietf.org/html/rfc2119">RFC 2119</link>. Only <emphasis>emphasized</emphasis> words are to be interpreted in this way.
198− </para>
199−
200− <para>
201− In Nixpkgs, there are generally three different names associated with a package:
202− <itemizedlist>
203− <listitem>
204− <para>
205− The <varname>name</varname> attribute of the derivation (excluding the version part). This is what most users see, in particular when using <command>nix-env</command>.
206− </para>
207− </listitem>
208− <listitem>
209− <para>
210− The variable name used for the instantiated package in <filename>all-packages.nix</filename>, and when passing it as a dependency to other functions. Typically this is called the <emphasis>package attribute name</emphasis>. This is what Nix expression authors see. It can also be used when installing using <command>nix-env -iA</command>.
211− </para>
212− </listitem>
213− <listitem>
214− <para>
215− The filename for (the directory containing) the Nix expression.
216− </para>
217− </listitem>
218− </itemizedlist>
219− Most of the time, these are the same. For instance, the package <literal>e2fsprogs</literal> has a <varname>name</varname> attribute <literal>"e2fsprogs-<replaceable>version</replaceable>"</literal>, is bound to the variable name <varname>e2fsprogs</varname> in <filename>all-packages.nix</filename>, and the Nix expression is in <filename>pkgs/os-specific/linux/e2fsprogs/default.nix</filename>.
220− </para>
221−
222− <para>
223− There are a few naming guidelines:
224− <itemizedlist>
225− <listitem>
226− <para>
227− The <literal>name</literal> attribute <emphasis>should</emphasis> be identical to the upstream package name.
228− </para>
229− </listitem>
230− <listitem>
231− <para>
232− The <literal>name</literal> attribute <emphasis>must not</emphasis> contain uppercase letters — e.g., <literal>"mplayer-1.0rc2"</literal> instead of <literal>"MPlayer-1.0rc2"</literal>.
233− </para>
234− </listitem>
235− <listitem>
236− <para>
237− The version part of the <literal>name</literal> attribute <emphasis>must</emphasis> start with a digit (following a dash) — e.g., <literal>"hello-0.3.1rc2"</literal>.
238− </para>
239− </listitem>
240− <listitem>
241− <para>
242− If a package is not a release but a commit from a repository, then the version part of the name <emphasis>must</emphasis> be the date of that (fetched) commit. The date <emphasis>must</emphasis> be in <literal>"YYYY-MM-DD"</literal> format. Also append <literal>"unstable"</literal> to the name - e.g., <literal>"pkgname-unstable-2014-09-23"</literal>.
243− </para>
244− </listitem>
245− <listitem>
246− <para>
247− Dashes in the package name <emphasis>should</emphasis> be preserved in new variable names, rather than converted to underscores or camel cased — e.g., <varname>http-parser</varname> instead of <varname>http_parser</varname> or <varname>httpParser</varname>. The hyphenated style is preferred in all three package names.
248− </para>
249− </listitem>
250− <listitem>
251− <para>
252− If there are multiple versions of a package, this <emphasis>should</emphasis> be reflected in the variable names in <filename>all-packages.nix</filename>, e.g. <varname>json-c-0-9</varname> and <varname>json-c-0-11</varname>. If there is an obvious “default” version, make an attribute like <literal>json-c = json-c-0-9;</literal>. See also <xref linkend="sec-versioning" />
253− </para>
254− </listitem>
255− </itemizedlist>
256− </para>
257− </section>
258− <section xml:id="sec-organisation">
259− <title>File naming and organisation</title>
260−
261− <para>
262− Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be <filename>all-packages.nix</filename>, not <filename>allPackages.nix</filename> or <filename>AllPackages.nix</filename>.
263− </para>
264−
265− <section xml:id="sec-hierarchy">
266− <title>Hierarchy</title>
267−
268− <para>
269− Each package should be stored in its own directory somewhere in the <filename>pkgs/</filename> tree, i.e. in <filename>pkgs/<replaceable>category</replaceable>/<replaceable>subcategory</replaceable>/<replaceable>...</replaceable>/<replaceable>pkgname</replaceable></filename>. Below are some rules for picking the right category for a package. Many packages fall under several categories; what matters is the <emphasis>primary</emphasis> purpose of a package. For example, the <literal>libxml2</literal> package builds both a library and some tools; but it’s a library foremost, so it goes under <filename>pkgs/development/libraries</filename>.
270− </para>
271−
272− <para>
273− When in doubt, consider refactoring the <filename>pkgs/</filename> tree, e.g. creating new categories or splitting up an existing category.
274− </para>
275−
276− <variablelist>
277− <varlistentry>
278− <term>
279− If it’s used to support <emphasis>software development</emphasis>:
280− </term>
281− <listitem>
282− <variablelist>
283− <varlistentry>
284− <term>
285− If it’s a <emphasis>library</emphasis> used by other packages:
286− </term>
287− <listitem>
288− <para>
289− <filename>development/libraries</filename> (e.g. <filename>libxml2</filename>)
290− </para>
291− </listitem>
292− </varlistentry>
293− <varlistentry>
294− <term>
295− If it’s a <emphasis>compiler</emphasis>:
296− </term>
297− <listitem>
298− <para>
299− <filename>development/compilers</filename> (e.g. <filename>gcc</filename>)
300− </para>
301− </listitem>
302− </varlistentry>
303− <varlistentry>
304− <term>
305− If it’s an <emphasis>interpreter</emphasis>:
306− </term>
307− <listitem>
308− <para>
309− <filename>development/interpreters</filename> (e.g. <filename>guile</filename>)
310− </para>
311− </listitem>
312− </varlistentry>
313− <varlistentry>
314− <term>
315− If it’s a (set of) development <emphasis>tool(s)</emphasis>:
316− </term>
317− <listitem>
318− <variablelist>
319− <varlistentry>
320− <term>
321− If it’s a <emphasis>parser generator</emphasis> (including lexers):
322− </term>
323− <listitem>
324− <para>
325− <filename>development/tools/parsing</filename> (e.g. <filename>bison</filename>, <filename>flex</filename>)
326− </para>
327− </listitem>
328− </varlistentry>
329− <varlistentry>
330− <term>
331− If it’s a <emphasis>build manager</emphasis>:
332− </term>
333− <listitem>
334− <para>
335− <filename>development/tools/build-managers</filename> (e.g. <filename>gnumake</filename>)
336− </para>
337− </listitem>
338− </varlistentry>
339− <varlistentry>
340− <term>
341− Else:
342− </term>
343− <listitem>
344− <para>
345− <filename>development/tools/misc</filename> (e.g. <filename>binutils</filename>)
346− </para>
347− </listitem>
348− </varlistentry>
349− </variablelist>
350− </listitem>
351− </varlistentry>
352− <varlistentry>
353− <term>
354− Else:
355− </term>
356− <listitem>
357− <para>
358− <filename>development/misc</filename>
359− </para>
360− </listitem>
361− </varlistentry>
362− </variablelist>
363− </listitem>
364− </varlistentry>
365− <varlistentry>
366− <term>
367− If it’s a (set of) <emphasis>tool(s)</emphasis>:
368− </term>
369− <listitem>
370− <para>
371− (A tool is a relatively small program, especially one intended to be used non-interactively.)
372− </para>
373− <variablelist>
374− <varlistentry>
375− <term>
376− If it’s for <emphasis>networking</emphasis>:
377− </term>
378− <listitem>
379− <para>
380− <filename>tools/networking</filename> (e.g. <filename>wget</filename>)
381− </para>
382− </listitem>
383− </varlistentry>
384− <varlistentry>
385− <term>
386− If it’s for <emphasis>text processing</emphasis>:
387− </term>
388− <listitem>
389− <para>
390− <filename>tools/text</filename> (e.g. <filename>diffutils</filename>)
391− </para>
392− </listitem>
393− </varlistentry>
394− <varlistentry>
395− <term>
396− If it’s a <emphasis>system utility</emphasis>, i.e., something related or essential to the operation of a system:
397− </term>
398− <listitem>
399− <para>
400− <filename>tools/system</filename> (e.g. <filename>cron</filename>)
401− </para>
402− </listitem>
403− </varlistentry>
404− <varlistentry>
405− <term>
406− If it’s an <emphasis>archiver</emphasis> (which may include a compression function):
407− </term>
408− <listitem>
409− <para>
410− <filename>tools/archivers</filename> (e.g. <filename>zip</filename>, <filename>tar</filename>)
411− </para>
412− </listitem>
413− </varlistentry>
414− <varlistentry>
415− <term>
416− If it’s a <emphasis>compression</emphasis> program:
417− </term>
418− <listitem>
419− <para>
420− <filename>tools/compression</filename> (e.g. <filename>gzip</filename>, <filename>bzip2</filename>)
421− </para>
422− </listitem>
423− </varlistentry>
424− <varlistentry>
425− <term>
426− If it’s a <emphasis>security</emphasis>-related program:
427− </term>
428− <listitem>
429− <para>
430− <filename>tools/security</filename> (e.g. <filename>nmap</filename>, <filename>gnupg</filename>)
431− </para>
432− </listitem>
433− </varlistentry>
434− <varlistentry>
435− <term>
436− Else:
437− </term>
438− <listitem>
439− <para>
440− <filename>tools/misc</filename>
441− </para>
442− </listitem>
443− </varlistentry>
444− </variablelist>
445− </listitem>
446− </varlistentry>
447− <varlistentry>
448− <term>
449− If it’s a <emphasis>shell</emphasis>:
450− </term>
451− <listitem>
452− <para>
453− <filename>shells</filename> (e.g. <filename>bash</filename>)
454− </para>
455− </listitem>
456− </varlistentry>
457− <varlistentry>
458− <term>
459− If it’s a <emphasis>server</emphasis>:
460− </term>
461− <listitem>
462− <variablelist>
463− <varlistentry>
464− <term>
465− If it’s a web server:
466− </term>
467− <listitem>
468− <para>
469− <filename>servers/http</filename> (e.g. <filename>apache-httpd</filename>)
470− </para>
471− </listitem>
472− </varlistentry>
473− <varlistentry>
474− <term>
475− If it’s an implementation of the X Windowing System:
476− </term>
477− <listitem>
478− <para>
479− <filename>servers/x11</filename> (e.g. <filename>xorg</filename> — this includes the client libraries and programs)
480− </para>
481− </listitem>
482− </varlistentry>
483− <varlistentry>
484− <term>
485− Else:
486− </term>
487− <listitem>
488− <para>
489− <filename>servers/misc</filename>
490− </para>
491− </listitem>
492− </varlistentry>
493− </variablelist>
494− </listitem>
495− </varlistentry>
496− <varlistentry>
497− <term>
498− If it’s a <emphasis>desktop environment</emphasis>:
499− </term>
500− <listitem>
501− <para>
502− <filename>desktops</filename> (e.g. <filename>kde</filename>, <filename>gnome</filename>, <filename>enlightenment</filename>)
503− </para>
504− </listitem>
505− </varlistentry>
506− <varlistentry>
507− <term>
508− If it’s a <emphasis>window manager</emphasis>:
509− </term>
510− <listitem>
511− <para>
512− <filename>applications/window-managers</filename> (e.g. <filename>awesome</filename>, <filename>stumpwm</filename>)
513− </para>
514− </listitem>
515− </varlistentry>
516− <varlistentry>
517− <term>
518− If it’s an <emphasis>application</emphasis>:
519− </term>
520− <listitem>
521− <para>
522− A (typically large) program with a distinct user interface, primarily used interactively.
523− </para>
524− <variablelist>
525− <varlistentry>
526− <term>
527− If it’s a <emphasis>version management system</emphasis>:
528− </term>
529− <listitem>
530− <para>
531− <filename>applications/version-management</filename> (e.g. <filename>subversion</filename>)
532− </para>
533− </listitem>
534− </varlistentry>
535− <varlistentry>
536− <term>
537− If it’s a <emphasis>terminal emulator</emphasis>:
538− </term>
539− <listitem>
540− <para>
541− <filename>applications/terminal-emulators</filename> (e.g. <filename>alacritty</filename> or <filename>rxvt</filename> or <filename>termite</filename>)
542− </para>
543− </listitem>
544− </varlistentry>
545− <varlistentry>
546− <term>
547− If it’s for <emphasis>video playback / editing</emphasis>:
548− </term>
549− <listitem>
550− <para>
551− <filename>applications/video</filename> (e.g. <filename>vlc</filename>)
552− </para>
553− </listitem>
554− </varlistentry>
555− <varlistentry>
556− <term>
557− If it’s for <emphasis>graphics viewing / editing</emphasis>:
558− </term>
559− <listitem>
560− <para>
561− <filename>applications/graphics</filename> (e.g. <filename>gimp</filename>)
562− </para>
563− </listitem>
564− </varlistentry>
565− <varlistentry>
566− <term>
567− If it’s for <emphasis>networking</emphasis>:
568− </term>
569− <listitem>
570− <variablelist>
571− <varlistentry>
572− <term>
573− If it’s a <emphasis>mailreader</emphasis>:
574− </term>
575− <listitem>
576− <para>
577− <filename>applications/networking/mailreaders</filename> (e.g. <filename>thunderbird</filename>)
578− </para>
579− </listitem>
580− </varlistentry>
581− <varlistentry>
582− <term>
583− If it’s a <emphasis>newsreader</emphasis>:
584− </term>
585− <listitem>
586− <para>
587− <filename>applications/networking/newsreaders</filename> (e.g. <filename>pan</filename>)
588− </para>
589− </listitem>
590− </varlistentry>
591− <varlistentry>
592− <term>
593− If it’s a <emphasis>web browser</emphasis>:
594− </term>
595− <listitem>
596− <para>
597− <filename>applications/networking/browsers</filename> (e.g. <filename>firefox</filename>)
598− </para>
599− </listitem>
600− </varlistentry>
601− <varlistentry>
602− <term>
603− Else:
604− </term>
605− <listitem>
606− <para>
607− <filename>applications/networking/misc</filename>
608− </para>
609− </listitem>
610− </varlistentry>
611− </variablelist>
612− </listitem>
613− </varlistentry>
614− <varlistentry>
615− <term>
616− Else:
617− </term>
618− <listitem>
619− <para>
620− <filename>applications/misc</filename>
621− </para>
622− </listitem>
623− </varlistentry>
624− </variablelist>
625− </listitem>
626− </varlistentry>
627− <varlistentry>
628− <term>
629− If it’s <emphasis>data</emphasis> (i.e., does not have a straight-forward executable semantics):
630− </term>
631− <listitem>
632− <variablelist>
633− <varlistentry>
634− <term>
635− If it’s a <emphasis>font</emphasis>:
636− </term>
637− <listitem>
638− <para>
639− <filename>data/fonts</filename>
640− </para>
641− </listitem>
642− </varlistentry>
643− <varlistentry>
644− <term>
645− If it’s an <emphasis>icon theme</emphasis>:
646− </term>
647− <listitem>
648− <para>
649− <filename>data/icons</filename>
650− </para>
651− </listitem>
652− </varlistentry>
653− <varlistentry>
654− <term>
655− If it’s related to <emphasis>SGML/XML processing</emphasis>:
656− </term>
657− <listitem>
658− <variablelist>
659− <varlistentry>
660− <term>
661− If it’s an <emphasis>XML DTD</emphasis>:
662− </term>
663− <listitem>
664− <para>
665− <filename>data/sgml+xml/schemas/xml-dtd</filename> (e.g. <filename>docbook</filename>)
666− </para>
667− </listitem>
668− </varlistentry>
669− <varlistentry>
670− <term>
671− If it’s an <emphasis>XSLT stylesheet</emphasis>:
672− </term>
673− <listitem>
674− <para>
675− (Okay, these are executable...)
676− </para>
677− <para>
678− <filename>data/sgml+xml/stylesheets/xslt</filename> (e.g. <filename>docbook-xsl</filename>)
679− </para>
680− </listitem>
681− </varlistentry>
682− </variablelist>
683− </listitem>
684− </varlistentry>
685− <varlistentry>
686− <term>
687− If it’s a <emphasis>theme</emphasis> for a <emphasis>desktop environment</emphasis>, a <emphasis>window manager</emphasis> or a <emphasis>display manager</emphasis>:
688− </term>
689− <listitem>
690− <para>
691− <filename>data/themes</filename>
692− </para>
693− </listitem>
694− </varlistentry>
695− </variablelist>
696− </listitem>
697− </varlistentry>
698− <varlistentry>
699− <term>
700− If it’s a <emphasis>game</emphasis>:
701− </term>
702− <listitem>
703− <para>
704− <filename>games</filename>
705− </para>
706− </listitem>
707− </varlistentry>
708− <varlistentry>
709− <term>
710− Else:
711− </term>
712− <listitem>
713− <para>
714− <filename>misc</filename>
715− </para>
716− </listitem>
717− </varlistentry>
718− </variablelist>
719− </section>
720−
721− <section xml:id="sec-versioning">
722− <title>Versioning</title>
723−
724− <para>
725− 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.
726− </para>
727−
728− <para>
729− If there is only one version of a package, its Nix expression should be named <filename>e2fsprogs/default.nix</filename>. If there are multiple versions, this should be reflected in the filename, e.g. <filename>e2fsprogs/1.41.8.nix</filename> and <filename>e2fsprogs/1.41.9.nix</filename>. 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 <filename>firefox/2.0.nix</filename> and <filename>firefox/3.5.nix</filename>, respectively (which, at a given point, might contain versions <literal>2.0.0.20</literal> and <literal>3.5.4</literal>). If a version requires many auxiliary files, you can use a subdirectory for each version, e.g. <filename>firefox/2.0/default.nix</filename> and <filename>firefox/3.5/default.nix</filename>.
730− </para>
731−
732− <para>
733− All versions of a package <emphasis>must</emphasis> be included in <filename>all-packages.nix</filename> to make sure that they evaluate correctly.
734− </para>
735− </section>
736− </section>
737− <section xml:id="sec-sources">
738− <title>Fetching Sources</title>
739−
740− <para>
741− 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 <literal>fetchurl</literal>. Note that you should also prefer protocols which have a corresponding proxy environment variable.
742− </para>
743−
744− <para>
745− You can find many source fetch helpers in <literal>pkgs/build-support/fetch*</literal>.
746− </para>
747−
748− <para>
749− In the file <literal>pkgs/top-level/all-packages.nix</literal> you can find fetch helpers, these have names on the form <literal>fetchFrom*</literal>. The intention of these are to provide snapshot fetches but using the same api as some of the version controlled fetchers from <literal>pkgs/build-support/</literal>. As an example going from bad to good:
750− <itemizedlist>
751− <listitem>
752− <para>
753− Bad: Uses <literal>git://</literal> which won't be proxied.
754−<programlisting>
755−src = fetchgit {
756− url = "git://github.com/NixOS/nix.git";
757− rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
758− sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
759−}
760−</programlisting>
761− </para>
762− </listitem>
763− <listitem>
764− <para>
765− Better: This is ok, but an archive fetch will still be faster.
766−<programlisting>
767−src = fetchgit {
768− url = "https://github.com/NixOS/nix.git";
769− rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
770− sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
771−}
772−</programlisting>
773− </para>
774− </listitem>
775− <listitem>
776− <para>
777− Best: Fetches a snapshot archive and you get the rev you want.
778−<programlisting>
779−src = fetchFromGitHub {
780− owner = "NixOS";
781− repo = "nix";
782− rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
783− sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc";
784−}
785−</programlisting>
786− Find the value to put as <literal>sha256</literal> by running <literal>nix run -f '<nixpkgs>' nix-prefetch-github -c nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS nix</literal> or <literal>nix-prefetch-url --unpack https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz</literal>.
787− </para>
788− </listitem>
789− </itemizedlist>
790− </para>
791− </section>
792− <section xml:id="sec-source-hashes">
793− <title>Obtaining source hash</title>
794−
795− <para>
796− Preferred source hash type is sha256. There are several ways to get it.
797− </para>
798−
799− <orderedlist>
800− <listitem>
801− <para>
802− Prefetch URL (with <literal>nix-prefetch-<replaceable>XXX</replaceable> <replaceable>URL</replaceable></literal>, where <replaceable>XXX</replaceable> is one of <literal>url</literal>, <literal>git</literal>, <literal>hg</literal>, <literal>cvs</literal>, <literal>bzr</literal>, <literal>svn</literal>). Hash is printed to stdout.
803− </para>
804− </listitem>
805− <listitem>
806− <para>
807− Prefetch by package source (with <literal>nix-prefetch-url '<nixpkgs>' -A <replaceable>PACKAGE</replaceable>.src</literal>, where <replaceable>PACKAGE</replaceable> is package attribute name). Hash is printed to stdout.
808− </para>
809− <para>
810− 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 (<literal>.srcs</literal>, architecture-dependent sources, etc).
811− </para>
812− </listitem>
813− <listitem>
814− <para>
815− Upstream provided hash: use it when upstream provides <literal>sha256</literal> or <literal>sha512</literal> (when upstream provides <literal>md5</literal>, don't use it, compute <literal>sha256</literal> instead).
816− </para>
817− <para>
818− A little nuance is that <literal>nix-prefetch-*</literal> tools produce hash encoded with <literal>base32</literal>, but upstream usually provides hexadecimal (<literal>base16</literal>) encoding. Fetchers understand both formats. Nixpkgs does not standardize on any one format.
819− </para>
820− <para>
821− You can convert between formats with nix-hash, for example:
822−<screen>
823−<prompt>$ </prompt>nix-hash --type sha256 --to-base32 <replaceable>HASH</replaceable>
824−</screen>
825− </para>
826− </listitem>
827− <listitem>
828− <para>
829− Extracting hash from local source tarball can be done with <literal>sha256sum</literal>. Use <literal>nix-prefetch-url file:///path/to/tarball </literal> if you want base32 hash.
830− </para>
831− </listitem>
832− <listitem>
833− <para>
834− Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints.
835− </para>
836− <para>
837− For package updates it is enough to change one symbol to make hash fake. For new packages, you can use <literal>lib.fakeSha256</literal>, <literal>lib.fakeSha512</literal> or any other fake hash.
838− </para>
839− <para>
840− This is last resort method when reconstructing source URL is non-trivial and <literal>nix-prefetch-url -A</literal> isn't applicable (for example, <link xlink:href="https://github.com/NixOS/nixpkgs/blob/d2ab091dd308b99e4912b805a5eb088dd536adb9/pkgs/applications/video/kodi/default.nix#L73"> one of <literal>kodi</literal> dependencies</link>). 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.
841− </para>
842− <warning>
843− <para>
844− This method has security problems. Check below for details.
845− </para>
846− </warning>
847− </listitem>
848− </orderedlist>
849−
850− <section xml:id="sec-source-hashes-security">
851− <title>Obtaining hashes securely</title>
852−
853− <para>
854− 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:
855− </para>
856−
857− <itemizedlist>
858− <listitem>
859− <para>
860− <literal>http://</literal> URLs are not secure to prefetch hash from;
861− </para>
862− </listitem>
863− <listitem>
864− <para>
865− hashes from upstream (in method 3) should be obtained via secure protocol;
866− </para>
867− </listitem>
868− <listitem>
869− <para>
870− <literal>https://</literal> URLs are secure in methods 1, 2, 3;
871− </para>
872− </listitem>
873− <listitem>
874− <para>
875− <literal>https://</literal> 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 <literal>https://</literal> URL and prefetch it with method 1.
876− </para>
877− </listitem>
878− </itemizedlist>
879− </section>
880− </section>
881− <section xml:id="sec-patches">
882− <title>Patches</title>
883−
884− <para>
885− Patches available online should be retrieved using <literal>fetchpatch</literal>.
886− </para>
887−
888− <para>
889−<programlisting>
890−patches = [
891− (fetchpatch {
892− name = "fix-check-for-using-shared-freetype-lib.patch";
893− url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285";
894− sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr";
895− })
896−];
897−</programlisting>
898− </para>
899−
900− <para>
901− Otherwise, you can add a <literal>.patch</literal> file to the <literal>nixpkgs</literal> repository. In the interest of keeping our maintenance burden to a minimum, only patches that are unique to <literal>nixpkgs</literal> should be added in this way.
902− </para>
903−
904− <para>
905−<programlisting>
906−patches = [ ./0001-changes.patch ];
907−</programlisting>
908− </para>
909−
910− <para>
911− If you do need to do create this sort of patch file, one way to do so is with git:
912− <orderedlist>
913− <listitem>
914− <para>
915− Move to the root directory of the source code you're patching.
916−<screen>
917−<prompt>$ </prompt>cd the/program/source</screen>
918− </para>
919− </listitem>
920− <listitem>
921− <para>
922− If a git repository is not already present, create one and stage all of the source files.
923−<screen>
924−<prompt>$ </prompt>git init
925−<prompt>$ </prompt>git add .</screen>
926− </para>
927− </listitem>
928− <listitem>
929− <para>
930− Edit some files to make whatever changes need to be included in the patch.
931− </para>
932− </listitem>
933− <listitem>
934− <para>
935− Use git to create a diff, and pipe the output to a patch file:
936−<screen>
937−<prompt>$ </prompt>git diff > nixpkgs/pkgs/the/package/0001-changes.patch</screen>
938− </para>
939− </listitem>
940− </orderedlist>
941− </para>
942− </section>
943−</chapter>
doc/contributing/contributing-to-documentation.chapter.mdnew file+106
@@ -0,0 +1,106 @@
1+# Contributing to this documentation {#chap-contributing}
2+
3+The sources of the Nixpkgs manual are in the [doc](https://github.com/NixOS/nixpkgs/tree/master/doc) subdirectory of the Nixpkgs repository. The manual is still partially written in DocBook but it is progressively being converted to [Markdown](#sec-contributing-markup).
4+
5+You can quickly check your edits with `make`:
6+
7+```ShellSession
8+$ cd /path/to/nixpkgs/doc
9+$ nix-shell
10+[nix-shell]$ make
11+```
12+
13+If you experience problems, run `make debug` to help understand the docbook errors.
14+
15+After making modifications to the manual, it's important to build it before committing. You can do that as follows:
16+
17+```ShellSession
18+$ cd /path/to/nixpkgs/doc
19+$ nix-shell
20+[nix-shell]$ make clean
21+[nix-shell]$ nix-build .
22+```
23+
24+If the build succeeds, the manual will be in `./result/share/doc/nixpkgs/manual.html`.
25+
26+## Syntax {#sec-contributing-markup}
27+
28+As per [RFC 0072](https://github.com/NixOS/rfcs/pull/72), all new documentation content should be written in [CommonMark](https://commonmark.org/) Markdown dialect.
29+
30+Additionally, the following syntax extensions are currently used:
31+
32+- []{#ssec-contributing-markup-anchors}
33+ Explicitly defined **anchors** on headings, to allow linking to sections. These should be always used, to ensure the anchors can be linked even when the heading text changes, and to prevent conflicts between [automatically assigned identifiers](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/auto_identifiers.md).
34+
35+ It uses the widely compatible [header attributes](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/attributes.md) syntax:
36+
37+ ```markdown
38+ ## Syntax {#sec-contributing-markup}
39+ ```
40+
41+- []{#ssec-contributing-markup-anchors-inline}
42+ **Inline anchors**, which allow linking arbitrary place in the text (e.g. individual list items, sentences…).
43+
44+ They are defined using a hybrid of the link syntax with the attributes syntax known from headings, called [bracketed spans](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/bracketed_spans.md):
45+
46+ ```markdown
47+ - []{#ssec-gnome-hooks-glib} `glib` setup hook will populate `GSETTINGS_SCHEMAS_PATH` and then `wrapGAppsHook` will prepend it to `XDG_DATA_DIRS`.
48+ ```
49+
50+- []{#ssec-contributing-markup-automatic-links}
51+ If you **omit a link text** for a link pointing to a section, the text will be substituted automatically. For example, `[](#chap-contributing)` will result in [](#chap-contributing).
52+
53+ This syntax is taken from [MyST](https://myst-parser.readthedocs.io/en/latest/using/syntax.html#targets-and-cross-referencing).
54+
55+- []{#ssec-contributing-markup-inline-roles}
56+ If you want to link to a man page, you can use `` {manpage}`nix.conf(5)` ``, which will turn into {manpage}`nix.conf(5)`.
57+
58+ The references will turn into links when a mapping exists in {file}`doc/build-aux/pandoc-filters/link-unix-man-references.lua`.
59+
60+ This syntax is taken from [MyST](https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html#roles-an-in-line-extension-point). Though, the feature originates from [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-manpage) with slightly different syntax.
61+
62+- []{#ssec-contributing-markup-admonitions}
63+ **Admonitions**, set off from the text to bring attention to something.
64+
65+ It uses pandoc’s [fenced `div`s syntax](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/fenced_divs.md):
66+
67+ ```markdown
68+ ::: {.warning}
69+ This is a warning
70+ :::
71+ ```
72+
73+ which renders as
74+
75+ > ::: {.warning}
76+ > This is a warning.
77+ > :::
78+
79+ The following are supported:
80+
81+ - [`caution`](https://tdg.docbook.org/tdg/5.0/caution.html)
82+ - [`important`](https://tdg.docbook.org/tdg/5.0/important.html)
83+ - [`note`](https://tdg.docbook.org/tdg/5.0/note.html)
84+ - [`tip`](https://tdg.docbook.org/tdg/5.0/tip.html)
85+ - [`warning`](https://tdg.docbook.org/tdg/5.0/warning.html)
86+
87+- []{#ssec-contributing-markup-definition-lists}
88+ [**Definition lists**](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/definition_lists.md), for defining a group of terms:
89+
90+ ```markdown
91+ pear
92+ : green or yellow bulbous fruit
93+
94+ watermelon
95+ : green fruit with red flesh
96+ ```
97+
98+ which renders as
99+
100+ > pear
101+ > : green or yellow bulbous fruit
102+ >
103+ > watermelon
104+ > : green fruit with red flesh
105+
106+For contributing to the legacy parts, please see [DocBook: The Definitive Guide](https://tdg.docbook.org/) or the [DocBook rocks! primer](https://web.archive.org/web/20200816233747/https://docbook.rocks/).
doc/contributing/contributing-to-documentation.xmldeleted−30
@@ -1,30 +0,0 @@
1−<chapter xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="chap-contributing">
4− <title>Contributing to this documentation</title>
5− <para>
6− The DocBook sources of the Nixpkgs manual are in the <filename
7−xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename> subdirectory of the Nixpkgs repository.
8− </para>
9− <para>
10− You can quickly check your edits with <command>make</command>:
11− </para>
12−<screen>
13−<prompt>$ </prompt>cd /path/to/nixpkgs/doc
14−<prompt>$ </prompt>nix-shell
15−<prompt>[nix-shell]$ </prompt>make $makeFlags
16−</screen>
17− <para>
18− If you experience problems, run <command>make debug</command> to help understand the docbook errors.
19− </para>
20− <para>
21− After making modifications to the manual, it's important to build it before committing. You can do that as follows:
22−<screen>
23−<prompt>$ </prompt>cd /path/to/nixpkgs/doc
24−<prompt>$ </prompt>nix-shell
25−<prompt>[nix-shell]$ </prompt>make clean
26−<prompt>[nix-shell]$ </prompt>nix-build .
27−</screen>
28− If the build succeeds, the manual will be in <filename>./result/share/doc/nixpkgs/manual.html</filename>.
29− </para>
30−</chapter>
doc/contributing/quick-start.chapter.mdnew file+77
@@ -0,0 +1,77 @@
1+# Quick Start to Adding a Package {#chap-quick-start}
2+
3+To add a package to Nixpkgs:
4+
5+1. Checkout the Nixpkgs source tree:
6+
7+ ```ShellSession
8+ $ git clone https://github.com/NixOS/nixpkgs
9+ $ cd nixpkgs
10+ ```
11+
12+2. 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 [](#sec-organisation) for some hints on the tree organisation. Create a directory for your package, e.g.
13+
14+ ```ShellSession
15+ $ mkdir pkgs/development/libraries/libfoo
16+ ```
17+
18+3. 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`.
19+
20+ ```ShellSession
21+ $ emacs pkgs/development/libraries/libfoo/default.nix
22+ $ git add pkgs/development/libraries/libfoo/default.nix
23+ ```
24+
25+ You can have a look at the existing Nix expressions under `pkgs/` to see how it’s done. Here are some good ones:
26+
27+ - GNU Hello: [`pkgs/applications/misc/hello/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hello/default.nix). Trivial package, which specifies some `meta` attributes which is good practice.
28+
29+ - GNU cpio: [`pkgs/tools/archivers/cpio/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/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`.
30+
31+ - GNU Multiple Precision arithmetic library (GMP): [`pkgs/development/libraries/gmp/5.1.x.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix). Also done by the generic builder, but has a dependency on `m4`.
32+
33+ - Pan, a GTK-based newsreader: [`pkgs/applications/networking/newsreaders/pan/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix). Has an optional dependency on `gtkspell`, which is only built if `spellCheck` is `true`.
34+
35+ - Apache HTTPD: [`pkgs/servers/http/apache-httpd/2.4.nix`](https://github.com/NixOS/nixpkgs/blob/master/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.
36+
37+ - Thunderbird: [`pkgs/applications/networking/mailreaders/thunderbird/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/default.nix). Lots of dependencies.
38+
39+ - JDiskReport, a Java utility: [`pkgs/tools/misc/jdiskreport/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/default.nix). Nixpkgs doesn’t have a decent `stdenv` for Java yet so this is pretty ad-hoc.
40+
41+ - XML::Simple, a Perl module: [`pkgs/top-level/perl-packages.nix`](https://github.com/NixOS/nixpkgs/blob/master/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.
42+
43+ - Adobe Reader: [`pkgs/applications/misc/adobe-reader/default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/default.nix). Shows how binary-only packages can be supported. In particular the [builder](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/builder.sh) uses `patchelf` to set the RUNPATH and ELF interpreter of the executables so that the right libraries are found at runtime.
44+
45+ Some notes:
46+
47+ - All [`meta`](#chap-meta) attributes are optional, but it’s still a good idea to provide at least the `description`, `homepage` and [`license`](#sec-meta-license).
48+
49+ - 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.
50+
51+ - A list of schemes for `mirror://` URLs can be found in [`pkgs/build-support/fetchurl/mirrors.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/mirrors.nix).
52+
53+ 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](https://hydra.nixos.org/job/nix/trunk/tarball/latest/download-by-type/doc/manual/#chap-writing-nix-expressions).
54+
55+4. Add a call to the function defined in the previous step to [`pkgs/top-level/all-packages.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix) with some descriptive name for the variable, e.g. `libfoo`.
56+
57+ ```ShellSession
58+ $ emacs pkgs/top-level/all-packages.nix
59+ ```
60+
61+ 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.
62+
63+5. To test whether the package builds, run the following command from the root of the nixpkgs source tree:
64+
65+ ```ShellSession
66+ $ nix-build -A libfoo
67+ ```
68+
69+ where `libfoo` should be the variable name defined in the previous step. You may want to add the flag `-K` 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.
70+
71+6. If you want to install the package into your profile (optional), do
72+
73+ ```ShellSession
74+ $ nix-env -f . -iA libfoo
75+ ```
76+
77+7. Optionally commit the new package and open a pull request [to nixpkgs](https://github.com/NixOS/nixpkgs/pulls), or use [the Patches category](https://discourse.nixos.org/t/about-the-patches-category/477) on Discourse for sending a patch without a GitHub account.
doc/contributing/quick-start.xmldeleted−152
@@ -1,152 +0,0 @@
1−<chapter xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="chap-quick-start">
4− <title>Quick Start to Adding a Package</title>
5− <para>
6− To add a package to Nixpkgs:
7− <orderedlist>
8− <listitem>
9− <para>
10− Checkout the Nixpkgs source tree:
11−<screen>
12−<prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs
13−<prompt>$ </prompt>cd nixpkgs</screen>
14− </para>
15− </listitem>
16− <listitem>
17− <para>
18− Find a good place in the Nixpkgs tree to add the Nix expression for your package. For instance, a library package typically goes into <filename>pkgs/development/libraries/<replaceable>pkgname</replaceable></filename>, while a web browser goes into <filename>pkgs/applications/networking/browsers/<replaceable>pkgname</replaceable></filename>. See <xref linkend="sec-organisation" /> for some hints on the tree organisation. Create a directory for your package, e.g.
19−<screen>
20−<prompt>$ </prompt>mkdir pkgs/development/libraries/libfoo</screen>
21− </para>
22− </listitem>
23− <listitem>
24− <para>
25− 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 <emphasis>function</emphasis> 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 <filename>default.nix</filename>.
26−<screen>
27−<prompt>$ </prompt>emacs pkgs/development/libraries/libfoo/default.nix
28−<prompt>$ </prompt>git add pkgs/development/libraries/libfoo/default.nix</screen>
29− </para>
30− <para>
31− You can have a look at the existing Nix expressions under <filename>pkgs/</filename> to see how it’s done. Here are some good ones:
32− <itemizedlist>
33− <listitem>
34− <para>
35− GNU Hello: <link
36− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hello/default.nix"><filename>pkgs/applications/misc/hello/default.nix</filename></link>. Trivial package, which specifies some <varname>meta</varname> attributes which is good practice.
37− </para>
38− </listitem>
39− <listitem>
40− <para>
41− GNU cpio: <link
42− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/archivers/cpio/default.nix"><filename>pkgs/tools/archivers/cpio/default.nix</filename></link>. Also a simple package. The generic builder in <varname>stdenv</varname> does everything for you. It has no dependencies beyond <varname>stdenv</varname>.
43− </para>
44− </listitem>
45− <listitem>
46− <para>
47− GNU Multiple Precision arithmetic library (GMP): <link
48− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix"><filename>pkgs/development/libraries/gmp/5.1.x.nix</filename></link>. Also done by the generic builder, but has a dependency on <varname>m4</varname>.
49− </para>
50− </listitem>
51− <listitem>
52− <para>
53− Pan, a GTK-based newsreader: <link
54− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix"><filename>pkgs/applications/networking/newsreaders/pan/default.nix</filename></link>. Has an optional dependency on <varname>gtkspell</varname>, which is only built if <varname>spellCheck</varname> is <literal>true</literal>.
55− </para>
56− </listitem>
57− <listitem>
58− <para>
59− Apache HTTPD: <link
60− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/apache-httpd/2.4.nix"><filename>pkgs/servers/http/apache-httpd/2.4.nix</filename></link>. A bunch of optional features, variable substitutions in the configure flags, a post-install hook, and miscellaneous hackery.
61− </para>
62− </listitem>
63− <listitem>
64− <para>
65− Thunderbird: <link
66− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/default.nix"><filename>pkgs/applications/networking/mailreaders/thunderbird/default.nix</filename></link>. Lots of dependencies.
67− </para>
68− </listitem>
69− <listitem>
70− <para>
71− JDiskReport, a Java utility: <link
72− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/default.nix"><filename>pkgs/tools/misc/jdiskreport/default.nix</filename></link>. Nixpkgs doesn’t have a decent <varname>stdenv</varname> for Java yet so this is pretty ad-hoc.
73− </para>
74− </listitem>
75− <listitem>
76− <para>
77− XML::Simple, a Perl module: <link
78− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix"><filename>pkgs/top-level/perl-packages.nix</filename></link> (search for the <varname>XMLSimple</varname> attribute). Most Perl modules are so simple to build that they are defined directly in <filename>perl-packages.nix</filename>; no need to make a separate file for them.
79− </para>
80− </listitem>
81− <listitem>
82− <para>
83− Adobe Reader: <link
84− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/default.nix"><filename>pkgs/applications/misc/adobe-reader/default.nix</filename></link>. Shows how binary-only packages can be supported. In particular the <link
85− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/builder.sh">builder</link> uses <command>patchelf</command> to set the RUNPATH and ELF interpreter of the executables so that the right libraries are found at runtime.
86− </para>
87− </listitem>
88− </itemizedlist>
89− </para>
90− <para>
91− Some notes:
92− <itemizedlist>
93− <listitem>
94− <para>
95− All <varname linkend="chap-meta">meta</varname> attributes are optional, but it’s still a good idea to provide at least the <varname>description</varname>, <varname>homepage</varname> and <varname
96− linkend="sec-meta-license">license</varname>.
97− </para>
98− </listitem>
99− <listitem>
100− <para>
101− You can use <command>nix-prefetch-url</command> <replaceable>url</replaceable> to get the SHA-256 hash of source distributions. There are similar commands as <command>nix-prefetch-git</command> and <command>nix-prefetch-hg</command> available in <literal>nix-prefetch-scripts</literal> package.
102− </para>
103− </listitem>
104− <listitem>
105− <para>
106− A list of schemes for <literal>mirror://</literal> URLs can be found in <link
107− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/mirrors.nix"><filename>pkgs/build-support/fetchurl/mirrors.nix</filename></link>.
108− </para>
109− </listitem>
110− </itemizedlist>
111− </para>
112− <para>
113− The exact syntax and semantics of the Nix expression language, including the built-in function, are described in the Nix manual in the <link
114− xlink:href="https://hydra.nixos.org/job/nix/trunk/tarball/latest/download-by-type/doc/manual/#chap-writing-nix-expressions">chapter on writing Nix expressions</link>.
115− </para>
116− </listitem>
117− <listitem>
118− <para>
119− Add a call to the function defined in the previous step to <link
120− xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix"><filename>pkgs/top-level/all-packages.nix</filename></link> with some descriptive name for the variable, e.g. <varname>libfoo</varname>.
121−<screen>
122−<prompt>$ </prompt>emacs pkgs/top-level/all-packages.nix</screen>
123− </para>
124− <para>
125− 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.
126− </para>
127− </listitem>
128− <listitem>
129− <para>
130− To test whether the package builds, run the following command from the root of the nixpkgs source tree:
131−<screen>
132−<prompt>$ </prompt>nix-build -A libfoo</screen>
133− where <varname>libfoo</varname> should be the variable name defined in the previous step. You may want to add the flag <option>-K</option> to keep the temporary build directory in case something fails. If the build succeeds, a symlink <filename>./result</filename> to the package in the Nix store is created.
134− </para>
135− </listitem>
136− <listitem>
137− <para>
138− If you want to install the package into your profile (optional), do
139−<screen>
140−<prompt>$ </prompt>nix-env -f . -iA libfoo</screen>
141− </para>
142− </listitem>
143− <listitem>
144− <para>
145− Optionally commit the new package and open a pull request <link
146− xlink:href="https://github.com/NixOS/nixpkgs/pulls">to nixpkgs</link>, or use <link
147− xlink:href="https://discourse.nixos.org/t/about-the-patches-category/477"> the Patches category</link> on Discourse for sending a patch without a GitHub account.
148− </para>
149− </listitem>
150− </orderedlist>
151− </para>
152−</chapter>
doc/contributing/reviewing-contributions.chapter.mdnew file+208
@@ -0,0 +1,208 @@
1+# Reviewing contributions {#chap-reviewing-contributions}
2+
3+::: {.warning}
4+The following section is a draft, and the policy for reviewing is still being discussed in issues such as [#11166](https://github.com/NixOS/nixpkgs/issues/11166) and [#20836](https://github.com/NixOS/nixpkgs/issues/20836).
5+:::
6+
7+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.
8+
9+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](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) and the [least recently](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc) updated pull requests. We highly encourage looking at [this list of ready to merge, unreviewed pull requests](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone).
10+
11+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.
12+
13+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.
14+
15+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.
16+
17+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.
18+
19+## Package updates {#reviewing-contributions-package-updates}
20+
21+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.
22+
23+It can happen that non-trivial updates include patches or more complex changes.
24+
25+Reviewing process:
26+
27+- Ensure that the package versioning fits the guidelines.
28+- Ensure that the commit text fits the guidelines.
29+- Ensure that the package maintainers are notified.
30+ - [CODEOWNERS](https://help.github.com/articles/about-codeowners) will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
31+- Ensure that the meta field information is correct.
32+ - License can change with version updates, so it should be checked to match the upstream license.
33+ - 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.
34+- Ensure that the code contains no typos.
35+- Building the package locally.
36+ - 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.
37+ - 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.
38+
39+ ```ShellSession
40+ $ git fetch origin nixos-unstable
41+ $ git fetch origin pull/PRNUMBER/head
42+ $ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD
43+ ```
44+
45+ - The first command fetches the nixos-unstable branch.
46+ - The second command fetches 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.
47+ - The third command rebases the pull request changes to the nixos-unstable branch.
48+ - The [nixpkgs-review](https://github.com/Mic92/nixpkgs-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.
49+
50+ ```ShellSession
51+ $ nix-shell -p nixpkgs-review --run "nixpkgs-review pr PRNUMBER"
52+ ```
53+- Running every binary.
54+
55+Sample template for a package update review is provided below.
56+
57+```markdown
58+##### Reviewed points
59+
60+- [ ] package name fits guidelines
61+- [ ] package version fits guidelines
62+- [ ] package build on ARCHITECTURE
63+- [ ] executables tested on ARCHITECTURE
64+- [ ] all depending packages build
65+
66+##### Possible improvements
67+
68+##### Comments
69+```
70+
71+## New packages {#reviewing-contributions-new-packages}
72+
73+New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package.
74+
75+Review process:
76+
77+- Ensure that the package versioning fits the guidelines.
78+- Ensure that the commit name fits the guidelines.
79+- Ensure that the meta fields contain correct information.
80+ - License must match the upstream license.
81+ - Platforms should be set (or the package will not get binary substitutes).
82+ - Maintainers must be set. This can be the package submitter or a community member that accepts taking up maintainership of the package.
83+- Report detected typos.
84+- Ensure the package source:
85+ - Uses mirror URLs when available.
86+ - Uses the most appropriate functions (e.g. packages from GitHub should use `fetchFromGitHub`).
87+- Building the package locally.
88+- Running every binary.
89+
90+Sample template for a new package review is provided below.
91+
92+```markdown
93+##### Reviewed points
94+
95+- [ ] package path fits guidelines
96+- [ ] package name fits guidelines
97+- [ ] package version fits guidelines
98+- [ ] package build on ARCHITECTURE
99+- [ ] executables tested on ARCHITECTURE
100+- [ ] `meta.description` is set and fits guidelines
101+- [ ] `meta.license` fits upstream license
102+- [ ] `meta.platforms` is set
103+- [ ] `meta.maintainers` is set
104+- [ ] build time only dependencies are declared in `nativeBuildInputs`
105+- [ ] source is fetched using the appropriate function
106+- [ ] the list of `phases` is not overridden
107+- [ ] when a phase (like `installPhase`) is overridden it starts with `runHook preInstall` and ends with `runHook postInstall`.
108+- [ ] patches that are remotely available are fetched with `fetchpatch`
109+
110+##### Possible improvements
111+
112+##### Comments
113+```
114+
115+## Module updates {#reviewing-contributions-module-updates}
116+
117+Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.
118+
119+Reviewing process:
120+
121+- Ensure that the module maintainers are notified.
122+ - [CODEOWNERS](https://help.github.com/articles/about-codeowners/) will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
123+- Ensure that the module tests, if any, are succeeding.
124+- Ensure that the introduced options are correct.
125+ - Type should be appropriate (string related types differs in their merging capabilities, `loaOf` and `string` types are deprecated).
126+ - Description, default and example should be provided.
127+- Ensure that option changes are backward compatible.
128+ - `mkRenamedOptionModuleWith` provides a way to make option changes backward compatible.
129+- Ensure that removed options are declared with `mkRemovedOptionModule`
130+- Ensure that changes that are not backward compatible are mentioned in release notes.
131+- Ensure that documentations affected by the change is updated.
132+
133+Sample template for a module update review is provided below.
134+
135+```markdown
136+##### Reviewed points
137+
138+- [ ] changes are backward compatible
139+- [ ] removed options are declared with `mkRemovedOptionModule`
140+- [ ] changes that are not backward compatible are documented in release notes
141+- [ ] module tests succeed on ARCHITECTURE
142+- [ ] options types are appropriate
143+- [ ] options description is set
144+- [ ] options example is provided
145+- [ ] documentation affected by the changes is updated
146+
147+##### Possible improvements
148+
149+##### Comments
150+```
151+
152+## New modules {#reviewing-contributions-new-modules}
153+
154+New modules submissions introduce a new module to NixOS.
155+
156+Reviewing process:
157+
158+- Ensure that the module tests, if any, are succeeding.
159+- Ensure that the introduced options are correct.
160+ - Type should be appropriate (string related types differs in their merging capabilities, `loaOf` and `string` types are deprecated).
161+ - Description, default and example should be provided.
162+- Ensure that module `meta` field is present
163+ - Maintainers should be declared in `meta.maintainers`.
164+ - Module documentation should be declared with `meta.doc`.
165+- Ensure that the module respect other modules functionality.
166+ - For example, enabling a module should not open firewall ports by default.
167+
168+Sample template for a new module review is provided below.
169+
170+```markdown
171+##### Reviewed points
172+
173+- [ ] module path fits the guidelines
174+- [ ] module tests succeed on ARCHITECTURE
175+- [ ] options have appropriate types
176+- [ ] options have default
177+- [ ] options have example
178+- [ ] options have descriptions
179+- [ ] No unneeded package is added to environment.systemPackages
180+- [ ] meta.maintainers is set
181+- [ ] module documentation is declared in meta.doc
182+
183+##### Possible improvements
184+
185+##### Comments
186+```
187+
188+## Other submissions {#reviewing-contributions-other-submissions}
189+
190+Other type of submissions requires different reviewing steps.
191+
192+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.
193+
194+Container system, boot system and library changes are some examples of the pull requests fitting this category.
195+
196+## Merging pull requests {#reviewing-contributions--merging-pull-requests}
197+
198+It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
199+
200+<!--
201+The following paragraphs about how to deal with unactive contributors is just a proposition and should be modified to what the community agrees to be the right policy.
202+
203+Please note that contributors with commit rights unactive for more than three months will have their commit rights revoked.
204+-->
205+
206+Please see the discussion in [GitHub nixpkgs issue #50105](https://github.com/NixOS/nixpkgs/issues/50105) for information on how to proceed to be granted this level of access.
207+
208+In a case a contributor definitively leaves the Nix community, they should create an issue or post on [Discourse](https://discourse.nixos.org) with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
doc/contributing/reviewing-contributions.xmldeleted−488
@@ -1,488 +0,0 @@
1−<chapter xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/XInclude"
4− version="5.0"
5− xml:id="chap-reviewing-contributions">
6− <title>Reviewing contributions</title>
7− <warning>
8− <para>
9− The following section is a draft, and the policy for reviewing is still being discussed in issues such as <link
10− xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 </link> and <link
11− xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 </link>.
12− </para>
13− </warning>
14− <para>
15− 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.
16− </para>
17− <para>
18− 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 <link
19− xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most recently</link> and the <link
20− xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc">least recently</link> updated pull requests. We highly encourage looking at <link xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone"> this list of ready to merge, unreviewed pull requests</link>.
21− </para>
22− <para>
23− 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.
24− </para>
25− <para>
26− 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.
27− </para>
28− <para>
29− 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.
30− </para>
31− <para>
32− 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.
33− </para>
34− <section xml:id="reviewing-contributions-package-updates">
35− <title>Package updates</title>
36−
37− <para>
38− 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.
39− </para>
40−
41− <para>
42− It can happen that non-trivial updates include patches or more complex changes.
43− </para>
44−
45− <para>
46− Reviewing process:
47− </para>
48−
49− <itemizedlist>
50− <listitem>
51− <para>
52− Ensure that the package versioning fits the guidelines.
53− </para>
54− </listitem>
55− <listitem>
56− <para>
57− Ensure that the commit text fits the guidelines.
58− </para>
59− </listitem>
60− <listitem>
61− <para>
62− Ensure that the package maintainers are notified.
63− </para>
64− <itemizedlist>
65− <listitem>
66− <para>
67− <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
68− </para>
69− </listitem>
70− </itemizedlist>
71− </listitem>
72− <listitem>
73− <para>
74− Ensure that the meta field information is correct.
75− </para>
76− <itemizedlist>
77− <listitem>
78− <para>
79− License can change with version updates, so it should be checked to match the upstream license.
80− </para>
81− </listitem>
82− <listitem>
83− <para>
84− 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.
85− </para>
86− </listitem>
87− </itemizedlist>
88− </listitem>
89− <listitem>
90− <para>
91− Ensure that the code contains no typos.
92− </para>
93− </listitem>
94− <listitem>
95− <para>
96− Building the package locally.
97− </para>
98− <itemizedlist>
99− <listitem>
100− <para>
101− 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.
102− </para>
103− <para>
104− 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.
105−<screen>
106−<prompt>$ </prompt>git fetch origin nixos-unstable <co xml:id='reviewing-rebase-2' />
107−<prompt>$ </prompt>git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
108−<prompt>$ </prompt>git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
109− xml:id='reviewing-rebase-4' />
110−</screen>
111− <calloutlist>
112− <callout arearefs='reviewing-rebase-2'>
113− <para>
114− Fetching the nixos-unstable branch.
115− </para>
116− </callout>
117− <callout arearefs='reviewing-rebase-3'>
118− <para>
119− Fetching the pull request changes, <varname>PRNUMBER</varname> is the number at the end of the pull request title and <varname>BASEBRANCH</varname> the base branch of the pull request.
120− </para>
121− </callout>
122− <callout arearefs='reviewing-rebase-4'>
123− <para>
124− Rebasing the pull request changes to the nixos-unstable branch.
125− </para>
126− </callout>
127− </calloutlist>
128− </para>
129− </listitem>
130− <listitem>
131− <para>
132− The <link xlink:href="https://github.com/Mic92/nixpkgs-review">nixpkgs-review</link> tool can be used to review a pull request content in a single command. <varname>PRNUMBER</varname> should be replaced by the number at the end of the pull request title. You can also provide the full github pull request url.
133− </para>
134−<screen>
135−<prompt>$ </prompt>nix-shell -p nixpkgs-review --run "nixpkgs-review pr PRNUMBER"
136−</screen>
137− </listitem>
138− </itemizedlist>
139− </listitem>
140− <listitem>
141− <para>
142− Running every binary.
143− </para>
144− </listitem>
145− </itemizedlist>
146−
147− <example xml:id="reviewing-contributions-sample-package-update">
148− <title>Sample template for a package update review</title>
149−<screen>
150−##### Reviewed points
151−
152−- [ ] package name fits guidelines
153−- [ ] package version fits guidelines
154−- [ ] package build on ARCHITECTURE
155−- [ ] executables tested on ARCHITECTURE
156−- [ ] all depending packages build
157−
158−##### Possible improvements
159−
160−##### Comments
161−
162−</screen>
163− </example>
164− </section>
165− <section xml:id="reviewing-contributions-new-packages">
166− <title>New packages</title>
167−
168− <para>
169− New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package.
170− </para>
171−
172− <para>
173− Reviewing process:
174− </para>
175−
176− <itemizedlist>
177− <listitem>
178− <para>
179− Ensure that the package versioning is fitting the guidelines.
180− </para>
181− </listitem>
182− <listitem>
183− <para>
184− Ensure that the commit name is fitting the guidelines.
185− </para>
186− </listitem>
187− <listitem>
188− <para>
189− Ensure that the meta field contains correct information.
190− </para>
191− <itemizedlist>
192− <listitem>
193− <para>
194− License must be checked to be fitting upstream license.
195− </para>
196− </listitem>
197− <listitem>
198− <para>
199− Platforms should be set or the package will not get binary substitutes.
200− </para>
201− </listitem>
202− <listitem>
203− <para>
204− A maintainer must be set. This can be the package submitter or a community member that accepts to take maintainership of the package.
205− </para>
206− </listitem>
207− </itemizedlist>
208− </listitem>
209− <listitem>
210− <para>
211− Ensure that the code contains no typos.
212− </para>
213− </listitem>
214− <listitem>
215− <para>
216− Ensure the package source.
217− </para>
218− <itemizedlist>
219− <listitem>
220− <para>
221− Mirrors urls should be used when available.
222− </para>
223− </listitem>
224− <listitem>
225− <para>
226− The most appropriate function should be used (e.g. packages from GitHub should use <literal>fetchFromGitHub</literal>).
227− </para>
228− </listitem>
229− </itemizedlist>
230− </listitem>
231− <listitem>
232− <para>
233− Building the package locally.
234− </para>
235− </listitem>
236− <listitem>
237− <para>
238− Running every binary.
239− </para>
240− </listitem>
241− </itemizedlist>
242−
243− <example xml:id="reviewing-contributions-sample-new-package">
244− <title>Sample template for a new package review</title>
245−<screen>
246−##### Reviewed points
247−
248−- [ ] package path fits guidelines
249−- [ ] package name fits guidelines
250−- [ ] package version fits guidelines
251−- [ ] package build on ARCHITECTURE
252−- [ ] executables tested on ARCHITECTURE
253−- [ ] `meta.description` is set and fits guidelines
254−- [ ] `meta.license` fits upstream license
255−- [ ] `meta.platforms` is set
256−- [ ] `meta.maintainers` is set
257−- [ ] build time only dependencies are declared in `nativeBuildInputs`
258−- [ ] source is fetched using the appropriate function
259−- [ ] phases are respected
260−- [ ] patches that are remotely available are fetched with `fetchpatch`
261−
262−##### Possible improvements
263−
264−##### Comments
265−
266−</screen>
267− </example>
268− </section>
269− <section xml:id="reviewing-contributions-module-updates">
270− <title>Module updates</title>
271−
272− <para>
273− Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.
274− </para>
275−
276− <para>
277− Reviewing process
278− </para>
279−
280− <itemizedlist>
281− <listitem>
282− <para>
283− Ensure that the module maintainers are notified.
284− </para>
285− <itemizedlist>
286− <listitem>
287− <para>
288− <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
289− </para>
290− </listitem>
291− </itemizedlist>
292− </listitem>
293− <listitem>
294− <para>
295− Ensure that the module tests, if any, are succeeding.
296− </para>
297− </listitem>
298− <listitem>
299− <para>
300− Ensure that the introduced options are correct.
301− </para>
302− <itemizedlist>
303− <listitem>
304− <para>
305− Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
306− </para>
307− </listitem>
308− <listitem>
309− <para>
310− Description, default and example should be provided.
311− </para>
312− </listitem>
313− </itemizedlist>
314− </listitem>
315− <listitem>
316− <para>
317− Ensure that option changes are backward compatible.
318− </para>
319− <itemizedlist>
320− <listitem>
321− <para>
322− <literal>mkRenamedOptionModule</literal> and <literal>mkAliasOptionModule</literal> functions provide way to make option changes backward compatible.
323− </para>
324− </listitem>
325− </itemizedlist>
326− </listitem>
327− <listitem>
328− <para>
329− Ensure that removed options are declared with <literal>mkRemovedOptionModule</literal>
330− </para>
331− </listitem>
332− <listitem>
333− <para>
334− Ensure that changes that are not backward compatible are mentioned in release notes.
335− </para>
336− </listitem>
337− <listitem>
338− <para>
339− Ensure that documentations affected by the change is updated.
340− </para>
341− </listitem>
342− </itemizedlist>
343−
344− <example xml:id="reviewing-contributions-sample-module-update">
345− <title>Sample template for a module update review</title>
346−<screen>
347−##### Reviewed points
348−
349−- [ ] changes are backward compatible
350−- [ ] removed options are declared with `mkRemovedOptionModule`
351−- [ ] changes that are not backward compatible are documented in release notes
352−- [ ] module tests succeed on ARCHITECTURE
353−- [ ] options types are appropriate
354−- [ ] options description is set
355−- [ ] options example is provided
356−- [ ] documentation affected by the changes is updated
357−
358−##### Possible improvements
359−
360−##### Comments
361−
362−</screen>
363− </example>
364− </section>
365− <section xml:id="reviewing-contributions-new-modules">
366− <title>New modules</title>
367−
368− <para>
369− New modules submissions introduce a new module to NixOS.
370− </para>
371−
372− <itemizedlist>
373− <listitem>
374− <para>
375− Ensure that the module tests, if any, are succeeding.
376− </para>
377− </listitem>
378− <listitem>
379− <para>
380− Ensure that the introduced options are correct.
381− </para>
382− <itemizedlist>
383− <listitem>
384− <para>
385− Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
386− </para>
387− </listitem>
388− <listitem>
389− <para>
390− Description, default and example should be provided.
391− </para>
392− </listitem>
393− </itemizedlist>
394− </listitem>
395− <listitem>
396− <para>
397− Ensure that module <literal>meta</literal> field is present
398− </para>
399− <itemizedlist>
400− <listitem>
401− <para>
402− Maintainers should be declared in <literal>meta.maintainers</literal>.
403− </para>
404− </listitem>
405− <listitem>
406− <para>
407− Module documentation should be declared with <literal>meta.doc</literal>.
408− </para>
409− </listitem>
410− </itemizedlist>
411− </listitem>
412− <listitem>
413− <para>
414− Ensure that the module respect other modules functionality.
415− </para>
416− <itemizedlist>
417− <listitem>
418− <para>
419− For example, enabling a module should not open firewall ports by default.
420− </para>
421− </listitem>
422− </itemizedlist>
423− </listitem>
424− </itemizedlist>
425−
426− <example xml:id="reviewing-contributions-sample-new-module">
427− <title>Sample template for a new module review</title>
428−<screen>
429−##### Reviewed points
430−
431−- [ ] module path fits the guidelines
432−- [ ] module tests succeed on ARCHITECTURE
433−- [ ] options have appropriate types
434−- [ ] options have default
435−- [ ] options have example
436−- [ ] options have descriptions
437−- [ ] No unneeded package is added to environment.systemPackages
438−- [ ] meta.maintainers is set
439−- [ ] module documentation is declared in meta.doc
440−
441−##### Possible improvements
442−
443−##### Comments
444−
445−</screen>
446− </example>
447− </section>
448− <section xml:id="reviewing-contributions-other-submissions">
449− <title>Other submissions</title>
450−
451− <para>
452− Other type of submissions requires different reviewing steps.
453− </para>
454−
455− <para>
456− 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.
457− </para>
458−
459− <para>
460− Container system, boot system and library changes are some examples of the pull requests fitting this category.
461− </para>
462− </section>
463− <section xml:id="reviewing-contributions--merging-pull-requests">
464− <title>Merging pull requests</title>
465−
466− <para>
467− It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
468− </para>
469−
470−<!--
471−The following paragraphs about how to deal with unactive contributors is just a
472−proposition and should be modified to what the community agrees to be the right
473−policy.
474−
475−<para>Please note that contributors with commit rights unactive for more than
476− three months will have their commit rights revoked.</para>
477−-->
478−
479− <para>
480− Please see the discussion in <link xlink:href="https://github.com/NixOS/nixpkgs/issues/50105">GitHub nixpkgs issue #50105</link> for information on how to proceed to be granted this level of access.
481− </para>
482−
483− <para>
484− In a case a contributor definitively leaves the Nix community, they should create an issue or post on <link
485− xlink:href="https://discourse.nixos.org">Discourse</link> with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
486− </para>
487− </section>
488−</chapter>
doc/contributing/submitting-changes.chapter.md+82−11
@@ -43,13 +43,13 @@
4343 - nixpkgs:
4444
4545 - update pkg
46− - `nix-env -i pkg-name -f <path to your local nixpkgs folder>`
46+ - `nix-env -iA pkg-attribute-name -f <path to your local nixpkgs folder>`
4747 - add pkg
4848 - Make sure it’s in `pkgs/top-level/all-packages.nix`
49− - `nix-env -i pkg-name -f <path to your local nixpkgs folder>`
49+ - `nix-env -iA pkg-attribute-name -f <path to your local nixpkgs folder>`
5050 - _If you don’t want to install pkg in you profile_.
51− - `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`.
52− - If you did `nix-env -i pkg-name` you can do `nix-env -e pkg-name` to uninstall it from your system.
51+ - `nix-build -A pkg-attribute-name <path to your local nixpkgs folder>` and check results in the folder `result`. It will appear in the same directory where you did `nix-build`.
52+ - If you installed your package with `nix-env`, you can run `nix-env -e pkg-name` where `pkg-name` is as reported by `nix-env -q` to uninstall it from your system.
5353
5454 - NixOS and its modules:
5555 - 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`.
@@ -62,7 +62,7 @@
6262
6363- Push your changes to your fork of nixpkgs.
6464- Create the pull request
65−- Follow [the contribution guidelines](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md#submitting-changes).
65+- Follow [the contribution guidelines](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#submitting-changes).
6666
6767## Submitting security fixes {#submitting-changes-submitting-security-fixes}
6868
@@ -71,6 +71,7 @@ Security fixes are submitted in the same way as other changes and thus the same
7171- If a new version fixing the vulnerability has been released, update the package;
7272- If the security fix comes in the form of a patch and a CVE is available, then add the patch to the Nixpkgs tree, and apply it to the package.
7373 The name of the patch should be the CVE identifier, so e.g. `CVE-2019-13636.patch`; If a patch is fetched the name needs to be set as well, e.g.:
74+
7475 ```nix
7576 (fetchpatch {
7677 name = "CVE-2019-11068.patch";
@@ -83,6 +84,53 @@ If a security fix applies to both master and a stable release then, similar to r
8384
8485Critical security fixes may by-pass the staging branches and be delivered directly to release branches such as `master` and `release-*`.
8586
87+## Deprecating/removing packages {#submitting-changes-deprecating-packages}
88+
89+There is currently no policy when to remove a package.
90+
91+Before removing a package, one should try to find a new maintainer or fix smaller issues first.
92+
93+### Steps to remove a package from Nixpkgs {#steps-to-remove-a-package-from-nixpkgs}
94+
95+We use jbidwatcher as an example for a discontinued project here.
96+
97+1. Have Nixpkgs checked out locally and up to date.
98+1. Create a new branch for your change, e.g. `git checkout -b jbidwatcher`
99+1. Remove the actual package including its directory, e.g. `git rm -rf pkgs/applications/misc/jbidwatcher`
100+1. Remove the package from the list of all packages (`pkgs/top-level/all-packages.nix`).
101+1. Add an alias for the package name in `pkgs/top-level/aliases.nix` (There is also `pkgs/applications/editors/vim/plugins/aliases.nix`. Package sets typically do not have aliases, so we can't add them there.)
102+
103+ For example in this case:
104+
105+ ```
106+ jbidwatcher = throw "jbidwatcher was discontinued in march 2021"; # added 2021-03-15
107+ ```
108+
109+ The throw message should explain in short why the package was removed for users that still have it installed.
110+
111+1. Test if the changes introduced any issues by running `nix-env -qaP -f . --show-trace`. It should show the list of packages without errors.
112+1. Commit the changes. Explain again why the package was removed. If it was declared discontinued upstream, add a link to the source.
113+
114+ ```ShellSession
115+ $ git add pkgs/applications/misc/jbidwatcher/default.nix pkgs/top-level/all-packages.nix pkgs/top-level/aliases.nix
116+ $ git commit
117+ ```
118+
119+ Example commit message:
120+
121+ ```
122+ jbidwatcher: remove
123+
124+ project was discontinued in march 2021. the program does not work anymore because ebay changed the login.
125+
126+ https://web.archive.org/web/20210315205723/http://www.jbidwatcher.com/
127+ ```
128+
129+1. Push changes to your GitHub fork with `git push`
130+1. Create a pull request against Nixpkgs. Mention the package maintainer.
131+
132+This is how the pull request looks like in this case: [https://github.com/NixOS/nixpkgs/pull/116470](https://github.com/NixOS/nixpkgs/pull/116470)
133+
86134## Pull Request Template {#submitting-changes-pull-request-template}
87135
88136The 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.
@@ -115,7 +163,7 @@ Many Nix packages are designed to run on multiple platforms. As such, it’s imp
115163
116164### Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests) {#submitting-changes-nixos-tests}
117165
118−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](https://nixos.org/nixos/manual/index.html#sec-nixos-tests).
166+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 can only be run on Linux. For more details on writing and running tests, see the [section in the NixOS manual](https://nixos.org/nixos/manual/index.html#sec-nixos-tests).
119167
120168### Tested compilation of all pkgs that depend on this change using `nixpkgs-review` {#submitting-changes-tested-compilation}
121169
@@ -145,7 +193,7 @@ It’s important to test any executables generated by a build when you change or
145193
146194### Meets Nixpkgs contribution standards {#submitting-changes-contribution-standards}
147195
148−The last checkbox is fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/.github/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.
196+The last checkbox is fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/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.
149197
150198## Hotfixing pull requests {#submitting-changes-hotfixing-pull-requests}
151199
@@ -179,7 +227,7 @@ digraph {
179227}
180228```
181229
182−[This GitHub Action](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/merge-staging.yml) brings changes from `master` to `staging-next` and from `staging-next` to `staging` every 6 hours.
230+[This GitHub Action](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/periodic-merge-6h.yml) brings changes from `master` to `staging-next` and from `staging-next` to `staging` every 6 hours.
183231
184232
185233### Master branch {#submitting-changes-master-branch}
@@ -192,15 +240,27 @@ The `staging` branch is a development branch where mass-rebuilds go. It should o
192240
193241### Staging-next branch {#submitting-changes-staging-next-branch}
194242
195−The `staging-next` branch is for stabilizing mass-rebuilds submitted to the `staging` branch prior to merging them into `master`. Mass-rebuilds should go via the `staging` branch. It should only see non-breaking commits that are fixing issues blocking it from being merged into the `master ` branch.
243+The `staging-next` branch is for stabilizing mass-rebuilds submitted to the `staging` branch prior to merging them into `master`. Mass-rebuilds must go via the `staging` branch. It must only see non-breaking commits that are fixing issues blocking it from being merged into the `master ` branch.
196244
197245If the branch is already in a broken state, please refrain from adding extra new breakages. Stabilize it for a few days and then merge into master.
198246
199247### Stable release branches {#submitting-changes-stable-release-branches}
200248
201−For cherry-picking a commit to a stable release branch (“backporting”), use `git cherry-pick -x <original commit>` so that the original commit id is included in the commit.
249+The same staging workflow applies to stable release branches, but the main branch is called `release-*` instead of `master`.
250+
251+Example branch names: `release-21.11`, `staging-21.11`, `staging-next-21.11`.
202252
203−Add a reason for the backport by using `git cherry-pick -xe <original commit>` instead when it is not obvious from the original commit message. It is not needed when it's a minor version update that includes security and bug fixes but don't add new features or when the commit fixes an otherwise broken package.
253+Most changes added to the stable release branches are cherry-picked (“backported”) from the `master` and staging branches.
254+
255+#### Automatically backporting a Pull Request {#submitting-changes-stable-release-branches-automatic-backports}
256+
257+Assign label `backport <branch>` (e.g. `backport release-21.11`) to the PR and a backport PR is automatically created after the PR is merged.
258+
259+#### Manually backporting changes {#submitting-changes-stable-release-branches-manual-backports}
260+
261+Cherry-pick changes via `git cherry-pick -x <original commit>` so that the original commit id is included in the commit message.
262+
263+Add a reason for the backport when it is not obvious from the original commit message. You can do this by cherry picking with `git cherry-pick -xe <original commit>`, which allows editing the commit message. This is not needed for minor version updates that include security and bug fixes but don't add new features or when the commit fixes an otherwise broken package.
204264
205265Here is an example of a cherry-picked commit message with good reason description:
206266
@@ -219,3 +279,14 @@ Other examples of reasons are:
219279- Previously the build would fail due to, e.g., `getaddrinfo` not being defined
220280- The previous download links were all broken
221281- Crash when starting on some X11 systems
282+
283+#### Acceptable backport criteria
284+
285+The stable branch does have some changes which cannot be backported. Most notable are breaking changes. The desire is to have stable users be uninterrupted when updating packages.
286+
287+However, many changes are able to be backported, including:
288+- New Packages / Modules
289+- Security / Patch updates
290+- Version updates which include new functionality (but no breaking changes)
291+- Services which require a client to be up-to-date regardless. (E.g. `spotify`, `steam`, or `discord`)
292+- Security critical applications (E.g. `firefox`)
doc/default.nix+3−4
@@ -17,10 +17,6 @@ in pkgs.stdenv.mkDerivation {
1717
1818 src = lib.cleanSource ./.;
1919
20− makeFlags = [
21− "PANDOC_LUA_FILTERS_DIR=${pkgs.pandoc-lua-filters}/share/pandoc/filters"
22− ];
23−
2420 postPatch = ''
2521 ln -s ${doc-support} ./doc-support/result
2622 '';
@@ -37,4 +33,7 @@ in pkgs.stdenv.mkDerivation {
3733 echo "doc manual $dest manual.html" >> $out/nix-support/hydra-build-products
3834 echo "doc manual $dest nixpkgs-manual.epub" >> $out/nix-support/hydra-build-products
3935 '';
36+
37+ # Environment variables
38+ PANDOC_LUA_FILTERS_DIR = "${pkgs.pandoc-lua-filters}/share/pandoc/filters";
4039}
doc/doc-support/lib-function-docs.nix+1
@@ -22,5 +22,6 @@ with pkgs; stdenv.mkDerivation {
2222 docgen lists 'List manipulation functions'
2323 docgen debug 'Debugging functions'
2424 docgen options 'NixOS / nixpkgs option handling'
25+ docgen sources 'Source filtering functions'
2526 '';
2627}
doc/functions.xml+4−4
@@ -7,8 +7,8 @@
77 The nixpkgs repository has several utility functions to manipulate Nix expressions.
88 </para>
99 <xi:include href="functions/library.xml" />
10− <xi:include href="functions/generators.xml" />
11− <xi:include href="functions/debug.xml" />
12− <xi:include href="functions/prefer-remote-fetch.xml" />
13− <xi:include href="functions/nix-gitignore.xml" />
10+ <xi:include href="functions/generators.section.xml" />
11+ <xi:include href="functions/debug.section.xml" />
12+ <xi:include href="functions/prefer-remote-fetch.section.xml" />
13+ <xi:include href="functions/nix-gitignore.section.xml" />
1414</chapter>
doc/functions/debug.section.mdnew file+5
@@ -0,0 +1,5 @@
1+# Debugging Nix Expressions {#sec-debug}
2+
3+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.
4+
5+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.
doc/functions/debug.xmldeleted−14
@@ -1,14 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/XInclude"
4− xml:id="sec-debug">
5− <title>Debugging Nix Expressions</title>
6−
7− <para>
8− 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.
9− </para>
10−
11− <para>
12− 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.
13− </para>
14−</section>
doc/functions/generators.section.mdnew file+56
@@ -0,0 +1,56 @@
1+# Generators {#sec-generators}
2+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`
3+
4+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.
5+
6+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:
7+
8+```nix
9+with lib;
10+let
11+ customToINI = generators.toINI {
12+ # specifies how to format a key/value pair
13+ mkKeyValue = generators.mkKeyValueDefault {
14+ # specifies the generated string for a subset of nix values
15+ mkValueString = v:
16+ if v == true then ''"yes"''
17+ else if v == false then ''"no"''
18+ else if isString v then ''"${v}"''
19+ # and delegats all other values to the default generator
20+ else generators.mkValueStringDefault {} v;
21+ } ":";
22+ };
23+
24+# the INI file can now be given as plain old nix values
25+in customToINI {
26+ main = {
27+ pushinfo = true;
28+ autopush = false;
29+ host = "localhost";
30+ port = 42;
31+ };
32+ mergetool = {
33+ merge = "diff3";
34+ };
35+}
36+```
37+
38+This will produce the following INI file as nix string:
39+
40+```INI
41+[main]
42+autopush:"no"
43+host:"localhost"
44+port:42
45+pushinfo:"yes"
46+str\:ange:"very::strange"
47+
48+[mergetool]
49+merge:"diff3"
50+```
51+
52+::: {.note}
53+Nix store paths can be converted to strings by enclosing a derivation attribute like so: `"${drv}"`.
54+:::
55+
56+Detailed documentation for each generator can be found in `lib/generators.nix`.
doc/functions/generators.xmldeleted−74
@@ -1,74 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/XInclude"
4− xml:id="sec-generators">
5− <title>Generators</title>
6−
7− <para>
8− Generators are functions that create file formats from nix data structures, e. g. for configuration files. There are generators available for: <literal>INI</literal>, <literal>JSON</literal> and <literal>YAML</literal>
9− </para>
10−
11− <para>
12− All generators follow a similar call interface: <code>generatorName configFunctions data</code>, where <literal>configFunctions</literal> 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 <code>mkSectionName ? (name: libStr.escape [ "[" "]" ] name)</code> from the <literal>INI</literal> generator. It receives the name of a section and sanitizes it. The default <literal>mkSectionName</literal> escapes <literal>[</literal> and <literal>]</literal> with a backslash.
13− </para>
14−
15− <para>
16− 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 <literal>: </literal> as separator, the strings <literal>"yes"</literal>/<literal>"no"</literal> as boolean values and requires all string values to be quoted:
17− </para>
18−
19−<programlisting>
20−with lib;
21−let
22− customToINI = generators.toINI {
23− # specifies how to format a key/value pair
24− mkKeyValue = generators.mkKeyValueDefault {
25− # specifies the generated string for a subset of nix values
26− mkValueString = v:
27− if v == true then ''"yes"''
28− else if v == false then ''"no"''
29− else if isString v then ''"${v}"''
30− # and delegats all other values to the default generator
31− else generators.mkValueStringDefault {} v;
32− } ":";
33− };
34−
35−# the INI file can now be given as plain old nix values
36−in customToINI {
37− main = {
38− pushinfo = true;
39− autopush = false;
40− host = "localhost";
41− port = 42;
42− };
43− mergetool = {
44− merge = "diff3";
45− };
46−}
47−</programlisting>
48−
49− <para>
50− This will produce the following INI file as nix string:
51− </para>
52−
53−<programlisting>
54−[main]
55−autopush:"no"
56−host:"localhost"
57−port:42
58−pushinfo:"yes"
59−str\:ange:"very::strange"
60−
61−[mergetool]
62−merge:"diff3"
63−</programlisting>
64−
65− <note>
66− <para>
67− Nix store paths can be converted to strings by enclosing a derivation attribute like so: <code>"${drv}"</code>.
68− </para>
69− </note>
70−
71− <para>
72− Detailed documentation for each generator can be found in <literal>lib/generators.nix</literal>.
73− </para>
74−</section>
doc/functions/library.xml+2
@@ -25,4 +25,6 @@
2525 <xi:include href="./library/generated/debug.xml" />
2626
2727 <xi:include href="./library/generated/options.xml" />
28+
29+ <xi:include href="./library/generated/sources.xml" />
2830</section>
doc/functions/library/attrsets.xml+3−3
@@ -772,7 +772,7 @@ nameValuePair "some" 6
772772 <title>Modifying each value of an attribute set</title>
773773<programlisting><![CDATA[
774774lib.attrsets.mapAttrs
775− (name: value: name + "-" value)
775+ (name: value: name + "-" + value)
776776 { x = "foo"; y = "bar"; }
777777=> { x = "x-foo"; y = "y-bar"; }
778778]]></programlisting>
@@ -855,7 +855,7 @@ lib.attrsets.mapAttrs' (name: value: lib.attrsets.nameValuePair ("foo_" + name)
855855 <title><function>lib.attrsets.mapAttrsToList</function></title>
856856
857857 <subtitle><literal>mapAttrsToList :: (String -> Any -> Any) ->
858− AttrSet -> Any</literal>
858+ AttrSet -> [Any]</literal>
859859 </subtitle>
860860
861861 <xi:include href="./locations.xml" xpointer="lib.attrsets.mapAttrsToList" />
@@ -1474,7 +1474,7 @@ lib.attrsets.zipAttrsWith
14741474 <section xml:id="function-library-lib.attrsets.zipAttrs">
14751475 <title><function>lib.attrsets.zipAttrs</function></title>
14761476
1477− <subtitle><literal>zipAttrsWith :: [ AttrSet ] -> AttrSet</literal>
1477+ <subtitle><literal>zipAttrs :: [ AttrSet ] -> AttrSet</literal>
14781478 </subtitle>
14791479
14801480 <xi:include href="./locations.xml" xpointer="lib.attrsets.zipAttrs" />
doc/functions/nix-gitignore.section.mdnew file+49
@@ -0,0 +1,49 @@
1+# pkgs.nix-gitignore {#sec-pkgs-nix-gitignore}
2+
3+`pkgs.nix-gitignore` is a function that acts similarly to `builtins.filterSource` but also allows filtering with the help of the gitignore format.
4+
5+## Usage {#sec-pkgs-nix-gitignore-usage}
6+
7+`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.
8+
9+```nix
10+{ pkgs ? import <nixpkgs> {} }:
11+
12+ nix-gitignore.gitignoreSource [] ./source
13+ # Simplest version
14+
15+ nix-gitignore.gitignoreSource "supplemental-ignores\n" ./source
16+ # This one reads the ./source/.gitignore and concats the auxiliary ignores
17+
18+ nix-gitignore.gitignoreSourcePure "ignore-this\nignore-that\n" ./source
19+ # Use this string as gitignore, don't read ./source/.gitignore.
20+
21+ nix-gitignore.gitignoreSourcePure ["ignore-this\nignore-that\n", ~/.gitignore] ./source
22+ # It also accepts a list (of strings and paths) that will be concatenated
23+ # once the paths are turned to strings via readFile.
24+```
25+
26+These functions are derived from the `Filter` functions by setting the first filter argument to `(_: _: true)`:
27+
28+```nix
29+gitignoreSourcePure = gitignoreFilterSourcePure (_: _: true);
30+gitignoreSource = gitignoreFilterSource (_: _: true);
31+```
32+
33+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.
34+
35+If you want to make your own filter from scratch, you may use
36+
37+```nix
38+gitignoreFilter = ign: root: filterPattern (gitignoreToPatterns ign) root;
39+```
40+
41+## gitignore files in subdirectories {#sec-pkgs-nix-gitignore-usage-recursive}
42+
43+If you wish to use a filter that would search for .gitignore files in subdirectories, just like git does by default, use this function:
44+
45+```nix
46+gitignoreFilterRecursiveSource = filter: patterns: root:
47+# OR
48+gitignoreRecursiveSource = gitignoreFilterSourcePure (_: _: true);
49+```
doc/functions/nix-gitignore.xmldeleted−70
@@ -1,70 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/XInclude"
4− xml:id="sec-pkgs-nix-gitignore">
5− <title>pkgs.nix-gitignore</title>
6−
7− <para>
8− <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.
9− </para>
10−
11− <section xml:id="sec-pkgs-nix-gitignore-usage">
12− <title>Usage</title>
13−
14− <para>
15− <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.
16− </para>
17−
18−<programlisting><![CDATA[
19−{ pkgs ? import <nixpkgs> {} }:
20−
21− nix-gitignore.gitignoreSource [] ./source
22− # Simplest version
23−
24− nix-gitignore.gitignoreSource "supplemental-ignores\n" ./source
25− # This one reads the ./source/.gitignore and concats the auxiliary ignores
26−
27− nix-gitignore.gitignoreSourcePure "ignore-this\nignore-that\n" ./source
28− # Use this string as gitignore, don't read ./source/.gitignore.
29−
30− nix-gitignore.gitignoreSourcePure ["ignore-this\nignore-that\n", ~/.gitignore] ./source
31− # It also accepts a list (of strings and paths) that will be concatenated
32− # once the paths are turned to strings via readFile.
33− ]]></programlisting>
34−
35− <para>
36− These functions are derived from the <literal>Filter</literal> functions by setting the first filter argument to <literal>(_: _: true)</literal>:
37− </para>
38−
39−<programlisting><![CDATA[
40−gitignoreSourcePure = gitignoreFilterSourcePure (_: _: true);
41−gitignoreSource = gitignoreFilterSource (_: _: true);
42− ]]></programlisting>
43−
44− <para>
45− 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.
46− </para>
47−
48− <para>
49− If you want to make your own filter from scratch, you may use
50− </para>
51−
52−<programlisting><![CDATA[
53−gitignoreFilter = ign: root: filterPattern (gitignoreToPatterns ign) root;
54− ]]></programlisting>
55− </section>
56−
57− <section xml:id="sec-pkgs-nix-gitignore-usage-recursive">
58− <title>gitignore files in subdirectories</title>
59−
60− <para>
61− If you wish to use a filter that would search for .gitignore files in subdirectories, just like git does by default, use this function:
62− </para>
63−
64−<programlisting><![CDATA[
65−gitignoreFilterRecursiveSource = filter: patterns: root:
66−# OR
67−gitignoreRecursiveSource = gitignoreFilterSourcePure (_: _: true);
68− ]]></programlisting>
69− </section>
70−</section>
doc/functions/prefer-remote-fetch.section.mdnew file+17
@@ -0,0 +1,17 @@
1+# prefer-remote-fetch overlay {#sec-prefer-remote-fetch}
2+
3+`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:
4+
5+```nix
6+self: super:
7+ (super.prefer-remote-fetch self super)
8+```
9+
10+A full configuration example for that sets the overlay up for your own account, could look like this
11+
12+```ShellSession
13+$ mkdir ~/.config/nixpkgs/overlays/
14+$ cat > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix <<EOF
15+ self: super: super.prefer-remote-fetch self super
16+EOF
17+```
doc/functions/prefer-remote-fetch.xmldeleted−21
@@ -1,21 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/xinclude"
4− xml:id="sec-prefer-remote-fetch">
5− <title>prefer-remote-fetch overlay</title>
6−
7− <para>
8− <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:
9−<programlisting>
10−self: super:
11− (super.prefer-remote-fetch self super)
12−</programlisting>
13− A full configuration example for that sets the overlay up for your own account, could look like this
14−<screen>
15−<prompt>$ </prompt>mkdir ~/.config/nixpkgs/overlays/
16−<prompt>$ </prompt>cat > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix <<EOF
17− self: super: super.prefer-remote-fetch self super
18−EOF
19−</screen>
20− </para>
21−</section>
doc/hooks/index.xmlnew file+10
@@ -0,0 +1,10 @@
1+<chapter xmlns="http://docbook.org/ns/docbook"
2+ xmlns:xlink="http://www.w3.org/1999/xlink"
3+ xmlns:xi="http://www.w3.org/2001/XInclude"
4+ xml:id="chap-hooks">
5+ <title>Hooks reference</title>
6+ <para>
7+ Nixpkgs has several hook packages that augment the stdenv phases.
8+ </para>
9+ <xi:include href="./postgresql-test-hook.section.xml" />
10+</chapter>
doc/hooks/postgresql-test-hook.section.mdnew file+59
@@ -0,0 +1,59 @@
1+
2+# `postgresqlTestHook` {#sec-postgresqlTestHook}
3+
4+This hook starts a PostgreSQL server during the `checkPhase`. Example:
5+
6+```nix
7+{ stdenv, postgresql, postgresqlTestHook }:
8+stdenv.mkDerivation {
9+
10+ # ...
11+
12+ checkInputs = [
13+ postgresql
14+ postgresqlTestHook
15+ ];
16+}
17+```
18+
19+If you use a custom `checkPhase`, remember to add the `runHook` calls:
20+```nix
21+ checkPhase ''
22+ runHook preCheck
23+
24+ # ... your tests
25+
26+ runHook postCheck
27+ ''
28+```
29+
30+## Variables {#sec-postgresqlTestHook-variables}
31+
32+The hook logic will read a number of variables and set them to a default value if unset or empty.
33+
34+Exported variables:
35+
36+ - `PGDATA`: location of server files.
37+ - `PGHOST`: location of UNIX domain socket directory; the default `host` in a connection string.
38+ - `PGUSER`: user to create / log in with, default: `test_user`.
39+ - `PGDATABASE`: database name, default: `test_db`.
40+
41+Bash-only variables:
42+
43+ - `postgresqlTestUserOptions`: SQL options to use when creating the `$PGUSER` role, default: `LOGIN`.
44+ - `postgresqlTestSetupSQL`: SQL commands to run as database administrator after startup, default: statements that create `$PGUSER` and `$PGDATABASE`.
45+ - `postgresqlTestSetupCommands`: bash commands to run after database start, defaults to running `$postgresqlTestSetupSQL` as database administrator.
46+ - `postgresqlEnableTCP`: set to `1` to enable TCP listening. Flaky; not recommended.
47+ - `postgresqlStartCommands`: defaults to `pg_ctl start`.
48+
49+## TCP and the Nix sandbox {#sec-postgresqlTestHook-tcp}
50+
51+`postgresqlEnableTCP` relies on network sandboxing, which is not available on macOS and some custom Nix installations, resulting in flaky tests.
52+For this reason, it is disabled by default.
53+
54+The preferred solution is to make the test suite use a UNIX domain socket connection. This is the default behavior when no `host` connection parameter is provided.
55+Some test suites hardcode a value for `host` though, so a patch may be required. If you can upstream the patch, you can make `host` default to the `PGHOST` environment variable when set. Otherwise, you can patch it locally to omit the `host` connection string parameter altogether.
56+
57+::: {.note}
58+The error `libpq: failed (could not receive data from server: Connection refused` is generally an indication that the test suite is trying to connect through TCP.
59+:::
doc/languages-frameworks/agda.section.md+177−27
@@ -1,62 +1,126 @@
11# Agda {#agda}
22
3−## How to use Agda
3+## How to use Agda {#how-to-use-agda}
44
5−Agda can be installed from `agda`:
6−```
7−$ nix-env -iA agda
8−```
5+Agda is available as the [agda](https://search.nixos.org/packages?channel=unstable&show=agda&from=0&size=30&sort=relevance&query=agda)
6+package.
97
10−To use Agda with libraries, the `agda.withPackages` function can be used. This function either takes:
8+The `agda` package installs an Agda-wrapper, which calls `agda` with `--library-file`
9+set to a generated library-file within the nix store, this means your library-file in
10+`$HOME/.agda/libraries` will be ignored. By default the agda package installs Agda
11+with no libraries, i.e. the generated library-file is empty. To use Agda with libraries,
12+the `agda.withPackages` function can be used. This function either takes:
1113
1214* A list of packages,
1315* or a function which returns a list of packages when given the `agdaPackages` attribute set,
1416* or an attribute set containing a list of packages and a GHC derivation for compilation (see below).
17+* or an attribute set containing a function which returns a list of packages when given the `agdaPackages` attribute set and a GHC derivation for compilation (see below).
1518
1619For example, suppose we wanted a version of Agda which has access to the standard library. This can be obtained with the expressions:
1720
18−```
21+```nix
1922agda.withPackages [ agdaPackages.standard-library ]
2023```
2124
2225or
2326
24−```
27+```nix
2528agda.withPackages (p: [ p.standard-library ])
2629```
2730
2831or can be called as in the [Compiling Agda](#compiling-agda) section.
2932
30−If you want to use a library in your home directory (for instance if it is a development version) then typecheck it manually (using `agda.withPackages` if necessary) and then override the `src` attribute of the package to point to your local repository.
33+If you want to use a different version of a library (for instance a development version)
34+override the `src` attribute of the package to point to your local repository
3135
32−Agda will not by default use these libraries. To tell Agda to use the library we have some options:
33−
34−* Call `agda` with the library flag:
36+```nix
37+agda.withPackages (p: [
38+ (p.standard-library.overrideAttrs (oldAttrs: {
39+ version = "local version";
40+ src = /path/to/local/repo/agda-stdlib;
41+ }))
42+])
3543```
36−$ agda -l standard-library -i . MyFile.agda
44+
45+You can also reference a GitHub repository
46+
47+```nix
48+agda.withPackages (p: [
49+ (p.standard-library.overrideAttrs (oldAttrs: {
50+ version = "1.5";
51+ src = fetchFromGitHub {
52+ repo = "agda-stdlib";
53+ owner = "agda";
54+ rev = "v1.5";
55+ sha256 = "16fcb7ssj6kj687a042afaa2gq48rc8abihpm14k684ncihb2k4w";
56+ };
57+ }))
58+])
3759```
38−* Write a `my-library.agda-lib` file for the project you are working on which may look like:
60+
61+If you want to use a library not added to Nixpkgs, you can add a
62+dependency to a local library by calling `agdaPackages.mkDerivation`.
63+
64+```nix
65+agda.withPackages (p: [
66+ (p.mkDerivation {
67+ pname = "your-agda-lib";
68+ version = "1.0.0";
69+ src = /path/to/your-agda-lib;
70+ })
71+])
3972```
40−name: my-library
41−include: .
42−depend: standard-library
73+
74+Again you can reference GitHub
75+
76+```nix
77+agda.withPackages (p: [
78+ (p.mkDerivation {
79+ pname = "your-agda-lib";
80+ version = "1.0.0";
81+ src = fetchFromGitHub {
82+ repo = "repo";
83+ owner = "owner";
84+ version = "...";
85+ rev = "...";
86+ sha256 = "...";
87+ };
88+ })
89+])
4390```
91+
92+See [Building Agda Packages](#building-agda-packages) for more information on `mkDerivation`.
93+
94+Agda will not by default use these libraries. To tell Agda to use a library we have some options:
95+
96+* Call `agda` with the library flag:
97+ ```ShellSession
98+ $ agda -l standard-library -i . MyFile.agda
99+ ```
100+* Write a `my-library.agda-lib` file for the project you are working on which may look like:
101+ ```
102+ name: my-library
103+ include: .
104+ depend: standard-library
105+ ```
44106* Create the file `~/.agda/defaults` and add any libraries you want to use by default.
45107
46108More information can be found in the [official Agda documentation on library management](https://agda.readthedocs.io/en/v2.6.1/tools/package-system.html).
47109
48−## Compiling Agda
49−Agda modules can be compiled with the `--compile` flag. A version of `ghc` with `ieee754` is made available to the Agda program via the `--with-compiler` flag.
110+## Compiling Agda {#compiling-agda}
111+
112+Agda modules can be compiled using the GHC backend with the `--compile` flag. A version of `ghc` with `ieee754` is made available to the Agda program via the `--with-compiler` flag.
50113This can be overridden by a different version of `ghc` as follows:
51114
52−```
115+```nix
53116agda.withPackages {
54117 pkgs = [ ... ];
55118 ghc = haskell.compiler.ghcHEAD;
56119}
57120```
58121
59−## Writing Agda packages
122+## Writing Agda packages {#writing-agda-packages}
123+
60124To write a nix derivation for an Agda library, first check that the library has a `*.agda-lib` file.
61125
62126A derivation can then be written using `agdaPackages.mkDerivation`. This has similar arguments to `stdenv.mkDerivation` with the following additions:
@@ -65,27 +129,66 @@ A derivation can then be written using `agdaPackages.mkDerivation`. This has sim
65129* `libraryName` should be the name that appears in the `*.agda-lib` file, defaulting to `pname`.
66130* `libraryFile` should be the file name of the `*.agda-lib` file, defaulting to `${libraryName}.agda-lib`.
67131
68−### Building Agda packages
132+Here is an example `default.nix`
133+
134+```nix
135+{ nixpkgs ? <nixpkgs> }:
136+with (import nixpkgs {});
137+agdaPackages.mkDerivation {
138+ version = "1.0";
139+ pname = "my-agda-lib";
140+ src = ./.;
141+ buildInputs = [
142+ agdaPackages.standard-library
143+ ];
144+}
145+```
146+
147+### Building Agda packages {#building-agda-packages}
148+
69149The default build phase for `agdaPackages.mkDerivation` simply runs `agda` on the `Everything.agda` file.
70150If something else is needed to build the package (e.g. `make`) then the `buildPhase` should be overridden.
71151Additionally, a `preBuild` or `configurePhase` can be used if there are steps that need to be done prior to checking the `Everything.agda` file.
72152`agda` and the Agda libraries contained in `buildInputs` are made available during the build phase.
73153
74−### Installing Agda packages
154+### Installing Agda packages {#installing-agda-packages}
155+
75156The default install phase copies Agda source files, Agda interface files (`*.agdai`) and `*.agda-lib` files to the output directory.
76157This can be overridden.
77158
78159By default, Agda sources are files ending on `.agda`, or literate Agda files ending on `.lagda`, `.lagda.tex`, `.lagda.org`, `.lagda.md`, `.lagda.rst`. The list of recognised Agda source extensions can be extended by setting the `extraExtensions` config variable.
79160
80−## Adding Agda packages to Nixpkgs
161+## Maintaining the Agda package set on Nixpkgs {#maintaining-the-agda-package-set-on-nixpkgs}
162+
163+We are aiming at providing all common Agda libraries as packages on `nixpkgs`,
164+and keeping them up to date.
165+Contributions and maintenance help is always appreciated,
166+but the maintenance effort is typically low since the Agda ecosystem is quite small.
167+
168+The `nixpkgs` Agda package set tries to take up a role similar to that of [Stackage](https://www.stackage.org/) in the Haskell world.
169+It is a curated set of libraries that:
170+
171+1. Always work together.
172+2. Are as up-to-date as possible.
173+
174+While the Haskell ecosystem is huge, and Stackage is highly automatised,
175+the Agda package set is small and can (still) be maintained by hand.
176+
177+### Adding Agda packages to Nixpkgs {#adding-agda-packages-to-nixpkgs}
81178
82179To add an Agda package to `nixpkgs`, the derivation should be written to `pkgs/development/libraries/agda/${library-name}/` and an entry should be added to `pkgs/top-level/agda-packages.nix`. Here it is called in a scope with access to all other Agda libraries, so the top line of the `default.nix` can look like:
83−```
180+
181+```nix
84182{ mkDerivation, standard-library, fetchFromGitHub }:
85183```
86−and `mkDerivation` should be called instead of `agdaPackages.mkDerivation`. Here is an example skeleton derivation for iowa-stdlib:
87184
88−```
185+Note that the derivation function is called with `mkDerivation` set to `agdaPackages.mkDerivation`, therefore you
186+could use a similar set as in your `default.nix` from [Writing Agda Packages](#writing-agda-packages) with
187+`agdaPackages.mkDerivation` replaced with `mkDerivation`.
188+
189+Here is an example skeleton derivation for iowa-stdlib:
190+
191+```nix
89192mkDerivation {
90193 version = "1.5.0";
91194 pname = "iowa-stdlib";
@@ -101,6 +204,53 @@ mkDerivation {
101204 '';
102205}
103206```
207+
104208This library has a file called `.agda-lib`, and so we give an empty string to `libraryFile` as nothing precedes `.agda-lib` in the filename. This file contains `name: IAL-1.3`, and so we let `libraryName = "IAL-1.3"`. This library does not use an `Everything.agda` file and instead has a Makefile, so there is no need to set `everythingFile` and we set a custom `buildPhase`.
105209
106210When writing an Agda package it is essential to make sure that no `.agda-lib` file gets added to the store as a single file (for example by using `writeText`). This causes Agda to think that the nix store is a Agda library and it will attempt to write to it whenever it typechecks something. See [https://github.com/agda/agda/issues/4613](https://github.com/agda/agda/issues/4613).
211+
212+In the pull request adding this library,
213+you can test whether it builds correctly by writing in a comment:
214+
215+```
216+@ofborg build agdaPackages.iowa-stdlib
217+```
218+
219+### Maintaining Agda packages
220+
221+As mentioned before, the aim is to have a compatible, and up-to-date package set.
222+These two conditions sometimes exclude each other:
223+For example, if we update `agdaPackages.standard-library` because there was an upstream release,
224+this will typically break many reverse dependencies,
225+i.e. downstream Agda libraries that depend on the standard library.
226+In `nixpkgs` we are typically among the first to notice this,
227+since we have build tests in place to check this.
228+
229+In a pull request updating e.g. the standard library, you should write the following comment:
230+
231+```
232+@ofborg build agdaPackages.standard-library.passthru.tests
233+```
234+
235+This will build all reverse dependencies of the standard library,
236+for example `agdaPackages.agda-categories`, or `agdaPackages.generic`.
237+
238+In some cases it is useful to build _all_ Agda packages.
239+This can be done with the following Github comment:
240+
241+```
242+@ofborg build agda.passthru.tests.allPackages
243+```
244+
245+Sometimes, the builds of the reverse dependencies fail because they have not yet been updated and released.
246+You should drop the maintainers a quick issue notifying them of the breakage,
247+citing the build error (which you can get from the ofborg logs).
248+If you are motivated, you might even send a pull request that fixes it.
249+Usually, the maintainers will answer within a week or two with a new release.
250+Bumping the version of that reverse dependency should be a further commit on your PR.
251+
252+In the rare case that a new release is not to be expected within an acceptable time,
253+simply mark the broken package as broken by setting `meta.broken = true;`.
254+This will exclude it from the build test.
255+It can be added later when it is fixed,
256+and does not hinder the advancement of the whole package set in the meantime.
doc/languages-frameworks/android.section.md+23−18
@@ -3,8 +3,8 @@
33The Android build environment provides three major features and a number of
44supporting features.
55
6−Deploying an Android SDK installation with plugins
7−--------------------------------------------------
6+## Deploying an Android SDK installation with plugins {#deploying-an-android-sdk-installation-with-plugins}
7+
88The first use case is deploying the SDK with a desired set of plugins or subsets
99of an SDK.
1010
@@ -25,7 +25,7 @@ let
2525 abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
2626 cmakeVersions = [ "3.10.2" ];
2727 includeNDK = true;
28− ndkVersion = "22.0.7026061";
28+ ndkVersions = ["22.0.7026061"];
2929 useGoogleAPIs = false;
3030 useGoogleTVAddOns = false;
3131 includeExtras = [
@@ -52,7 +52,11 @@ The following parameters are supported:
5252* `cmakeVersions` specifies which CMake versions should be deployed.
5353* `includeNDK` specifies that the Android NDK bundle should be included.
5454 Defaults to: `false`.
55−* `ndkVersion` specifies the NDK version that we want to use.
55+* `ndkVersions` specifies the NDK versions that we want to use. These are linked
56+ under the `ndk` directory of the SDK root, and the first is linked under the
57+ `ndk-bundle` directory.
58+* `ndkVersion` is equivalent to specifying one entry in `ndkVersions`, and
59+ `ndkVersions` overrides this parameter if provided.
5660* `includeExtras` is an array of identifier strings referring to arbitrary
5761 add-on packages that should be installed.
5862* `platformVersions` specifies which platform SDK versions should be included.
@@ -132,8 +136,8 @@ in
132136androidComposition.platform-tools
133137```
134138
135−Using predefined Android package compositions
136−---------------------------------------------
139+## Using predefined Android package compositions {#using-predefined-android-package-compositions}
140+
137141In addition to composing an Android package set manually, it is also possible
138142to use a predefined composition that contains all basic packages for a specific
139143Android version, such as version 9.0 (API-level 28).
@@ -155,12 +159,13 @@ with import <nixpkgs> {};
155159androidenv.androidPkgs_9_0.platform-tools
156160```
157161
158−Building an Android application
159−-------------------------------
162+## Building an Android application {#building-an-android-application}
163+
160164In addition to the SDK, it is also possible to build an Ant-based Android
161165project and automatically deploy all the Android plugins that a project
162166requires.
163167
168+
164169```nix
165170with import <nixpkgs> {};
166171
@@ -195,8 +200,8 @@ to build Android apps. An Android APK gets exposed as a build product and can be
195200installed on any Android device with a web browser by navigating to the build
196201result page.
197202
198−Spawning emulator instances
199−---------------------------
203+## Spawning emulator instances {#spawning-emulator-instances}
204+
200205For testing purposes, it can also be quite convenient to automatically generate
201206scripts that spawn emulator instances with all desired configuration settings.
202207
@@ -237,8 +242,8 @@ androidenv.emulateApp {
237242In addition to prebuilt APKs, you can also bind the APK parameter to a
238243`buildApp {}` function invocation shown in the previous example.
239244
240−Notes on environment variables in Android projects
241−--------------------------------------------------
245+## Notes on environment variables in Android projects {#notes-on-environment-variables-in-android-projects}
246+
242247* `ANDROID_SDK_ROOT` should point to the Android SDK. In your Nix expressions, this should be
243248 `${androidComposition.androidsdk}/libexec/android-sdk`. Note that `ANDROID_HOME` is deprecated,
244249 but if you rely on tools that need it, you can export it too.
@@ -296,8 +301,8 @@ This shell.nix includes a shell hook that overwrites local.properties with the c
296301sdk.dir and ndk.dir values. This will ensure that the SDK and NDK directories will
297302both be correct when you run Android Studio inside nix-shell.
298303
299−Notes on improving build.gradle compatibility
300−---------------------------------------------
304+## Notes on improving build.gradle compatibility {#notes-on-improving-build.gradle-compatibility}
305+
301306Ensure that your buildToolsVersion and ndkVersion match what is declared in androidenv.
302307If you are using cmake, make sure its declared version is correct too.
303308
@@ -317,8 +322,8 @@ android {
317322
318323```
319324
320−Querying the available versions of each plugin
321−----------------------------------------------
325+## Querying the available versions of each plugin {#querying-the-available-versions-of-each-plugin}
326+
322327repo.json provides all the options in one file now.
323328
324329A shell script in the `pkgs/development/mobile/androidenv/` subdirectory can be used to retrieve all
@@ -330,8 +335,8 @@ possible options:
330335
331336The above command-line instruction queries all package versions in repo.json.
332337
333−Updating the generated expressions
334−----------------------------------
338+## Updating the generated expressions {#updating-the-generated-expressions}
339+
335340repo.json is generated from XML files that the Android Studio package manager uses.
336341To update the expressions run the `generate.sh` script that is stored in the
337342`pkgs/development/mobile/androidenv/` subdirectory:
doc/languages-frameworks/beam.section.md+303−14
@@ -2,15 +2,21 @@
22
33## Introduction {#beam-introduction}
44
5−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.
5+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.
6+
7+## Available versions and deprecations schedule {#available-versions-and-deprecations-schedule}
8+
9+### Elixir {#elixir}
10+
11+nixpkgs follows the [official elixir deprecation schedule](https://hexdocs.pm/elixir/compatibility-and-deprecations.html) and keeps the last 5 released versions of Elixir available.
612
713## Structure {#beam-structure}
814
915All BEAM-related expressions are available via the top-level `beam` attribute, which includes:
1016
11− - `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`).
17+- `interpreters`: a set of compilers running on the BEAM, including multiple Erlang/OTP versions (`beam.interpreters.erlangR22`, etc), Elixir (`beam.interpreters.elixir`) and LFE (Lisp Flavoured Erlang) (`beam.interpreters.lfe`).
1218
13− - `packages`: a set of package builders (Mix and rebar3), each compiled with a specific Erlang/OTP version, e.g. `beam.packages.erlangR19`.
19+- `packages`: a set of package builders (Mix and rebar3), each compiled with a specific Erlang/OTP version, e.g. `beam.packages.erlang22`.
1420
1521The 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`.
1622
@@ -24,9 +30,17 @@ Many Erlang/OTP distributions available in `beam.interpreters` have versions wit
2430
2531We provide a version of Rebar3, under `rebar3`. We also provide a helper to fetch Rebar3 dependencies from a lockfile under `fetchRebar3Deps`.
2632
33+We also provide a version on Rebar3 with plugins included, under `rebar3WithPlugins`. This package is a function which takes two arguments: `plugins`, a list of nix derivations to include as plugins (loaded only when specified in `rebar.config`), and `globalPlugins`, which should always be loaded by rebar3. Example: `rebar3WithPlugins { globalPlugins = [beamPackages.pc]; }`.
34+
35+When adding a new plugin it is important that the `packageName` attribute is the same as the atom used by rebar3 to refer to the plugin.
36+
2737### Mix & Erlang.mk {#build-tools-other}
2838
29−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.
39+Erlang.mk works exactly as expected. There is a bootstrap process that needs to be run, which is supported by the `buildErlangMk` derivation.
40+
41+For Elixir applications use `mixRelease` to make a release. See examples for more details.
42+
43+There is also a `buildMix` helper, whose behavior is closer to that of `buildErlangMk` and `buildRebar3`. The primary difference is that mixRelease makes a release, while buildMix only builds the package, making it useful for libraries and other dependencies.
3044
3145## How to Install BEAM Packages {#how-to-install-beam-packages}
3246
@@ -52,33 +66,308 @@ Erlang.mk functions similarly to Rebar3, except we use `buildErlangMk` instead o
5266
5367#### Mix Packages {#mix-packages}
5468
55−Mix functions similarly to Rebar3, except we use `buildMix` instead of `buildRebar3`.
69+`mixRelease` is used to make a release in the mix sense. Dependencies will need to be fetched with `fetchMixDeps` and passed to it.
70+
71+#### mixRelease - Elixir Phoenix example {#mix-release-elixir-phoenix-example}
72+
73+there are 3 steps, frontend dependencies (javascript), backend dependencies (elixir) and the final derivation that puts both of those together
74+
75+##### mixRelease - Frontend dependencies (javascript) {#mix-release-javascript-deps}
76+
77+For phoenix projects, inside of nixpkgs you can either use yarn2nix (mkYarnModule) or node2nix. An example with yarn2nix can be found [here](https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/web-apps/plausible/default.nix#L39). An example with node2nix will follow. To package something outside of nixpkgs, you have alternatives like [npmlock2nix](https://github.com/nix-community/npmlock2nix) or [nix-npm-buildpackage](https://github.com/serokell/nix-npm-buildpackage)
78+
79+##### mixRelease - backend dependencies (mix) {#mix-release-mix-deps}
80+
81+There are 2 ways to package backend dependencies. With mix2nix and with a fixed-output-derivation (FOD).
82+
83+###### mix2nix {#mix2nix}
84+
85+`mix2nix` is a cli tool available in nixpkgs. it will generate a nix expression from a mix.lock file. It is quite standard in the 2nix tool series.
86+
87+Note that currently mix2nix can't handle git dependencies inside the mix.lock file. If you have git dependencies, you can either add them manually (see [example](https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/pleroma/default.nix#L20)) or use the FOD method.
88+
89+The advantage of using mix2nix is that nix will know your whole dependency graph. On a dependency update, this won't trigger a full rebuild and download of all the dependencies, where FOD will do so.
90+
91+Practical steps:
5692
57−Alternatively, we can use `buildHex` as a shortcut:
93+- run `mix2nix > mix_deps.nix` in the upstream repo.
94+- pass `mixNixDeps = with pkgs; import ./mix_deps.nix { inherit lib beamPackages; };` as an argument to mixRelease.
95+
96+If there are git depencencies.
97+
98+- You'll need to fix the version artificially in mix.exs and regenerate the mix.lock with fixed version (on upstream). This will enable you to run `mix2nix > mix_deps.nix`.
99+- From the mix_deps.nix file, remove the dependencies that had git versions and pass them as an override to the import function.
100+
101+```nix
102+ mixNixDeps = import ./mix.nix {
103+ inherit beamPackages lib;
104+ overrides = (final: prev: {
105+ # mix2nix does not support git dependencies yet,
106+ # so we need to add them manually
107+ prometheus_ex = beamPackages.buildMix rec {
108+ name = "prometheus_ex";
109+ version = "3.0.5";
110+
111+ # Change the argument src with the git src that you actually need
112+ src = fetchFromGitLab {
113+ domain = "git.pleroma.social";
114+ group = "pleroma";
115+ owner = "elixir-libraries";
116+ repo = "prometheus.ex";
117+ rev = "a4e9beb3c1c479d14b352fd9d6dd7b1f6d7deee5";
118+ sha256 = "1v0q4bi7sb253i8q016l7gwlv5562wk5zy3l2sa446csvsacnpjk";
119+ };
120+ # you can re-use the same beamDeps argument as generated
121+ beamDeps = with final; [ prometheus ];
122+ };
123+ });
124+};
125+```
126+
127+You will need to run the build process once to fix the sha256 to correspond to your new git src.
128+
129+###### FOD {#fixed-output-derivation}
130+
131+A fixed output derivation will download mix dependencies from the internet. To ensure reproducibility, a hash will be supplied. Note that mix is relatively reproducible. An FOD generating a different hash on each run hasn't been observed (as opposed to npm where the chances are relatively high). See [elixir_ls](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/beam-modules/elixir_ls.nix) for a usage example of FOD.
132+
133+Practical steps
134+
135+- start with the following argument to mixRelease
136+
137+```nix
138+ mixFodDeps = fetchMixDeps {
139+ pname = "mix-deps-${pname}";
140+ inherit src version;
141+ sha256 = lib.fakeSha256;
142+ };
143+```
144+
145+The first build will complain about the sha256 value, you can replace with the suggested value after that.
146+
147+Note that if after you've replaced the value, nix suggests another sha256, then mix is not fetching the dependencies reproducibly. An FOD will not work in that case and you will have to use mix2nix.
148+
149+##### mixRelease - example {#mix-release-example}
150+
151+Here is how your `default.nix` file would look for a phoenix project.
152+
153+```nix
154+with import <nixpkgs> { };
155+
156+let
157+ # beam.interpreters.erlangR23 is available if you need a particular version
158+ packages = beam.packagesWith beam.interpreters.erlang;
159+
160+ pname = "your_project";
161+ version = "0.0.1";
162+
163+ src = builtins.fetchgit {
164+ url = "ssh://git@github.com/your_id/your_repo";
165+ rev = "replace_with_your_commit";
166+ };
167+
168+ # if using mix2nix you can use the mixNixDeps attribute
169+ mixFodDeps = packages.fetchMixDeps {
170+ pname = "mix-deps-${pname}";
171+ inherit src version;
172+ # nix will complain and tell you the right value to replace this with
173+ sha256 = lib.fakeSha256;
174+ # if you have build time environment variables add them here
175+ MY_ENV_VAR="my_value";
176+ };
177+
178+ nodeDependencies = (pkgs.callPackage ./assets/default.nix { }).shell.nodeDependencies;
179+
180+in packages.mixRelease {
181+ inherit src pname version mixFodDeps;
182+ # if you have build time environment variables add them here
183+ MY_ENV_VAR="my_value";
184+
185+ postBuild = ''
186+ ln -sf ${nodeDependencies}/lib/node_modules assets/node_modules
187+ npm run deploy --prefix ./assets
188+
189+ # for external task you need a workaround for the no deps check flag
190+ # https://github.com/phoenixframework/phoenix/issues/2690
191+ mix do deps.loadpaths --no-deps-check, phx.digest
192+ mix phx.digest --no-deps-check
193+ '';
194+}
195+```
196+
197+Setup will require the following steps:
198+
199+- Move your secrets to runtime environment variables. For more information refer to the [runtime.exs docs](https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-runtime-configuration). On a fresh Phoenix build that would mean that both `DATABASE_URL` and `SECRET_KEY` need to be moved to `runtime.exs`.
200+- `cd assets` and `nix-shell -p node2nix --run node2nix --development` will generate a Nix expression containing your frontend dependencies
201+- commit and push those changes
202+- you can now `nix-build .`
203+- To run the release, set the `RELEASE_TMP` environment variable to a directory that your program has write access to. It will be used to store the BEAM settings.
204+
205+#### Example of creating a service for an Elixir - Phoenix project {#example-of-creating-a-service-for-an-elixir---phoenix-project}
206+
207+In order to create a service with your release, you could add a `service.nix`
208+in your project with the following
209+
210+```nix
211+{config, pkgs, lib, ...}:
212+
213+let
214+ release = pkgs.callPackage ./default.nix;
215+ release_name = "app";
216+ working_directory = "/home/app";
217+in
218+{
219+ systemd.services.${release_name} = {
220+ wantedBy = [ "multi-user.target" ];
221+ after = [ "network.target" "postgresql.service" ];
222+ # note that if you are connecting to a postgres instance on a different host
223+ # postgresql.service should not be included in the requires.
224+ requires = [ "network-online.target" "postgresql.service" ];
225+ description = "my app";
226+ environment = {
227+ # RELEASE_TMP is used to write the state of the
228+ # VM configuration when the system is running
229+ # it needs to be a writable directory
230+ RELEASE_TMP = working_directory;
231+ # can be generated in an elixir console with
232+ # Base.encode32(:crypto.strong_rand_bytes(32))
233+ RELEASE_COOKIE = "my_cookie";
234+ MY_VAR = "my_var";
235+ };
236+ serviceConfig = {
237+ Type = "exec";
238+ DynamicUser = true;
239+ WorkingDirectory = working_directory;
240+ # Implied by DynamicUser, but just to emphasize due to RELEASE_TMP
241+ PrivateTmp = true;
242+ ExecStart = ''
243+ ${release}/bin/${release_name} start
244+ '';
245+ ExecStop = ''
246+ ${release}/bin/${release_name} stop
247+ '';
248+ ExecReload = ''
249+ ${release}/bin/${release_name} restart
250+ '';
251+ Restart = "on-failure";
252+ RestartSec = 5;
253+ StartLimitBurst = 3;
254+ StartLimitInterval = 10;
255+ };
256+ # disksup requires bash
257+ path = [ pkgs.bash ];
258+ };
259+
260+ # in case you have migration scripts or you want to use a remote shell
261+ environment.systemPackages = [ release ];
262+}
263+```
58264
59265## How to Develop {#how-to-develop}
60266
61267### Creating a Shell {#creating-a-shell}
62268
63−Usually, we need to create a `shell.nix` file and do our development inside of the environment specified therein. Just install your version of erlang and other interpreter, and then user your normal build tools. As an example with elixir:
269+Usually, we need to create a `shell.nix` file and do our development inside of the environment specified therein. Just install your version of Erlang and any other interpreters, and then use your normal build tools. As an example with Elixir:
64270
65271```nix
66−{ pkgs ? import "<nixpkgs"> {} }:
272+{ pkgs ? import <nixpkgs> {} }:
67273
68274with pkgs;
69−
70275let
276+ elixir = beam.packages.erlangR24.elixir_1_12;
277+in
278+mkShell {
279+ buildInputs = [ elixir ];
280+}
281+```
282+
283+### Using an overlay
71284
72− elixir = beam.packages.erlangR22.elixir_1_9;
285+If you need to use an overlay to change some attributes of a derivation, e.g. if you need a bugfix from a version that is not yet available in nixpkgs, you can override attributes such as `version` (and the corresponding `sha256`) and then use this overlay in your development environment:
73286
287+#### `shell.nix`
288+
289+```nix
290+let
291+ elixir_1_13_1_overlay = (self: super: {
292+ elixir_1_13 = super.elixir_1_13.override {
293+ version = "1.13.1";
294+ sha256 = "0z0b1w2vvw4vsnb99779c2jgn9bgslg7b1pmd9vlbv02nza9qj5p";
295+ };
296+ });
297+ pkgs = import <nixpkgs> { overlays = [ elixir_1_13_1_overlay ]; };
74298in
299+with pkgs;
75300mkShell {
76− buildInputs = [ elixir ];
301+ buildInputs = [
302+ elixir_1_13
303+ ];
304+}
305+```
306+
307+#### Elixir - Phoenix project {#elixir---phoenix-project}
77308
78− ERL_INCLUDE_PATH="${erlang}/lib/erlang/usr/include";
309+Here is an example `shell.nix`.
310+
311+```nix
312+with import <nixpkgs> { };
313+
314+let
315+ # define packages to install
316+ basePackages = [
317+ git
318+ # replace with beam.packages.erlang.elixir_1_13 if you need
319+ beam.packages.erlang.elixir
320+ nodejs
321+ postgresql_14
322+ # only used for frontend dependencies
323+ # you are free to use yarn2nix as well
324+ nodePackages.node2nix
325+ # formatting js file
326+ nodePackages.prettier
327+ ];
328+
329+ inputs = basePackages ++ lib.optionals stdenv.isLinux [ inotify-tools ]
330+ ++ lib.optionals stdenv.isDarwin
331+ (with darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]);
332+
333+ # define shell startup command
334+ hooks = ''
335+ # this allows mix to work on the local directory
336+ mkdir -p .nix-mix .nix-hex
337+ export MIX_HOME=$PWD/.nix-mix
338+ export HEX_HOME=$PWD/.nix-mix
339+ # make hex from Nixpkgs available
340+ # `mix local.hex` will install hex into MIX_HOME and should take precedence
341+ export MIX_PATH="${beam.packages.erlang.hex}/lib/erlang/lib/hex/ebin"
342+ export PATH=$MIX_HOME/bin:$HEX_HOME/bin:$PATH
343+ export LANG=C.UTF-8
344+ # keep your shell history in iex
345+ export ERL_AFLAGS="-kernel shell_history enabled"
346+
347+ # postges related
348+ # keep all your db data in a folder inside the project
349+ export PGDATA="$PWD/db"
350+
351+ # phoenix related env vars
352+ export POOL_SIZE=15
353+ export DB_URL="postgresql://postgres:postgres@localhost:5432/db"
354+ export PORT=4000
355+ export MIX_ENV=dev
356+ # add your project env vars here, word readable in the nix store.
357+ export ENV_VAR="your_env_var"
358+ '';
359+
360+in mkShell {
361+ buildInputs = inputs;
362+ shellHook = hooks;
79363}
80364```
81365
82−#### Building in a Shell (for Mix Projects) {#building-in-a-shell}
366+Initializing the project will require the following steps:
83367
84−Using a `shell.nix` as described (see <xref linkend="creating-a-shell"/>) should just work.
368+- create the db directory `initdb ./db` (inside your mix project folder)
369+- create the postgres user `createuser postgres -ds`
370+- create the db `createdb db`
371+- start the postgres instance `pg_ctl -l "$PGDATA/server.log" start`
372+- add the `/db` folder to your `.gitignore`
373+- you can start your phoenix server and get a shell with `iex -S mix phx.server`
doc/languages-frameworks/bower.section.md+1−1
@@ -149,7 +149,7 @@ A few notes about [Full example — `default.nix`](#ex-buildBowerComponentsDefau
149149
150150## Troubleshooting {#ssec-bower2nix-troubleshooting}
151151
152−### ENOCACHE errors from buildBowerComponents
152+### ENOCACHE errors from buildBowerComponents {#enocache-errors-from-buildbowercomponents}
153153
154154This means that Bower was looking for a package version which doesn't exist in the generated `bower-packages.nix`.
155155
doc/languages-frameworks/chicken.section.mdnew file+49
@@ -0,0 +1,49 @@
1+# CHICKEN {#sec-chicken}
2+
3+[CHICKEN](https://call-cc.org/) is a
4+[R⁵RS](https://schemers.org/Documents/Standards/R5RS/HTML/)-compliant Scheme
5+compiler. It includes an interactive mode and a custom package format, "eggs".
6+
7+## Using Eggs
8+
9+Eggs described in nixpkgs are available inside the
10+`chickenPackages.chickenEggs` attrset. Including an egg as a build input is
11+done in the typical Nix fashion. For example, to include support for [SRFI
12+189](https://srfi.schemers.org/srfi-189/srfi-189.html) in a derivation, one
13+might write:
14+
15+```nix
16+ buildInputs = [
17+ chicken
18+ chickenPackages.chickenEggs.srfi-189
19+ ];
20+```
21+
22+Both `chicken` and its eggs have a setup hook which configures the environment
23+variables `CHICKEN_INCLUDE_PATH` and `CHICKEN_REPOSITORY_PATH`.
24+
25+## Updating Eggs
26+
27+nixpkgs only knows about a subset of all published eggs. It uses
28+[egg2nix](https://github.com/the-kenny/egg2nix) to generate a
29+package set from a list of eggs to include.
30+
31+The package set is regenerated by running the following shell commands:
32+
33+```
34+$ nix-shell -p chickenPackages.egg2nix
35+$ cd pkgs/development/compilers/chicken/5/
36+$ egg2nix eggs.scm > eggs.nix
37+```
38+
39+## Adding Eggs
40+
41+When we run `egg2nix`, we obtain one collection of eggs with
42+mutually-compatible versions. This means that when we add new eggs, we may
43+need to update existing eggs. To keep those separate, follow the procedure for
44+updating eggs before including more eggs.
45+
46+To include more eggs, edit `pkgs/development/compilers/chicken/5/eggs.scm`.
47+The first section of this file lists eggs which are required by `egg2nix`
48+itself; all other eggs go into the second section. After editing, follow the
49+procedure for updating eggs.
doc/languages-frameworks/coq.section.md+6−4
@@ -1,6 +1,6 @@
11# Coq and coq packages {#sec-language-coq}
22
3−## Coq derivation: `coq`
3+## Coq derivation: `coq` {#coq-derivation-coq}
44
55The Coq derivation is overridable through the `coq.override overrides`, where overrides is an attribute set which contains the arguments to override. We recommend overriding either of the following
66
@@ -8,7 +8,7 @@ The Coq derivation is overridable through the `coq.override overrides`, where ov
88* `customOCamlPackage` (optional, defaults to `null`, which lets Coq choose a version automatically), which can be set to any of the ocaml packages attribute of `ocaml-ng` (such as `ocaml-ng.ocamlPackages_4_10` which is the default for Coq 8.11 for example).
99* `coq-version` (optional, defaults to the short version e.g. "8.10"), is a version number of the form "x.y" that indicates which Coq's version build behavior to mimic when using a source which is not a release. E.g. `coq.override { version = "d370a9d1328a4e1cdb9d02ee032f605a9d94ec7a"; coq-version = "8.10"; }`.
1010
11−## Coq packages attribute sets: `coqPackages`
11+## Coq packages attribute sets: `coqPackages` {#coq-packages-attribute-sets-coqpackages}
1212
1313The recommended way of defining a derivation for a Coq library, is to use the `coqPackages.mkCoqDerivation` function, which is essentially a specialization of `mkDerivation` taking into account most of the specifics of Coq libraries. The following attributes are supported:
1414
@@ -28,11 +28,13 @@ The recommended way of defining a derivation for a Coq library, is to use the `c
2828* `domain` (optional, defaults to `"github.com"`), domains including the strings `"github"` or `"gitlab"` in their names are automatically supported, otherwise, one must change the `fetcher` argument to support them (cf `pkgs/development/coq-modules/heq/default.nix` for an example),
2929* `releaseRev` (optional, defaults to `(v: v)`), provides a default mapping from release names to revision hashes/branch names/tags,
3030* `displayVersion` (optional), provides a way to alter the computation of `name` from `pname`, by explaining how to display version numbers,
31−* `namePrefix` (optional), provides a way to alter the computation of `name` from `pname`, by explaining which dependencies must occur in `name`,
32−* `extraBuildInputs` (optional), by default `buildInputs` just contains `coq`, this allows to add more build inputs,
31+* `namePrefix` (optional, defaults to `[ "coq" ]`), provides a way to alter the computation of `name` from `pname`, by explaining which dependencies must occur in `name`,
32+* `extraNativeBuildInputs` (optional), by default `nativeBuildInputs` just contains `coq`, this allows to add more native build inputs, `nativeBuildInputs` are executables and `buildInputs` are libraries and dependencies,
33+* `extraBuildInputs` (optional), this allows to add more build inputs,
3334* `mlPlugin` (optional, defaults to `false`). Some extensions (plugins) might require OCaml and sometimes other OCaml packages. Standard dependencies can be added by setting the current option to `true`. For a finer grain control, the `coq.ocamlPackages` attribute can be used in `extraBuildInputs` to depend on the same package set Coq was built against.
3435* `useDune2ifVersion` (optional, default to `(x: false)` uses Dune2 to build the package if the provided predicate evaluates to true on the version, e.g. `useDune2if = versions.isGe "1.1"` will use dune if the version of the package is greater or equal to `"1.1"`,
3536* `useDune2` (optional, defaults to `false`) uses Dune2 to build the package if set to true, the presence of this attribute overrides the behavior of the previous one.
37+* `opam-name` (optional, defaults to concatenating with a dash separator the components of `namePrefix` and `pname`), name of the Dune package to build.
3638* `enableParallelBuilding` (optional, defaults to `true`), since it is activated by default, we provide a way to disable it.
3739* `extraInstallFlags` (optional), allows to extend `installFlags` which initializes the variable `COQMF_COQLIB` so as to install in the proper subdirectory. Indeed 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.
3840* `setCOQBIN` (optional, defaults to `true`), by default, the environment variable `$COQBIN` is set to the current Coq's binary, but one can disable this behavior by setting it to `false`,
doc/languages-frameworks/crystal.section.md+4−2
@@ -1,20 +1,22 @@
11# Crystal {#crystal}
22
3−## Building a Crystal package
3+## Building a Crystal package {#building-a-crystal-package}
44
55This section uses [Mint](https://github.com/mint-lang/mint) as an example for how to build a Crystal package.
66
7−If the Crystal project has any dependencies, the first step is to get a `shards.nix` file encoding those. Get a copy of the project and go to its root directory such that its `shard.lock` file is in the current directory, then run `crystal2nix` in it
7+If the Crystal project has any dependencies, the first step is to get a `shards.nix` file encoding those. Get a copy of the project and go to its root directory such that its `shard.lock` file is in the current directory. Executable projects should usually commit the `shard.lock` file, but sometimes that's not the case, which means you need to generate it yourself. With an existing `shard.lock` file, `crystal2nix` can be run.
88```bash
99$ git clone https://github.com/mint-lang/mint
1010$ cd mint
1111$ git checkout 0.5.0
12+$ if [ ! -f shard.lock ]; then nix-shell -p shards --run "shards lock"; fi
1213$ nix-shell -p crystal2nix --run crystal2nix
1314```
1415
1516This should have generated a `shards.nix` file.
1617
1718Next create a Nix file for your derivation and use `pkgs.crystal.buildCrystalPackage` as follows:
19+
1820```nix
1921with import <nixpkgs> {};
2022crystal.buildCrystalPackage rec {
doc/languages-frameworks/cuda.section.mdnew file+34
@@ -0,0 +1,34 @@
1+# CUDA {#cuda}
2+
3+CUDA-only packages are stored in the `cudaPackages` packages set. This set
4+includes the `cudatoolkit`, portions of the toolkit in separate derivations,
5+`cudnn`, `cutensor` and `nccl`.
6+
7+A package set is available for each CUDA version, so for example
8+`cudaPackages_11_6`. Within each set is a matching version of the above listed
9+packages. Additionally, other versions of the packages that are packaged and
10+compatible are available as well. For example, there can be a
11+`cudaPackages.cudnn_8_3_2` package.
12+
13+To use one or more CUDA packages in an expression, give the expression a `cudaPackages` parameter, and in case CUDA is optional
14+```nix
15+cudaSupport ? false
16+cudaPackages ? {}
17+```
18+
19+When using `callPackage`, you can choose to pass in a different variant, e.g.
20+when a different version of the toolkit suffices
21+```nix
22+mypkg = callPackage { cudaPackages = cudaPackages_11_5; }
23+```
24+
25+If another version of say `cudnn` or `cutensor` is needed, you can override the
26+package set to make it the default. This guarantees you get a consistent package
27+set.
28+```nix
29+mypkg = let
30+ cudaPackages = cudaPackages_11_5.overrideScope' (final: prev {
31+ cudnn = prev.cudnn_8_3_2;
32+ }});
33+in callPackage { inherit cudaPackages; };
34+```
doc/languages-frameworks/dhall.section.mdnew file+463
@@ -0,0 +1,463 @@
1+# Dhall {#sec-language-dhall}
2+
3+The Nixpkgs support for Dhall assumes some familiarity with Dhall's language
4+support for importing Dhall expressions, which is documented here:
5+
6+* [`dhall-lang.org` - Installing packages](https://docs.dhall-lang.org/tutorials/Language-Tour.html#installing-packages)
7+
8+## Remote imports {#ssec-dhall-remote-imports}
9+
10+Nixpkgs bypasses Dhall's support for remote imports using Dhall's
11+semantic integrity checks. Specifically, any Dhall import can be protected by
12+an integrity check like:
13+
14+```dhall
15+https://prelude.dhall-lang.org/v20.1.0/package.dhall
16+ sha256:26b0ef498663d269e4dc6a82b0ee289ec565d683ef4c00d0ebdd25333a5a3c98
17+```
18+
19+… and if the import is cached then the interpreter will load the import from
20+cache instead of fetching the URL.
21+
22+Nixpkgs uses this trick to add all of a Dhall expression's dependencies into the
23+cache so that the Dhall interpreter never needs to resolve any remote URLs. In
24+fact, Nixpkgs uses a Dhall interpreter with remote imports disabled when
25+packaging Dhall expressions to enforce that the interpreter never resolves a
26+remote import. This means that Nixpkgs only supports building Dhall expressions
27+if all of their remote imports are protected by semantic integrity checks.
28+
29+Instead of remote imports, Nixpkgs uses Nix to fetch remote Dhall code. For
30+example, the Prelude Dhall package uses `pkgs.fetchFromGitHub` to fetch the
31+`dhall-lang` repository containing the Prelude. Relying exclusively on Nix
32+to fetch Dhall code ensures that Dhall packages built using Nix remain pure and
33+also behave well when built within a sandbox.
34+
35+## Packaging a Dhall expression from scratch {#ssec-dhall-packaging-expression}
36+
37+We can illustrate how Nixpkgs integrates Dhall by beginning from the following
38+trivial Dhall expression with one dependency (the Prelude):
39+
40+```dhall
41+-- ./true.dhall
42+
43+let Prelude = https://prelude.dhall-lang.org/v20.1.0/package.dhall
44+
45+in Prelude.Bool.not False
46+```
47+
48+As written, this expression cannot be built using Nixpkgs because the
49+expression does not protect the Prelude import with a semantic integrity
50+check, so the first step is to freeze the expression using `dhall freeze`,
51+like this:
52+
53+```ShellSession
54+$ dhall freeze --inplace ./true.dhall
55+```
56+
57+… which gives us:
58+
59+```dhall
60+-- ./true.dhall
61+
62+let Prelude =
63+ https://prelude.dhall-lang.org/v20.1.0/package.dhall
64+ sha256:26b0ef498663d269e4dc6a82b0ee289ec565d683ef4c00d0ebdd25333a5a3c98
65+
66+in Prelude.Bool.not False
67+```
68+
69+To package that expression, we create a `./true.nix` file containing the
70+following specification for the Dhall package:
71+
72+```nix
73+# ./true.nix
74+
75+{ buildDhallPackage, Prelude }:
76+
77+buildDhallPackage {
78+ name = "true";
79+ code = ./true.dhall;
80+ dependencies = [ Prelude ];
81+ source = true;
82+}
83+```
84+
85+… and we complete the build by incorporating that Dhall package into the
86+`pkgs.dhallPackages` hierarchy using an overlay, like this:
87+
88+```nix
89+# ./example.nix
90+
91+let
92+ nixpkgs = builtins.fetchTarball {
93+ url = "https://github.com/NixOS/nixpkgs/archive/94b2848559b12a8ed1fe433084686b2a81123c99.tar.gz";
94+ sha256 = "1pbl4c2dsaz2lximgd31m96jwbps6apn3anx8cvvhk1gl9rkg107";
95+ };
96+
97+ dhallOverlay = self: super: {
98+ true = self.callPackage ./true.nix { };
99+ };
100+
101+ overlay = self: super: {
102+ dhallPackages = super.dhallPackages.override (old: {
103+ overrides =
104+ self.lib.composeExtensions (old.overrides or (_: _: {})) dhallOverlay;
105+ });
106+ };
107+
108+ pkgs = import nixpkgs { config = {}; overlays = [ overlay ]; };
109+
110+in
111+ pkgs
112+```
113+
114+… which we can then build using this command:
115+
116+```ShellSession
117+$ nix build --file ./example.nix dhallPackages.true
118+```
119+
120+## Contents of a Dhall package {#ssec-dhall-package-contents}
121+
122+The above package produces the following directory tree:
123+
124+```ShellSession
125+$ tree -a ./result
126+result
127+├── .cache
128+│ └── dhall
129+│ └── 122027abdeddfe8503496adeb623466caa47da5f63abd2bc6fa19f6cfcb73ecfed70
130+├── binary.dhall
131+└── source.dhall
132+```
133+
134+… where:
135+
136+* `source.dhall` contains the result of interpreting our Dhall package:
137+
138+ ```ShellSession
139+ $ cat ./result/source.dhall
140+ True
141+ ```
142+
143+* The `.cache` subdirectory contains one binary cache product encoding the
144+ same result as `source.dhall`:
145+
146+ ```ShellSession
147+ $ dhall decode < ./result/.cache/dhall/122027abdeddfe8503496adeb623466caa47da5f63abd2bc6fa19f6cfcb73ecfed70
148+ True
149+ ```
150+
151+* `binary.dhall` contains a Dhall expression which handles fetching and decoding
152+ the same cache product:
153+
154+ ```ShellSession
155+ $ cat ./result/binary.dhall
156+ missing sha256:27abdeddfe8503496adeb623466caa47da5f63abd2bc6fa19f6cfcb73ecfed70
157+ $ cp -r ./result/.cache .cache
158+
159+ $ chmod -R u+w .cache
160+
161+ $ XDG_CACHE_HOME=.cache dhall --file ./result/binary.dhall
162+ True
163+ ```
164+
165+The `source.dhall` file is only present for packages that specify
166+`source = true;`. By default, Dhall packages omit the `source.dhall` in order
167+to conserve disk space when they are used exclusively as dependencies. For
168+example, if we build the Prelude package it will only contain the binary
169+encoding of the expression:
170+
171+```ShellSession
172+$ nix build --file ./example.nix dhallPackages.Prelude
173+
174+$ tree -a result
175+result
176+├── .cache
177+│ └── dhall
178+│ └── 122026b0ef498663d269e4dc6a82b0ee289ec565d683ef4c00d0ebdd25333a5a3c98
179+└── binary.dhall
180+
181+2 directories, 2 files
182+```
183+
184+Typically, you only specify `source = true;` for the top-level Dhall expression
185+of interest (such as our example `true.nix` Dhall package). However, if you
186+wish to specify `source = true` for all Dhall packages, then you can amend the
187+Dhall overlay like this:
188+
189+```nix
190+ dhallOverrides = self: super: {
191+ # Enable source for all Dhall packages
192+ buildDhallPackage =
193+ args: super.buildDhallPackage (args // { source = true; });
194+
195+ true = self.callPackage ./true.nix { };
196+ };
197+```
198+
199+… and now the Prelude will contain the fully decoded result of interpreting
200+the Prelude:
201+
202+```ShellSession
203+$ nix build --file ./example.nix dhallPackages.Prelude
204+
205+$ tree -a result
206+result
207+├── .cache
208+│ └── dhall
209+│ └── 122026b0ef498663d269e4dc6a82b0ee289ec565d683ef4c00d0ebdd25333a5a3c98
210+├── binary.dhall
211+└── source.dhall
212+
213+$ cat ./result/source.dhall
214+{ Bool =
215+ { and =
216+ \(_ : List Bool) ->
217+ List/fold Bool _ Bool (\(_ : Bool) -> \(_ : Bool) -> _@1 && _) True
218+ , build = \(_ : Type -> _ -> _@1 -> _@2) -> _ Bool True False
219+ , even =
220+ \(_ : List Bool) ->
221+ List/fold Bool _ Bool (\(_ : Bool) -> \(_ : Bool) -> _@1 == _) True
222+ , fold =
223+ \(_ : Bool) ->
224+…
225+```
226+
227+## Packaging functions {#ssec-dhall-packaging-functions}
228+
229+We already saw an example of using `buildDhallPackage` to create a Dhall
230+package from a single file, but most Dhall packages consist of more than one
231+file and there are two derived utilities that you may find more useful when
232+packaging multiple files:
233+
234+* `buildDhallDirectoryPackage` - build a Dhall package from a local directory
235+
236+* `buildDhallGitHubPackage` - build a Dhall package from a GitHub repository
237+
238+The `buildDhallPackage` is the lowest-level function and accepts the following
239+arguments:
240+
241+* `name`: The name of the derivation
242+
243+* `dependencies`: Dhall dependencies to build and cache ahead of time
244+
245+* `code`: The top-level expression to build for this package
246+
247+ Note that the `code` field accepts an arbitrary Dhall expression. You're
248+ not limited to just a file.
249+
250+* `source`: Set to `true` to include the decoded result as `source.dhall` in the
251+ build product, at the expense of requiring more disk space
252+
253+* `documentationRoot`: Set to the root directory of the package if you want
254+ `dhall-docs` to generate documentation underneath the `docs` subdirectory of
255+ the build product
256+
257+The `buildDhallDirectoryPackage` is a higher-level function implemented in terms
258+of `buildDhallPackage` that accepts the following arguments:
259+
260+* `name`: Same as `buildDhallPackage`
261+
262+* `dependencies`: Same as `buildDhallPackage`
263+
264+* `source`: Same as `buildDhallPackage`
265+
266+* `src`: The directory containing Dhall code that you want to turn into a Dhall
267+ package
268+
269+* `file`: The top-level file (`package.dhall` by default) that is the entrypoint
270+ to the rest of the package
271+
272+* `document`: Set to `true` to generate documentation for the package
273+
274+The `buildDhallGitHubPackage` is another higher-level function implemented in
275+terms of `buildDhallPackage` that accepts the following arguments:
276+
277+* `name`: Same as `buildDhallPackage`
278+
279+* `dependencies`: Same as `buildDhallPackage`
280+
281+* `source`: Same as `buildDhallPackage`
282+
283+* `owner`: The owner of the repository
284+
285+* `repo`: The repository name
286+
287+* `rev`: The desired revision (or branch, or tag)
288+
289+* `directory`: The subdirectory of the Git repository to package (if a
290+ directory other than the root of the repository)
291+
292+* `file`: The top-level file (`${directory}/package.dhall` by default) that is
293+ the entrypoint to the rest of the package
294+
295+* `document`: Set to `true` to generate documentation for the package
296+
297+Additionally, `buildDhallGitHubPackage` accepts the same arguments as
298+`fetchFromGitHub`, such as `sha256` or `fetchSubmodules`.
299+
300+## `dhall-to-nixpkgs` {#ssec-dhall-dhall-to-nixpkgs}
301+
302+You can use the `dhall-to-nixpkgs` command-line utility to automate
303+packaging Dhall code. For example:
304+
305+```ShellSession
306+$ nix-env --install --attr haskellPackages.dhall-nixpkgs
307+
308+$ nix-env --install --attr nix-prefetch-git # Used by dhall-to-nixpkgs
309+
310+$ dhall-to-nixpkgs github https://github.com/Gabriel439/dhall-semver.git
311+{ buildDhallGitHubPackage, Prelude }:
312+ buildDhallGitHubPackage {
313+ name = "dhall-semver";
314+ githubBase = "github.com";
315+ owner = "Gabriel439";
316+ repo = "dhall-semver";
317+ rev = "2d44ae605302ce5dc6c657a1216887fbb96392a4";
318+ fetchSubmodules = false;
319+ sha256 = "0y8shvp8srzbjjpmnsvz9c12ciihnx1szs0yzyi9ashmrjvd0jcz";
320+ directory = "";
321+ file = "package.dhall";
322+ source = false;
323+ document = false;
324+ dependencies = [ (Prelude.overridePackage { file = "package.dhall"; }) ];
325+ }
326+```
327+
328+The utility takes care of automatically detecting remote imports and converting
329+them to package dependencies. You can also use the utility on local
330+Dhall directories, too:
331+
332+```ShellSession
333+$ dhall-to-nixpkgs directory ~/proj/dhall-semver
334+{ buildDhallDirectoryPackage, Prelude }:
335+ buildDhallDirectoryPackage {
336+ name = "proj";
337+ src = ~/proj/dhall-semver;
338+ file = "package.dhall";
339+ source = false;
340+ document = false;
341+ dependencies = [ (Prelude.overridePackage { file = "package.dhall"; }) ];
342+ }
343+```
344+
345+### Remote imports as fixed-output derivations {#ssec-dhall-remote-imports-as-fod}
346+
347+`dhall-to-nixpkgs` has the ability to fetch and build remote imports as
348+fixed-output derivations by using their Dhall integrity check. This is
349+sometimes easier than manually packaging all remote imports.
350+
351+This can be used like the following:
352+
353+```ShellSession
354+$ dhall-to-nixpkgs directory --fixed-output-derivations ~/proj/dhall-semver
355+{ buildDhallDirectoryPackage, buildDhallUrl }:
356+ buildDhallDirectoryPackage {
357+ name = "proj";
358+ src = ~/proj/dhall-semver;
359+ file = "package.dhall";
360+ source = false;
361+ document = false;
362+ dependencies = [
363+ (buildDhallUrl {
364+ url = "https://prelude.dhall-lang.org/v17.0.0/package.dhall";
365+ hash = "sha256-ENs8kZwl6QRoM9+Jeo/+JwHcOQ+giT2VjDQwUkvlpD4=";
366+ dhallHash = "sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e";
367+ })
368+ ];
369+ }
370+```
371+
372+Here, `dhall-semver`'s `Prelude` dependency is fetched and built with the
373+`buildDhallUrl` helper function, instead of being passed in as a function
374+argument.
375+
376+## Overriding dependency versions {#ssec-dhall-overriding-dependency-versions}
377+
378+Suppose that we change our `true.dhall` example expression to depend on an older
379+version of the Prelude (19.0.0):
380+
381+```dhall
382+-- ./true.dhall
383+
384+let Prelude =
385+ https://prelude.dhall-lang.org/v19.0.0/package.dhall
386+ sha256:eb693342eb769f782174157eba9b5924cf8ac6793897fc36a31ccbd6f56dafe2
387+
388+in Prelude.Bool.not False
389+```
390+
391+If we try to rebuild that expression the build will fail:
392+
393+```ShellSession
394+$ nix build --file ./example.nix dhallPackages.true
395+builder for '/nix/store/0f1hla7ff1wiaqyk1r2ky4wnhnw114fi-true.drv' failed with exit code 1; last 10 log lines:
396+
397+ Dhall was compiled without the 'with-http' flag.
398+
399+ The requested URL was: https://prelude.dhall-lang.org/v19.0.0/package.dhall
400+
401+
402+ 4│ https://prelude.dhall-lang.org/v19.0.0/package.dhall
403+ 5│ sha256:eb693342eb769f782174157eba9b5924cf8ac6793897fc36a31ccbd6f56dafe2
404+
405+ /nix/store/rsab4y99h14912h4zplqx2iizr5n4rc2-true.dhall:4:7
406+[1 built (1 failed), 0.0 MiB DL]
407+error: build of '/nix/store/0f1hla7ff1wiaqyk1r2ky4wnhnw114fi-true.drv' failed
408+```
409+
410+… because the default Prelude selected by Nixpkgs revision
411+`94b2848559b12a8ed1fe433084686b2a81123c99is` is version 20.1.0, which doesn't
412+have the same integrity check as version 19.0.0. This means that version
413+19.0.0 is not cached and the interpreter is not allowed to fall back to
414+importing the URL.
415+
416+However, we can override the default Prelude version by using `dhall-to-nixpkgs`
417+to create a Dhall package for our desired Prelude:
418+
419+```ShellSession
420+$ dhall-to-nixpkgs github https://github.com/dhall-lang/dhall-lang.git \
421+ --name Prelude \
422+ --directory Prelude \
423+ --rev v19.0.0 \
424+ > Prelude.nix
425+```
426+
427+… and then referencing that package in our Dhall overlay, by either overriding
428+the Prelude globally for all packages, like this:
429+
430+```nix
431+ dhallOverrides = self: super: {
432+ true = self.callPackage ./true.nix { };
433+
434+ Prelude = self.callPackage ./Prelude.nix { };
435+ };
436+```
437+
438+… or selectively overriding the Prelude dependency for just the `true` package,
439+like this:
440+
441+```nix
442+ dhallOverrides = self: super: {
443+ true = self.callPackage ./true.nix {
444+ Prelude = self.callPackage ./Prelude.nix { };
445+ };
446+ };
447+```
448+
449+## Overrides {#ssec-dhall-overrides}
450+
451+You can override any of the arguments to `buildDhallGitHubPackage` or
452+`buildDhallDirectoryPackage` using the `overridePackage` attribute of a package.
453+For example, suppose we wanted to selectively enable `source = true` just for the Prelude. We can do that like this:
454+
455+```nix
456+ dhallOverrides = self: super: {
457+ Prelude = super.Prelude.overridePackage { source = true; };
458+
459+ …
460+ };
461+```
462+
463+[semantic-integrity-checks]: https://docs.dhall-lang.org/tutorials/Language-Tour.html#installing-packages
doc/languages-frameworks/dotnet.section.md+77−20
@@ -1,35 +1,34 @@
1−# Dotnet
1+# Dotnet {#dotnet}
22
3−## Local Development Workflow
3+## Local Development Workflow {#local-development-workflow}
44
55For local development, it's recommended to use nix-shell to create a dotnet environment:
66
7−```
7+```nix
88# shell.nix
99with import <nixpkgs> {};
1010
1111mkShell {
1212 name = "dotnet-env";
13− buildInputs = [
13+ packages = [
1414 dotnet-sdk_3
1515 ];
1616}
1717```
1818
19−### Using many sdks in a workflow
19+### Using many sdks in a workflow {#using-many-sdks-in-a-workflow}
2020
2121It's very likely that more than one sdk will be needed on a given project. Dotnet provides several different frameworks (E.g dotnetcore, aspnetcore, etc.) as well as many versions for a given framework. Normally, dotnet is able to fetch a framework and install it relative to the executable. However, this would mean writing to the nix store in nixpkgs, which is read-only. To support the many-sdk use case, one can compose an environment using `dotnetCorePackages.combinePackages`:
2222
23−```
23+```nix
2424with import <nixpkgs> {};
2525
2626mkShell {
2727 name = "dotnet-env";
28− buildInputs = [
28+ packages = [
2929 (with dotnetCorePackages; combinePackages [
3030 sdk_3_1
31− sdk_3_0
32− sdk_2_1
31+ sdk_5_0
3332 ])
3433 ];
3534}
@@ -37,7 +36,7 @@ mkShell {
3736
3837This will produce a dotnet installation that has the dotnet 3.1, 3.0, and 2.1 sdk. The first sdk listed will have it's cli utility present in the resulting environment. Example info output:
3938
40−```
39+```ShellSession
4140$ dotnet --info
4241.NET Core SDK (reflecting any global.json):
4342 Version: 3.1.101
@@ -60,16 +59,74 @@ $ dotnet --info
6059 Microsoft.NETCore.App 3.1.1 [/nix/store/iiv98i2jdi226dgh4jzkkj2ww7f8jgpd-dotnet-core-combined/shared/Microsoft.NETCore.App]
6160```
6261
63−## dotnet-sdk vs dotnetCorePackages.sdk
62+## dotnet-sdk vs dotnetCorePackages.sdk {#dotnet-sdk-vs-dotnetcorepackages.sdk}
6463
6564The `dotnetCorePackages.sdk_X_Y` is preferred over the old dotnet-sdk as both major and minor version are very important for a dotnet environment. If a given minor version isn't present (or was changed), then this will likely break your ability to build a project.
6665
67−## dotnetCorePackages.sdk vs dotnetCorePackages.net vs dotnetCorePackages.netcore vs dotnetCorePackages.aspnetcore
68−
69−The `dotnetCorePackages.sdk` contains both a runtime and the full sdk of a given version. The `net`, `netcore` and `aspnetcore` packages are meant to serve as minimal runtimes to deploy alongside already built applications. For runtime versions >= .NET 5 `net` is used while `netcore` is used for older .NET Core runtime version.
70−
71−## Packaging a Dotnet Application
72−
73−Ideally, we would like to build against the sdk, then only have the dotnet runtime available in the runtime closure.
74−
75−TODO: Create closure-friendly way to package dotnet applications
66+## dotnetCorePackages.sdk vs dotnetCorePackages.runtime vs dotnetCorePackages.aspnetcore {#dotnetcorepackages.sdk-vs-dotnetcorepackages.runtime-vs-dotnetcorepackages.aspnetcore}
67+
68+The `dotnetCorePackages.sdk` contains both a runtime and the full sdk of a given version. The `runtime` and `aspnetcore` packages are meant to serve as minimal runtimes to deploy alongside already built applications.
69+
70+## Packaging a Dotnet Application {#packaging-a-dotnet-application}
71+
72+To package Dotnet applications, you can use `buildDotnetModule`. This has similar arguments to `stdenv.mkDerivation`, with the following additions:
73+
74+* `projectFile` has to be used for specifying the dotnet project file relative to the source root. These usually have `.sln` or `.csproj` file extensions. This can be an array of multiple projects as well.
75+* `nugetDeps` has to be used to specify the NuGet dependency file. Unfortunately, these cannot be deterministically fetched without a lockfile. A script to fetch these is available as `passthru.fetch-deps`. This file can also be generated manually using `nuget-to-nix` tool, which is available in nixpkgs.
76+* `packNupkg` is used to pack project as a `nupkg`, and installs it to `$out/share`. If set to `true`, the derivation can be used as a dependency for another dotnet project by adding it to `projectReferences`.
77+* `projectReferences` can be used to resolve `ProjectReference` project items. Referenced projects can be packed with `buildDotnetModule` by setting the `packNupkg = true` attribute and passing a list of derivations to `projectReferences`. Since we are sharing referenced projects as NuGets they must be added to csproj/fsproj files as `PackageReference` as well.
78+ For example, your project has a local dependency:
79+ ```xml
80+ <ProjectReference Include="../foo/bar.fsproj" />
81+ ```
82+ To enable discovery through `projectReferences` you would need to add:
83+ ```xml
84+ <ProjectReference Include="../foo/bar.fsproj" />
85+ <PackageReference Include="bar" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/>
86+ ```
87+* `executables` is used to specify which executables get wrapped to `$out/bin`, relative to `$out/lib/$pname`. If this is unset, all executables generated will get installed. If you do not want to install any, set this to `[]`. This gets done in the `preFixup` phase.
88+* `runtimeDeps` is used to wrap libraries into `LD_LIBRARY_PATH`. This is how dotnet usually handles runtime dependencies.
89+* `buildType` is used to change the type of build. Possible values are `Release`, `Debug`, etc. By default, this is set to `Release`.
90+* `dotnet-sdk` is useful in cases where you need to change what dotnet SDK is being used.
91+* `dotnet-runtime` is useful in cases where you need to change what dotnet runtime is being used. This can be either a regular dotnet runtime, or an aspnetcore.
92+* `dotnet-test-sdk` is useful in cases where unit tests expect a different dotnet SDK. By default, this is set to the `dotnet-sdk` attribute.
93+* `testProjectFile` is useful in cases where the regular project file does not contain the unit tests. It gets restored and build, but not installed. You may need to regenerate your nuget lockfile after setting this.
94+* `disabledTests` is used to disable running specific unit tests. This gets passed as: `dotnet test --filter "FullyQualifiedName!={}"`, to ensure compatibility with all unit test frameworks.
95+* `dotnetRestoreFlags` can be used to pass flags to `dotnet restore`.
96+* `dotnetBuildFlags` can be used to pass flags to `dotnet build`.
97+* `dotnetTestFlags` can be used to pass flags to `dotnet test`. Used only if `doCheck` is set to `true`.
98+* `dotnetInstallFlags` can be used to pass flags to `dotnet install`.
99+* `dotnetPackFlags` can be used to pass flags to `dotnet pack`. Used only if `packNupkg` is set to `true`.
100+* `dotnetFlags` can be used to pass flags to all of the above phases.
101+
102+When packaging a new application, you need to fetch it's dependencies. You can set `nugetDeps` to an empty string to make the derivation temporarily evaluate, and then run `nix-build -A package.passthru.fetch-deps` to generate it's dependency fetching script. After running the script, you should have the location of the generated lockfile printed to the console. This can be copied to a stable directory. Note that if either `projectFile` or `nugetDeps` are unset, this script cannot be generated!
103+
104+Here is an example `default.nix`, using some of the previously discussed arguments:
105+```nix
106+{ lib, buildDotnetModule, dotnetCorePackages, ffmpeg }:
107+
108+let
109+ referencedProject = import ../../bar { ... };
110+in buildDotnetModule rec {
111+ pname = "someDotnetApplication";
112+ version = "0.1";
113+
114+ src = ./.;
115+
116+ projectFile = "src/project.sln";
117+ nugetDeps = ./deps.nix; # File generated with `nix-build -A package.passthru.fetch-deps`.
118+
119+ projectReferences = [ referencedProject ]; # `referencedProject` must contain `nupkg` in the folder structure.
120+
121+ dotnet-sdk = dotnetCorePackages.sdk_3_1;
122+ dotnet-runtime = dotnetCorePackages.net_5_0;
123+ dotnetFlags = [ "--runtime linux-x64" ];
124+
125+ executables = [ "foo" ]; # This wraps "$out/lib/$pname/foo" to `$out/bin/foo`.
126+ executables = []; # Don't install any executables.
127+
128+ packNupkg = true; # This packs the project as "foo-0.1.nupkg" at `$out/share`.
129+
130+ runtimeDeps = [ ffmpeg ]; # This will wrap ffmpeg's library path into `LD_LIBRARY_PATH`.
131+}
132+```
doc/languages-frameworks/emscripten.section.md+8−10
@@ -15,28 +15,26 @@ Modes of use of `emscripten`:
1515
1616 If you want to work with `emcc`, `emconfigure` and `emmake` as you are used to from Ubuntu and similar distributions you can use these commands:
1717
18− * `nix-env -i emscripten`
18+ * `nix-env -f "<nixpkgs>" -iA emscripten`
1919 * `nix-shell -p emscripten`
2020
2121* **Declarative usage**:
2222
23− This mode is far more power full since this makes use of `nix` for dependency management of emscripten libraries and targets by using the `mkDerivation` which is implemented by `pkgs.emscriptenStdenv` and `pkgs.buildEmscriptenPackage`. The source for the packages is in `pkgs/top-level/emscripten-packages.nix` and the abstraction behind it in `pkgs/development/em-modules/generic/default.nix`.
23+ This mode is far more power full since this makes use of `nix` for dependency management of emscripten libraries and targets by using the `mkDerivation` which is implemented by `pkgs.emscriptenStdenv` and `pkgs.buildEmscriptenPackage`. The source for the packages is in `pkgs/top-level/emscripten-packages.nix` and the abstraction behind it in `pkgs/development/em-modules/generic/default.nix`. From the root of the nixpkgs repository:
2424 * build and install all packages:
2525 * `nix-env -iA emscriptenPackages`
2626
2727 * dev-shell for zlib implementation hacking:
2828 * `nix-shell -A emscriptenPackages.zlib`
2929
30−
31−## Imperative usage
30+## Imperative usage {#imperative-usage}
3231
3332A few things to note:
3433
3534* `export EMCC_DEBUG=2` is nice for debugging
3635* `~/.emscripten`, the build artifact cache sometimes creates issues and needs to be removed from time to time
3736
38−
39−## Declarative usage
37+## Declarative usage {#declarative-usage}
4038
4139Let's see two different examples from `pkgs/top-level/emscripten-packages.nix`:
4240
@@ -50,7 +48,7 @@ A special requirement of the `pkgs.buildEmscriptenPackage` is the `doCheck = tru
5048* Use `export EMCC_DEBUG=2` from within a emscriptenPackage's `phase` to get more detailed debug output what is going wrong.
5149* ~/.emscripten cache is requiring us to set `HOME=$TMPDIR` in individual phases. This makes compilation slower but also makes it more deterministic.
5250
53−### Usage 1: pkgs.zlib.override
51+### Usage 1: pkgs.zlib.override {#usage-1-pkgs.zlib.override}
5452
5553This example uses `zlib` from nixpkgs but instead of compiling **C** to **ELF** it compiles **C** to **JS** since we were using `pkgs.zlib.override` and changed stdenv to `pkgs.emscriptenStdenv`. A few adaptions and hacks were set in place to make it working. One advantage is that when `pkgs.zlib` is updated, it will automatically update this package as well. However, this can also be the downside...
5654
@@ -110,7 +108,7 @@ See the `zlib` example:
110108 '';
111109 });
112110
113−### Usage 2: pkgs.buildEmscriptenPackage
111+### Usage 2: pkgs.buildEmscriptenPackage {#usage-2-pkgs.buildemscriptenpackage}
114112
115113This `xmlmirror` example features a emscriptenPackage which is defined completely from this context and no `pkgs.zlib.override` is used.
116114
@@ -165,7 +163,7 @@ This `xmlmirror` example features a emscriptenPackage which is defined completel
165163 '';
166164 };
167165
168−### Declarative debugging
166+### Declarative debugging {#declarative-debugging}
169167
170168Use `nix-shell -I nixpkgs=/some/dir/nixpkgs -A emscriptenPackages.libz` and from there you can go trough the individual steps. This makes it easy to build a good `unit test` or list the files of the project.
171169
@@ -177,7 +175,7 @@ Use `nix-shell -I nixpkgs=/some/dir/nixpkgs -A emscriptenPackages.libz` and from
1771756. `buildPhase`
1781767. ... happy hacking...
179177
180−## Summary
178+## Summary {#summary}
181179
182180Using this toolchain makes it easy to leverage `nix` from NixOS, MacOSX or even Windows (WSL+ubuntu+nix). This toolchain is reproducible, behaves like the rest of the packages from nixpkgs and contains a set of well working examples to learn and adapt from.
183181
doc/languages-frameworks/gnome.section.md+40−8
@@ -8,12 +8,30 @@ Programs in the GNOME universe are written in various languages but they all use
88
99[GSettings](https://developer.gnome.org/gio/stable/GSettings.html) 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`.
1010
11−On Linux, GSettings API is implemented using [dconf](https://wiki.gnome.org/Projects/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.
11+On Linux, GSettings API is implemented using [dconf](https://wiki.gnome.org/Projects/dconf) backend. You will need to add `dconf` [GIO module](#ssec-gnome-gio-modules) to `GIO_EXTRA_MODULES` variable, otherwise the `memory` backend will be used and the saved settings will not be persistent.
1212
1313Last you will need the dconf database D-Bus service itself. You can enable it using `programs.dconf.enable`.
1414
1515Some 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.
1616
17+### GIO modules {#ssec-gnome-gio-modules}
18+
19+GLib’s [GIO](https://developer.gnome.org/gio/stable/ch01.html) library supports several [extension points](https://developer.gnome.org/gio/stable/extending-gio.html). Notably, they allow:
20+
21+* implementing settings backends (already [mentioned](#ssec-gnome-settings))
22+* adding TLS support
23+* proxy settings
24+* virtual file systems
25+
26+The modules are typically installed to `lib/gio/modules/` directory of a package and you need to add them to `GIO_EXTRA_MODULES` if you need any of those features.
27+
28+In particular, we recommend:
29+
30+* adding `dconf.lib` for any software on Linux that reads [GSettings](#ssec-gnome-settings) (even transitivily through e.g. GTK’s file manager)
31+* adding `glib-networking` for any software that accesses network using GIO or libsoup – glib-networking contains a module that implements TLS support and loads system-wide proxy settings
32+
33+To allow software to use various virtual file systems, `gvfs` package can be also added. But that is usually an optional feature so we typically use `gvfs` from the system (e.g. installed globally using NixOS module).
34+
1735### GdkPixbuf loaders {#ssec-gnome-gdk-pixbuf-loaders}
1836
1937GTK applications typically use [GdkPixbuf](https://developer.gnome.org/gdk-pixbuf/stable/) to load images. But `gdk-pixbuf` package only supports basic bitmap formats like JPEG, PNG or TIFF, requiring to use third-party loader modules for other formats. This is especially painful since GTK itself includes SVG icons, which cannot be rendered without a loader provided by `librsvg`.
@@ -24,7 +42,21 @@ Unlike other libraries mentioned in this section, GdkPixbuf only supports a sing
2442
2543### Icons {#ssec-gnome-icons}
2644
27−When an application uses icons, an icon theme should be available in `XDG_DATA_DIRS` during runtime. The package for the default, icon-less [hicolor-icon-theme](https://www.freedesktop.org/wiki/Software/icon-theme/) (should be propagated by every icon theme) contains [a setup hook](#ssec-gnome-hooks-hicolor-icon-theme) 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.
45+When an application uses icons, an icon theme should be available in `XDG_DATA_DIRS` during runtime. The package for the default, icon-less [hicolor-icon-theme](https://www.freedesktop.org/wiki/Software/icon-theme/) (should be propagated by every icon theme) contains [a setup hook](#ssec-gnome-hooks-hicolor-icon-theme) that will pick up icon themes from `buildInputs` and add their datadirs to `XDG_ICON_DIRS` environment variable (this is Nixpkgs specific, not actually a XDG standard variable). 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.
46+
47+In the rare case you need to use icons from dependencies (e.g. when an app forces an icon theme), you can use the following to pick them up:
48+
49+```nix
50+ buildInputs = [
51+ pantheon.elementary-icon-theme
52+ ];
53+ preFixup = ''
54+ gappsWrapperArgs+=(
55+ # The icon theme is hardcoded.
56+ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS"
57+ )
58+ '';
59+```
2860
2961To avoid costly file system access when locating icons, GTK, [as well as Qt](https://woboq.com/blog/qicon-reads-gtk-icon-cache-in-qt57.html), can rely on `icon-theme.cache` files from the themes' top-level directories. These files are generated using `gtk-update-icon-cache`, which is expected to be run whenever an icon is added or removed to an icon theme (typically an application icon into `hicolor` theme) and some programs do indeed run this after icon installation. However, since packages are installed into their own prefix by Nix, this would lead to conflicts. For that reason, `gtk3` provides a [setup hook](#ssec-gnome-hooks-gtk-drop-icon-theme-cache) that will clean the file from installation. Since most applications only ship their own icon that will be loaded on start-up, it should not affect them too much. On the other hand, icon themes are much larger and more widely used so we need to cache them. Because we recommend installing icon themes globally, we will generate the cache files from all packages in a profile using a NixOS module. You can enable the cache generation using `gtk.iconCache.enable` option if your desktop environment does not already do that.
3062
@@ -68,27 +100,27 @@ preFixup = ''
68100
69101Fortunately, there is [`wrapGAppsHook`]{#ssec-gnome-hooks-wrapgappshook}. It works in conjunction with other setup hooks that populate environment variables, and it will then wrap all executables in `bin` and `libexec` directories using said variables.
70102
71−For convenience, it also adds `dconf.lib` for a GIO module implementing a GSettings backend using `dconf`, `gtk3` for GSettings schemas, and `librsvg` for GdkPixbuf loader to the closure. In case you are packaging a program without a graphical interface, you might want to use [`wrapGAppsNoGuiHook`]{#ssec-gnome-hooks-wrapgappsnoguihook}, which runs the same script as `wrapGAppsHook` but does not bring `gtk3` and `librsvg` into the closure.
103+For convenience, it also adds `dconf.lib` for a GIO module implementing a GSettings backend using `dconf`, `gtk3` for GSettings schemas, and `librsvg` for GdkPixbuf loader to the closure. There is also [`wrapGAppsHook4`]{#ssec-gnome-hooks-wrapgappshook4}, which replaces GTK 3 with GTK 4. And in case you are packaging a program without a graphical interface, you might want to use [`wrapGAppsNoGuiHook`]{#ssec-gnome-hooks-wrapgappsnoguihook}, which runs the same script as `wrapGAppsHook` but does not bring `gtk3` and `librsvg` into the closure.
72104
73105- `wrapGAppsHook` itself will add the package’s `share` directory to `XDG_DATA_DIRS`.
74106
75107- []{#ssec-gnome-hooks-glib} `glib` setup hook will populate `GSETTINGS_SCHEMAS_PATH` and then `wrapGAppsHook` will prepend it to `XDG_DATA_DIRS`.
76108
77−- []{#ssec-gnome-hooks-gdk-pixbuf} `gdk-pixbuf` setup hook will populate `GDK_PIXBUF_MODULE_FILE` with the path to biggest `loaders.cache` file from the dependencies containing [GdkPixbuf loaders](ssec-gnome-gdk-pixbuf-loaders). This works fine when there are only two packages containing loaders (`gdk-pixbuf` and e.g. `librsvg`) – it will choose the second one, reasonably expecting that it will be bigger since it describes extra loader in addition to the default ones. But when there are more than two loader packages, this logic will break. One possible solution would be constructing a custom cache file for each package containing a program like `services/x11/gdk-pixbuf.nix` NixOS module does. `wrapGAppsHook` copies the `GDK_PIXBUF_MODULE_FILE` environment variable into the produced wrapper.
109+- []{#ssec-gnome-hooks-gdk-pixbuf} `gdk-pixbuf` setup hook will populate `GDK_PIXBUF_MODULE_FILE` with the path to biggest `loaders.cache` file from the dependencies containing [GdkPixbuf loaders](#ssec-gnome-gdk-pixbuf-loaders). This works fine when there are only two packages containing loaders (`gdk-pixbuf` and e.g. `librsvg`) – it will choose the second one, reasonably expecting that it will be bigger since it describes extra loader in addition to the default ones. But when there are more than two loader packages, this logic will break. One possible solution would be constructing a custom cache file for each package containing a program like `services/x11/gdk-pixbuf.nix` NixOS module does. `wrapGAppsHook` copies the `GDK_PIXBUF_MODULE_FILE` environment variable into the produced wrapper.
78110
79111- []{#ssec-gnome-hooks-gtk-drop-icon-theme-cache} One of `gtk3`’s setup hooks will remove `icon-theme.cache` files from package’s icon theme directories to avoid conflicts. Icon theme packages should prevent this with `dontDropIconThemeCache = true;`.
80112
81113- []{#ssec-gnome-hooks-dconf} `dconf.lib` is a dependency of `wrapGAppsHook`, which then also adds it to the `GIO_EXTRA_MODULES` variable.
82114
83−- []{#ssec-gnome-hooks-hicolor-icon-theme} `hicolor-icon-theme`’s setup hook will add icon themes to `XDG_ICON_DIRS` which is prepended to `XDG_DATA_DIRS` by `wrapGAppsHook`.
115+- []{#ssec-gnome-hooks-hicolor-icon-theme} `hicolor-icon-theme`’s setup hook will add icon themes to `XDG_ICON_DIRS`.
84116
85117- []{#ssec-gnome-hooks-gobject-introspection} `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](https://github.com/NixOS/nixpkgs/issues/32790) of packages using `wrapGAppsHook`.
86118
87− ::: warning
119+ ::: {.warning}
88120 The setup hook [currently](https://github.com/NixOS/nixpkgs/issues/56943) does not work in expressions with `strictDeps` enabled, like Python packages. In those cases, you will need to disable it with `strictDeps = false;`.
89121 :::
90122
91−- []{#ssec-gnome-hooks-gst-grl-plugins} 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`.
123+- []{#ssec-gnome-hooks-gst-grl-plugins} Setup hooks of `gst_all_1.gstreamer` and `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`.
92124
93125You can also pass additional arguments to `makeWrapper` using `gappsWrapperArgs` in `preFixup` hook:
94126
@@ -105,7 +137,7 @@ preFixup = ''
105137
106138## Updating GNOME packages {#ssec-gnome-updating}
107139
108−Most GNOME package offer [`updateScript`](#var-passthru-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.
140+Most GNOME package offer [`updateScript`](#var-passthru-updateScript), it is therefore possible to update to latest source tarball by running `nix-shell maintainers/scripts/update.nix --argstr package gnome.nautilus` or even en masse with `nix-shell maintainers/scripts/update.nix --argstr path gnome`. Read the package’s `NEWS` file to see what changed.
109141
110142## Frequently encountered issues {#ssec-gnome-common-issues}
111143
doc/languages-frameworks/go.section.md+25−16
@@ -12,7 +12,7 @@ The function `buildGoModule` builds Go programs managed with Go modules. It buil
1212In the following is an example expression using `buildGoModule`, the following arguments are of special significance to the function:
1313
1414- `vendorSha256`: is the hash of the output of the intermediate fetcher derivation. `vendorSha256` can also take `null` as an input. When `null` is used as a value, rather than fetching the dependencies and vendoring them, we use the vendoring included within the source repo. If you'd like to not have to update this field on dependency changes, run `go mod vendor` in your source repo and set `vendorSha256 = null;`
15−- `runVend`: runs the vend command to generate the vendor directory. This is useful if your code depends on c code and go mod tidy does not include the needed sources to build.
15+- `proxyVendor`: Fetches (go mod download) and proxies the vendor directory. This is useful if your code depends on c code and go mod tidy does not include the needed sources to build or if any dependency has case-insensitive conflicts which will produce platform dependant `vendorSha256` checksums.
1616
1717```nix
1818pet = buildGoModule rec {
@@ -28,14 +28,11 @@ pet = buildGoModule rec {
2828
2929 vendorSha256 = "1879j77k96684wi554rkjxydrj8g3hpp0kvxz03sd8dmwr3lh83j";
3030
31− runVend = true;
32−
3331 meta = with lib; {
3432 description = "Simple command-line snippet manager, written in Go";
3533 homepage = "https://github.com/knqyf263/pet";
3634 license = licenses.mit;
3735 maintainers = with maintainers; [ kalbasit ];
38− platforms = platforms.linux ++ platforms.darwin;
3936 };
4037}
4138```
@@ -44,7 +41,7 @@ pet = buildGoModule rec {
4441
4542The function `buildGoPackage` builds legacy Go programs, not supporting Go modules.
4643
47−### Example for `buildGoPackage`
44+### Example for `buildGoPackage` {#example-for-buildgopackage}
4845
4946In the following is an example expression using buildGoPackage, the following arguments are of special significance to the function:
5047
@@ -112,23 +109,31 @@ done
112109
113110Both `buildGoModule` and `buildGoPackage` can be tweaked to behave slightly differently, if the following attributes are used:
114111
115−### `buildFlagsArray` and `buildFlags`: {#ex-goBuildFlags-noarray}
112+### `ldflags` {#var-go-ldflags}
116113
117−These attributes set build flags supported by `go build`. We recommend using `buildFlagsArray`. The most common use case of these attributes is to make the resulting executable aware of its own version. For example:
114+Arguments to pass to the Go linker tool via the `-ldflags` argument of `go build`. The most common use case for this argument is to make the resulting executable aware of its own version. For example:
118115
119116```nix
120− buildFlagsArray = [
121− # Note: single quotes are not needed.
122− "-ldflags=-X main.Version=${version} -X main.Commit=${version}"
117+ ldflags = [
118+ "-s" "-w"
119+ "-X main.Version=${version}"
120+ "-X main.Commit=${version}"
123121 ];
124122```
125123
124+### `tags` {#var-go-tags}
125+
126+Arguments to pass to the Go via the `-tags` argument of `go build`. For example:
127+
126128```nix
127− buildFlagsArray = ''
128− -ldflags=
129− -X main.Version=${version}
130− -X main.Commit=${version}
131− '';
129+ tags = [
130+ "production"
131+ "sqlite"
132+ ];
133+```
134+
135+```nix
136+ tags = [ "production" ] ++ lib.optionals withSqlite [ "sqlite" ];
132137```
133138
134139### `deleteVendor` {#var-go-deleteVendor}
@@ -137,4 +142,8 @@ Removes the pre-existing vendor directory. This should only be used if the depen
137142
138143### `subPackages` {#var-go-subPackages}
139144
140−Limits the builder from building child packages that have not been listed. If <varname>subPackages</varname> is not specified, all child packages will be built.
145+Specified as a string or list of strings. Limits the builder from building child packages that have not been listed. If `subPackages` is not specified, all child packages will be built.
146+
147+### `excludedPackages` {#var-go-excludedPackages}
148+
149+Specified as a string or list of strings. Causes the builder to skip building child packages that match any of the provided values. If `excludedPackages` is not specified, all child packages will be built.
doc/languages-frameworks/hy.section.mdnew file+31
@@ -0,0 +1,31 @@
1+# Hy {#sec-language-hy}
2+
3+## Installation {#ssec-hy-installation}
4+
5+### Installation without packages {#installation-without-packages}
6+
7+You can install `hy` via nix-env or by adding it to `configuration.nix` by reffering to it as a `hy` attribute. This kind of installation adds `hy` to your environment and it succesfully works with `python3`.
8+
9+::: {.caution}
10+Packages that are installed with your python derivation, are not accesible by `hy` this way.
11+:::
12+
13+### Installation with packages {#installation-with-packages}
14+
15+Creating `hy` derivation with custom `python` packages is really simple and similar to the way that python does it. Attribute `hy` provides function `withPackages` that creates custom `hy` derivation with specified packages.
16+
17+For example if you want to create shell with `matplotlib` and `numpy`, you can do it like so:
18+
19+```ShellSession
20+$ nix-shell -p "hy.withPackages (ps: with ps; [ numpy matplotlib ])"
21+```
22+
23+Or if you want to extend your `configuration.nix`:
24+```nix
25+{ # ...
26+
27+ environment.systemPackages = with pkgs; [
28+ (hy.withPackages (py-packages: with py-packages; [ numpy matplotlib ]))
29+ ];
30+}
31+```
doc/languages-frameworks/idris.section.md+16−17
@@ -1,14 +1,11 @@
11# Idris {#idris}
22
3−## Installing Idris
3+## Installing Idris {#installing-idris}
44
55The easiest way to get a working idris version is to install the `idris` attribute:
66
7−```
8−$ # On NixOS
9−$ nix-env -i nixos.idris
10−$ # On non-NixOS
11−$ nix-env -i nixpkgs.idris
7+```ShellSession
8+$ nix-env -f "<nixpkgs>" -iA idris
129```
1310
1411This however only provides the `prelude` and `base` libraries. To install idris with additional libraries, you can use the `idrisPackages.with-packages` function, e.g. in an overlay in `~/.config/nixpkgs/overlays/my-idris.nix`:
@@ -21,7 +18,7 @@ self: super: {
2118
2219And then:
2320
24−```
21+```ShellSession
2522$ # On NixOS
2623$ nix-env -iA nixos.myIdris
2724$ # On non-NixOS
@@ -29,7 +26,8 @@ $ nix-env -iA nixpkgs.myIdris
2926```
3027
3128To see all available Idris packages:
32−```
29+
30+```ShellSession
3331$ # On NixOS
3432$ nix-env -qaPA nixos.idrisPackages
3533$ # On non-NixOS
@@ -37,22 +35,23 @@ $ nix-env -qaPA nixpkgs.idrisPackages
3735```
3836
3937Similarly, entering a `nix-shell`:
40−```
38+
39+```ShellSession
4140$ nix-shell -p 'idrisPackages.with-packages (with idrisPackages; [ contrib pruviloj ])'
4241```
4342
44−## Starting Idris with library support
43+## Starting Idris with library support {#starting-idris-with-library-support}
4544
4645To have access to these libraries in idris, call it with an argument `-p <library name>` for each library:
4746
48−```
47+```ShellSession
4948$ nix-shell -p 'idrisPackages.with-packages (with idrisPackages; [ contrib pruviloj ])'
5049[nix-shell:~]$ idris -p contrib -p pruviloj
5150```
5251
5352A listing of all available packages the Idris binary has access to is available via `--listlibs`:
5453
55−```
54+```ShellSession
5655$ idris --listlibs
575600prelude-idx.ibc
5857pruviloj
@@ -64,7 +63,7 @@ prelude
646300contrib-idx.ibc
6564```
6665
67−## Building an Idris project with Nix
66+## Building an Idris project with Nix {#building-an-idris-project-with-nix}
6867
6968As an example of how a Nix expression for an Idris package can be created, here is the one for `idrisPackages.yaml`:
7069
@@ -105,7 +104,7 @@ build-idris-package {
105104
106105Assuming this file is saved as `yaml.nix`, it's buildable using
107106
108−```
107+```ShellSession
109108$ nix-build -E '(import <nixpkgs> {}).idrisPackages.callPackage ./yaml.nix {}'
110109```
111110
@@ -121,11 +120,11 @@ with import <nixpkgs> {};
121120
122121in another file (say `default.nix`) to be able to build it with
123122
124−```
123+```ShellSession
125124$ nix-build -A yaml
126125```
127126
128−## Passing options to `idris` commands
127+## Passing options to `idris` commands {#passing-options-to-idris-commands}
129128
130129The `build-idris-package` function provides also optional input values to set additional options for the used `idris` commands.
131130
@@ -133,7 +132,7 @@ Specifically, you can set `idrisBuildOptions`, `idrisTestOptions`, `idrisInstall
133132
134133For example you could set
135134
136−```
135+```nix
137136build-idris-package {
138137 idrisBuildOptions = [ "--log" "1" "--verbose" ]
139138
doc/languages-frameworks/index.xml+8−1
@@ -9,19 +9,26 @@
99 <xi:include href="android.section.xml" />
1010 <xi:include href="beam.section.xml" />
1111 <xi:include href="bower.section.xml" />
12+ <xi:include href="chicken.section.xml" />
1213 <xi:include href="coq.section.xml" />
1314 <xi:include href="crystal.section.xml" />
15+ <xi:include href="cuda.section.xml" />
16+ <xi:include href="dhall.section.xml" />
17+ <xi:include href="dotnet.section.xml" />
1418 <xi:include href="emscripten.section.xml" />
1519 <xi:include href="gnome.section.xml" />
1620 <xi:include href="go.section.xml" />
1721 <xi:include href="haskell.section.xml" />
22+ <xi:include href="hy.section.xml" />
1823 <xi:include href="idris.section.xml" />
1924 <xi:include href="ios.section.xml" />
2025 <xi:include href="java.section.xml" />
26+ <xi:include href="javascript.section.xml" />
2127 <xi:include href="lua.section.xml" />
2228 <xi:include href="maven.section.xml" />
23− <xi:include href="node.section.xml" />
29+ <xi:include href="nim.section.xml" />
2430 <xi:include href="ocaml.section.xml" />
31+ <xi:include href="octave.section.xml" />
2532 <xi:include href="perl.section.xml" />
2633 <xi:include href="php.section.xml" />
2734 <xi:include href="python.section.xml" />
doc/languages-frameworks/ios.section.md+9−8
@@ -20,8 +20,8 @@ Hydra.
2020
2121The Xcode build environment implements a number of features.
2222
23−Deploying a proxy component wrapper exposing Xcode
24−--------------------------------------------------
23+## Deploying a proxy component wrapper exposing Xcode {#deploying-a-proxy-component-wrapper-exposing-xcode}
24+
2525The first use case is deploying a Nix package that provides symlinks to the Xcode
2626installation on the host system. This package can be used as a build input to
2727any build function implemented in the Nix expression language that requires
@@ -55,8 +55,8 @@ lrwxr-xr-x 1 sander staff 61 1 jan 1970 xcodebuild -> /Applications/Xcode.a
5555lrwxr-xr-x 1 sander staff 14 1 jan 1970 xcrun -> /usr/bin/xcrun
5656```
5757
58−Building an iOS application
59−---------------------------
58+## Building an iOS application {#building-an-ios-application}
59+
6060We can build an iOS app executable for the simulator, or an IPA/xcarchive file
6161for release purposes, e.g. ad-hoc, enterprise or store installations, by
6262executing the `xcodeenv.buildApp {}` function:
@@ -99,6 +99,7 @@ xcodeenv.buildApp {
9999```
100100
101101The above function takes a variety of parameters:
102+
102103* The `name` and `src` parameters are mandatory and specify the name of the app
103104 and the location where the source code resides
104105* `sdkVersion` specifies which version of the iOS SDK to use.
@@ -151,8 +152,8 @@ the `xcodeenv.composeXcodeWrapper {}` function takes. For example, the
151152`xcodeBaseDir` parameter can be overridden to refer to a different Xcode
152153version.
153154
154−Spawning simulator instances
155−----------------------------
155+## Spawning simulator instances {#spawning-simulator-instances}
156+
156157In addition to building iOS apps, we can also automatically spawn simulator
157158instances:
158159
@@ -213,8 +214,8 @@ xcode.simulateApp {
213214By providing the result of an `xcode.buildApp {}` function and configuring the
214215app bundle id, the app gets deployed automatically and started.
215216
216−Troubleshooting
217−---------------
217+## Troubleshooting {#troubleshooting}
218+
218219In some rare cases, it may happen that after a failure, changes are not picked
219220up. Most likely, this is caused by a derived data cache that Xcode maintains.
220221To wipe it you can run:
doc/languages-frameworks/java.section.md+9
@@ -72,6 +72,15 @@ in
7272 ...
7373```
7474
75+You can also specify what JDK your JRE should be based on, for example
76+selecting a 'headless' build to avoid including a link to GTK+:
77+
78+```nix
79+my_jre = pkgs.jre_minimal.override {
80+ jdk = jdk11_headless;
81+};
82+```
83+
7584Note all JDKs passthru `home`, so if your application requires
7685environment variables like `JAVA_HOME` being set, that can be done in a
7786generic fashion with the `--set` argument of `makeWrapper`:
doc/languages-frameworks/javascript.section.mdnew file+278
@@ -0,0 +1,278 @@
1+# Javascript {#language-javascript}
2+
3+## Introduction {#javascript-introduction}
4+
5+This contains instructions on how to package javascript applications.
6+
7+The various tools available will be listed in the [tools-overview](#javascript-tools-overview). Some general principles for packaging will follow. Finally some tool specific instructions will be given.
8+
9+## Getting unstuck / finding code examples
10+
11+If you find you are lacking inspiration for packing javascript applications, the links below might prove useful.
12+Searching online for prior art can be helpful if you are running into solved problems.
13+
14+### Github
15+
16+- Searching Nix files for `mkYarnPackage`: <https://github.com/search?q=mkYarnPackage+language%3ANix&type=code>
17+
18+- Searching just `flake.nix` files for `mkYarnPackage`: <https://github.com/search?q=mkYarnPackage+filename%3Aflake.nix&type=code>
19+
20+### Gitlab
21+
22+- Searching Nix files for `mkYarnPackage`: <https://gitlab.com/search?scope=blobs&search=mkYarnPackage+extension%3Anix>
23+
24+- Searching just `flake.nix` files for `mkYarnPackage`: <https://gitlab.com/search?scope=blobs&search=mkYarnPackage+filename%3Aflake.nix>
25+
26+## Tools overview {#javascript-tools-overview}
27+
28+## General principles {#javascript-general-principles}
29+
30+The following principles are given in order of importance with potential exceptions.
31+
32+### Try to use the same node version used upstream {#javascript-upstream-node-version}
33+
34+It is often not documented which node version is used upstream, but if it is, try to use the same version when packaging.
35+
36+This can be a problem if upstream is using the latest and greatest and you are trying to use an earlier version of node. Some cryptic errors regarding V8 may appear.
37+
38+An exception to this:
39+
40+### Try to respect the package manager originally used by upstream (and use the upstream lock file) {#javascript-upstream-package-manager}
41+
42+A lock file (package-lock.json, yarn.lock...) is supposed to make reproducible installations of node_modules for each tool.
43+
44+Guidelines of package managers, recommend to commit those lock files to the repos. If a particular lock file is present, it is a strong indication of which package manager is used upstream.
45+
46+It's better to try to use a nix tool that understand the lock file. Using a different tool might give you hard to understand error because different packages have been installed. An example of problems that could arise can be found [here](https://github.com/NixOS/nixpkgs/pull/126629). Upstream uses npm, but this is an attempt to package it with yarn2nix (that uses yarn.lock)
47+
48+Using a different tool forces to commit a lock file to the repository. Those files are fairly large, so when packaging for nixpkgs, this approach does not scale well.
49+
50+Exceptions to this rule are:
51+
52+- when you encounter one of the bugs from a nix tool. In each of the tool specific instructions, known problems will be detailed. If you have a problem with a particular tool, then it's best to try another tool, even if this means you will have to recreate a lock file and commit it to nixpkgs. In general yarn2nix has less known problems and so a simple search in nixpkgs will reveal many yarn.lock files committed
53+- Some lock files contain particular version of a package that has been pulled off npm for some reason. In that case, you can recreate upstream lock (by removing the original and `npm install`, `yarn`, ...) and commit this to nixpkgs.
54+- The only tool that supports workspaces (a feature of npm that helps manage sub-directories with different package.json from a single top level package.json) is yarn2nix. If upstream has workspaces you should try yarn2nix.
55+
56+### Try to use upstream package.json {#javascript-upstream-package-json}
57+
58+Exceptions to this rule are
59+
60+- Sometimes the upstream repo assumes some dependencies be installed globally. In that case you can add them manually to the upstream package.json (`yarn add xxx` or `npm install xxx`, ...). Dependencies that are installed locally can be executed with `npx` for cli tools. (e.g. `npx postcss ...`, this is how you can call those dependencies in the phases).
61+- Sometimes there is a version conflict between some dependency requirements. In that case you can fix a version (by removing the `^`).
62+- Sometimes the script defined in the package.json does not work as is. Some scripts for example use cli tools that might not be available, or cd in directory with a different package.json (for workspaces notably). In that case, it's perfectly fine to look at what the particular script is doing and break this down in the phases. In the build script you can see `build:*` calling in turns several other build scripts like `build:ui` or `build:server`. If one of those fails, you can try to separate those into:
63+
64+```Shell
65+yarn build:ui
66+yarn build:server
67+# OR
68+npm run build:ui
69+npm run build:server
70+```
71+
72+when you need to override a package.json. It's nice to use the one from the upstream src and do some explicit override. Here is an example.
73+
74+```nix
75+patchedPackageJSON = final.runCommand "package.json" { } ''
76+ ${jq}/bin/jq '.version = "0.4.0" |
77+ .devDependencies."@jsdoc/cli" = "^0.2.5"
78+ ${sonar-src}/package.json > $out
79+'';
80+```
81+
82+you will still need to commit the modified version of the lock files, but at least the overrides are explicit for everyone to see.
83+
84+### Using node_modules directly {#javascript-using-node_modules}
85+
86+each tool has an abstraction to just build the node_modules (dependencies) directory. you can always use the stdenv.mkDerivation with the node_modules to build the package (symlink the node_modules directory and then use the package build command). the node_modules abstraction can be also used to build some web framework frontends. For an example of this see how [plausible](https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/web-apps/plausible/default.nix) is built. mkYarnModules to make the derivation containing node_modules. Then when building the frontend you can just symlink the node_modules directory
87+
88+## Javascript packages inside nixpkgs {#javascript-packages-nixpkgs}
89+
90+The `pkgs/development/node-packages` folder contains a generated collection of
91+[NPM packages](https://npmjs.com/) that can be installed with the Nix package
92+manager.
93+
94+As a rule of thumb, the package set should only provide _end user_ software
95+packages, such as command-line utilities. Libraries should only be added to the
96+package set if there is a non-NPM package that requires it.
97+
98+When it is desired to use NPM libraries in a development project, use the
99+`node2nix` generator directly on the `package.json` configuration file of the
100+project.
101+
102+The package set provides support for the official stable Node.js versions.
103+The latest stable LTS release in `nodePackages`, as well as the latest stable
104+Current release in `nodePackages_latest`.
105+
106+If your package uses native addons, you need to examine what kind of native
107+build system it uses. Here are some examples:
108+
109+- `node-gyp`
110+- `node-gyp-builder`
111+- `node-pre-gyp`
112+
113+After you have identified the correct system, you need to override your package
114+expression while adding in build system as a build input. For example, `dat`
115+requires `node-gyp-build`, so [we override](https://github.com/NixOS/nixpkgs/blob/32f5e5da4a1b3f0595527f5195ac3a91451e9b56/pkgs/development/node-packages/default.nix#L37-L40) its expression in [`default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/node-packages/default.nix):
116+
117+```nix
118+ dat = super.dat.override {
119+ buildInputs = [ self.node-gyp-build pkgs.libtool pkgs.autoconf pkgs.automake ];
120+ meta.broken = since "12";
121+ };
122+```
123+
124+### Adding and Updating Javascript packages in nixpkgs
125+
126+To add a package from NPM to nixpkgs:
127+
128+1. Modify `pkgs/development/node-packages/node-packages.json` to add, update
129+ or remove package entries to have it included in `nodePackages` and
130+ `nodePackages_latest`.
131+2. Run the script: `./pkgs/development/node-packages/generate.sh`.
132+3. Build your new package to test your changes:
133+ `cd /path/to/nixpkgs && nix-build -A nodePackages.<new-or-updated-package>`.
134+ To build against the latest stable Current Node.js version (e.g. 14.x):
135+ `nix-build -A nodePackages_latest.<new-or-updated-package>`
136+4. Add and commit all modified and generated files.
137+
138+For more information about the generation process, consult the
139+[README.md](https://github.com/svanderburg/node2nix) file of the `node2nix`
140+tool.
141+
142+To update NPM packages in nixpkgs, run the same `generate.sh` script:
143+
144+```sh
145+./pkgs/development/node-packages/generate.sh
146+```
147+
148+#### Git protocol error
149+
150+Some packages may have Git dependencies from GitHub specified with `git://`.
151+GitHub has
152+[disabled unecrypted Git connections](https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git),
153+so you may see the following error when running the generate script:
154+`The unauthenticated git protocol on port 9418 is no longer supported`.
155+
156+Use the following Git configuration to resolve the issue:
157+
158+```sh
159+git config --global url."https://github.com/".insteadOf git://github.com/
160+```
161+
162+## Tool specific instructions {#javascript-tool-specific}
163+
164+### node2nix {#javascript-node2nix}
165+
166+#### Preparation {#javascript-node2nix-preparation}
167+
168+you will need to generate a nix expression for the dependencies
169+
170+- don't forget the `-l package-lock.json` if there is a lock file
171+- Most probably you will need the `--development` to include the `devDependencies`
172+
173+so the command will most likely be
174+`node2nix --development -l package-lock.json`
175+
176+[link to the doc in the repo](https://github.com/svanderburg/node2nix)
177+
178+#### Pitfalls {#javascript-node2nix-pitfalls}
179+
180+- if upstream package.json does not have a "version" attribute, node2nix will crash. You will need to add it like shown in [the package.json section](#javascript-upstream-package-json)
181+- node2nix has some [bugs](https://github.com/svanderburg/node2nix/issues/238). related to working with lock files from npm distributed with nodejs-16_x
182+- node2nix does not like missing packages from npm. If you see something like `Cannot resolve version: vue-loader-v16@undefined` then you might want to try another tool. The package might have been pulled off of npm.
183+
184+### yarn2nix {#javascript-yarn2nix}
185+
186+#### Preparation {#javascript-yarn2nix-preparation}
187+
188+you will need at least a yarn.lock and yarn.nix file
189+
190+- generate a yarn.lock in upstream if it is not already there
191+- `yarn2nix > yarn.nix` will generate the dependencies in a nix format
192+
193+#### mkYarnPackage {#javascript-yarn2nix-mkYarnPackage}
194+
195+this will by default try to generate a binary. For package only generating static assets (Svelte, Vue, React...), you will need to explicitly override the build step with your instructions. It's important to use the `--offline` flag. For example if you script is `"build": "something"` in package.json use
196+
197+```nix
198+buildPhase = ''
199+ yarn build --offline
200+'';
201+```
202+
203+The dist phase is also trying to build a binary, the only way to override it is with
204+
205+```nix
206+distPhase = "true";
207+```
208+
209+the configure phase can sometimes fail because it tries to be too clever.
210+One common override is
211+
212+```nix
213+configurePhase = "ln -s $node_modules node_modules";
214+```
215+
216+#### mkYarnModules {#javascript-yarn2nix-mkYarnModules}
217+
218+this will generate a derivation including the node_modules. If you have to build a derivation for an integrated web framework (rails, phoenix..), this is probably the easiest way. [Plausible](https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/web-apps/plausible/default.nix#L39) offers a good example of how to do this.
219+
220+#### Overriding dependency behavior
221+
222+In the `mkYarnPackage` record the property `pkgConfig` can be used to override packages when you encounter problems building.
223+
224+For instance, say your package is throwing errors when trying to invoke node-sass: `ENOENT: no such file or directory, scandir '/build/source/node_modules/node-sass/vendor'`
225+
226+To fix this we will specify different versions of build inputs to use, as well as some post install steps to get the software built the way we want:
227+
228+```nix
229+mkYarnPackage rec {
230+ pkgConfig = {
231+ node-sass = {
232+ buildInputs = with final;[ python libsass pkg-config ];
233+ postInstall = ''
234+ LIBSASS_EXT=auto yarn --offline run build
235+ rm build/config.gypi
236+ '';
237+ };
238+ };
239+}
240+```
241+
242+#### Pitfalls {#javascript-yarn2nix-pitfalls}
243+
244+- if version is missing from upstream package.json, yarn will silently install nothing. In that case, you will need to override package.json as shown in the [package.json section](#javascript-upstream-package-json)
245+
246+- having trouble with node-gyp? Try adding these lines to the `yarnPreBuild` steps:
247+
248+ ```nix
249+ yarnPreBuild = ''
250+ mkdir -p $HOME/.node-gyp/${nodejs.version}
251+ echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion
252+ ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version}
253+ export npm_config_nodedir=${nodejs}
254+ '';
255+ ```
256+
257+ - The `echo 9` steps comes from this answer: <https://stackoverflow.com/a/49139496>
258+ - Exporting the headers in `npm_config_nodedir` comes from this issue: <https://github.com/nodejs/node-gyp/issues/1191#issuecomment-301243919>
259+
260+## Outside of nixpkgs {#javascript-outside-nixpkgs}
261+
262+There are some other options available that can't be used inside nixpkgs. Those other options are written in nix. Importing them in nixpkgs will require moving the source code into nixpkgs. Using [Import From Derivation](https://nixos.wiki/wiki/Import_From_Derivation) is not allowed in hydra at present. If you are packaging something outside nixpkgs, those can be considered
263+
264+### npmlock2nix {#javascript-npmlock2nix}
265+
266+[npmlock2nix](https://github.com/nix-community/npmlock2nix) aims at building node_modules without code generation. It hasn't reached v1 yet, the api might be subject to change.
267+
268+#### Pitfalls {#javascript-npmlock2nix-pitfalls}
269+
270+- there are some [problems with npm v7](https://github.com/tweag/npmlock2nix/issues/45).
271+
272+### nix-npm-buildpackage {#javascript-nix-npm-buildpackage}
273+
274+[nix-npm-buildpackage](https://github.com/serokell/nix-npm-buildpackage) aims at building node_modules without code generation. It hasn't reached v1 yet, the api might change. It supports both package-lock.json and yarn.lock.
275+
276+#### Pitfalls {#javascript-nix-npm-buildpackage-pitfalls}
277+
278+- there are some [problems with npm v7](https://github.com/serokell/nix-npm-buildpackage/issues/33).
doc/languages-frameworks/lua.section.md+37−29
@@ -1,8 +1,8 @@
1−# User's Guide to Lua Infrastructure {#users-guide-to-lua-infrastructure}
1+# User’s Guide to Lua Infrastructure {#users-guide-to-lua-infrastructure}
22
3−## Using Lua
3+## Using Lua {#using-lua}
44
5−### Overview of Lua
5+### Overview of Lua {#overview-of-lua}
66
77Several versions of the Lua interpreter are available: luajit, lua 5.1, 5.2, 5.3.
88The attribute `lua` refers to the default interpreter, it is also possible to refer to specific versions, e.g. `lua5_2` refers to Lua 5.2.
@@ -17,27 +17,31 @@ The main package set contains aliases to these package sets, e.g.
1717`luaPackages` refers to `lua5_1.pkgs` and `lua52Packages` to
1818`lua5_2.pkgs`.
1919
20−### Installing Lua and packages
20+### Installing Lua and packages {#installing-lua-and-packages}
2121
22−#### Lua environment defined in separate `.nix` file
22+#### Lua environment defined in separate `.nix` file {#lua-environment-defined-in-separate-.nix-file}
2323
2424Create a file, e.g. `build.nix`, with the following expression
25+
2526```nix
2627with import <nixpkgs> {};
2728
2829lua5_2.withPackages (ps: with ps; [ busted luafilesystem ])
2930```
31+
3032and install it in your profile with
33+
3134```shell
3235nix-env -if build.nix
3336```
3437Now you can use the Lua interpreter, as well as the extra packages (`busted`,
3538`luafilesystem`) that you added to the environment.
3639
37−#### Lua environment defined in `~/.config/nixpkgs/config.nix`
40+#### Lua environment defined in `~/.config/nixpkgs/config.nix` {#lua-environment-defined-in-.confignixpkgsconfig.nix}
3841
3942If you prefer to, you could also add the environment as a package override to the Nixpkgs set, e.g.
4043using `config.nix`,
44+
4145```nix
4246{ # ...
4347
@@ -46,14 +50,16 @@ using `config.nix`,
4650 };
4751}
4852```
53+
4954and install it in your profile with
55+
5056```shell
5157nix-env -iA nixpkgs.myLuaEnv
5258```
5359The environment is installed by referring to the attribute, and considering
5460the `nixpkgs` channel was used.
5561
56−#### Lua environment defined in `/etc/nixos/configuration.nix`
62+#### Lua environment defined in `/etc/nixos/configuration.nix` {#lua-environment-defined-in-etcnixosconfiguration.nix}
5763
5864For the sake of completeness, here's another example how to install the environment system-wide.
5965
@@ -66,7 +72,7 @@ For the sake of completeness, here's another example how to install the environm
6672}
6773```
6874
69−### How to override a Lua package using overlays?
75+### How to override a Lua package using overlays? {#how-to-override-a-lua-package-using-overlays}
7076
7177Use the following overlay template:
7278
@@ -87,18 +93,22 @@ final: prev:
8793}
8894```
8995
90−### Temporary Lua environment with `nix-shell`
96+### Temporary Lua environment with `nix-shell` {#temporary-lua-environment-with-nix-shell}
9197
9298
9399There are two methods for loading a shell with Lua packages. The first and recommended method
94100is to create an environment with `lua.buildEnv` or `lua.withPackages` and load that. E.g.
101+
95102```sh
96103$ nix-shell -p 'lua.withPackages(ps: with ps; [ busted luafilesystem ])'
97104```
105+
98106opens a shell from which you can launch the interpreter
107+
99108```sh
100109[nix-shell:~] lua
101110```
111+
102112The other method, which is not recommended, does not create an environment and requires you to list the packages directly,
103113
104114```sh
@@ -108,7 +118,7 @@ Again, it is possible to launch the interpreter from the shell.
108118The Lua interpreter has the attribute `pkgs` which contains all Lua libraries for that specific interpreter.
109119
110120
111−## Developing with Lua
121+## Developing with Lua {#developing-with-lua}
112122
113123Now that you know how to get a working Lua environment with Nix, it is time
114124to go forward and start actually developing with Lua. There are two ways to
@@ -116,9 +126,9 @@ package lua software, either it is on luarocks and most of it can be taken care
116126of by the luarocks2nix converter or the packaging has to be done manually.
117127Let's present the luarocks way first and the manual one in a second time.
118128
119−### Packaging a library on luarocks
129+### Packaging a library on luarocks {#packaging-a-library-on-luarocks}
120130
121−[Luarocks.org](www.luarocks.org) is the main repository of lua packages.
131+[Luarocks.org](https://luarocks.org/) is the main repository of lua packages.
122132The site proposes two types of packages, the rockspec and the src.rock
123133(equivalent of a [rockspec](https://github.com/luarocks/luarocks/wiki/Rockspec-format) but with the source).
124134These packages can have different build types such as `cmake`, `builtin` etc .
@@ -129,16 +139,15 @@ the whitelist maintainers/scripts/luarocks-packages.csv and updated by running m
129139[luarocks2nix](https://github.com/nix-community/luarocks) is a tool capable of generating nix derivations from both rockspec and src.rock (and favors the src.rock).
130140The automation only goes so far though and some packages need to be customized.
131141These customizations go in `pkgs/development/lua-modules/overrides.nix`.
132−For instance if the rockspec defines `external_dependencies`, these need to be manually added in its rockspec file then it won't work.
142+For instance if the rockspec defines `external_dependencies`, these need to be manually added to the overrides.nix.
133143
134144You can try converting luarocks packages to nix packages with the command `nix-shell -p luarocks-nix` and then `luarocks nix PKG_NAME`.
135−Nix rely on luarocks to install lua packages, basically it runs:
136−`luarocks make --deps-mode=none --tree $out`
137145
138−#### Packaging a library manually
146+#### Packaging a library manually {#packaging-a-library-manually}
139147
140148You can develop your package as you usually would, just don't forget to wrap it
141149within a `toLuaModule` call, for instance
150+
142151```nix
143152mynewlib = toLuaModule ( stdenv.mkDerivation { ... });
144153```
@@ -146,16 +155,15 @@ mynewlib = toLuaModule ( stdenv.mkDerivation { ... });
146155There is also the `buildLuaPackage` function that can be used when lua modules
147156are not packaged for luarocks. You can see a few examples at `pkgs/top-level/lua-packages.nix`.
148157
149−## Lua Reference
158+## Lua Reference {#lua-reference}
150159
151−### Lua interpreters
160+### Lua interpreters {#lua-interpreters}
152161
153−Versions 5.1, 5.2 and 5.3 of the lua interpreter are available as
154−respectively `lua5_1`, `lua5_2` and `lua5_3`. Luajit is available too.
162+Versions 5.1, 5.2, 5.3 and 5.4 of the lua interpreter are available as
163+respectively `lua5_1`, `lua5_2`, `lua5_3` and `lua5_4`. Luajit is available too.
155164The Nix expressions for the interpreters can be found in `pkgs/development/interpreters/lua-5`.
156165
157−
158−#### Attributes on lua interpreters packages
166+#### Attributes on lua interpreters packages {#attributes-on-lua-interpreters-packages}
159167
160168Each interpreter has the following attributes:
161169
@@ -164,8 +172,7 @@ Each interpreter has the following attributes:
164172- `withPackages`. Simpler interface to `buildEnv`.
165173- `pkgs`. Set of Lua packages for that specific interpreter. The package set can be modified by overriding the interpreter and passing `packageOverrides`.
166174
167−
168−#### `buildLuarocksPackage` function
175+#### `buildLuarocksPackage` function {#buildluarockspackage-function}
169176
170177The `buildLuarocksPackage` function is implemented in `pkgs/development/interpreters/lua-5/build-lua-package.nix`
171178The following is an example:
@@ -205,16 +212,17 @@ install the package
205212
206213By default `meta.platforms` is set to the same value as the interpreter unless overridden otherwise.
207214
208−#### `buildLuaApplication` function
215+#### `buildLuaApplication` function {#buildluaapplication-function}
209216
210217The `buildLuaApplication` function is practically the same as `buildLuaPackage`.
211218The difference is that `buildLuaPackage` by default prefixes the names of the packages with the version of the interpreter.
212219Because with an application we're not interested in multiple version the prefix is dropped.
213220
214−#### lua.withPackages function
221+#### lua.withPackages function {#lua.withpackages-function}
215222
216223The `lua.withPackages` takes a function as an argument that is passed the set of lua packages and returns the list of packages to be included in the environment.
217224Using the `withPackages` function, the previous example for the luafilesystem environment can be written like this:
225+
218226```nix
219227with import <nixpkgs> {};
220228
@@ -223,6 +231,7 @@ lua.withPackages (ps: [ps.luafilesystem])
223231
224232`withPackages` passes the correct package set for the specific interpreter version as an argument to the function. In the above example, `ps` equals `luaPackages`.
225233But you can also easily switch to using `lua5_2`:
234+
226235```nix
227236with import <nixpkgs> {};
228237
@@ -231,13 +240,12 @@ lua5_2.withPackages (ps: [ps.lua])
231240
232241Now, `ps` is set to `lua52Packages`, matching the version of the interpreter.
233242
234−
235−### Possible Todos
243+### Possible Todos {#possible-todos}
236244
237245* export/use version specific variables such as `LUA_PATH_5_2`/`LUAROCKS_CONFIG_5_2`
238246* let luarocks check for dependencies via exporting the different rocktrees in temporary config
239247
240−### Lua Contributing guidelines
248+### Lua Contributing guidelines {#lua-contributing-guidelines}
241249
242250Following rules should be respected:
243251
doc/languages-frameworks/maven.section.md+10−7
@@ -43,9 +43,9 @@ public class Main {
4343
4444You find this demo project at https://github.com/fzakaria/nixos-maven-example
4545
46−## Solving for dependencies
46+## Solving for dependencies {#solving-for-dependencies}
4747
48−### buildMaven with NixOS/mvn2nix-maven-plugin
48+### buildMaven with NixOS/mvn2nix-maven-plugin {#buildmaven-with-nixosmvn2nix-maven-plugin}
4949
5050> ⚠️ Although `buildMaven` is the "blessed" way within nixpkgs, as of 2020, it hasn't seen much activity in quite a while.
5151
@@ -82,6 +82,7 @@ This file is then given to the `buildMaven` function, and it returns 2 attribute
8282 A simple derivation that runs through `mvn compile` & `mvn package` to build the JAR. You may use this as inspiration for more complicated derivations.
8383
8484Here is an [example](https://github.com/fzakaria/nixos-maven-example/blob/main/build-maven-repository.nix) of building the Maven repository
85+
8586```nix
8687{ pkgs ? import <nixpkgs> { } }:
8788with pkgs;
@@ -103,7 +104,8 @@ The benefit over the _double invocation_ as we will see below, is that the _/nix
103104│ └── 4.1.3
104105│ ├── avalon-framework-4.1.3.jar -> /nix/store/iv5fp3955w3nq28ff9xfz86wvxbiw6n9-avalon-framework-4.1.3.jar
105106```
106−### Double Invocation
107+
108+### Double Invocation {#double-invocation}
107109
108110> ⚠️ This pattern is the simplest but may cause unnecessary rebuilds due to the output hash changing.
109111
@@ -163,7 +165,7 @@ The build will fail, and tell you the expected `outputHash` to place. When you'v
163165
164166If your package uses _SNAPSHOT_ dependencies or _version ranges_; there is a strong likelihood that over-time your output hash will change since the resolved dependencies may change. Hence this method is less recommended then using `buildMaven`.
165167
166−## Building a JAR
168+## Building a JAR {#building-a-jar}
167169
168170Regardless of which strategy is chosen above, the step to build the derivation is the same.
169171
@@ -201,7 +203,7 @@ in stdenv.mkDerivation rec {
2012032 directories, 1 file
202204```
203205
204−## Runnable JAR
206+## Runnable JAR {#runnable-jar}
205207
206208The previous example builds a `jar` file but that's not a file one can run.
207209
@@ -213,7 +215,7 @@ We will use the same repository we built above (either _double invocation_ or _b
213215
214216The following two methods are more suited to Nix then building an [UberJar](https://imagej.net/Uber-JAR) which may be the more traditional approach.
215217
216−### CLASSPATH
218+### CLASSPATH {#classpath}
217219
218220> This is ideal if you are providing a derivation for _nixpkgs_ and don't want to patch the project's `pom.xml`.
219221
@@ -252,11 +254,12 @@ in stdenv.mkDerivation rec {
252254}
253255```
254256
255−### MANIFEST file via Maven Plugin
257+### MANIFEST file via Maven Plugin {#manifest-file-via-maven-plugin}
256258
257259> This is ideal if you are the project owner and want to change your `pom.xml` to set the CLASSPATH within it.
258260
259261Augment the `pom.xml` to create a JAR with the following manifest:
262+
260263```xml
261264<build>
262265 <plugins>
doc/languages-frameworks/nim.section.mdnew file+91
@@ -0,0 +1,91 @@
1+# Nim {#nim}
2+
3+## Overview {#nim-overview}
4+
5+The Nim compiler, a builder function, and some packaged libraries are available
6+in Nixpkgs. Until now each compiler release has been effectively backwards
7+compatible so only the latest version is available.
8+
9+## Nim program packages in Nixpkgs {#nim-program-packages-in-nixpkgs}
10+
11+Nim programs can be built using `nimPackages.buildNimPackage`. In the
12+case of packages not containing exported library code the attribute
13+`nimBinOnly` should be set to `true`.
14+
15+The following example shows a Nim program that depends only on Nim libraries:
16+
17+```nix
18+{ lib, nimPackages, fetchurl }:
19+
20+nimPackages.buildNimPackage rec {
21+ pname = "hottext";
22+ version = "1.4";
23+
24+ nimBinOnly = true;
25+
26+ src = fetchurl {
27+ url = "https://git.sr.ht/~ehmry/hottext/archive/v${version}.tar.gz";
28+ sha256 = "sha256-hIUofi81zowSMbt1lUsxCnVzfJGN3FEiTtN8CEFpwzY=";
29+ };
30+
31+ buildInputs = with nimPackages; [
32+ bumpy
33+ chroma
34+ flatty
35+ nimsimd
36+ pixie
37+ sdl2
38+ typography
39+ vmath
40+ zippy
41+ ];
42+}
43+
44+```
45+
46+## Nim library packages in Nixpkgs {#nim-library-packages-in-nixpkgs}
47+
48+
49+Nim libraries can also be built using `nimPackages.buildNimPackage`, but
50+often the product of a fetcher is sufficient to satisfy a dependency.
51+The `fetchgit`, `fetchFromGitHub`, and `fetchNimble` functions yield an
52+output that can be discovered during the `configurePhase` of `buildNimPackage`.
53+
54+Nim library packages are listed in
55+[pkgs/top-level/nim-packages.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/nim-packages.nix) and implemented at
56+[pkgs/development/nim-packages](https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/nim-packages).
57+
58+The following example shows a Nim library that propagates a dependency on a
59+non-Nim package:
60+```nix
61+{ lib, buildNimPackage, fetchNimble, SDL2 }:
62+
63+buildNimPackage rec {
64+ pname = "sdl2";
65+ version = "2.0.4";
66+ src = fetchNimble {
67+ inherit pname version;
68+ hash = "sha256-Vtcj8goI4zZPQs2TbFoBFlcR5UqDtOldaXSH/+/xULk=";
69+ };
70+ propagatedBuildInputs = [ SDL2 ];
71+}
72+```
73+
74+## `buildNimPackage` parameters {#buildnimpackage-parameters}
75+
76+All parameters from `stdenv.mkDerivation` function are still supported. The
77+following are specific to `buildNimPackage`:
78+
79+* `nimBinOnly ? false`: If `true` then build only the programs listed in
80+ the Nimble file in the packages sources.
81+* `nimbleFile`: Specify the Nimble file location of the package being built
82+ rather than discover the file at build-time.
83+* `nimRelease ? true`: Build the package in *release* mode.
84+* `nimDefines ? []`: A list of Nim defines. Key-value tuples are not supported.
85+* `nimFlags ? []`: A list of command line arguments to pass to the Nim compiler.
86+ Use this to specify defines with arguments in the form of `-d:${name}=${value}`.
87+* `nimDoc` ? false`: Build and install HTML documentation.
88+
89+* `buildInputs` ? []: The packages listed here will be searched for `*.nimble`
90+ files which are used to populate the Nim library path. Otherwise the standard
91+ behavior is in effect.
doc/languages-frameworks/node.section.mddeleted−51
@@ -1,51 +0,0 @@
1−# Node.js {#node.js}
2−
3−The `pkgs/development/node-packages` folder contains a generated collection of
4−[NPM packages](https://npmjs.com/) that can be installed with the Nix package
5−manager.
6−
7−As a rule of thumb, the package set should only provide *end user* software
8−packages, such as command-line utilities. Libraries should only be added to the
9−package set if there is a non-NPM package that requires it.
10−
11−When it is desired to use NPM libraries in a development project, use the
12−`node2nix` generator directly on the `package.json` configuration file of the
13−project.
14−
15−The package set provides support for the official stable Node.js versions.
16−The latest stable LTS release in `nodePackages`, as well as the latest stable
17−Current release in `nodePackages_latest`.
18−
19−If your package uses native addons, you need to examine what kind of native
20−build system it uses. Here are some examples:
21−
22−* `node-gyp`
23−* `node-gyp-builder`
24−* `node-pre-gyp`
25−
26−After you have identified the correct system, you need to override your package
27−expression while adding in build system as a build input. For example, `dat`
28−requires `node-gyp-build`, so [we override](https://github.com/NixOS/nixpkgs/blob/32f5e5da4a1b3f0595527f5195ac3a91451e9b56/pkgs/development/node-packages/default.nix#L37-L40) its expression in [`default.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/node-packages/default.nix):
29−
30−```nix
31− dat = super.dat.override {
32− buildInputs = [ self.node-gyp-build pkgs.libtool pkgs.autoconf pkgs.automake ];
33− meta.broken = since "12";
34− };
35−```
36−
37−To add a package from NPM to nixpkgs:
38−
39− 1. Modify `pkgs/development/node-packages/node-packages.json` to add, update
40− or remove package entries to have it included in `nodePackages` and
41− `nodePackages_latest`.
42− 2. Run the script: `(cd pkgs/development/node-packages && ./generate.sh)`.
43− 3. Build your new package to test your changes:
44− `cd /path/to/nixpkgs && nix-build -A nodePackages.<new-or-updated-package>`.
45− To build against the latest stable Current Node.js version (e.g. 14.x):
46− `nix-build -A nodePackages_latest.<new-or-updated-package>`
47− 4. Add and commit all modified and generated files.
48−
49−For more information about the generation process, consult the
50−[README.md](https://github.com/svanderburg/node2nix) file of the `node2nix`
51−tool.
doc/languages-frameworks/ocaml.section.md+86−25
@@ -1,63 +1,116 @@
11# OCaml {#sec-language-ocaml}
22
3+## User guide {#sec-language-ocaml-user-guide}
4+
5+OCaml libraries are available in attribute sets of the form `ocaml-ng.ocamlPackages_X_XX` where X is to be replaced with the desired compiler version. For example, ocamlgraph compiled with OCaml 4.12 can be found in `ocaml-ng.ocamlPackages_4_12.ocamlgraph`. The compiler itself is also located in this set, under the name `ocaml`.
6+
7+If you don't care about the exact compiler version, `ocamlPackages` is a top-level alias pointing to a recent version of OCaml.
8+
9+OCaml applications are usually available top-level, and not inside `ocamlPackages`. Notable exceptions are build tools that must be built with the same compiler version as the compiler you intend to use like `dune` or `ocaml-lsp`.
10+
11+To open a shell able to build a typical OCaml project, put the dependencies in `buildInputs` and add `ocamlPackages.ocaml` and `ocamlPackages.findlib` to `nativeBuildInputs` at least.
12+For example:
13+```nix
14+let
15+ pkgs = import <nixpkgs> {};
16+ # choose the ocaml version you want to use
17+ ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_12;
18+in
19+pkgs.mkShell {
20+ # build tools
21+ nativeBuildInputs = with ocamlPackages; [ ocaml findlib dune_2 ocaml-lsp ];
22+ # dependencies
23+ buildInputs = with ocamlPackages; [ ocamlgraph ];
24+}
25+```
26+
27+## Packaging guide {#sec-language-ocaml-packaging}
28+
329OCaml 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`.
430
531Given 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`.
632
7−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.
33+Here is a simple package example.
34+
35+- It defines an (optional) attribute `minimalOCamlVersion` (see note below)
36+ that will be used to throw a descriptive evaluation error if building with
37+ an older OCaml is attempted.
38+
39+- It uses the `fetchFromGitHub` fetcher to get its source.
40+
41+- `duneVersion = "2"` ensures that Dune version 2 is used for the
42+ build (this is the default; valid values are `"1"`, `"2"`, and `"3"`);
43+ note that there is also a legacy `useDune2` boolean attribute:
44+ set to `false` it corresponds to `duneVersion = "1"`; set to `true` it
45+ corresponds to `duneVersion = "2"`. If both arguments (`duneVersion` and
46+ `useDune2`) are given, the second one (`useDune2`) is silently ignored.
47+
48+- It sets the optional `doCheck` attribute such that tests will be run with
49+ `dune runtest -p angstrom` after the build (`dune build -p angstrom`) is
50+ complete, but only if the Ocaml version is at at least `"4.05"`.
51+
52+- It uses the package `ocaml-syntax-shims` as a build input, `alcotest` and
53+ `ppx_let` as check inputs (because they are needed to run the tests), and
54+ `bigstringaf` and `result` as propagated build inputs (thus they will also be
55+ available to libraries depending on this library).
56+
57+- The library will be installed using the `angstrom.install` file that dune
58+ generates.
859
960```nix
10−{ lib
11−, fetchFromGitHub
12−, buildDunePackage
13−, alcotest
14−, result
15−, bigstringaf
16−}:
61+{ lib,
62+ fetchFromGitHub,
63+ buildDunePackage,
64+ ocaml,
65+ ocaml-syntax-shims,
66+ alcotest,
67+ result,
68+ bigstringaf,
69+ ppx_let }:
1770
1871buildDunePackage rec {
1972 pname = "angstrom";
20− version = "0.10.0";
73+ version = "0.15.0";
74+ duneVersion = "2";
2175
22− minimumOCamlVersion = "4.03";
76+ minimalOCamlVersion = "4.04";
2377
2478 src = fetchFromGitHub {
2579 owner = "inhabitedtype";
2680 repo = pname;
2781 rev = version;
28− sha256 = "0lh6024yf9ds0nh9i93r9m6p5psi8nvrqxl5x7jwl13zb0r9xfpw";
82+ sha256 = "1hmrkdcdlkwy7rxhngf3cv3sa61cznnd9p5lmqhx20664gx2ibrh";
2983 };
3084
31− buildInputs = [ alcotest ];
85+ checkInputs = [ alcotest ppx_let ];
86+ buildInputs = [ ocaml-syntax-shims ];
3287 propagatedBuildInputs = [ bigstringaf result ];
33− doCheck = true;
88+ doCheck = lib.versionAtLeast ocaml.version "4.05";
3489
35− meta = with lib; {
90+ meta = {
3691 homepage = "https://github.com/inhabitedtype/angstrom";
3792 description = "OCaml parser combinators built for speed and memory efficiency";
38− license = licenses.bsd3;
39− maintainers = with maintainers; [ sternenseemann ];
93+ license = lib.licenses.bsd3;
94+ maintainers = with lib.maintainers; [ sternenseemann ];
4095 };
41−}
4296```
4397
4498Here 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.
4599
46100```nix
47−{ lib
48−, fetchurl
49−, buildDunePackage
50−}:
101+{ lib, fetchurl, buildDunePackage }:
51102
52103buildDunePackage rec {
53104 pname = "wtf8";
54− version = "1.0.1";
105+ version = "1.0.2";
55106
56− minimumOCamlVersion = "4.01";
107+ useDune2 = true;
108+
109+ minimalOCamlVersion = "4.02";
57110
58111 src = fetchurl {
59− url = "https://github.com/flowtype/ocaml-${pname}/releases/download/v${version}/${pname}-${version}.tbz";
60− sha256 = "1msg3vycd3k8qqj61sc23qks541cxpb97vrnrvrhjnqxsqnh6ygq";
112+ url = "https://github.com/flowtype/ocaml-${pname}/releases/download/v${version}/${pname}-v${version}.tbz";
113+ sha256 = "09ygcxxd5warkdzz17rgpidrd0pg14cy2svvnvy1hna080lzg7vp";
61114 };
62115
63116 meta = with lib; {
@@ -68,3 +121,11 @@ buildDunePackage rec {
68121 };
69122}
70123```
124+
125+Note about `minimalOCamlVersion`. A deprecated version of this argument was
126+spelled `minimumOCamlVersion`; setting the old attribute wrongly modifies the
127+derivation hash and is therefore inappropriate. As a technical dept, currently
128+packaged libraries may still use the old spelling: maintainers are invited to
129+fix this when updating packages. Massive renaming is strongly discouraged as it
130+would be challenging to review, difficult to test, and will cause unnecessary
131+rebuild.
doc/languages-frameworks/octave.section.mdnew file+92
@@ -0,0 +1,92 @@
1+# Octave {#sec-octave}
2+
3+## Introduction {#ssec-octave-introduction}
4+
5+Octave is a modular scientific programming language and environment.
6+A majority of the packages supported by Octave from their [website](https://octave.sourceforge.io/packages.php) are packaged in nixpkgs.
7+
8+## Structure {#ssec-octave-structure}
9+
10+All Octave add-on packages are available in two ways:
11+1. Under the top-level `Octave` attribute, `octave.pkgs`.
12+2. As a top-level attribute, `octavePackages`.
13+
14+## Packaging Octave Packages {#ssec-octave-packaging}
15+
16+Nixpkgs provides a function `buildOctavePackage`, a generic package builder function for any Octave package that complies with the Octave's current packaging format.
17+
18+All Octave packages are defined in [pkgs/top-level/octave-packages.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/octave-packages.nix) rather than `pkgs/all-packages.nix`.
19+Each package is defined in their own file in the [pkgs/development/octave-modules](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/octave-modules) directory.
20+Octave packages are made available through `all-packages.nix` through both the attribute `octavePackages` and `octave.pkgs`.
21+You can test building an Octave package as follows:
22+
23+```ShellSession
24+$ nix-build -A octavePackages.symbolic
25+```
26+
27+To install it into your user profile, run this command from the root of the repository:
28+
29+```ShellSession
30+$ nix-env -f. -iA octavePackages.symbolic
31+```
32+
33+You can build Octave with packages by using the `withPackages` passed-through function.
34+
35+```ShellSession
36+$ nix-shell -p 'octave.withPackages (ps: with ps; [ symbolic ])'
37+```
38+
39+This will also work in a `shell.nix` file.
40+
41+```nix
42+{ pkgs ? import <nixpkgs> { }}:
43+
44+pkgs.mkShell {
45+ nativeBuildInputs = with pkgs; [
46+ (octave.withPackages (opkgs: with opkgs; [ symbolic ]))
47+ ];
48+}
49+```
50+
51+### `buildOctavePackage` Steps {#sssec-buildOctavePackage-steps}
52+
53+The `buildOctavePackage` does several things to make sure things work properly.
54+
55+1. Sets the environment variable `OCTAVE_HISTFILE` to `/dev/null` during package compilation so that the commands run through the Octave interpreter directly are not logged.
56+2. Skips the configuration step, because the packages are stored as gzipped tarballs, which Octave itself handles directly.
57+3. Change the hierarchy of the tarball so that only a single directory is at the top-most level of the tarball.
58+4. Use Octave itself to run the `pkg build` command, which unzips the tarball, extracts the necessary files written in Octave, and compiles any code written in C++ or Fortran, and places the fully compiled artifact in `$out`.
59+
60+`buildOctavePackage` is built on top of `stdenv` in a standard way, allowing most things to be customized.
61+
62+### Handling Dependencies {#sssec-octave-handling-dependencies}
63+
64+In Octave packages, there are four sets of dependencies that can be specified:
65+
66+`nativeBuildInputs`
67+: Just like other packages, `nativeBuildInputs` is intended for architecture-dependent build-time-only dependencies.
68+
69+`buildInputs`
70+: Like other packages, `buildInputs` is intended for architecture-independent build-time-only dependencies.
71+
72+`propagatedBuildInputs`
73+: Similar to other packages, `propagatedBuildInputs` is intended for packages that are required for both building and running of the package.
74+See [Symbolic](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/octave-modules/symbolic/default.nix) for how this works and why it is needed.
75+
76+`requiredOctavePackages`
77+: This is a special dependency that ensures the specified Octave packages are dependent on others, and are made available simultaneously when loading them in Octave.
78+
79+### Installing Octave Packages {#sssec-installing-octave-packages}
80+
81+By default, the `buildOctavePackage` function does _not_ install the requested package into Octave for use.
82+The function will only build the requested package.
83+This is due to Octave maintaining an text-based database about which packages are installed where.
84+To this end, when all the requested packages have been built, the Octave package and all its add-on packages are put together into an environment, similar to Python.
85+
86+1. First, all the Octave binaries are wrapped with the environment variable `OCTAVE_SITE_INITFILE` set to a file in `$out`, which is required for Octave to be able to find the non-standard package database location.
87+2. Because of the way `buildEnv` works, all tarballs that are present (which should be all Octave packages to install) should be removed.
88+3. The path down to the default install location of Octave packages is recreated so that Nix-operated Octave can install the packages.
89+4. Install the packages into the `$out` environment while writing package entries to the database file.
90+This database file is unique for each different (according to Nix) environment invocation.
91+5. Rewrite the Octave-wide startup file to read from the list of packages installed in that particular environment.
92+6. Wrap any programs that are required by the Octave packages so that they work with all the paths defined within the environment.
doc/languages-frameworks/perl.section.md+5−9
@@ -58,13 +58,7 @@ in `all-packages.nix`. You can test building a Perl package as follows:
5858$ nix-build -A perlPackages.ClassC3
5959```
6060
61−`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:
62−
63−```ShellSession
64−$ nix-env -i perl-Class-C3
65−```
66−
67−(Of course you can also install using the attribute name: `nix-env -i -A perlPackages.ClassC3`.)
61+To install it with `nix-env` instead: `nix-env -f. -iA perlPackages.ClassC3`.
6862
6963So what does `buildPerlPackage` do? It does the following:
7064
@@ -122,7 +116,7 @@ ImageExifTool = buildPerlPackage {
122116 };
123117
124118 buildInputs = lib.optional stdenv.isDarwin shortenPerlShebang;
125− postInstall = lib.optional stdenv.isDarwin ''
119+ postInstall = lib.optionalString stdenv.isDarwin ''
126120 shortenPerlShebang $out/bin/exiftool
127121 '';
128122};
@@ -135,9 +129,11 @@ This will remove the `-I` flags from the shebang line, rewrite them in the `use
135129Nix 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:
136130
137131```ShellSession
138−$ nix-env -i nix-generate-from-cpan
132+$ nix-env -f "<nixpkgs>" -iA nix-generate-from-cpan
139133```
140134
135+Substitute `<nixpkgs>` by the path of a nixpkgs clone to use the latest version.
136+
141137This 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:
142138
143139```ShellSession
doc/languages-frameworks/python.section.md+210−102
@@ -1,14 +1,15 @@
11# Python {#python}
22
3−## User Guide
3+## User Guide {#user-guide}
44
5−### Using Python
5+### Using Python {#using-python}
66
7−#### Overview
7+#### Overview {#overview}
88
99Several versions of the Python interpreter are available on Nix, as well as a
10−high amount of packages. The attribute `python` refers to the default
11−interpreter, which is currently CPython 2.7. It is also possible to refer to
10+high amount of packages. The attribute `python3` refers to the default
11+interpreter, which is currently CPython 3.9. The attribute `python` refers to
12+CPython 2.7 for backwards-compatibility. It is also possible to refer to
1213specific versions, e.g. `python38` refers to CPython 3.8, and `pypy` refers to
1314the default PyPy interpreter.
1415
@@ -30,7 +31,7 @@ The main package set contains aliases to these package sets, e.g.
3031`pythonPackages` refers to `python.pkgs` and `python38Packages` to
3132`python38.pkgs`.
3233
33−#### Installing Python and packages
34+#### Installing Python and packages {#installing-python-and-packages}
3435
3536The Nix and NixOS manuals explain how packages are generally installed. In the
3637case of Python and Nix, it is important to make a distinction between whether the
@@ -61,7 +62,7 @@ Philosphically, this should be familiar to users who are used to a `venv` style
6162of development: individual projects create their own Python environments without
6263impacting the global environment or each other.
6364
64−#### Ad-hoc temporary Python environment with `nix-shell`
65+#### Ad-hoc temporary Python environment with `nix-shell` {#ad-hoc-temporary-python-environment-with-nix-shell}
6566
6667The simplest way to start playing with the way nix wraps and sets up Python
6768environments is with `nix-shell` at the cmdline. These environments create a
@@ -78,7 +79,7 @@ $ nix-shell -p 'python38.withPackages(ps: with ps; [ numpy toolz ])'
7879By default `nix-shell` will start a `bash` session with this interpreter in our
7980`PATH`, so if we then run:
8081
81−```
82+```Python console
8283[nix-shell:~/src/nixpkgs]$ python3
8384Python 3.8.1 (default, Dec 18 2019, 19:06:26)
8485[GCC 9.2.0] on linux
@@ -89,7 +90,7 @@ Type "help", "copyright", "credits" or "license" for more information.
8990Note that no other modules are in scope, even if they were imperatively
9091installed into our user environment as a dependency of a Python application:
9192
92−```
93+```Python console
9394>>> import requests
9495Traceback (most recent call last):
9596 File "<stdin>", line 1, in <module>
@@ -130,7 +131,7 @@ arbitrary dependencies. This is a good way to get a feel for how the Python
130131interpreter and dependencies work in Nix and NixOS, but to do some actual
131132development, we'll want to make it a bit more persistent.
132133
133−##### Running Python scripts and using `nix-shell` as shebang
134+##### Running Python scripts and using `nix-shell` as shebang {#running-python-scripts-and-using-nix-shell-as-shebang}
134135
135136Sometimes, we have a script whose header looks like this:
136137
@@ -145,8 +146,8 @@ print(f"The dot product of {a} and {b} is: {np.dot(a, b)}")
145146Executing this script requires a `python3` that has `numpy`. Using what we learned
146147in the previous section, we could startup a shell and just run it like so:
147148
148−```
149−nix-shell -p 'python38.withPackages(ps: with ps; [ numpy ])' --run 'python3 foo.py'
149+```ShellSession
150+$ nix-shell -p 'python38.withPackages(ps: with ps; [ numpy ])' --run 'python3 foo.py'
150151The dot product of [1 2] and [3 4] is: 11
151152```
152153
@@ -202,7 +203,7 @@ of the package versions.
202203This is also a great way to ensure the script executes identically on different
203204servers.
204205
205−##### Load environment from `.nix` expression
206+##### Load environment from `.nix` expression {#load-environment-from-.nix-expression}
206207
207208We've now seen how to create an ad-hoc temporary shell session, and how to
208209create a single script with Python dependencies, but in the course of normal
@@ -244,7 +245,7 @@ let
244245 ps.toolz
245246 ]);
246247in mkShell {
247− buildInputs = [
248+ packages = [
248249 pythonEnv
249250
250251 black
@@ -261,7 +262,7 @@ and its Python dependencies, but also tools like `black` or `mypy` and libraries
261262like `libffi` the `openssl` in scope. This is generic and can span any number of
262263tools or languages across the Nixpkgs ecosystem.
263264
264−##### Installing environments globally on the system
265+##### Installing environments globally on the system {#installing-environments-globally-on-the-system}
265266
266267Up to now, we've been creating environments scoped to an ad-hoc shell session,
267268or a single script, or a single project. This is generally advisable, as it
@@ -314,7 +315,7 @@ If you get a conflict or prefer to keep the setup clean, you can have `nix-env`
314315atomically *uninstall* all other imperatively installed packages and replace
315316your profile with just `myEnv` by using the `--replace` flag.
316317
317−##### Environment defined in `/etc/nixos/configuration.nix`
318+##### Environment defined in `/etc/nixos/configuration.nix` {#environment-defined-in-etcnixosconfiguration.nix}
318319
319320For the sake of completeness, here's how to install the environment system-wide
320321on NixOS.
@@ -328,7 +329,7 @@ on NixOS.
328329}
329330```
330331
331−### Developing with Python
332+### Developing with Python {#developing-with-python}
332333
333334Above, we were mostly just focused on use cases and what to do to get started
334335creating working Python environments in nix.
@@ -337,7 +338,7 @@ Now that you know the basics to be up and running, it is time to take a step
337338back and take a deeper look at how Python packages are packaged on Nix. Then,
338339we will look at how you can use development mode with your code.
339340
340−#### Python library packages in Nixpkgs
341+#### Python library packages in Nixpkgs {#python-library-packages-in-nixpkgs}
341342
342343With Nix all packages are built by functions. The main function in Nix for
343344building Python libraries is `buildPythonPackage`. Let's see how we can build the
@@ -424,7 +425,7 @@ of `withPackages` we used a `let` expression. You can see that we used
424425`toolz` from the Nixpkgs package set this time, but instead took our own version
425426that we introduced with the `let` expression.
426427
427−#### Handling dependencies
428+#### Handling dependencies {#handling-dependencies}
428429
429430Our example, `toolz`, does not have any dependencies on other Python packages or
430431system libraries. According to the manual, `buildPythonPackage` uses the
@@ -438,7 +439,7 @@ The following example shows which arguments are given to `buildPythonPackage` in
438439order to build [`datashape`](https://github.com/blaze/datashape).
439440
440441```nix
441−{ lib, buildPythonPackage, fetchPypi, numpy, multipledispatch, dateutil, pytest }:
442+{ lib, buildPythonPackage, fetchPypi, numpy, multipledispatch, python-dateutil, pytest }:
442443
443444buildPythonPackage rec {
444445 pname = "datashape";
@@ -450,7 +451,7 @@ buildPythonPackage rec {
450451 };
451452
452453 checkInputs = [ pytest ];
453− propagatedBuildInputs = [ numpy multipledispatch dateutil ];
454+ propagatedBuildInputs = [ numpy multipledispatch python-dateutil ];
454455
455456 meta = with lib; {
456457 homepage = "https://github.com/ContinuumIO/datashape";
@@ -462,7 +463,7 @@ buildPythonPackage rec {
462463```
463464
464465We can see several runtime dependencies, `numpy`, `multipledispatch`, and
465−`dateutil`. Furthermore, we have one `checkInputs`, i.e. `pytest`. `pytest` is a
466+`python-dateutil`. Furthermore, we have one `checkInputs`, i.e. `pytest`. `pytest` is a
466467test runner and is only used during the `checkPhase` and is therefore not added
467468to `propagatedBuildInputs`.
468469
@@ -536,9 +537,10 @@ buildPythonPackage rec {
536537 };
537538}
538539```
540+
539541Note also the line `doCheck = false;`, we explicitly disabled running the test-suite.
540542
541−#### Testing Python Packages
543+#### Testing Python Packages {#testing-python-packages}
542544
543545It is highly encouraged to have testing as part of the package build. This
544546helps to avoid situations where the package was able to build and install,
@@ -558,10 +560,11 @@ thus can cause issues when a test suite asserts on that behavior.
558560as many tests should be enabled as possible. Failing tests can still be
559561a good indication that the package is not in a valid state.
560562
561−#### Using pytest
563+#### Using pytest {#using-pytest}
562564
563565Pytest is the most common test runner for python repositories. A trivial
564566test run would be:
567+
565568```
566569 checkInputs = [ pytest ];
567570 checkPhase = "pytest";
@@ -571,6 +574,7 @@ However, many repositories' test suites do not translate well to nix's build
571574sandbox, and will generally need many tests to be disabled.
572575
573576To filter tests using pytest, one can do the following:
577+
574578```
575579 checkInputs = [ pytest ];
576580 # avoid tests which need additional data or touch network
@@ -586,19 +590,20 @@ easier than having to create a new package.
586590
587591`-k` is used to define a predicate for test names. In this example, we are
588592filtering out tests which contain `download` or `update` in their test case name.
589−Only one `-k` argument is allows, and thus a long predicate should be concatenated
590−with "\" and wrapped to the next line.
593+Only one `-k` argument is allowed, and thus a long predicate should be concatenated
594+with “\\” and wrapped to the next line.
591595
592−*NOTE:* In pytest==6.0.1, the use of "\" to continue a line (e.g. `-k 'not download \'`) has
596+*NOTE:* In pytest==6.0.1, the use of “\\” to continue a line (e.g. `-k 'not download \'`) has
593597been removed, in this case, it's recommended to use `pytestCheckHook`.
594598
595−#### Using pytestCheckHook
599+#### Using pytestCheckHook {#using-pytestcheckhook}
596600
597601`pytestCheckHook` is a convenient hook which will substitute the setuptools
598602`test` command for a checkPhase which runs `pytest`. This is also beneficial
599603when a package may need many items disabled to run the test suite.
600604
601605Using the example above, the analagous pytestCheckHook usage would be:
606+
602607```
603608 checkInputs = [ pytestCheckHook ];
604609
@@ -636,9 +641,9 @@ Trying to concatenate the related strings to disable tests in a regular checkPha
636641would be much harder to read. This also enables us to comment on why specific tests
637642are disabled.
638643
639−#### Using pythonImportsCheck
644+#### Using pythonImportsCheck {#using-pythonimportscheck}
640645
641−Although unit tests are highly prefered to valid correctness of a package. Not
646+Although unit tests are highly prefered to validate correctness of a package, not
642647all packages have test suites that can be ran easily, and some have none at all.
643648To help ensure the package still works, `pythonImportsCheck` can attempt to import
644649the listed modules.
@@ -658,7 +663,7 @@ However, this is done in it's own phase, and not dependent on whether `doCheck =
658663This can also be useful in verifying that the package doesn't assume commonly
659664present packages (e.g. `setuptools`)
660665
661−### Develop local package
666+### Develop local package {#develop-local-package}
662667
663668As a Python developer you're likely aware of [development mode](http://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode)
664669(`python setup.py develop`); instead of installing the package this command
@@ -693,7 +698,7 @@ buildPythonPackage rec {
693698It is important to note that due to how development mode is implemented on Nix
694699it is not possible to have multiple packages simultaneously in development mode.
695700
696−### Organising your packages
701+### Organising your packages {#organising-your-packages}
697702
698703So far we discussed how you can use Python on Nix, and how you can develop with
699704it. We've looked at how you write expressions to package Python packages, and we
@@ -705,7 +710,7 @@ like to be able to use in different projects. In order to minimise unnecessary
705710duplication we now look at how you can maintain a repository with your
706711own packages. The important functions here are `import` and `callPackage`.
707712
708−### Including a derivation using `callPackage`
713+### Including a derivation using `callPackage` {#including-a-derivation-using-callpackage}
709714
710715Earlier we created a Python environment using `withPackages`, and included the
711716`toolz` package via a `let` expression.
@@ -755,28 +760,28 @@ don't explicitly define which `python` derivation should be used. In the above
755760example we use `buildPythonPackage` that is part of the set `python38Packages`,
756761and in this case the `python38` interpreter is automatically used.
757762
758−## Reference
763+## Reference {#reference}
759764
760−### Interpreters
765+### Interpreters {#interpreters}
761766
762−Versions 2.7, 3.6, 3.7, 3.8 and 3.9 of the CPython interpreter are available as
763−respectively `python27`, `python36`, `python37`, `python38` and `python39`. The
767+Versions 2.7, 3.7, 3.8 and 3.9 of the CPython interpreter are available as
768+respectively `python27`, `python37`, `python38` and `python39`. The
764769aliases `python2` and `python3` correspond to respectively `python27` and
765−`python38`. The default interpreter, `python`, maps to `python2`. The PyPy
766−interpreters compatible with Python 2.7 and 3 are available as `pypy27` and
767−`pypy3`, with aliases `pypy2` mapping to `pypy27` and `pypy` mapping to `pypy2`.
768−The Nix expressions for the interpreters can be found in
770+`python39`. The attribute `python` maps to `python2`. The PyPy interpreters
771+compatible with Python 2.7 and 3 are available as `pypy27` and `pypy3`, with
772+aliases `pypy2` mapping to `pypy27` and `pypy` mapping to `pypy2`. The Nix
773+expressions for the interpreters can be found in
769774`pkgs/development/interpreters/python`.
770775
771776All packages depending on any Python interpreter get appended
772777`out/{python.sitePackages}` to `$PYTHONPATH` if such directory
773778exists.
774779
775−#### Missing `tkinter` module standard library
780+#### Missing `tkinter` module standard library {#missing-tkinter-module-standard-library}
776781
777782To reduce closure size the `Tkinter`/`tkinter` is available as a separate package, `pythonPackages.tkinter`.
778783
779−#### Attributes on interpreters packages
784+#### Attributes on interpreters packages {#attributes-on-interpreters-packages}
780785
781786Each interpreter has the following attributes:
782787
@@ -788,7 +793,24 @@ Each interpreter has the following attributes:
788793- `executable`. Name of the interpreter executable, e.g. `python3.8`.
789794- `pkgs`. Set of Python packages for that specific interpreter. The package set can be modified by overriding the interpreter and passing `packageOverrides`.
790795
791−### Building packages and applications
796+### Optimizations {#optimizations}
797+
798+The Python interpreters are by default not build with optimizations enabled, because
799+the builds are in that case not reproducible. To enable optimizations, override the
800+interpreter of interest, e.g using
801+
802+```
803+let
804+ pkgs = import ./. {};
805+ mypython = pkgs.python3.override {
806+ enableOptimizations = true;
807+ reproducibleBuild = false;
808+ self = mypython;
809+ };
810+in mypython
811+```
812+
813+### Building packages and applications {#building-packages-and-applications}
792814
793815Python libraries and applications that use `setuptools` or
794816`distutils` are typically built with respectively the `buildPythonPackage` and
@@ -808,19 +830,20 @@ attribute set is created for each available Python interpreter. The available
808830sets are
809831
810832* `pkgs.python27Packages`
811−* `pkgs.python36Packages`
812833* `pkgs.python37Packages`
813834* `pkgs.python38Packages`
814835* `pkgs.python39Packages`
836+* `pkgs.python310Packages`
837+* `pkgs.python311Packages`
815838* `pkgs.pypyPackages`
816839
817840and the aliases
818841
819842* `pkgs.python2Packages` pointing to `pkgs.python27Packages`
820−* `pkgs.python3Packages` pointing to `pkgs.python38Packages`
843+* `pkgs.python3Packages` pointing to `pkgs.python39Packages`
821844* `pkgs.pythonPackages` pointing to `pkgs.python2Packages`
822845
823−#### `buildPythonPackage` function
846+#### `buildPythonPackage` function {#buildpythonpackage-function}
824847
825848The `buildPythonPackage` function is implemented in
826849`pkgs/development/interpreters/python/mk-python-derivation`
@@ -829,7 +852,7 @@ using setup hooks.
829852The following is an example:
830853
831854```nix
832−{ lib, buildPythonPackage, fetchPypi, hypothesis, setuptools_scm, attrs, py, setuptools, six, pluggy }:
855+{ lib, buildPythonPackage, fetchPypi, hypothesis, setuptools-scm, attrs, py, setuptools, six, pluggy }:
833856
834857buildPythonPackage rec {
835858 pname = "pytest";
@@ -846,7 +869,7 @@ buildPythonPackage rec {
846869 '';
847870
848871 checkInputs = [ hypothesis ];
849− nativeBuildInputs = [ setuptools_scm ];
872+ nativeBuildInputs = [ setuptools-scm ];
850873 propagatedBuildInputs = [ attrs py setuptools six pluggy ];
851874
852875 meta = with lib; {
@@ -872,7 +895,7 @@ e.g. the test runner, should be added to `checkInputs`.
872895By default `meta.platforms` is set to the same value
873896as the interpreter unless overridden otherwise.
874897
875−##### `buildPythonPackage` parameters
898+##### `buildPythonPackage` parameters {#buildpythonpackage-parameters}
876899
877900All parameters from `stdenv.mkDerivation` function are still supported. The
878901following are specific to `buildPythonPackage`:
@@ -928,7 +951,7 @@ because their behaviour is different:
928951 `buildPythonPackage` also injects code into and wraps executables with the
929952 paths included in this list. Items listed in `install_requires` go here.
930953
931−##### Overriding Python packages
954+##### Overriding Python packages {#overriding-python-packages}
932955
933956The `buildPythonPackage` function has a `overridePythonAttrs` method that can be
934957used to override the package. In the following example we create an environment
@@ -956,7 +979,32 @@ with import <nixpkgs> {};
956979in python.withPackages(ps: [ps.blaze])).env
957980```
958981
959−#### `buildPythonApplication` function
982+#### Optional extra dependencies
983+
984+Some packages define optional dependencies for additional features. With
985+`setuptools` this is called `extras_require` and `flit` calls it `extras-require`. A
986+method for supporting this is by declaring the extras of a package in its
987+`passthru`, e.g. in case of the package `dask`
988+
989+```nix
990+passthru.extras-require = {
991+ complete = [ distributed ];
992+};
993+```
994+
995+and letting the package requiring the extra add the list to its dependencies
996+
997+```nix
998+propagatedBuildInputs = [
999+ ...
1000+] ++ dask.extras-require.complete;
1001+```
1002+
1003+Note this method is preferred over adding parameters to builders, as that can
1004+result in packages depending on different variants and thereby causing
1005+collisions.
1006+
1007+#### `buildPythonApplication` function {#buildpythonapplication-function}
9601008
9611009The `buildPythonApplication` function is practically the same as
9621010`buildPythonPackage`. The main purpose of this function is to build a Python
@@ -973,18 +1021,18 @@ called with `callPackage` and passed `python` or `pythonPackages` (possibly
9731021specifying an interpreter version), like this:
9741022
9751023```nix
976−{ lib, python3Packages }:
1024+{ lib, python3 }:
9771025
978−python3Packages.buildPythonApplication rec {
1026+python3.pkgs.buildPythonApplication rec {
9791027 pname = "luigi";
9801028 version = "2.7.9";
9811029
982− src = python3Packages.fetchPypi {
1030+ src = python3.pkgs.fetchPypi {
9831031 inherit pname version;
9841032 sha256 = "035w8gqql36zlan0xjrzz9j4lh9hs0qrsgnbyw07qs7lnkvbdv9x";
9851033 };
9861034
987− propagatedBuildInputs = with python3Packages; [ tornado_4 python-daemon ];
1035+ propagatedBuildInputs = with python3.pkgs; [ tornado python-daemon ];
9881036
9891037 meta = with lib; {
9901038 ...
@@ -1001,7 +1049,7 @@ luigi = callPackage ../applications/networking/cluster/luigi { };
10011049Since the package is an application, a consumer doesn't need to care about
10021050Python versions or modules, which is why they don't go in `pythonPackages`.
10031051
1004−#### `toPythonApplication` function
1052+#### `toPythonApplication` function {#topythonapplication-function}
10051053
10061054A distinction is made between applications and libraries, however, sometimes a
10071055package is used as both. In this case the package is added as a library to
@@ -1013,11 +1061,12 @@ The Nix expression shall use `buildPythonPackage` and be called from
10131061`python-packages.nix`. A reference shall be created from `all-packages.nix` to
10141062the attribute in `python-packages.nix`, and the `toPythonApplication` shall be
10151063applied to the reference:
1064+
10161065```nix
10171066youtube-dl = with pythonPackages; toPythonApplication youtube-dl;
10181067```
10191068
1020−#### `toPythonModule` function
1069+#### `toPythonModule` function {#topythonmodule-function}
10211070
10221071In some cases, such as bindings, a package is created using
10231072`stdenv.mkDerivation` and added as attribute in `all-packages.nix`. The Python
@@ -1034,7 +1083,7 @@ opencv = toPythonModule (pkgs.opencv.override {
10341083
10351084Do pay attention to passing in the right Python version!
10361085
1037−#### `python.buildEnv` function
1086+#### `python.buildEnv` function {#python.buildenv-function}
10381087
10391088Python environments can be created using the low-level `pkgs.buildEnv` function.
10401089This example shows how to create an environment that has the Pyramid Web Framework.
@@ -1072,8 +1121,8 @@ with import <nixpkgs> {};
10721121will drop you into a shell where Python will have the
10731122specified packages in its path.
10741123
1124+##### `python.buildEnv` arguments {#python.buildenv-arguments}
10751125
1076−##### `python.buildEnv` arguments
10771126
10781127* `extraLibs`: List of packages installed inside the environment.
10791128* `postBuild`: Shell command executed after the build of environment.
@@ -1081,7 +1130,7 @@ specified packages in its path.
10811130* `permitUserSite`: Skip setting the `PYTHONNOUSERSITE` environment variable in
10821131 wrapped binaries in the environment.
10831132
1084−#### `python.withPackages` function
1133+#### `python.withPackages` function {#python.withpackages-function}
10851134
10861135The `python.withPackages` function provides a simpler interface to the `python.buildEnv` functionality.
10871136It takes a function as an argument that is passed the set of python packages and returns the list
@@ -1123,7 +1172,7 @@ need them, you have to use `python.buildEnv`.
11231172Python 2 namespace packages may provide `__init__.py` that collide. In that case
11241173`python.buildEnv` should be used with `ignoreCollisions = true`.
11251174
1126−#### Setup hooks
1175+#### Setup hooks {#setup-hooks}
11271176
11281177The following are setup hooks specifically for Python packages. Most of these
11291178are used in `buildPythonPackage`.
@@ -1148,7 +1197,7 @@ are used in `buildPythonPackage`.
11481197- `wheelUnpackHook` to move a wheel to the correct folder so it can be installed
11491198 with the `pipInstallHook`.
11501199
1151−### Development mode
1200+### Development mode {#development-mode}
11521201
11531202Development or editable mode is supported. To develop Python packages
11541203`buildPythonPackage` has additional logic inside `shellPhase` to run `pip
@@ -1157,6 +1206,7 @@ install -e . --prefix $TMPDIR/`for the package.
11571206Warning: `shellPhase` is executed only if `setup.py` exists.
11581207
11591208Given a `default.nix`:
1209+
11601210```nix
11611211with import <nixpkgs> {};
11621212
@@ -1179,7 +1229,7 @@ nix-shell -p pythonPackages.pyramid zlib libjpeg git
11791229
11801230Note: There is a boolean value `lib.inNixShell` set to `true` if nix-shell is invoked.
11811231
1182−### Tools
1232+### Tools {#tools}
11831233
11841234Packages inside nixpkgs are written by hand. However many tools exist in
11851235community to help save time. No tool is preferred at the moment.
@@ -1191,7 +1241,7 @@ community to help save time. No tool is preferred at the moment.
11911241- [nixpkgs-pytools](https://github.com/nix-community/nixpkgs-pytools)
11921242- [poetry2nix](https://github.com/nix-community/poetry2nix)
11931243
1194−### Deterministic builds
1244+### Deterministic builds {#deterministic-builds}
11951245
11961246The Python interpreters are now built deterministically. Minor modifications had
11971247to be made to the interpreters in order to generate deterministic bytecode. This
@@ -1203,7 +1253,7 @@ have timestamp 1. The `buildPythonPackage` function sets `DETERMINISTIC_BUILD=1`
12031253and [PYTHONHASHSEED=0](https://docs.python.org/3.8/using/cmdline.html#envvar-PYTHONHASHSEED).
12041254Both are also exported in `nix-shell`.
12051255
1206−### Automatic tests
1256+### Automatic tests {#automatic-tests}
12071257
12081258It is recommended to test packages as part of the build process.
12091259Source distributions (`sdist`) often include test files, but not always.
@@ -1212,7 +1262,7 @@ By default the command `python setup.py test` is run as part of the
12121262`checkPhase`, but often it is necessary to pass a custom `checkPhase`. An
12131263example of such a situation is when `py.test` is used.
12141264
1215−#### Common issues
1265+#### Common issues {#common-issues}
12161266
12171267* Non-working tests can often be deselected. By default `buildPythonPackage`
12181268 runs `python setup.py test`. Most Python modules follows the standard test
@@ -1229,18 +1279,19 @@ example of such a situation is when `py.test` is used.
12291279 '';
12301280 }
12311281 ```
1282+
12321283* Tests that attempt to access `$HOME` can be fixed by using the following
12331284 work-around before running tests (e.g. `preCheck`): `export HOME=$(mktemp -d)`
12341285
1235−## FAQ
1286+## FAQ {#faq}
12361287
1237−### How to solve circular dependencies?
1288+### How to solve circular dependencies? {#how-to-solve-circular-dependencies}
12381289
12391290Consider the packages `A` and `B` that depend on each other. When packaging `B`,
12401291a solution is to override package `A` not to depend on `B` as an input. The same
12411292should also be done when packaging `A`.
12421293
1243−### How to override a Python package?
1294+### How to override a Python package? {#how-to-override-a-python-package}
12441295
12451296We can override the interpreter and pass `packageOverrides`. In the following
12461297example we rename the `pandas` package and build it.
@@ -1298,7 +1349,7 @@ let
12981349in newpkgs.inkscape
12991350```
13001351
1301−### `python setup.py bdist_wheel` cannot create .whl
1352+### `python setup.py bdist_wheel` cannot create .whl {#python-setup.py-bdist_wheel-cannot-create-.whl}
13021353
13031354Executing `python setup.py bdist_wheel` in a `nix-shell `fails with
13041355```
@@ -1331,7 +1382,7 @@ or unset `SOURCE_DATE_EPOCH`:
13311382nix-shell --run "unset SOURCE_DATE_EPOCH; python3 setup.py bdist_wheel"
13321383```
13331384
1334−### `install_data` / `data_files` problems
1385+### `install_data` / `data_files` problems {#install_data-data_files-problems}
13351386
13361387If you get the following error:
13371388
@@ -1351,7 +1402,7 @@ ${python.interpreter} setup.py install_data --install-dir=$out --root=$out
13511402sed -i '/ = data\_files/d' setup.py
13521403```
13531404
1354−### Rationale of non-existent global site-packages
1405+### Rationale of non-existent global site-packages {#rationale-of-non-existent-global-site-packages}
13551406
13561407On most operating systems a global `site-packages` is maintained. This however
13571408becomes problematic if you want to run multiple Python versions or have multiple
@@ -1366,7 +1417,7 @@ If you want to create a Python environment for development, then the recommended
13661417method is to use `nix-shell`, either with or without the `python.buildEnv`
13671418function.
13681419
1369−### How to consume Python modules using pip in a virtual environment like I am used to on other Operating Systems?
1420+### How to consume Python modules using pip in a virtual environment like I am used to on other Operating Systems? {#how-to-consume-python-modules-using-pip-in-a-virtual-environment-like-i-am-used-to-on-other-operating-systems}
13701421
13711422While this approach is not very idiomatic from Nix perspective, it can still be
13721423useful when dealing with pre-existing projects or in situations where it's not
@@ -1479,7 +1530,7 @@ is executed it will attempt to download the Python modules listed in
14791530requirements.txt. However these will be cached locally within the `virtualenv`
14801531folder and not downloaded again.
14811532
1482−### How to override a Python package from `configuration.nix`?
1533+### How to override a Python package from `configuration.nix`? {#how-to-override-a-python-package-from-configuration.nix}
14831534
14841535If you need to change a package's attribute(s) from `configuration.nix` you could do:
14851536
@@ -1487,11 +1538,12 @@ If you need to change a package's attribute(s) from `configuration.nix` you coul
14871538 nixpkgs.config.packageOverrides = super: {
14881539 python = super.python.override {
14891540 packageOverrides = python-self: python-super: {
1490− zerobin = python-super.zerobin.overrideAttrs (oldAttrs: {
1491− src = super.fetchgit {
1492− url = "https://github.com/sametmax/0bin";
1493− rev = "a344dbb18fe7a855d0742b9a1cede7ce423b34ec";
1494− sha256 = "16d769kmnrpbdr0ph0whyf4yff5df6zi4kmwx7sz1d3r6c8p6xji";
1541+ twisted = python-super.twisted.overrideAttrs (oldAttrs: {
1542+ src = super.fetchPypi {
1543+ pname = "twisted";
1544+ version = "19.10.0";
1545+ sha256 = "7394ba7f272ae722a74f3d969dcf599bc4ef093bc392038748a490f1724a515d";
1546+ extension = "tar.bz2";
14951547 };
14961548 });
14971549 };
@@ -1499,9 +1551,11 @@ If you need to change a package's attribute(s) from `configuration.nix` you coul
14991551 };
15001552```
15011553
1502−`pythonPackages.zerobin` is now globally overridden. All packages and also the
1503−`zerobin` NixOS service use the new definition. Note that `python-super` refers
1504−to the old package set and `python-self` to the new, overridden version.
1554+`pythonPackages.twisted` is now globally overridden.
1555+All packages and also all NixOS services that reference `twisted`
1556+(such as `services.buildbot-worker`) now use the new definition.
1557+Note that `python-super` refers to the old package set and `python-self`
1558+to the new, overridden version.
15051559
15061560To modify only a Python package set instead of a whole Python derivation, use
15071561this snippet:
@@ -1509,12 +1563,12 @@ this snippet:
15091563```nix
15101564 myPythonPackages = pythonPackages.override {
15111565 overrides = self: super: {
1512− zerobin = ...;
1566+ twisted = ...;
15131567 };
15141568 }
15151569```
15161570
1517−### How to override a Python package using overlays?
1571+### How to override a Python package using overlays? {#how-to-override-a-python-package-using-overlays}
15181572
15191573Use the following overlay template:
15201574
@@ -1522,11 +1576,12 @@ Use the following overlay template:
15221576self: super: {
15231577 python = super.python.override {
15241578 packageOverrides = python-self: python-super: {
1525− zerobin = python-super.zerobin.overrideAttrs (oldAttrs: {
1526− src = super.fetchgit {
1527− url = "https://github.com/sametmax/0bin";
1528− rev = "a344dbb18fe7a855d0742b9a1cede7ce423b34ec";
1529− sha256 = "16d769kmnrpbdr0ph0whyf4yff5df6zi4kmwx7sz1d3r6c8p6xji";
1579+ twisted = python-super.twisted.overrideAttrs (oldAttrs: {
1580+ src = super.fetchPypi {
1581+ pname = "twisted";
1582+ version = "19.10.0";
1583+ sha256 = "7394ba7f272ae722a74f3d969dcf599bc4ef093bc392038748a490f1724a515d";
1584+ extension = "tar.bz2";
15301585 };
15311586 });
15321587 };
@@ -1534,12 +1589,12 @@ self: super: {
15341589}
15351590```
15361591
1537−### How to use Intel's MKL with numpy and scipy?
1592+### How to use Intel’s MKL with numpy and scipy? {#how-to-use-intels-mkl-with-numpy-and-scipy}
15381593
15391594MKL can be configured using an overlay. See the section "[Using overlays to
15401595configure alternatives](#sec-overlays-alternatives-blas-lapack)".
15411596
1542−### What inputs do `setup_requires`, `install_requires` and `tests_require` map to?
1597+### What inputs do `setup_requires`, `install_requires` and `tests_require` map to? {#what-inputs-do-setup_requires-install_requires-and-tests_require-map-to}
15431598
15441599In a `setup.py` or `setup.cfg` it is common to declare dependencies:
15451600
@@ -1547,17 +1602,15 @@ In a `setup.py` or `setup.cfg` it is common to declare dependencies:
15471602* `install_requires` corresponds to `propagatedBuildInputs`
15481603* `tests_require` corresponds to `checkInputs`
15491604
1550−## Contributing
1605+## Contributing {#contributing}
15511606
1552−### Contributing guidelines
1607+### Contributing guidelines {#contributing-guidelines}
15531608
1554−Following rules are desired to be respected:
1609+The following rules are desired to be respected:
15551610
15561611* Python libraries are called from `python-packages.nix` and packaged with
15571612 `buildPythonPackage`. The expression of a library should be in
15581613 `pkgs/development/python-modules/<name>/default.nix`.
1559−* Libraries in `pkgs/top-level/python-packages.nix` are sorted
1560− alphanumerically to avoid merge conflicts and ease locating attributes.
15611614* Python applications live outside of `python-packages.nix` and are packaged
15621615 with `buildPythonApplication`.
15631616* Make sure libraries build for all Python interpreters.
@@ -1567,8 +1620,63 @@ Following rules are desired to be respected:
15671620 case, when you disable tests, leave a comment explaining why.
15681621* Commit names of Python libraries should reflect that they are Python
15691622 libraries, so write for example `pythonPackages.numpy: 1.11 -> 1.12`.
1570−* Attribute names in `python-packages.nix` should be normalized according to
1571− [PEP 0503](https://www.python.org/dev/peps/pep-0503/#normalized-names). This
1572− means that characters should be converted to lowercase and `.` and `_` should
1573− be replaced by a single `-` (foo-bar-baz instead of Foo__Bar.baz )
1574−* Attribute names in `python-packages.nix` should be sorted alphanumerically.
1623+* Attribute names in `python-packages.nix` as well as `pname`s should match the
1624+ library's name on PyPI, but be normalized according to [PEP
1625+ 0503](https://www.python.org/dev/peps/pep-0503/#normalized-names). This means
1626+ that characters should be converted to lowercase and `.` and `_` should be
1627+ replaced by a single `-` (foo-bar-baz instead of Foo__Bar.baz).
1628+ If necessary, `pname` has to be given a different value within `fetchPypi`.
1629+* Attribute names in `python-packages.nix` should be sorted alphanumerically to
1630+ avoid merge conflicts and ease locating attributes.
1631+
1632+## Package set maintenance
1633+
1634+The whole Python package set has a lot of packages that do not see regular
1635+updates, because they either are a very fragile component in the Python
1636+ecosystem, like for example the `hypothesis` package, or packages that have
1637+no maintainer, so maintenance falls back to the package set maintainers.
1638+
1639+### Updating packages in bulk
1640+
1641+There is a tool to update alot of python libraries in bulk, it exists at
1642+`maintainers/scripts/update-python-libraries` with this repository.
1643+
1644+It can quickly update minor or major versions for all packages selected
1645+and create update commits, and supports the `fetchPypi`, `fetchurl` and
1646+`fetchFromGitHub` fetchers. When updating lots of packages that are
1647+hosted on GitHub, exporting a `GITHUB_API_TOKEN` is highly recommended.
1648+
1649+Updating packages in bulk leads to lots of breakages, which is why a
1650+stabilization period on the `python-unstable` branch is required.
1651+
1652+Once the branch is sufficiently stable it should normally be merged
1653+into the `staging` branch.
1654+
1655+An exemplary call to update all python libraries between minor versions
1656+would be:
1657+
1658+```ShellSession
1659+$ maintainers/scripts/update-python-libraries --target minor --commit --use-pkgs-prefix pkgs/development/python-modules/**/default.nix
1660+```
1661+
1662+## CPython Update Schedule
1663+
1664+With [PEP 602](https://www.python.org/dev/peps/pep-0602/), CPython now
1665+follows a yearly release cadence. In nixpkgs, all supported interpreters
1666+are made available, but only the most recent two
1667+interpreters package sets are built; this is a compromise between being
1668+the latest interpreter, and what the majority of the Python packages support.
1669+
1670+New CPython interpreters are released in October. Generally, it takes some
1671+time for the majority of active Python projects to support the latest stable
1672+interpreter. To help ease the migration for Nixpkgs users
1673+between Python interpreters the schedule below will be used:
1674+
1675+| When | Event |
1676+| --- | --- |
1677+| After YY.11 Release | Bump CPython package set window. The latest and previous latest stable should now be built. |
1678+| After YY.05 Release | Bump default CPython interpreter to latest stable. |
1679+
1680+In practice, this means that the Python community will have had a stable interpreter
1681+for ~2 months before attempting to update the package set. And this will
1682+allow for ~7 months for Python applications to support the latest interpreter.
doc/languages-frameworks/qt.section.md+11−6
@@ -90,20 +90,22 @@ stdenv.mkDerivation {
9090}
9191```
9292
93−::: note
93+::: {.note}
9494`wrapQtAppsHook` ignores files that are non-ELF executables.
9595This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned.
9696An example of when you'd always need to do this is with Python applications that use PyQt.
9797:::
9898
99−## Adding a library to Nixpkgs
99+## Adding a library to Nixpkgs {#adding-a-library-to-nixpkgs}
100+
100101Add Qt libraries to `qt5-packages.nix` to make them available for every
101102supported Qt version.
102103
103104### Example adding a Qt library {#qt-library-all-packages-nix}
104105
105106The following represents the contents of `qt5-packages.nix`.
106−```
107+
108+```nix
107109{
108110 # ...
109111
@@ -126,14 +128,16 @@ stdenv.mkDerivation {
126128}
127129```
128130
129−## Adding an application to Nixpkgs
131+## Adding an application to Nixpkgs {#adding-an-application-to-nixpkgs}
132+
130133Add Qt applications to `qt5-packages.nix`. Add an alias to `all-packages.nix`
131134to select the Qt 5 version used for the application.
132135
133136### Example adding a Qt application {#qt-application-all-packages-nix}
134137
135138The following represents the contents of `qt5-packages.nix`.
136−```
139+
140+```nix
137141{
138142 # ...
139143
@@ -144,7 +148,8 @@ The following represents the contents of `qt5-packages.nix`.
144148```
145149
146150The following represents the contents of `all-packages.nix`.
147−```
151+
152+```nix
148153{
149154 # ...
150155
doc/languages-frameworks/r.section.md+16−12
@@ -1,6 +1,6 @@
11# R {#r}
22
3−## Installation
3+## Installation {#installation}
44
55Define an environment for R that contains all the libraries that you'd like to
66use by adding the following snippet to your $HOME/.config/nixpkgs/config.nix file:
@@ -31,6 +31,7 @@ output is the name that has to be passed to rWrapper in the code snipped above.
3131However, if you'd like to add a file to your project source to make the
3232environment available for other contributors, you can create a `default.nix`
3333file like so:
34+
3435```nix
3536with import <nixpkgs> {};
3637{
@@ -50,7 +51,7 @@ with import <nixpkgs> {};
5051and then run `nix-shell .` to be dropped into a shell with those packages
5152available.
5253
53−## RStudio
54+## RStudio {#rstudio}
5455
5556RStudio uses a standard set of packages and ignores any custom R
5657environments or installed packages you may have. To create a custom
@@ -93,7 +94,12 @@ Executing `nix-shell` will then drop you into an environment equivalent to the
9394one above. If you need additional packages just add them to the list and
9495re-enter the shell.
9596
96−## Updating the package set
97+## Updating the package set {#updating-the-package-set}
98+
99+There is a script and associated environment for regenerating the package
100+sets and synchronising the rPackages tree to the current CRAN and matching
101+BIOC release. These scripts are found in the `pkgs/development/r-modules`
102+directory and executed as follows:
97103
98104```bash
99105nix-shell generate-shell.nix
@@ -111,13 +117,11 @@ Rscript generate-r-packages.R bioc-experiment > bioc-experiment-packages.nix.new
111117mv bioc-experiment-packages.nix.new bioc-experiment-packages.nix
112118```
113119
114−`generate-r-packages.R <repo>` reads `<repo>-packages.nix`, therefor the renaming.
115−
116−
117−## Testing if the Nix-expression could be evaluated
118−
119−```bash
120−nix-build test-evaluation.nix --dry-run
121−```
120+`generate-r-packages.R <repo>` reads `<repo>-packages.nix`, therefore
121+the renaming.
122122
123−If this exits fine, the expression is ok. If not, you have to edit `default.nix`
123+Some packages require overrides to specify external dependencies or other
124+patches and special requirements. These overrides are specified in the
125+`pkgs/development/r-modules/default.nix` file. As the `*-packages.nix`
126+contents are automatically generated it should not be edited and broken
127+builds should be addressed using overrides.
doc/languages-frameworks/ruby.section.md+26−13
@@ -1,6 +1,6 @@
11# Ruby {#sec-language-ruby}
22
3−## Using Ruby
3+## Using Ruby {#using-ruby}
44
55Several versions of Ruby interpreters are available on Nix, as well as over 250 gems and many applications written in Ruby. The attribute `ruby` refers to the default Ruby interpreter, which is currently MRI 2.6. It's also possible to refer to specific versions, e.g. `ruby_2_y`, `jruby`, or `mruby`.
66
@@ -8,11 +8,11 @@ In the Nixpkgs tree, Ruby packages can be found throughout, depending on what th
88
99There are two main approaches for using Ruby with gems. One is to use a specifically locked `Gemfile` for an application that has very strict dependencies. The other is to depend on the common gems, which we'll explain further down, and rely on them being updated regularly.
1010
11−The interpreters have common attributes, namely `gems`, and `withPackages`. So you can refer to `ruby.gems.nokogiri`, or `ruby_2_6.gems.nokogiri` to get the Nokogiri gem already compiled and ready to use.
11+The interpreters have common attributes, namely `gems`, and `withPackages`. So you can refer to `ruby.gems.nokogiri`, or `ruby_2_7.gems.nokogiri` to get the Nokogiri gem already compiled and ready to use.
1212
1313Since not all gems have executables like `nokogiri`, it's usually more convenient to use the `withPackages` function like this: `ruby.withPackages (p: with p; [ nokogiri ])`. This will also make sure that the Ruby in your environment will be able to find the gem and it can be used in your Ruby code (for example via `ruby` or `irb` executables) via `require "nokogiri"` as usual.
1414
15−### Temporary Ruby environment with `nix-shell`
15+### Temporary Ruby environment with `nix-shell` {#temporary-ruby-environment-with-nix-shell}
1616
1717Rather than having a single Ruby environment shared by all Ruby development projects on a system, Nix allows you to create separate environments per project. `nix-shell` gives you the possibility to temporarily load another environment akin to a combined `chruby` or `rvm` and `bundle exec`.
1818
@@ -30,7 +30,7 @@ $ nix-shell -p ruby.gems.nokogiri ruby.gems.pry
3030
3131Again, it's possible to launch the interpreter from the shell. The Ruby interpreter has the attribute `gems` which contains all Ruby gems for that specific interpreter.
3232
33−#### Load Ruby environment from `.nix` expression
33+#### Load Ruby environment from `.nix` expression {#load-ruby-environment-from-.nix-expression}
3434
3535As explained in the Nix manual, `nix-shell` can also load an expression from a `.nix` file. Say we want to have Ruby 2.6, `nokogori`, and `pry`. Consider a `shell.nix` file with:
3636
@@ -45,7 +45,7 @@ What's happening here?
45452. Then we create a Ruby environment with the `withPackages` function.
46463. The `withPackages` function expects us to provide a function as an argument that takes the set of all ruby gems and returns a list of packages to include in the environment. Here, we select the packages `nokogiri` and `pry` from the package set.
4747
48−#### Execute command with `--run`
48+#### Execute command with `--run` {#execute-command-with---run}
4949
5050A convenient flag for `nix-shell` is `--run`. It executes a command in the `nix-shell`. We can e.g. directly open a `pry` REPL:
5151
@@ -65,7 +65,7 @@ Or run a script using this environment:
6565$ nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])" --run "ruby example.rb"
6666```
6767
68−#### Using `nix-shell` as shebang
68+#### Using `nix-shell` as shebang {#using-nix-shell-as-shebang}
6969
7070In fact, for the last case, there is a more convenient method. You can add a [shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>) to your script specifying which dependencies `nix-shell` needs. With the following shebang, you can just execute `./example.rb`, and it will run with all dependencies.
7171
@@ -80,9 +80,9 @@ body = RestClient.get('http://example.com').body
8080puts Nokogiri::HTML(body).at('h1').text
8181```
8282
83−## Developing with Ruby
83+## Developing with Ruby {#developing-with-ruby}
8484
85−### Using an existing Gemfile
85+### Using an existing Gemfile {#using-an-existing-gemfile}
8686
8787In most cases, you'll already have a `Gemfile.lock` listing all your dependencies. This can be used to generate a `gemset.nix` which is used to fetch the gems and combine them into a single environment. The reason why you need to have a separate file for this, is that Nix requires you to have a checksum for each input to your build. Since the `Gemfile.lock` that `bundler` generates doesn't provide us with checksums, we have to first download each gem, calculate its SHA256, and store it in this separate file.
8888
@@ -106,7 +106,7 @@ let
106106 name = "gems-for-some-project";
107107 gemdir = ./.;
108108 };
109−in mkShell { buildInputs = [ gems gems.wrappedRuby ]; }
109+in mkShell { packages = [ gems gems.wrappedRuby ]; }
110110```
111111
112112With this file in your directory, you can run `nix-shell` to build and use the gems. The important parts here are `bundlerEnv` and `wrappedRuby`.
@@ -120,7 +120,7 @@ One common issue that you might have is that you have Ruby 2.6, but also `bundle
120120mkShell { buildInputs = [ gems (lowPrio gems.wrappedRuby) ]; }
121121```
122122
123−### Gem-specific configurations and workarounds
123+### Gem-specific configurations and workarounds {#gem-specific-configurations-and-workarounds}
124124
125125In some cases, especially if the gem has native extensions, you might need to modify the way the gem is built.
126126
@@ -201,7 +201,20 @@ $ nix-shell --run 'ruby -rpg -e "puts PG.library_version"'
201201
202202Of course for this use-case one could also use overlays since the configuration for `pg` depends on the `postgresql` alias, but for demonstration purposes this has to suffice.
203203
204−### Adding a gem to the default gemset
204+### Platform-specific gems
205+
206+Right now, bundix has some issues with pre-built, platform-specific gems: [bundix PR #68](https://github.com/nix-community/bundix/pull/68).
207+Until this is solved, you can tell bundler to not use platform-specific gems and instead build them from source each time:
208+- globally (will be set in `~/.config/.bundle/config`):
209+```shell
210+$ bundle config set force_ruby_platform true
211+```
212+- locally (will be set in `<project-root>/.bundle/config`):
213+```shell
214+$ bundle config set --local force_ruby_platform true
215+```
216+
217+### Adding a gem to the default gemset {#adding-a-gem-to-the-default-gemset}
205218
206219Now that you know how to get a working Ruby environment with Nix, it's time to go forward and start actually developing with Ruby. We will first have a look at how Ruby gems are packaged on Nix. Then, we will look at how you can use development mode with your code.
207220
@@ -215,7 +228,7 @@ To test that it works, you can then try using the gem with:
215228NIX_PATH=nixpkgs=$PWD nix-shell -p "ruby.withPackages (ps: with ps; [ name-of-your-gem ])"
216229```
217230
218−### Packaging applications
231+### Packaging applications {#packaging-applications}
219232
220233A common task is to add a ruby executable to nixpkgs, popular examples would be `chef`, `jekyll`, or `sass`. A good way to do that is to use the `bundlerApp` function, that allows you to make a package that only exposes the listed executables, otherwise the package may cause conflicts through common paths like `bin/rake` or `bin/bundler` that aren't meant to be used.
221234
@@ -243,7 +256,7 @@ bundlerApp {
243256
244257All that's left to do is to generate the corresponding `Gemfile.lock` and `gemset.nix` as described above in the `Using an existing Gemfile` section.
245258
246−#### Packaging executables that require wrapping
259+#### Packaging executables that require wrapping {#packaging-executables-that-require-wrapping}
247260
248261Sometimes your app will depend on other executables at runtime, and tries to find it through the `PATH` environment variable.
249262
doc/languages-frameworks/rust.section.md+304−132
@@ -2,24 +2,25 @@
22
33To install the rust compiler and cargo put
44
5−```
6−rustc
7−cargo
5+```nix
6+environment.systemPackages = [
7+ rustc
8+ cargo
9+];
810```
911
10−into the `environment.systemPackages` or bring them into
11−scope with `nix-shell -p rustc cargo`.
12+into your `configuration.nix` or bring them into scope with `nix-shell -p rustc cargo`.
1213
1314For other versions such as daily builds (beta and nightly),
1415use either `rustup` from nixpkgs (which will manage the rust installation in your home directory),
15−or use Mozilla's [Rust nightlies overlay](#using-the-rust-nightlies-overlay).
16+or use a community maintained [Rust overlay](#using-community-rust-overlays).
1617
17−## Compiling Rust applications with Cargo
18+## Compiling Rust applications with Cargo {#compiling-rust-applications-with-cargo}
1819
1920Rust applications are packaged by using the `buildRustPackage` helper from `rustPlatform`:
2021
21−```
22−{ lib, rustPlatform }:
22+```nix
23+{ lib, fetchFromGitHub, rustPlatform }:
2324
2425rustPlatform.buildRustPackage rec {
2526 pname = "ripgrep";
@@ -49,7 +50,7 @@ package. `cargoHash256` is used for traditional Nix SHA-256 hashes,
4950such as the one in the example above. `cargoHash` should instead be
5051used for [SRI](https://www.w3.org/TR/SRI/) hashes. For example:
5152
52−```
53+```nix
5354 cargoHash = "sha256-l1vL2ZdtDRxSGvP0X/l3nMw8+6WF67KPutJEzUROjg8=";
5455```
5556
@@ -59,13 +60,13 @@ expression and building the package once. The correct checksum can
5960then be taken from the failed build. A fake hash can be used for
6061`cargoSha256` as follows:
6162
62−```
63+```nix
6364 cargoSha256 = lib.fakeSha256;
6465```
6566
6667For `cargoHash` you can use:
6768
68−```
69+```nix
6970 cargoHash = lib.fakeHash;
7071```
7172
@@ -106,8 +107,113 @@ rustPlatform.buildRustPackage rec {
106107}
107108```
108109
110+### Importing a `Cargo.lock` file {#importing-a-cargo.lock-file}
111+
112+Using `cargoSha256` or `cargoHash` is tedious when using
113+`buildRustPackage` within a project, since it requires that the hash
114+is updated after every change to `Cargo.lock`. Therefore,
115+`buildRustPackage` also supports vendoring dependencies directly from
116+a `Cargo.lock` file using the `cargoLock` argument. For example:
117+
118+```nix
119+rustPlatform.buildRustPackage {
120+ pname = "myproject";
121+ version = "1.0.0";
122+
123+ cargoLock = {
124+ lockFile = ./Cargo.lock;
125+ };
126+
127+ # ...
128+}
129+```
130+
131+This will retrieve the dependencies using fixed-output derivations from
132+the specified lockfile.
109133
110−### Cross compilation
134+One caveat is that `Cargo.lock` cannot be patched in the `patchPhase`
135+because it runs after the dependencies have already been fetched. If
136+you need to patch or generate the lockfile you can alternatively set
137+`cargoLock.lockFileContents` to a string of its contents:
138+
139+```nix
140+rustPlatform.buildRustPackage {
141+ pname = "myproject";
142+ version = "1.0.0";
143+
144+ cargoLock = let
145+ fixupLockFile = path: f (builtins.readFile path);
146+ in {
147+ lockFileContents = fixupLockFile ./Cargo.lock;
148+ };
149+
150+ # ...
151+}
152+```
153+
154+Note that setting `cargoLock.lockFile` or `cargoLock.lockFileContents`
155+doesn't add a `Cargo.lock` to your `src`, and a `Cargo.lock` is still
156+required to build a rust package. A simple fix is to use:
157+
158+```nix
159+postPatch = ''
160+ cp ${./Cargo.lock} Cargo.lock
161+'';
162+```
163+
164+The output hash of each dependency that uses a git source must be
165+specified in the `outputHashes` attribute. For example:
166+
167+```nix
168+rustPlatform.buildRustPackage rec {
169+ pname = "myproject";
170+ version = "1.0.0";
171+
172+ cargoLock = {
173+ lockFile = ./Cargo.lock;
174+ outputHashes = {
175+ "finalfusion-0.14.0" = "17f4bsdzpcshwh74w5z119xjy2if6l2wgyjy56v621skr2r8y904";
176+ };
177+ };
178+
179+ # ...
180+}
181+```
182+
183+If you do not specify an output hash for a git dependency, building
184+the package will fail and inform you of which crate needs to be
185+added. To find the correct hash, you can first use `lib.fakeSha256` or
186+`lib.fakeHash` as a stub hash. Building the package (and thus the
187+vendored dependencies) will then inform you of the correct hash.
188+
189+### Cargo features {#cargo-features}
190+
191+You can disable default features using `buildNoDefaultFeatures`, and
192+extra features can be added with `buildFeatures`.
193+
194+If you want to use different features for check phase, you can use
195+`checkNoDefaultFeatures` and `checkFeatures`. They are only passed to
196+`cargo test` and not `cargo build`. If left unset, they default to
197+`buildNoDefaultFeatures` and `buildFeatures`.
198+
199+For example:
200+
201+```nix
202+rustPlatform.buildRustPackage rec {
203+ pname = "myproject";
204+ version = "1.0.0";
205+
206+ buildNoDefaultFeatures = true;
207+ buildFeatures = [ "color" "net" ];
208+
209+ # disable network features in tests
210+ checkFeatures = [ "color" ];
211+
212+ # ...
213+}
214+```
215+
216+### Cross compilation {#cross-compilation}
111217
112218By default, Rust packages are compiled for the host platform, just like any
113219other package is. The `--target` passed to rust tools is computed from this.
@@ -119,6 +225,7 @@ where they are known to differ. But there are ways to customize the argument:
119225 name will be used instead.
120226
121227 For example:
228+
122229 ```nix
123230 import <nixpkgs> {
124231 crossSystem = (import <nixpkgs/lib>).systems.examples.armhf-embedded // {
@@ -126,7 +233,9 @@ where they are known to differ. But there are ways to customize the argument:
126233 };
127234 }
128235 ```
236+
129237 will result in:
238+
130239 ```shell
131240 --target thumbv7em-none-eabi
132241 ```
@@ -139,6 +248,7 @@ where they are known to differ. But there are ways to customize the argument:
139248 will be used instead.
140249
141250 For example:
251+
142252 ```nix
143253 import <nixpkgs> {
144254 crossSystem = (import <nixpkgs/lib>).systems.examples.armhf-embedded // {
@@ -147,31 +257,17 @@ where they are known to differ. But there are ways to customize the argument:
147257 };
148258 }
149259 ```
260+
150261 will result in:
262+
151263 ```shell
152264 --target /nix/store/asdfasdfsadf-thumb-crazy.json # contains {"foo":"","bar":""}
153265 ```
154266
155−Finally, as an ad-hoc escape hatch, a computed target (string or JSON file
156−path) can be passed directly to `buildRustPackage`:
157−
158−```nix
159−pkgs.rustPlatform.buildRustPackage {
160− /* ... */
161− target = "x86_64-fortanix-unknown-sgx";
162−}
163−```
164−
165−This is useful to avoid rebuilding Rust tools, since they are actually target
166−agnostic and don't need to be rebuilt. But in the future, we should always
167−build the Rust tools and standard library crates separately so there is no
168−reason not to take the `stdenv.hostPlatform.rustc`-modifying approach, and the
169−ad-hoc escape hatch to `buildRustPackage` can be removed.
170−
171267Note that currently custom targets aren't compiled with `std`, so `cargo test`
172268will fail. This can be ignored by adding `doCheck = false;` to your derivation.
173269
174−### Running package tests
270+### Running package tests {#running-package-tests}
175271
176272When using `buildRustPackage`, the `checkPhase` is enabled by default and runs
177273`cargo test` on the package to build. To make sure that we don't compile the
@@ -192,14 +288,14 @@ rustPlatform.buildRustPackage {
192288Please note that the code will be compiled twice here: once in `release` mode
193289for the `buildPhase`, and again in `debug` mode for the `checkPhase`.
194290
195−Test flags, e.g., `--features xxx/yyy`, can be passed to `cargo test` via the
291+Test flags, e.g., `--package foo`, can be passed to `cargo test` via the
196292`cargoTestFlags` attribute.
197293
198294Another attribute, called `checkFlags`, is used to pass arguments to the test
199295binary itself, as stated
200−(here)[https://doc.rust-lang.org/cargo/commands/cargo-test.html].
296+[here](https://doc.rust-lang.org/cargo/commands/cargo-test.html).
201297
202−#### Tests relying on the structure of the `target/` directory
298+#### Tests relying on the structure of the `target/` directory {#tests-relying-on-the-structure-of-the-target-directory}
203299
204300Some tests may rely on the structure of the `target/` directory. Those tests
205301are likely to fail because we use `cargo --target` during the build. This means that
@@ -209,7 +305,7 @@ rather than in `target/release/`.
209305
210306This can only be worked around by patching the affected tests accordingly.
211307
212−#### Disabling package-tests
308+#### Disabling package-tests {#disabling-package-tests}
213309
214310In some instances, it may be necessary to disable testing altogether (with `doCheck = false;`):
215311
@@ -223,7 +319,7 @@ The above are just guidelines, and exceptions may be granted on a case-by-case b
223319However, please check if it's possible to disable a problematic subset of the
224320test suite and leave a comment explaining your reasoning.
225321
226−#### Setting `test-threads`
322+#### Setting `test-threads` {#setting-test-threads}
227323
228324`buildRustPackage` will use parallel test threads by default,
229325sometimes it may be necessary to disable this so the tests run consecutively.
@@ -235,7 +331,7 @@ rustPlatform.buildRustPackage {
235331}
236332```
237333
238−### Building a package in `debug` mode
334+### Building a package in `debug` mode {#building-a-package-in-debug-mode}
239335
240336By default, `buildRustPackage` will use `release` mode for builds. If a package
241337should be built in `debug` mode, it can be configured like so:
@@ -249,20 +345,20 @@ rustPlatform.buildRustPackage {
249345
250346In this scenario, the `checkPhase` will be ran in `debug` mode as well.
251347
252−### Custom `build`/`install`-procedures
348+### Custom `build`/`install`-procedures {#custom-buildinstall-procedures}
253349
254350Some packages may use custom scripts for building/installing, e.g. with a `Makefile`.
255351In these cases, it's recommended to override the `buildPhase`/`installPhase`/`checkPhase`.
256352
257353Otherwise, some steps may fail because of the modified directory structure of `target/`.
258354
259−### Building a crate with an absent or out-of-date Cargo.lock file
355+### Building a crate with an absent or out-of-date Cargo.lock file {#building-a-crate-with-an-absent-or-out-of-date-cargo.lock-file}
260356
261357`buildRustPackage` needs a `Cargo.lock` file to get all dependencies in the
262358source code in a reproducible way. If it is missing or out-of-date one can use
263359the `cargoPatches` attribute to update or add it.
264360
265−```
361+```nix
266362rustPlatform.buildRustPackage rec {
267363 (...)
268364 cargoPatches = [
@@ -272,13 +368,13 @@ rustPlatform.buildRustPackage rec {
272368}
273369```
274370
275−## Compiling non-Rust packages that include Rust code
371+## Compiling non-Rust packages that include Rust code {#compiling-non-rust-packages-that-include-rust-code}
276372
277373Several non-Rust packages incorporate Rust code for performance- or
278374security-sensitive parts. `rustPlatform` exposes several functions and
279375hooks that can be used to integrate Cargo in non-Rust packages.
280376
281−### Vendoring of dependencies
377+### Vendoring of dependencies {#vendoring-of-dependencies}
282378
283379Since network access is not allowed in sandboxed builds, Rust crate
284380dependencies need to be retrieved using a fetcher. `rustPlatform`
@@ -307,11 +403,42 @@ attributes can also be used:
307403 the `Cargo.lock`/`Cargo.toml` files need to be patched before
308404 vendoring.
309405
310−### Hooks
406+If a `Cargo.lock` file is available, you can alternatively use the
407+`importCargoLock` function. In contrast to `fetchCargoTarball`, this
408+function does not require a hash (unless git dependencies are used)
409+and fetches every dependency as a separate fixed-output derivation.
410+`importCargoLock` can be used as follows:
411+
412+```
413+cargoDeps = rustPlatform.importCargoLock {
414+ lockFile = ./Cargo.lock;
415+};
416+```
417+
418+If the `Cargo.lock` file includes git dependencies, then their output
419+hashes need to be specified since they are not available through the
420+lock file. For example:
421+
422+```
423+cargoDeps = rustPlatform.importCargoLock {
424+ lockFile = ./Cargo.lock;
425+ outputHashes = {
426+ "rand-0.8.3" = "0ya2hia3cn31qa8894s3av2s8j5bjwb6yq92k0jsnlx7jid0jwqa";
427+ };
428+};
429+```
430+
431+If you do not specify an output hash for a git dependency, building
432+`cargoDeps` will fail and inform you of which crate needs to be
433+added. To find the correct hash, you can first use `lib.fakeSha256` or
434+`lib.fakeHash` as a stub hash. Building `cargoDeps` will then inform
435+you of the correct hash.
436+
437+### Hooks {#hooks}
311438
312439`rustPlatform` provides the following hooks to automate Cargo builds:
313440
314−* `cargoSetupHook`: configure Cargo to use depenencies vendored
441+* `cargoSetupHook`: configure Cargo to use dependencies vendored
315442 through `fetchCargoTarball`. This hook uses the `cargoDeps`
316443 environment variable to find the vendored dependencies. If a project
317444 already vendors its dependencies, the variable `cargoVendorDir` can
@@ -321,24 +448,28 @@ attributes can also be used:
321448* `cargoBuildHook`: use Cargo to build a crate. If the crate to be
322449 built is a crate in e.g. a Cargo workspace, the relative path to the
323450 crate to build can be set through the optional `buildAndTestSubdir`
324− environment variable. Additional Cargo build flags can be passed
325− through `cargoBuildFlags`.
451+ environment variable. Features can be specified with
452+ `cargoBuildNoDefaultFeatures` and `cargoBuildFeatures`. Additional
453+ Cargo build flags can be passed through `cargoBuildFlags`.
326454* `maturinBuildHook`: use [Maturin](https://github.com/PyO3/maturin)
327455 to build a Python wheel. Similar to `cargoBuildHook`, the optional
328456 variable `buildAndTestSubdir` can be used to build a crate in a
329− Cargo workspace. Additional maturin flags can be passed through
457+ Cargo workspace. Additional Maturin flags can be passed through
330458 `maturinBuildFlags`.
331459* `cargoCheckHook`: run tests using Cargo. The build type for checks
332− can be set using `cargoCheckType`. Additional flags can be passed to
333− the tests using `checkFlags` and `checkFlagsArray`. By default,
334− tests are run in parallel. This can be disabled by setting
335− `dontUseCargoParallelTests`.
460+ can be set using `cargoCheckType`. Features can be specified with
461+ `cargoCheckNoDefaultFeaatures` and `cargoCheckFeatures`. Additional
462+ flags can be passed to the tests using `checkFlags` and
463+ `checkFlagsArray`. By default, tests are run in parallel. This can
464+ be disabled by setting `dontUseCargoParallelTests`.
336465* `cargoInstallHook`: install binaries and static/shared libraries
337466 that were built using `cargoBuildHook`.
467+* `bindgenHook`: for crates which use `bindgen` as a build dependency, lets
468+ `bindgen` find `libclang` and `libclang` find the libraries in `buildInputs`.
338469
339−### Examples
470+### Examples {#examples}
340471
341−#### Python package using `setuptools-rust`
472+#### Python package using `setuptools-rust` {#python-package-using-setuptools-rust}
342473
343474For Python packages using `setuptools-rust`, you can use
344475`fetchCargoTarball` and `cargoSetupHook` to retrieve and set up Cargo
@@ -347,7 +478,7 @@ dependencies. The build itself is then performed by
347478
348479The following example outlines how the `tokenizers` Python package is
349480built. Since the Python package is in the `source/bindings/python`
350−directory of the *tokenizers* project's source archive, we use
481+directory of the `tokenizers` project's source archive, we use
351482`sourceRoot` to point the tooling to this directory:
352483
353484```nix
@@ -424,7 +555,7 @@ buildPythonPackage rec {
424555}
425556```
426557
427−#### Python package using `maturin`
558+#### Python package using `maturin` {#python-package-using-maturin}
428559
429560Python packages that use [Maturin](https://github.com/PyO3/maturin)
430561can be built with `fetchCargoTarball`, `cargoSetupHook`, and
@@ -465,9 +596,9 @@ buildPythonPackage rec {
465596}
466597```
467598
468−## Compiling Rust crates using Nix instead of Cargo
599+## Compiling Rust crates using Nix instead of Cargo {#compiling-rust-crates-using-nix-instead-of-cargo}
469600
470−### Simple operation
601+### Simple operation {#simple-operation}
471602
472603When run, `cargo build` produces a file called `Cargo.lock`,
473604containing pinned versions of all dependencies. Nixpkgs contains a
@@ -478,18 +609,19 @@ That Nix expression calls `rustc` directly (hence bypassing Cargo),
478609and can be used to compile a crate and all its dependencies. Here is
479610an example for a minimal `hello` crate:
480611
481−
482− $ cargo new hello
483− $ cd hello
484− $ cargo build
612+```ShellSession
613+$ cargo new hello
614+$ cd hello
615+$ cargo build
485616 Compiling hello v0.1.0 (file:///tmp/hello)
486− Finished dev [unoptimized + debuginfo] target(s) in 0.20 secs
487− $ carnix -o hello.nix --src ./. Cargo.lock --standalone
488− $ nix-build hello.nix -A hello_0_1_0
617+ Finished dev [unoptimized + debuginfo] target(s) in 0.20 secs
618+$ carnix -o hello.nix --src ./. Cargo.lock --standalone
619+$ nix-build hello.nix -A hello_0_1_0
620+```
489621
490622Now, the file produced by the call to `carnix`, called `hello.nix`, looks like:
491623
492−```
624+```nix
493625# Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone
494626{ stdenv, buildRustCrate, fetchgit }:
495627let kernel = stdenv.buildPlatform.parsed.kernel.name;
@@ -518,7 +650,7 @@ dependencies, for instance by adding a single line `libc="*"` to our
518650`Cargo.lock`. Then, `carnix` needs to be run again, and produces the
519651following nix file:
520652
521−```
653+```nix
522654# Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone
523655{ stdenv, buildRustCrate, fetchgit }:
524656let kernel = stdenv.buildPlatform.parsed.kernel.name;
@@ -564,16 +696,16 @@ Here, the `libc` crate has no `src` attribute, so `buildRustCrate`
564696will fetch it from [crates.io](https://crates.io). A `sha256`
565697attribute is still needed for Nix purity.
566698
567−### Handling external dependencies
699+### Handling external dependencies {#handling-external-dependencies}
568700
569701Some crates require external libraries. For crates from
570702[crates.io](https://crates.io), such libraries can be specified in
571703`defaultCrateOverrides` package in nixpkgs itself.
572704
573705Starting from that file, one can add more overrides, to add features
574−or build inputs by overriding the hello crate in a seperate file.
706+or build inputs by overriding the hello crate in a separate file.
575707
576−```
708+```nix
577709with import <nixpkgs> {};
578710((import ./hello.nix).hello {}).override {
579711 crateOverrides = defaultCrateOverrides // {
@@ -593,7 +725,7 @@ derivation depend on the crate's version, the `attrs` argument of
593725the override above can be read, as in the following example, which
594726patches the derivation:
595727
596−```
728+```nix
597729with import <nixpkgs> {};
598730((import ./hello.nix).hello {}).override {
599731 crateOverrides = defaultCrateOverrides // {
@@ -614,7 +746,7 @@ dependencies. For instance, to override the build inputs for crate
614746`libc` in the example above, where `libc` is a dependency of the main
615747crate, we could do:
616748
617−```
749+```nix
618750with import <nixpkgs> {};
619751((import hello.nix).hello {}).override {
620752 crateOverrides = defaultCrateOverrides // {
@@ -623,34 +755,34 @@ with import <nixpkgs> {};
623755}
624756```
625757
626−### Options and phases configuration
758+### Options and phases configuration {#options-and-phases-configuration}
627759
628760Actually, the overrides introduced in the previous section are more
629761general. A number of other parameters can be overridden:
630762
631−- The version of rustc used to compile the crate:
763+- The version of `rustc` used to compile the crate:
632764
633− ```
765+ ```nix
634766 (hello {}).override { rust = pkgs.rust; };
635767 ```
636768
637769- Whether to build in release mode or debug mode (release mode by
638770 default):
639771
640− ```
772+ ```nix
641773 (hello {}).override { release = false; };
642774 ```
643775
644−- Whether to print the commands sent to rustc when building
776+- Whether to print the commands sent to `rustc` when building
645777 (equivalent to `--verbose` in cargo:
646778
647− ```
779+ ```nix
648780 (hello {}).override { verbose = false; };
649781 ```
650782
651783- Extra arguments to be passed to `rustc`:
652784
653− ```
785+ ```nix
654786 (hello {}).override { extraRustcOpts = "-Z debuginfo=2"; };
655787 ```
656788
@@ -662,7 +794,7 @@ general. A number of other parameters can be overridden:
662794 `postInstall`. As an example, here is how to create a new module
663795 before running the build script:
664796
665− ```
797+ ```nix
666798 (hello {}).override {
667799 preConfigure = ''
668800 echo "pub const PATH=\"${hi.out}\";" >> src/path.rs"
@@ -670,13 +802,13 @@ general. A number of other parameters can be overridden:
670802 };
671803 ```
672804
673−### Features
805+### Features {#features}
674806
675807One can also supply features switches. For example, if we want to
676808compile `diesel_cli` only with the `postgres` feature, and no default
677809features, we would write:
678810
679−```
811+```nix
680812(callPackage ./diesel.nix {}).diesel {
681813 default = false;
682814 postgres = true;
@@ -685,21 +817,22 @@ features, we would write:
685817
686818Where `diesel.nix` is the file generated by Carnix, as explained above.
687819
820+## Setting Up `nix-shell` {#setting-up-nix-shell}
688821
689−## Setting Up `nix-shell`
690822Oftentimes you want to develop code from within `nix-shell`. Unfortunately
691823`buildRustCrate` does not support common `nix-shell` operations directly
692824(see [this issue](https://github.com/NixOS/nixpkgs/issues/37945))
693825so we will use `stdenv.mkDerivation` instead.
694826
695827Using the example `hello` project above, we want to do the following:
828+
696829- Have access to `cargo` and `rustc`
697830- Have the `openssl` library available to a crate through it's _normal_
698831 compilation mechanism (`pkg-config`).
699832
700833A typical `shell.nix` might look like:
701834
702−```
835+```nix
703836with import <nixpkgs> {};
704837
705838stdenv.mkDerivation {
@@ -721,17 +854,19 @@ stdenv.mkDerivation {
721854```
722855
723856You should now be able to run the following:
724−```
857+
858+```ShellSession
725859$ nix-shell --pure
726860$ cargo build
727861$ cargo test
728862```
729863
730−### Controlling Rust Version Inside `nix-shell`
864+### Controlling Rust Version Inside `nix-shell` {#controlling-rust-version-inside-nix-shell}
865+
731866To control your rust version (i.e. use nightly) from within `shell.nix` (or
732867other nix expressions) you can use the following `shell.nix`
733868
734−```
869+```nix
735870# Latest Nightly
736871with import <nixpkgs> {};
737872let src = fetchFromGitHub {
@@ -759,78 +894,115 @@ stdenv.mkDerivation {
759894```
760895
761896Now run:
762−```
897+
898+```ShellSession
763899$ rustc --version
764900rustc 1.26.0-nightly (188e693b3 2018-03-26)
765901```
766902
767903To see that you are using nightly.
768904
905+## Using community Rust overlays {#using-community-rust-overlays}
769906
770−## Using the Rust nightlies overlay
907+There are two community maintained approaches to Rust toolchain management:
908+- [oxalica's Rust overlay](https://github.com/oxalica/rust-overlay)
909+- [fenix](https://github.com/nix-community/fenix)
771910
772−Mozilla provides an overlay for nixpkgs to bring a nightly version of Rust into scope.
773−This overlay can _also_ be used to install recent unstable or stable versions
774−of Rust, if desired.
911+Oxalica's overlay allows you to select a particular Rust version and components.
912+See [their documentation](https://github.com/oxalica/rust-overlay#rust-overlay) for more
913+detailed usage.
775914
776−### Rust overlay installation
915+Fenix is an alternative to `rustup` and can also be used as an overlay.
777916
778−You can use this overlay by either changing your local nixpkgs configuration,
779−or by adding the overlay declaratively in a nix expression, e.g. in `configuration.nix`.
780−For more information see [#sec-overlays-install](the manual on installing overlays).
917+Both oxalica's overlay and fenix better integrate with nix and cache optimizations.
918+Because of this and ergonomics, either of those community projects
919+should be preferred to the Mozilla's Rust overlay (`nixpkgs-mozilla`).
781920
782−#### Imperative rust overlay installation
921+### How to select a specific `rustc` and toolchain version {#how-to-select-a-specific-rustc-and-toolchain-version}
783922
784−Clone [nixpkgs-mozilla](https://github.com/mozilla/nixpkgs-mozilla),
785−and create a symbolic link to the file
786−[rust-overlay.nix](https://github.com/mozilla/nixpkgs-mozilla/blob/master/rust-overlay.nix)
787−in the `~/.config/nixpkgs/overlays` directory.
923+You can consume the oxalica overlay and use it to grab a specific Rust toolchain version.
924+Here is an example `shell.nix` showing how to grab the current stable toolchain:
925+```nix
926+{ pkgs ? import <nixpkgs> {
927+ overlays = [
928+ (import (fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
929+ ];
930+ }
931+}:
932+pkgs.mkShell {
933+ nativeBuildInputs = with pkgs; [
934+ pkg-config
935+ rust-bin.stable.latest.minimal
936+ ];
937+}
938+```
788939
789− $ git clone https://github.com/mozilla/nixpkgs-mozilla.git
790− $ mkdir -p ~/.config/nixpkgs/overlays
791− $ ln -s $(pwd)/nixpkgs-mozilla/rust-overlay.nix ~/.config/nixpkgs/overlays/rust-overlay.nix
940+You can try this out by:
941+1. Saving that to `shell.nix`
942+2. Executing `nix-shell --pure --command 'rustc --version'`
792943
793−### Declarative rust overlay installation
944+As of writing, this prints out `rustc 1.56.0 (09c42c458 2021-10-18)`.
794945
795−Add the following to your `configuration.nix`, `home-configuration.nix`, `shell.nix`, or similar:
946+### How to use an overlay toolchain in a derivation {#how-to-use-an-overlay-toolchain-in-a-derivation}
796947
797−```
798−{ pkgs ? import <nixpkgs> {
799− overlays = [
800− (import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz))
801− # Further overlays go here
802− ];
803− };
948+You can also use an overlay's Rust toolchain with `buildRustPackage`.
949+The below snippet demonstrates invoking `buildRustPackage` with an oxalica overlay selected Rust toolchain:
950+```nix
951+with import <nixpkgs> {
952+ overlays = [
953+ (import (fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
954+ ];
804955};
805−```
806956
807−Note that this will fetch the latest overlay version when rebuilding your system.
957+rustPlatform.buildRustPackage rec {
958+ pname = "ripgrep";
959+ version = "12.1.1";
960+ nativeBuildInputs = [
961+ rust-bin.stable.latest.minimal
962+ ];
808963
809−### Rust overlay usage
964+ src = fetchFromGitHub {
965+ owner = "BurntSushi";
966+ repo = "ripgrep";
967+ rev = version;
968+ sha256 = "1hqps7l5qrjh9f914r5i6kmcz6f1yb951nv4lby0cjnp5l253kps";
969+ };
810970
811−The overlay contains attribute sets corresponding to different versions of the rust toolchain, such as:
971+ cargoSha256 = "03wf9r2csi6jpa7v5sw5lpxkrk4wfzwmzx7k3991q3bdjzcwnnwp";
812972
813−* `latest.rustChannels.stable`
814−* `latest.rustChannels.nightly`
815−* a function `rustChannelOf`, called as `(rustChannelOf { date = "2018-04-11"; channel = "nightly"; })`, or...
816−* `(nixpkgs.rustChannelOf { rustToolchain = ./rust-toolchain; })` if you have a local `rust-toolchain` file (see https://github.com/mozilla/nixpkgs-mozilla#using-in-nix-expressions for an example)
973+ meta = with lib; {
974+ description = "A fast line-oriented regex search tool, similar to ag and ack";
975+ homepage = "https://github.com/BurntSushi/ripgrep";
976+ license = licenses.unlicense;
977+ maintainers = [ maintainers.tailhook ];
978+ };
979+}
980+```
817981
818−Each of these contain packages such as `rust`, which contains your usual rust development tools with the respective toolchain chosen.
819−For example, you might want to add `latest.rustChannels.stable.rust` to the list of packages in your configuration.
982+Follow the below steps to try that snippet.
983+1. create a new directory
984+1. save the above snippet as `default.nix` in that directory
985+1. cd into that directory and run `nix-build`
820986
821−Imperatively, the latest stable version can be installed with the following command:
987+### Rust overlay installation {#rust-overlay-installation}
822988
823− $ nix-env -Ai nixpkgs.latest.rustChannels.stable.rust
989+You can use this overlay by either changing your local nixpkgs configuration,
990+or by adding the overlay declaratively in a nix expression, e.g. in `configuration.nix`.
991+For more information see [the manual on installing overlays](#sec-overlays-install).
824992
825−Or using the attribute with nix-shell:
993+### Declarative Rust overlay installation {#declarative-rust-overlay-installation}
826994
827− $ nix-shell -p nixpkgs.latest.rustChannels.stable.rust
995+This snippet shows how to use oxalica's Rust overlay.
996+Add the following to your `configuration.nix`, `home-configuration.nix`, `shell.nix`, or similar:
828997
829−Substitute the `nixpkgs` prefix with `nixos` on NixOS.
830−To install the beta or nightly channel, "stable" should be substituted by
831−"nightly" or "beta", or
832−use the function provided by this overlay to pull a version based on a
833−build date.
998+```nix
999+{ pkgs ? import <nixpkgs> {
1000+ overlays = [
1001+ (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
1002+ # Further overlays go here
1003+ ];
1004+ };
1005+};
1006+```
8341007
835−The overlay automatically updates itself as it uses the same source as
836−[rustup](https://www.rustup.rs/).
1008+Note that this will fetch the latest overlay version when rebuilding your system.
doc/languages-frameworks/texlive.section.md+3−1
@@ -5,7 +5,8 @@ Since release 15.09 there is a new TeX Live packaging that lives entirely under
55## User's guide {#sec-language-texlive-user-guide}
66
77- For basic usage just pull `texlive.combined.scheme-basic` for an environment with basic LaTeX support.
8−- It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this:
8+
9+- It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this. Most CTAN packages should be available:
910
1011 ```nix
1112 texlive.combine {
@@ -14,6 +15,7 @@ Since release 15.09 there is a new TeX Live packaging that lives entirely under
1415 ```
1516
1617- There are all the schemes, collections and a few thousand packages, as defined upstream (perhaps with tiny differences).
18+
1719- 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`.
1820
1921 ```nix
doc/languages-frameworks/titanium.section.md+4−4
@@ -9,8 +9,8 @@ applications for Android and iOS devices from source code.
99Not all Titanium features supported -- currently, it can only be used to build
1010Android and iOS apps.
1111
12−Building a Titanium app
13−-----------------------
12+## Building a Titanium app {#building-a-titanium-app}
13+
1414We can build a Titanium app from source for Android or iOS and for debugging or
1515release purposes by invoking the `titaniumenv.buildApp {}` function:
1616
@@ -103,8 +103,8 @@ When `enableWirelessDistribution` has been enabled, you must also provide the
103103path of the PHP script (`installURL`) (that is included with the iOS build
104104environment) to enable wireless ad-hoc installations.
105105
106−Emulating or simulating the app
107−-------------------------------
106+## Emulating or simulating the app {#emulating-or-simulating-the-app}
107+
108108It is also possible to simulate the correspond iOS simulator build by using
109109`xcodeenv.simulateApp {}` and emulate an Android APK by using
110110`androidenv.emulateApp {}`.
doc/languages-frameworks/vim.section.md+87−19
@@ -12,13 +12,13 @@ At the moment we support three different methods for managing plugins:
1212- Pathogen
1313- vim-plug
1414
15−## Custom configuration
15+## Custom configuration {#custom-configuration}
1616
1717Adding custom .vimrc lines can be done using the following code:
1818
1919```nix
2020vim_configurable.customize {
21− # `name` specifies the name of the executable and package
21+ # `name` optionally specifies the name of the executable and package
2222 name = "vim-with-plugins";
2323
2424 vimrcConfig.customRC = ''
@@ -28,6 +28,9 @@ vim_configurable.customize {
2828```
2929
3030This configuration is used when Vim is invoked with the command specified as name, in this case `vim-with-plugins`.
31+You can also omit `name` to customize Vim itself. See the
32+[definition of `vimUtils.makeCustomizable`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/vim-utils.nix#L408)
33+for all supported options.
3134
3235For Neovim the `configure` argument can be overridden to achieve the same:
3336
@@ -56,7 +59,7 @@ neovim-qt.override {
5659}
5760```
5861
59−## Managing plugins with Vim packages
62+## Managing plugins with Vim packages {#managing-plugins-with-vim-packages}
6063
6164To store you plugins in Vim packages (the native Vim plugin manager, see `:help packages`) the following example can be used:
6265
@@ -116,7 +119,72 @@ The resulting package can be added to `packageOverrides` in `~/.nixpkgs/config.n
116119
117120After that you can install your special grafted `myVim` or `myNeovim` packages.
118121
119−## Managing plugins with vim-plug
122+### What if your favourite Vim plugin isn’t already packaged? {#what-if-your-favourite-vim-plugin-isnt-already-packaged}
123+
124+If one of your favourite plugins isn't packaged, you can package it yourself:
125+
126+```nix
127+{ config, pkgs, ... }:
128+
129+let
130+ easygrep = pkgs.vimUtils.buildVimPlugin {
131+ name = "vim-easygrep";
132+ src = pkgs.fetchFromGitHub {
133+ owner = "dkprice";
134+ repo = "vim-easygrep";
135+ rev = "d0c36a77cc63c22648e792796b1815b44164653a";
136+ sha256 = "0y2p5mz0d5fhg6n68lhfhl8p4mlwkb82q337c22djs4w5zyzggbc";
137+ };
138+ };
139+in
140+{
141+ environment.systemPackages = [
142+ (
143+ pkgs.neovim.override {
144+ configure = {
145+ packages.myPlugins = with pkgs.vimPlugins; {
146+ start = [
147+ vim-go # already packaged plugin
148+ easygrep # custom package
149+ ];
150+ opt = [];
151+ };
152+ # ...
153+ };
154+ }
155+ )
156+ ];
157+}
158+```
159+
160+### Specificities for some plugins
161+#### Tree sitter
162+
163+By default `nvim-treesitter` encourages you to download, compile and install
164+the required tree-sitter grammars at run time with `:TSInstall`. This works
165+poorly on NixOS. Instead, to install the `nvim-treesitter` plugins with a set
166+of precompiled grammars, you can use `nvim-treesitter.withPlugins` function:
167+
168+```nix
169+(pkgs.neovim.override {
170+ configure = {
171+ packages.myPlugins = with pkgs.vimPlugins; {
172+ start = [
173+ (nvim-treesitter.withPlugins (
174+ plugins: with plugins; [
175+ tree-sitter-nix
176+ tree-sitter-python
177+ ]
178+ ))
179+ ];
180+ };
181+ };
182+})
183+```
184+
185+To enable all grammars packaged in nixpkgs, use `(pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars))`.
186+
187+## Managing plugins with vim-plug {#managing-plugins-with-vim-plug}
120188
121189To use [vim-plug](https://github.com/junegunn/vim-plug) to manage your Vim
122190plugins the following example can be used:
@@ -145,18 +213,18 @@ neovim.override {
145213}
146214```
147215
148−## Managing plugins with VAM
216+## Managing plugins with VAM {#managing-plugins-with-vam}
149217
150−### Handling dependencies of Vim plugins
218+### Handling dependencies of Vim plugins {#handling-dependencies-of-vim-plugins}
151219
152220VAM introduced .json files supporting dependencies without versioning
153221assuming that "using latest version" is ok most of the time.
154222
155−### Example
223+### Example {#example}
156224
157225First create a vim-scripts file having one plugin name per line. Example:
158226
159−```
227+```vim
160228"tlib"
161229{'name': 'vim-addon-sql'}
162230{'filetype_regex': '\%(vim)$', 'names': ['reload', 'vim-dev-plugin']}
@@ -197,7 +265,7 @@ nix-shell -p vimUtils.vim_with_vim2nix --command "vim -c 'source generate.vim'"
197265You should get a Vim buffer with the nix derivations (output1) and vam.pluginDictionaries (output2).
198266You can add your Vim to your system's configuration file like this and start it by "vim-my":
199267
200−```
268+```nix
201269my-vim =
202270 let plugins = let inherit (vimUtils) buildVimPluginFrom2Nix; in {
203271 copy paste output1 here
@@ -217,11 +285,11 @@ my-vim =
217285
218286Sample output1:
219287
220−```
288+```nix
221289"reload" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
222290 name = "reload";
223291 src = fetchgit {
224− url = "git://github.com/xolox/vim-reload";
292+ url = "https://github.com/xolox/vim-reload";
225293 rev = "0a601a668727f5b675cb1ddc19f6861f3f7ab9e1";
226294 sha256 = "0vb832l9yxj919f5hfg6qj6bn9ni57gnjd3bj7zpq7d4iv2s4wdh";
227295 };
@@ -242,13 +310,13 @@ Sample output2:
242310]
243311```
244312
245−## Adding new plugins to nixpkgs
313+## Adding new plugins to nixpkgs {#adding-new-plugins-to-nixpkgs}
246314
247−Nix expressions for Vim plugins are stored in [pkgs/misc/vim-plugins](/pkgs/misc/vim-plugins). For the vast majority of plugins, Nix expressions are automatically generated by running [`./update.py`](/pkgs/misc/vim-plugins/update.py). This creates a [generated.nix](/pkgs/misc/vim-plugins/generated.nix) file based on the plugins listed in [vim-plugin-names](/pkgs/misc/vim-plugins/vim-plugin-names). Plugins are listed in alphabetical order in `vim-plugin-names` using the format `[github username]/[repository]`. For example https://github.com/scrooloose/nerdtree becomes `scrooloose/nerdtree`.
315+Nix expressions for Vim plugins are stored in [pkgs/applications/editors/vim/plugins](https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/editors/vim/plugins). For the vast majority of plugins, Nix expressions are automatically generated by running [`./update.py`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py). This creates a [generated.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/generated.nix) file based on the plugins listed in [vim-plugin-names](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/vim-plugin-names). Plugins are listed in alphabetical order in `vim-plugin-names` using the format `[github username]/[repository]@[gitref]`. For example https://github.com/scrooloose/nerdtree becomes `scrooloose/nerdtree`.
248316
249−Some plugins require overrides in order to function properly. Overrides are placed in [overrides.nix](/pkgs/misc/vim-plugins/overrides.nix). Overrides are most often required when a plugin requires some dependencies, or extra steps are required during the build process. For example `deoplete-fish` requires both `deoplete-nvim` and `vim-fish`, and so the following override was added:
317+Some plugins require overrides in order to function properly. Overrides are placed in [overrides.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/overrides.nix). Overrides are most often required when a plugin requires some dependencies, or extra steps are required during the build process. For example `deoplete-fish` requires both `deoplete-nvim` and `vim-fish`, and so the following override was added:
250318
251−```
319+```nix
252320deoplete-fish = super.deoplete-fish.overrideAttrs(old: {
253321 dependencies = with super; [ deoplete-nvim vim-fish ];
254322});
@@ -260,21 +328,21 @@ To add a new plugin, run `./update.py --add "[owner]/[name]"`. **NOTE**: This sc
260328
261329Finally, there are some plugins that are also packaged in nodePackages because they have Javascript-related build steps, such as running webpack. Those plugins are not listed in `vim-plugin-names` or managed by `update.py` at all, and are included separately in `overrides.nix`. Currently, all these plugins are related to the `coc.nvim` ecosystem of Language Server Protocol integration with vim/neovim.
262330
263−## Updating plugins in nixpkgs
331+## Updating plugins in nixpkgs {#updating-plugins-in-nixpkgs}
264332
265333Run the update script with a GitHub API token that has at least `public_repo` access. Running the script without the token is likely to result in rate-limiting (429 errors). For steps on creating an API token, please refer to [GitHub's token documentation](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token).
266334
267335```sh
268−GITHUB_API_TOKEN=my_token ./pkgs/misc/vim-plugins/update.py
336+GITHUB_API_TOKEN=my_token ./pkgs/applications/editors/vim/plugins/update.py
269337```
270338
271339Alternatively, set the number of processes to a lower count to avoid rate-limiting.
272340
273341```sh
274−./pkgs/misc/vim-plugins/update.py --proc 1
342+./pkgs/applications/editors/vim/plugins/update.py --proc 1
275343```
276344
277−## Important repositories
345+## Important repositories {#important-repositories}
278346
279347- [vim-pi](https://bitbucket.org/vimcommunity/vim-pi) is a plugin repository
280348 from VAM plugin manager meant to be used by others as well used by
doc/manual.xml+9−7
@@ -8,9 +8,9 @@
88 <xi:include href="preface.chapter.xml" />
99 <part>
1010 <title>Using Nixpkgs</title>
11− <xi:include href="using/configuration.xml" />
12− <xi:include href="using/overlays.xml" />
13− <xi:include href="using/overrides.xml" />
11+ <xi:include href="using/configuration.chapter.xml" />
12+ <xi:include href="using/overlays.chapter.xml" />
13+ <xi:include href="using/overrides.chapter.xml" />
1414 <xi:include href="functions.xml" />
1515 </part>
1616 <part>
@@ -25,18 +25,20 @@
2525 <title>Builders</title>
2626 <xi:include href="builders/fetchers.chapter.xml" />
2727 <xi:include href="builders/trivial-builders.chapter.xml" />
28+ <xi:include href="builders/testers.chapter.xml" />
2829 <xi:include href="builders/special.xml" />
2930 <xi:include href="builders/images.xml" />
31+ <xi:include href="hooks/index.xml" />
3032 <xi:include href="languages-frameworks/index.xml" />
3133 <xi:include href="builders/packages/index.xml" />
3234 </part>
3335 <part>
3436 <title>Contributing to Nixpkgs</title>
35− <xi:include href="contributing/quick-start.xml" />
36− <xi:include href="contributing/coding-conventions.xml" />
37+ <xi:include href="contributing/quick-start.chapter.xml" />
38+ <xi:include href="contributing/coding-conventions.chapter.xml" />
3739 <xi:include href="contributing/submitting-changes.chapter.xml" />
3840 <xi:include href="contributing/vulnerability-roundup.chapter.xml" />
39− <xi:include href="contributing/reviewing-contributions.xml" />
40− <xi:include href="contributing/contributing-to-documentation.xml" />
41+ <xi:include href="contributing/reviewing-contributions.chapter.xml" />
42+ <xi:include href="contributing/contributing-to-documentation.chapter.xml" />
4143 </part>
4244</book>
doc/preface.chapter.md+1−1
@@ -12,7 +12,7 @@ Nixpkgs. If you like to learn more about the Nix package manager and the Nix
1212expression language, then you are kindly referred to the [Nix manual](https://nixos.org/nix/manual/).
1313The NixOS distribution is documented in the [NixOS manual](https://nixos.org/nixos/manual/).
1414
15−## Overview of Nixpkgs
15+## Overview of Nixpkgs {#overview-of-nixpkgs}
1616
1717Nix expressions describe how to build packages from source and are collected in
1818the [nixpkgs repository](https://github.com/NixOS/nixpkgs). Also included in the
doc/stdenv/cross-compilation.chapter.md+55−27
@@ -6,7 +6,6 @@
66
77This 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.
88
9−
109## Packaging in a cross-friendly manner {#sec-cross-packaging}
1110
1211### Platform parameters {#ssec-cross-platform-parameters}
@@ -65,8 +64,8 @@ The exact schema these fields follow is a bit ill-defined due to a long and conv
6564
6665### Theory of dependency categorization {#ssec-cross-dependency-categorization}
6766
68−::: note
69−This is a rather philosophical description that isn't very Nixpkgs-specific. For an overview of all the relevant attributes given to `mkDerivation`, see <xref linkend="ssec-stdenv-dependencies"/>. For a description of how everything is implemented, see <xref linkend="ssec-cross-dependency-implementation"/>.
67+::: {.note}
68+This is a rather philosophical description that isn't very Nixpkgs-specific. For an overview of all the relevant attributes given to `mkDerivation`, see [](#ssec-stdenv-dependencies). For a description of how everything is implemented, see [](#ssec-cross-dependency-implementation).
7069:::
7170
7271In this section we explore the relationship between both runtime and build-time dependencies and the 3 Autoconf platforms.
@@ -79,21 +78,46 @@ If both the dependency and depending packages aren't compilers or other machine-
7978
8079Finally, 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 languages' 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.
8180
82−Putting this all together, that means we have dependencies in the form "host → target", in at most the following six combinations:
81+Putting this all together, that means that we have dependency types of the form "X→ E", which means that the dependency executes on X and emits code for E; each of X and E can be `build`, `host`, or `target`, and E can be `*` to indicate that the dependency is not a compiler-like package.
82+
83+Dependency types describe the relationships that a package has with each of its transitive dependencies. You could think of attaching one or more dependency types to each of the formal parameters at the top of a package's `.nix` file, as well as to all of *their* formal parameters, and so on. Triples like `(foo, bar, baz)`, on the other hand, are a property of an instantiated derivation -- you could would attach a triple `(mips-linux, mips-linux, sparc-solaris)` to a `.drv` file in `/nix/store`.
84+
85+Only nine dependency types matter in practice:
86+
87+#### Possible dependency types {#possible-dependency-types}
88+
89+| Dependency type | Dependency’s host platform | Dependency’s target platform |
90+|-----------------|----------------------------|------------------------------|
91+| build → * | build | (none) |
92+| build → build | build | build |
93+| build → host | build | host |
94+| build → target | build | target |
95+| host → * | host | (none) |
96+| host → host | host | host |
97+| host → target | host | target |
98+| target → * | target | (none) |
99+| target → target | target | target |
100+
101+Let's use `g++` as an example to make this table clearer. `g++` is a C++ compiler written in C. Suppose we are building `g++` with a `(build, host, target)` platform triple of `(foo, bar, baz)`. This means we are using a `foo`-machine to build a copy of `g++` which will run on a `bar`-machine and emit binaries for the `baz`-machine.
102+
103+* `g++` links against the host platform's `glibc` C library, which is a "host→ *" dependency with a triple of `(bar, bar, *)`. Since it is a library, not a compiler, it has no "target".
104+
105+* Since `g++` is written in C, the `gcc` compiler used to compile it is a "build→ host" dependency of `g++` with a triple of `(foo, foo, bar)`. This compiler runs on the build platform and emits code for the host platform.
83106
107+* `gcc` links against the build platform's `glibc` C library, which is a "build→ *" dependency with a triple of `(foo, foo, *)`. Since it is a library, not a compiler, it has no "target".
84108
85−#### Possible dependency types
86−| Dependency's host platform | Dependency's target platform |
87−| -- | -- |
88−| build | build |
89−| build | host |
90−| build | target |
91−| host | host |
92−| host | target |
93−| target | target |
109+* This `gcc` is itself compiled by an *earlier* copy of `gcc`. This earlier copy of `gcc` is a "build→ build" dependency of `g++` with a triple of `(foo, foo, foo)`. This "early `gcc`" runs on the build platform and emits code for the build platform.
94110
111+* `g++` is bundled with `libgcc`, which includes a collection of target-machine routines for exception handling and
112+software floating point emulation. `libgcc` would be a "target→ *" dependency with triple `(foo, baz, *)`, because it consists of machine code which gets linked against the output of the compiler that we are building. It is a library, not a compiler, so it has no target of its own.
95113
96−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)`.
114+* `libgcc` is written in C and compiled with `gcc`. The `gcc` that compiles it will be a "build→ target" dependency with triple `(foo, foo, baz)`. It gets compiled *and run* at `g++`-build-time (on platform `foo`), but must emit code for the `baz`-platform.
115+
116+* `g++` allows inline assembler code, so it depends on access to a copy of the `gas` assembler. This would be a "host→ target" dependency with triple `(foo, bar, baz)`.
117+
118+* `g++` (and `gcc`) include a library `libgccjit.so`, which wrap the compiler in a library to create a just-in-time compiler. In nixpkgs, this library is in the `libgccjit` package; if C++ required that programs have access to a JIT, `g++` would need to add a "target→ target" dependency for `libgccjit` with triple `(foo, baz, baz)`. This would ensure that the compiler ships with a copy of `libgccjit` which both executes on and generates code for the `baz`-platform.
119+
120+* If `g++` itself linked against `libgccjit.so` (for example, to allow compile-time-evaluated C++ expressions), then the `libgccjit` package used to provide this functionality would be a "host→ host" dependency of `g++`: it is code which runs on the `host` and emits code for execution on the `host`.
97121
98122### Cross packaging cookbook {#ssec-cross-cookbook}
99123
@@ -113,17 +137,20 @@ On less powerful machines, it can be inconvenient to cross-compile a package onl
113137$ nix-build '<nixpkgs>' -A pkgsCross.raspberryPi.hello
114138```
115139
116−#### What if my package's build system needs to build a C program to be run under the build environment? {#cross-qa-build-c-program-in-build-environment}
140+#### What if my package’s build system needs to build a C program to be run under the build environment? {#cross-qa-build-c-program-in-build-environment}
141+
117142Add the following to your `mkDerivation` invocation.
143+
118144```nix
119145depsBuildBuild = [ buildPackages.stdenv.cc ];
120146```
121147
122−#### My package's testsuite needs to run host platform code. {#cross-testsuite-runs-host-code}
148+#### My package’s testsuite needs to run host platform code. {#cross-testsuite-runs-host-code}
123149
124150Add the following to your `mkDerivation` invocation.
151+
125152```nix
126−doCheck = stdenv.hostPlatform == stdenv.buildPlatfrom;
153+doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
127154```
128155
129156## Cross-building packages {#sec-cross-usage}
@@ -134,7 +161,7 @@ Nixpkgs can be instantiated with `localSystem` alone, in which case there is no
134161$ nix-build '<nixpkgs>' --arg crossSystem '(import <nixpkgs/lib>).systems.examples.fooBarBaz' -A whatever
135162```
136163
137−::: note
164+::: {.note}
138165Eventually we would like to make these platform examples an unnecessary convenience so that
139166
140167```ShellSession
@@ -146,7 +173,7 @@ works in the vast majority of cases. The problem today is dependencies on other
146173
147174While 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.
148175
149−::: note
176+::: {.note}
150177Many 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.
151178:::
152179
@@ -156,9 +183,9 @@ One would think that `localSystem` and `crossSystem` overlap horribly with the t
156183
157184### Implementation of dependencies {#ssec-cross-dependency-implementation}
158185
159−The categories of dependencies developed in <xref linkend="ssec-cross-dependency-categorization"/> are specified as lists of derivations given to `mkDerivation`, as documented in <xref linkend="ssec-stdenv-dependencies"/>. 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 `pkgsFooBar`s 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.
186+The categories of dependencies developed in [](#ssec-cross-dependency-categorization) are specified as lists of derivations given to `mkDerivation`, as documented in [](#ssec-stdenv-dependencies). In short, each list of dependencies for "host → target" is called `deps<host><target>` (where `host`, and `target` values are either `build`, `host`, or `target`), with exceptions for backwards compatibility that `depsBuildHost` is instead called `nativeBuildInputs` and `depsHostTarget` is instead called `buildInputs`. Nixpkgs is now structured so that each `deps<host><target>` is automatically taken from `pkgs<host><target>`. (These `pkgs<host><target>`s 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.
160187
161−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.
188+Now, for most of Nixpkgs's history, there were no `pkgs<host><target>` 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.
162189
163190But 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.
164191
@@ -178,7 +205,7 @@ While there are many package sets, and thus many edges, the stages can also be a
178205
179206In each stage, `pkgsBuildHost` refers to 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`.
180207
181−::: note
208+::: {.note}
182209The native stages are bootstrapped in legacy ways that predate the current cross implementation. This is why the bootstrapping stages leading up to the final stages are ignored in the previous paragraph.
183210:::
184211
@@ -186,15 +213,16 @@ If one looks at the 3 platform triples, one can see that they overlap such that
186213```
187214(native, native, native, foreign, foreign)
188215```
216+
189217If 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:
190218```
191219(native..., native, native, native, foreign, foreign, foreign...)
192220```
193−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" bootstrapping stage where `build != host != target`, more bootstrapping stages are needed since no sliding window provides the pesky `pkgsBuildTarget` package set since it skips the Canadian cross stage's "host".
221+One 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" bootstrapping stage where `build != host != target`, more bootstrapping stages are needed since no sliding window provides the pesky `pkgsBuildTarget` package set since it skips the Canadian cross stage's "host".
194222
195223
196−::: note
197−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.
224+::: {.note}
225+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.
198226
199227First, 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`
200228
@@ -203,6 +231,6 @@ Second, it is because this is a frequent source of hard-to-follow "infinite recu
203231Thirdly, 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.
204232:::
205233
206−::: note
207−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.
234+::: {.note}
235+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.
208236:::
doc/stdenv/meta.chapter.md+67−10
@@ -114,6 +114,10 @@ For details, see [Licenses](#sec-meta-license).
114114
115115A list of the maintainers of this Nix expression. Maintainers are defined in [`nixpkgs/maintainers/maintainer-list.nix`](https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix). There is no restriction to becoming a maintainer, just add yourself to that list in a separate commit titled “maintainers: add alice”, and reference maintainers with `maintainers = with lib.maintainers; [ alice bob ]`.
116116
117+### `mainProgram` {#var-meta-mainProgram}
118+
119+The name of the main binary for the package. This effects the binary `nix run` executes and falls back to the name of the package. Example: `"rg"`
120+
117121### `priority` {#var-meta-priority}
118122
119123The *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).
@@ -130,11 +134,32 @@ Attribute Set `lib.platforms` defines [various common lists](https://github.com/
130134
131135### `tests` {#var-meta-tests}
132136
133−::: warning
137+::: {.warning}
134138This 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.
135139:::
136140
137−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.
141+An attribute set with tests as values. A test is a derivation that builds when the test passes and fails to build otherwise.
142+
143+You can run these tests with:
144+
145+```ShellSession
146+$ cd path/to/nixpkgs
147+$ nix-build -A your-package.tests
148+```
149+
150+#### Package tests
151+
152+Tests that are part of the source package are often executed in the `installCheckPhase`.
153+
154+Prefer `passthru.tests` for tests that are introduced in nixpkgs because:
155+
156+* `passthru.tests` tests the 'real' package, independently from the environment in which it was built
157+* we can run `passthru.tests` independently
158+* `installCheckPhase` adds overhead to each build
159+
160+For more on how to write and run package tests, see <xref linkend="sec-package-tests"/>.
161+
162+#### NixOS tests
138163
139164The NixOS tests are available as `nixosTests` in parameters of derivations. For instance, the OpenSMTPD derivation includes lines similar to:
140165
@@ -148,6 +173,42 @@ The NixOS tests are available as `nixosTests` in parameters of derivations. For
148173}
149174```
150175
176+NixOS tests run in a VM, so they are slower than regular package tests. For more information see [NixOS module tests](https://nixos.org/manual/nixos/stable/#sec-nixos-tests).
177+
178+Alternatively, you can specify other derivations as tests. You can make use of
179+the optional parameter to inject the correct package without
180+relying on non-local definitions, even in the presence of `overrideAttrs`.
181+Here that's `finalAttrs.finalPackage`, but you could choose a different name if
182+`finalAttrs` already exists in your scope.
183+
184+`(mypkg.overrideAttrs f).passthru.tests` will be as expected, as long as the
185+definition of `tests` does not rely on the original `mypkg` or overrides it in
186+all places.
187+
188+```nix
189+# my-package/default.nix
190+{ stdenv, callPackage }:
191+stdenv.mkDerivation (finalAttrs: {
192+ # ...
193+ passthru.tests.example = callPackage ./example.nix { my-package = finalAttrs.finalPackage; };
194+})
195+```
196+
197+```nix
198+# my-package/example.nix
199+{ runCommand, lib, my-package, ... }:
200+runCommand "my-package-test" {
201+ nativeBuildInputs = [ my-package ];
202+ src = lib.sources.sourcesByRegex ./. [ ".*.in" ".*.expected" ];
203+} ''
204+ my-package --help
205+ my-package <example.in >example.actual
206+ diff -U3 --color=auto example.expected example.actual
207+ mkdir $out
208+''
209+```
210+
211+
151212### `timeout` {#var-meta-timeout}
152213
153214A 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`.
@@ -165,30 +226,26 @@ meta.hydraPlatforms = [];
165226
166227If 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.
167228
168−### `updateWalker` {#var-meta-updateWalker}
169−
170−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.
171−
172229## Licenses {#sec-meta-license}
173230
174231The `meta.license` attribute should preferably contain a value from `lib.licenses` defined in [`nixpkgs/lib/licenses.nix`](https://github.com/NixOS/nixpkgs/blob/master/lib/licenses.nix), or in-place license description of the same format if the license is unlikely to be useful in another expression.
175232
176233Although it’s typically better to indicate the specific license, a few generic options are available:
177234
178−### `lib.licenses.free`, `"free"`
235+### `lib.licenses.free`, `"free"` {#lib.licenses.free-free}
179236
180237Catch-all for free software licenses not listed above.
181238
182−### `lib.licenses.unfreeRedistributable`, `"unfree-redistributable"`
239+### `lib.licenses.unfreeRedistributable`, `"unfree-redistributable"` {#lib.licenses.unfreeredistributable-unfree-redistributable}
183240
184241Unfree 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.
185242
186243Sometimes 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.
187244
188−### `lib.licenses.unfree`, `"unfree"`
245+### `lib.licenses.unfree`, `"unfree"` {#lib.licenses.unfree-unfree}
189246
190247Unfree 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.
191248
192−### `lib.licenses.unfreeRedistributableFirmware`, `"unfree-redistributable-firmware"`
249+### `lib.licenses.unfreeRedistributableFirmware`, `"unfree-redistributable-firmware"` {#lib.licenses.unfreeredistributablefirmware-unfree-redistributable-firmware}
193250
194251This package supplies unfree, redistributable firmware. This is a separate value from `unfree-redistributable` because not everybody cares whether firmware is free.
doc/stdenv/multiple-output.chapter.md+15−15
@@ -6,7 +6,7 @@ The Nix language allows a derivation to produce multiple outputs, which is simil
66
77The 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.
88
9−::: note
9+::: {.note}
1010The 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.
1111:::
1212
@@ -28,7 +28,7 @@ NixOS provides two ways to select the outputs to install for packages listed in
2828
2929`nix-env` lacks an easy way to select the outputs to install. When installing a package, `nix-env` always installs the outputs listed in `meta.outputsToInstall`, even when the user explicitly selects an output.
3030
31−::: warning
31+::: {.warning}
3232`nix-env` silenty disregards the outputs selected by the user, and instead installs the outputs from `meta.outputsToInstall`. For example,
3333
3434```ShellSession
@@ -38,7 +38,7 @@ $ nix-env -iA nixpkgs.coreutils.info
3838installs the `"out"` output (`coreutils.meta.outputsToInstall` is `[ "out" ]`) instead of the requested `"info"`.
3939:::
4040
41−The only recourse to select an output with `nix-env` is to override the package’s `meta.outputsToInstall`, using the functions described in <xref linkend="chap-overrides" />. For example, the following overlay adds the `"info"` output for the `coreutils` package:
41+The only recourse to select an output with `nix-env` is to override the package’s `meta.outputsToInstall`, using the functions described in [](#chap-overrides). For example, the following overlay adds the `"info"` output for the `coreutils` package:
4242
4343```nix
4444self: super:
@@ -53,7 +53,7 @@ self: super:
5353
5454In 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.
5555
56−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 <xref linkend="multiple-output-file-type-groups" />.)
56+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 [](#multiple-output-file-type-groups).)
5757
5858In 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.)
5959
@@ -69,8 +69,8 @@ outputs = [ "bin" "dev" "out" "doc" ];
6969
7070Often 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.
7171
72−::: note
73−There is a special handling of the `debug` output, described at <xref linkend="stdenv-separateDebugInfo" />.
72+::: {.note}
73+There is a special handling of the `debug` output, described at [](#stdenv-separateDebugInfo).
7474:::
7575
7676### “Binaries first” {#multiple-output-file-binaries-first-convention}
@@ -79,41 +79,41 @@ A commonly adopted convention in `nixpkgs` is that executables provided by the p
7979
8080The `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`).
8181
82−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](https://github.com/NixOS/patchelf/blob/master/README) for more details).
82+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](https://github.com/NixOS/patchelf) for more details).
8383
8484### File type groups {#multiple-output-file-type-groups}
8585
8686The 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.
8787
88−#### ` $outputDev`
88+#### `$outputDev` {#outputdev}
8989
9090is for development-only files. These include C(++) headers (`include/`), pkg-config (`lib/pkgconfig/`), cmake (`lib/cmake/`) and aclocal files (`share/aclocal/`). They go to `dev` or `out` by default.
9191
92−#### ` $outputBin`
92+#### `$outputBin` {#outputbin}
9393
9494is meant for user-facing binaries, typically residing in `bin/`. They go to `bin` or `out` by default.
9595
96−#### ` $outputLib`
96+#### `$outputLib` {#outputlib}
9797
9898is meant for libraries, typically residing in `lib/` and `libexec/`. They go to `lib` or `out` by default.
9999
100−#### ` $outputDoc`
100+#### `$outputDoc` {#outputdoc}
101101
102102is for user documentation, typically residing in `share/doc/`. It goes to `doc` or `out` by default.
103103
104−#### ` $outputDevdoc`
104+#### `$outputDevdoc` {#outputdevdoc}
105105
106106is for _developer_ documentation. Currently we count gtk-doc and devhelp books, typically residing in `share/gtk-doc/` and `share/devhelp/`, 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.
107107
108−#### ` $outputMan`
108+#### `$outputMan` {#outputman}
109109
110110is for man pages (except for section 3), typically residing in `share/man/man[0-9]/`. They go to `man` or `$outputBin` by default.
111111
112−#### ` $outputDevman`
112+#### `$outputDevman` {#outputdevman}
113113
114114is for section 3 man pages, typically residing in `share/man/man[0-9]/`. They go to `devman` or `$outputMan` by default.
115115
116−#### ` $outputInfo`
116+#### `$outputInfo` {#outputinfo}
117117
118118is for info pages, typically residing in `share/info/`. They go to `info` or `$outputBin` by default.
119119
doc/stdenv/stdenv.chapter.md+202−94
@@ -39,9 +39,9 @@ stdenv.mkDerivation {
3939}
4040```
4141
42−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 <xref linkend="ssec-setup-hooks" /> for details.)
42+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 [](#ssec-setup-hooks) for details.)
4343
44−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 <xref linkend="sec-stdenv-phases" />.) For instance, a package that doesn’t supply a makefile but instead has to be compiled "manually" could be handled like this:
44+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 [](#sec-stdenv-phases).) For instance, a package that doesn’t supply a makefile but instead has to be compiled "manually" could be handled like this:
4545
4646```nix
4747stdenv.mkDerivation {
@@ -59,7 +59,7 @@ stdenv.mkDerivation {
5959
6060(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.)
6161
62−There are many other attributes to customise the build. These are listed in <xref linkend="ssec-stdenv-attributes" />.
62+There are many other attributes to customise the build. These are listed in [](#ssec-stdenv-attributes).
6363
6464While the standard environment provides a generic builder, you can still supply your own build script:
6565
@@ -116,15 +116,27 @@ On Linux, `stdenv` also includes the `patchelf` utility.
116116
117117## Specifying dependencies {#ssec-stdenv-dependencies}
118118
119−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 <xref linkend="ssec-setup-hooks" /> for details.
119+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 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 [](#ssec-setup-hooks) for details.
120120
121−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 <xref linkend="chap-cross" /> for exactly what each platform means. [^footnote-stdenv-ignored-build-platform] 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.
121+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 [](#chap-cross) for exactly what each platform means. [^footnote-stdenv-ignored-build-platform] 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.
122122
123123The 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. [^footnote-stdenv-native-dependencies-in-path] For each dependency \<dep\> of those dependencies, `dep/bin`, if present, is added to the `PATH` environment variable.
124124
125−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.
125+A dependency is said to be **propagated** when some of its other-transitive (non-immediate) downstream dependencies also need it as an immediate dependency.
126+[^footnote-stdenv-propagated-dependencies]
126127
127−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.
128+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. To determine the exact rules for dependency propagation, we start by assigning to each dependency a couple of ternary numbers (`-1` for `build`, `0` for `host`, and `1` for `target`) representing its [dependency type](#possible-dependency-types), which captures how its host and target platforms are each "offset" from the depending derivation’s host and target platforms. The following table summarize the different combinations that can be obtained:
129+
130+| `host → target` | attribute name | offset |
131+| ------------------- | ------------------- | -------- |
132+| `build --> build` | `depsBuildBuild` | `-1, -1` |
133+| `build --> host` | `nativeBuildInputs` | `-1, 0` |
134+| `build --> target` | `depsBuildTarget` | `-1, 1` |
135+| `host --> host` | `depsHostHost` | `0, 0` |
136+| `host --> target` | `buildInputs` | `0, 1` |
137+| `target --> target` | `depsTargetTarget` | `1, 1` |
138+
139+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 is sort of 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.
128140
129141We can define the process precisely with [Natural Deduction](https://en.wikipedia.org/wiki/Natural_deduction) using the inference rules. This probably seems a bit obtuse, but so is the bash code that actually implements it! [^footnote-stdenv-find-inputs-location] They’re confusing in very different ways so… hopefully if something doesn’t make sense in one presentation, it will in the other!
130142
@@ -175,40 +187,41 @@ Because of the bounds checks, the uncommon cases are `h = t` and `h + 2 = t`. In
175187
176188Overall, 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.
177189
178−### Variables specifying dependencies
190+### Variables specifying dependencies {#variables-specifying-dependencies}
191+
179192#### `depsBuildBuild` {#var-stdenv-depsBuildBuild}
180193
181−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.
194+A list of dependencies whose host and target platforms are the new derivation’s build platform. 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.
182195
183196Since 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.
184197
185198#### `nativeBuildInputs` {#var-stdenv-nativeBuildInputs}
186199
187−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.
200+A list of dependencies whose host platform is the new derivation’s build platform, and target platform is the new derivation’s host platform. 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.
188201
189202Since 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.
190203
191204#### `depsBuildTarget` {#var-stdenv-depsBuildTarget}
192205
193−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.
206+A list of dependencies whose host platform is the new derivation’s build platform, and target platform is the new derivation’s target platform. 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.
194207
195−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.
208+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, `-1` and `1`, 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.
196209
197210Since 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.
198211
199212#### `depsHostHost` {#var-stdenv-depsHostHost}
200213
201−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.
214+A list of dependencies whose host and target platforms match the new derivation’s host platform. 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.
202215
203216#### `buildInputs` {#var-stdenv-buildInputs}
204217
205−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`.
218+A list of dependencies whose host platform and target platform match the new derivation’s. 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`.
206219
207220These 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.
208221
209222#### `depsTargetTarget` {#var-stdenv-depsTargetTarget}
210223
211−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.
224+A list of dependencies whose host platform matches the new derivation’s target platform. 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.
212225
213226#### `depsBuildBuildPropagated` {#var-stdenv-depsBuildBuildPropagated}
214227
@@ -236,13 +249,13 @@ The propagated equivalent of `depsTargetTarget`. This is prefixed for the same r
236249
237250## Attributes {#ssec-stdenv-attributes}
238251
239−### Variables affecting `stdenv` initialisation
252+### Variables affecting `stdenv` initialisation {#variables-affecting-stdenv-initialisation}
240253
241254#### `NIX_DEBUG` {#var-stdenv-NIX_DEBUG}
242255
243256A 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.
244257
245−### Attributes affecting build properties
258+### Attributes affecting build properties {#attributes-affecting-build-properties}
246259
247260#### `enableParallelBuilding` {#var-stdenv-enableParallelBuilding}
248261
@@ -250,7 +263,7 @@ If set to `true`, `stdenv` will pass specific flags to `make` and other build to
250263
251264Unless set to `false`, some build systems with good support for parallel building including `cmake`, `meson`, and `qmake` will set it to `true`.
252265
253−### Special variables
266+### Special variables {#special-variables}
254267
255268#### `passthru` {#var-stdenv-passthru}
256269
@@ -298,29 +311,90 @@ passthru.updateScript = [ ../../update.sh pname "--requested-release=unstable" ]
298311
299312The script will be run with `UPDATE_NIX_ATTR_PATH` environment variable set to the attribute path it is supposed to update.
300313
301−::: note
314+::: {.note}
302315The 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.
303316:::
304317
305318For information about how to run the updates, execute `nix-shell maintainers/scripts/update.nix`.
306319
320+### Recursive attributes in `mkDerivation`
321+
322+If you pass a function to `mkDerivation`, it will receive as its argument the final arguments, including the overrides when reinvoked via `overrideAttrs`. For example:
323+
324+```nix
325+mkDerivation (finalAttrs: {
326+ pname = "hello";
327+ withFeature = true;
328+ configureFlags =
329+ lib.optionals finalAttrs.withFeature ["--with-feature"];
330+})
331+```
332+
333+Note that this does not use the `rec` keyword to reuse `withFeature` in `configureFlags`.
334+The `rec` keyword works at the syntax level and is unaware of overriding.
335+
336+Instead, the definition references `finalAttrs`, allowing users to change `withFeature`
337+consistently with `overrideAttrs`.
338+
339+`finalAttrs` also contains the attribute `finalPackage`, which includes the output paths, etc.
340+
341+Let's look at a more elaborate example to understand the differences between
342+various bindings:
343+
344+```nix
345+# `pkg` is the _original_ definition (for illustration purposes)
346+let pkg =
347+ mkDerivation (finalAttrs: {
348+ # ...
349+
350+ # An example attribute
351+ packages = [];
352+
353+ # `passthru.tests` is a commonly defined attribute.
354+ passthru.tests.simple = f finalAttrs.finalPackage;
355+
356+ # An example of an attribute containing a function
357+ passthru.appendPackages = packages':
358+ finalAttrs.finalPackage.overrideAttrs (newSelf: super: {
359+ packages = super.packages ++ packages';
360+ });
361+
362+ # For illustration purposes; referenced as
363+ # `(pkg.overrideAttrs(x)).finalAttrs` etc in the text below.
364+ passthru.finalAttrs = finalAttrs;
365+ passthru.original = pkg;
366+ });
367+in pkg
368+```
369+
370+Unlike the `pkg` binding in the above example, the `finalAttrs` parameter always references the final attributes. For instance `(pkg.overrideAttrs(x)).finalAttrs.finalPackage` is identical to `pkg.overrideAttrs(x)`, whereas `(pkg.overrideAttrs(x)).original` is the same as the original `pkg`.
371+
372+See also the section about [`passthru.tests`](#var-meta-tests).
373+
307374## Phases {#sec-stdenv-phases}
308375
309−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.
376+`stdenv.mkDerivation` sets the Nix [derivation](https://nixos.org/manual/nix/stable/expressions/derivations.html#derivations)'s builder to a script that loads the stdenv `setup.sh` bash library and calls `genericBuild`. Most packaging functions rely on this default builder.
377+
378+This generic command invokes 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).
310379
311380Each 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`.
312381
382+When overriding a phase, for example `installPhase`, it is important to start with `runHook preInstall` and end it with `runHook postInstall`, otherwise `preInstall` and `postInstall` will not be run. Even if you don't use them directly, it is good practice to do so anyways for downstream users who would want to add a `postInstall` by overriding your derivation.
383+
384+While inside an interactive `nix-shell`, if you wanted to run all phases in the order they would be run in an actual build, you can invoke `genericBuild` yourself.
385+
313386### Controlling phases {#ssec-controlling-phases}
314387
315388There are a number of variables that control what phases are executed and in what order:
316389
317−#### Variables affecting phase control
390+#### Variables affecting phase control {#variables-affecting-phase-control}
318391
319392##### `phases` {#var-stdenv-phases}
320393
321394Specifies 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`.
322395
323−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.
396+It is discouraged to set this variable, as it is easy to miss some important functionality hidden in some of the less obviously needed phases (like `fixupPhase` which patches the shebang of scripts).
397+Usually, if you just want to add a few phases, it’s more convenient to set one of the variables below (such as `preInstallPhases`).
324398
325399##### `prePhases` {#var-stdenv-prePhases}
326400
@@ -354,28 +428,29 @@ Additional phases executed after any of the default phases.
354428
355429The 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:
356430
357−#### Tar files
431+#### Tar files {#tar-files}
358432
359433These 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`).
360434
361−#### Zip files
435+#### Zip files {#zip-files}
362436
363437Zip files are unpacked using `unzip`. However, `unzip` is not in the standard environment, so you should add it to `nativeBuildInputs` yourself.
364438
365−#### Directories in the Nix store
439+#### Directories in the Nix store {#directories-in-the-nix-store}
366440
367441These 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`.
368442
369443Additional file types can be supported by setting the `unpackCmd` variable (see below).
370444
371−#### Variables controlling the unpack phase
445+#### Variables controlling the unpack phase {#variables-controlling-the-unpack-phase}
446+
372447##### `srcs` / `src` {#var-stdenv-src}
373448
374−The list of source files or directories to be unpacked or copied. One of these must be set.
449+The list of source files or directories to be unpacked or copied. One of these must be set. Note that if you use `srcs`, you should also set `sourceRoot` or `setSourceRoot`.
375450
376451##### `sourceRoot` {#var-stdenv-sourceRoot}
377452
378−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.
453+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. Set `sourceRoot = ".";` if you use `srcs` and control the unpack phase yourself.
379454
380455##### `setSourceRoot` {#var-stdenv-setSourceRoot}
381456
@@ -405,7 +480,7 @@ The unpack phase evaluates the string `$unpackCmd` for any unrecognised file. Th
405480
406481The patch phase applies the list of patches defined in the `patches` variable.
407482
408−#### Variables controlling the patch phase
483+#### Variables controlling the patch phase {#variables-controlling-the-patch-phase}
409484
410485##### `dontPatch` {#var-stdenv-dontPatch}
411486
@@ -431,7 +506,7 @@ Hook executed at the end of the patch phase.
431506
432507The configure phase prepares the source tree for building. The default `configurePhase` runs `./configure` (typically an Autoconf-generated script) if it exists.
433508
434−#### Variables controlling the configure phase
509+#### Variables controlling the configure phase {#variables-controlling-the-configure-phase}
435510
436511##### `configureScript` {#var-stdenv-configureScript}
437512
@@ -461,6 +536,12 @@ The prefix under which the package must be installed, passed via the `--prefix`
461536
462537The key to use when specifying the prefix. By default, this is set to `--prefix=` as that is used by the majority of packages.
463538
539+##### `dontAddStaticConfigureFlags`
540+
541+By default, when building statically, stdenv will try to add build system appropriate configure flags to try to enable static builds.
542+
543+If this is undesirable, set this variable to true.
544+
464545##### `dontAddDisableDepTrack` {#var-stdenv-dontAddDisableDepTrack}
465546
466547By 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.
@@ -473,7 +554,7 @@ By default, the configure phase applies some special hackery to all files called
473554
474555By default, when the configure script has `--enable-static`, the option `--disable-static` is added to the configure flags.
475556
476−If this is undesirable, set this variable to true.
557+If this is undesirable, set this variable to true. It is automatically set to true when building statically, for example through `pkgsStatic`.
477558
478559##### `configurePlatforms` {#var-stdenv-configurePlatforms}
479560
@@ -491,7 +572,7 @@ Hook executed at the end of the configure phase.
491572
492573The 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.
493574
494−#### Variables controlling the build phase
575+#### Variables controlling the build phase {#variables-controlling-the-build-phase}
495576
496577##### `dontBuild` {#var-stdenv-dontBuild}
497578
@@ -509,7 +590,7 @@ A list of strings passed as additional flags to `make`. These flags are also use
509590makeFlags = [ "PREFIX=$(out)" ];
510591```
511592
512−::: note
593+::: {.note}
513594The flags are quoted in bash, but environment variables can be specified by using the make syntax.
514595:::
515596
@@ -545,7 +626,7 @@ Before and after running `make`, the hooks `preBuild` and `postBuild` are called
545626
546627The 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.
547628
548−#### Variables controlling the check phase
629+#### Variables controlling the check phase {#variables-controlling-the-check-phase}
549630
550631##### `doCheck` {#var-stdenv-doCheck}
551632
@@ -557,7 +638,7 @@ doCheck = true;
557638
558639in 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.
559640
560−##### `makeFlags` / `makeFlagsArray` / `makefile`
641+##### `makeFlags` / `makeFlagsArray` / `makefile` {#makeflags-makeflagsarray-makefile}
561642
562643See the [build phase](#var-stdenv-makeFlags) for details.
563644
@@ -585,13 +666,13 @@ Hook executed at the end of the check phase.
585666
586667The 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`.
587668
588−#### Variables controlling the install phase
669+#### Variables controlling the install phase {#variables-controlling-the-install-phase}
589670
590671##### `dontInstall` {#var-stdenv-dontInstall}
591672
592673Set to true to skip the install phase.
593674
594−##### `makeFlags` / `makeFlagsArray` / `makefile`
675+##### `makeFlags` / `makeFlagsArray` / `makefile` {#makeflags-makeflagsarray-makefile-1}
595676
596677See the [build phase](#var-stdenv-makeFlags) for details.
597678
@@ -624,7 +705,7 @@ The fixup phase performs some (Nix-specific) post-processing actions on the file
624705- 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.
625706- 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`.
626707
627−#### Variables controlling the fixup phase
708+#### Variables controlling the fixup phase {#variables-controlling-the-fixup-phase}
628709
629710##### `dontFixup` {#var-stdenv-dontFixup}
630711
@@ -706,7 +787,9 @@ to `~/.gdbinit`. GDB will then be able to find debug information installed via `
706787
707788The installCheck phase checks whether the package was installed correctly by running its test suite against the installed directories. The default `installCheck` calls `make installcheck`.
708789
709−#### Variables controlling the installCheck phase
790+It is often better to add tests that are not part of the source distribution to `passthru.tests` (see <xref linkend="var-meta-tests"/>). This avoids adding overhead to every build and enables us to run them independently.
791+
792+#### Variables controlling the installCheck phase {#variables-controlling-the-installcheck-phase}
710793
711794##### `doInstallCheck` {#var-stdenv-doInstallCheck}
712795
@@ -742,7 +825,7 @@ Hook executed at the end of the installCheck phase.
742825
743826The 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.
744827
745−#### Variables controlling the distribution phase
828+#### Variables controlling the distribution phase {#variables-controlling-the-distribution-phase}
746829
747830##### `distTarget` {#var-stdenv-distTarget}
748831
@@ -768,13 +851,13 @@ Hook executed at the start of the distribution phase.
768851
769852Hook executed at the end of the distribution phase.
770853
771−## Shell functions {#ssec-stdenv-functions}
854+## Shell functions and utilities {#ssec-stdenv-functions}
772855
773856The standard environment provides a number of useful functions.
774857
775858### `makeWrapper` \<executable\> \<wrapperfile\> \<args\> {#fun-makeWrapper}
776859
777−Constructs a wrapper for a program with various possible arguments. For example:
860+Constructs a wrapper for a program with various possible arguments. It is defined as part of 2 setup-hooks named `makeWrapper` and `makeBinaryWrapper` that implement the same bash functions. Hence, to use it you have to add `makeWrapper` to your `nativeBuildInputs`. Here's an example usage:
778861
779862```bash
780863# adds `FOOBAR=baz` to `$out/bin/foo`’s environment
@@ -786,9 +869,24 @@ makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz
786869makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello git ]}
787870```
788871
789−There’s many more kinds of arguments, they are documented in `nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh`.
872+There’s many more kinds of arguments, they are documented in `nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh` for the `makeWrapper` implementation and in `nixpkgs/pkgs/build-support/setup-hooks/make-binary-wrapper.sh` for the `makeBinaryWrapper` implementation.
873+
874+`wrapProgram` is a convenience function you probably want to use most of the time, implemented by both `makeWrapper` and `makeBinaryWrapper`.
875+
876+Using the `makeBinaryWrapper` implementation is usually preferred, as it creates a tiny _compiled_ wrapper executable, that can be used as a shebang interpreter. This is needed mostly on Darwin, where shebangs cannot point to scripts, [due to a limitation with the `execve`-syscall](https://stackoverflow.com/questions/67100831/macos-shebang-with-absolute-path-not-working). Compiled wrappers generated by `makeBinaryWrapper` can be inspected with `less <path-to-wrapper>` - by scrolling past the binary data you should be able to see the shell command that generated the executable and there see the environment variables that were injected into the wrapper.
877+
878+### `remove-references-to -t` \<storepath\> [ `-t` \<storepath\> ... ] \<file\> ... {#fun-remove-references-to}
790879
791−`wrapProgram` is a convenience function you probably want to use most of the time.
880+Removes the references of the specified files to the specified store files. This is done without changing the size of the file by replacing the hash by `eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`, and should work on compiled executables. This is meant to be used to remove the dependency of the output on inputs that are known to be unnecessary at runtime. Of course, reckless usage will break the patched programs.
881+To use this, add `removeReferencesTo` to `nativeBuildInputs`.
882+
883+As `remove-references-to` is an actual executable and not a shell function, it can be used with `find`.
884+Example removing all references to the compiler in the output:
885+```nix
886+postInstall = ''
887+ find "$out" -type f -exec remove-references-to -t ${stdenv.cc} '{}' +
888+'';
889+```
792890
793891### `substitute` \<infile\> \<outfile\> \<subs\> {#fun-substitute}
794892
@@ -863,9 +961,9 @@ someVar=$(stripHash $name)
863961
864962### `wrapProgram` \<executable\> \<makeWrapperArgs\> {#fun-wrapProgram}
865963
866−Convenience function for `makeWrapper` that automatically creates a sane wrapper file. It takes all the same arguments as `makeWrapper`, except for `--argv0`.
964+Convenience function for `makeWrapper` that replaces `<\executable\>` with a wrapper that executes the original program. It takes all the same arguments as `makeWrapper`, except for `--inherit-argv0` (used by the `makeBinaryWrapper` implementation) and `--argv0` (used by both `makeWrapper` and `makeBinaryWrapper` wrapper implementations).
867965
868−It cannot be applied multiple times, since it will overwrite the wrapper file.
966+If you will apply it multiple times, it will overwrite the wrapper file and you will end up with double wrapping, which should be avoided.
869967
870968## Package setup hooks {#ssec-setup-hooks}
871969
@@ -879,7 +977,7 @@ The most typical use of the setup hook is actually to add other hooks which are
879977
880978Packages 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
881979
882−```{.bash}
980+```bash
883981addEnvHooks "$hostOffset" myBashFunction
884982```
885983
@@ -887,47 +985,47 @@ The *existence* of setups hooks has long been documented and packages inside Nix
887985
888986First, 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.
889987
890−### `move-docs.sh`
988+### `move-docs.sh` {#move-docs.sh}
891989
892990This 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.
893991
894−### `compress-man-pages.sh`
992+### `compress-man-pages.sh` {#compress-man-pages.sh}
895993
896994This 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.
897995
898−### `strip.sh`
996+### `strip.sh` {#strip.sh}
899997
900998This 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.
901999
902−### `patch-shebangs.sh`
1000+### `patch-shebangs.sh` {#patch-shebangs.sh}
9031001
9041002This 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.
9051003
906−### `audit-tmpdir.sh`
1004+### `audit-tmpdir.sh` {#audit-tmpdir.sh}
9071005
9081006This 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.
9091007
910−### `multiple-outputs.sh`
1008+### `multiple-outputs.sh` {#multiple-outputs.sh}
9111009
912−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 <xref linkend="chap-multiple-output" /> for more information.
1010+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 [](#chap-multiple-output) for more information.
9131011
914−### `move-sbin.sh`
1012+### `move-sbin.sh` {#move-sbin.sh}
9151013
9161014This setup hook moves any binaries installed in the `sbin/` subdirectory into `bin/`. In addition, a link is provided from `sbin/` to `bin/` for compatibility.
9171015
918−### `move-lib64.sh`
1016+### `move-lib64.sh` {#move-lib64.sh}
9191017
9201018This setup hook moves any libraries installed in the `lib64/` subdirectory into `lib/`. In addition, a link is provided from `lib64/` to `lib/` for compatibility.
9211019
922−### `move-systemd-user-units.sh`
1020+### `move-systemd-user-units.sh` {#move-systemd-user-units.sh}
9231021
9241022This setup hook moves any systemd user units installed in the `lib/` subdirectory into `share/`. In addition, a link is provided from `share/` to `lib/` for compatibility. This is needed for systemd to find user services when installed into the user profile.
9251023
926−### `set-source-date-epoch-to-latest.sh`
1024+### `set-source-date-epoch-to-latest.sh` {#set-source-date-epoch-to-latest.sh}
9271025
9281026This sets `SOURCE_DATE_EPOCH` to the modification time of the most recent file.
9291027
930−### Bintools Wrapper
1028+### Bintools Wrapper {#bintools-wrapper}
9311029
9321030The 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.
9331031
@@ -937,7 +1035,7 @@ A final task of the setup hook is defining a number of standard environment vari
9371035
9381036A 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"`.
9391037
940−### CC Wrapper
1038+### CC Wrapper {#cc-wrapper}
9411039
9421040The 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.
9431041
@@ -971,11 +1069,11 @@ The `autoreconfHook` derivation adds `autoreconfPhase`, which runs autoreconf, l
9711069
9721070Adds 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.
9731071
974−### teTeX / TeX Live
1072+### teTeX / TeX Live {#tetex-tex-live}
9751073
9761074Adds the `share/texmf-nix` subdirectory of each build input to the `TEXINPUTS` environment variable.
9771075
978−### Qt 4
1076+### Qt 4 {#qt-4}
9791077
9801078Sets the `QTDIR` environment variable to Qt’s path.
9811079
@@ -983,13 +1081,13 @@ Sets the `QTDIR` environment variable to Qt’s path.
9831081
9841082Exports `GDK_PIXBUF_MODULE_FILE` environment variable to the builder. Add librsvg package to `buildInputs` to get svg support. See also the [setup hook description in GNOME platform docs](#ssec-gnome-hooks-gdk-pixbuf).
9851083
986−### GHC
1084+### GHC {#ghc}
9871085
9881086Creates a temporary package database and registers every Haskell build input in it (TODO: how?).
9891087
990−### GNOME platform
1088+### GNOME platform {#gnome-platform}
9911089
992−Hooks related to GNOME platform and related libraries like GLib, GTK and GStreamer are described in <xref linkend="sec-language-gnome" />.
1090+Hooks related to GNOME platform and related libraries like GLib, GTK and GStreamer are described in [](#sec-language-gnome).
9931091
9941092### autoPatchelfHook {#setup-hook-autopatchelfhook}
9951093
@@ -999,11 +1097,11 @@ You can also specify a `runtimeDependencies` variable which lists dependencies t
9991097
10001098In 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.
10011099
1002−By default `autoPatchelf` will fail as soon as any ELF file requires a dependency which cannot be resolved via the given build inputs. In some situations you might prefer to just leave missing dependencies unpatched and continue to patch the rest. This can be achieved by setting the `autoPatchelfIgnoreMissingDeps` environment variable to a non-empty value.
1100+By default `autoPatchelf` will fail as soon as any ELF file requires a dependency which cannot be resolved via the given build inputs. In some situations you might prefer to just leave missing dependencies unpatched and continue to patch the rest. This can be achieved by setting the `autoPatchelfIgnoreMissingDeps` environment variable to a non-empty value. `autoPatchelfIgnoreMissingDeps` can be set to a list like `autoPatchelfIgnoreMissingDeps = [ "libcuda.so.1" "libcudart.so.1" ];` or to simply `[ "*" ]` to ignore all missing dependencies.
10031101
10041102The `autoPatchelf` command also recognizes a `--no-recurse` command line flag, which prevents it from recursing into subdirectories.
10051103
1006−### breakpointHook
1104+### breakpointHook {#breakpointhook}
10071105
10081106This 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`.
10091107
@@ -1013,15 +1111,15 @@ nativeBuildInputs = [ breakpointHook ];
10131111
10141112When a build failure happens there will be an instruction printed that shows how to attach with `cntr` to the build sandbox.
10151113
1016−::: note
1017−::: title
1114+::: {.note}
1115+::: {.title}
10181116Caution with remote builds
10191117:::
10201118
10211119This 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`.
10221120:::
10231121
1024−### installShellFiles
1122+### installShellFiles {#installshellfiles}
10251123
10261124This 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.
10271125
@@ -1047,61 +1145,61 @@ postInstall = ''
10471145'';
10481146```
10491147
1050−### libiconv, libintl
1148+### libiconv, libintl {#libiconv-libintl}
10511149
10521150A 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`.
10531151
1054−### validatePkgConfig
1152+### validatePkgConfig {#validatepkgconfig}
10551153
10561154The `validatePkgConfig` hook validates all pkg-config (`.pc`) files in a package. This helps catching some common errors in pkg-config files, such as undefined variables.
10571155
1058−### cmake
1156+### cmake {#cmake}
10591157
10601158Overrides 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.
10611159
1062−### xcbuildHook
1160+### xcbuildHook {#xcbuildhook}
10631161
10641162Overrides 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.
10651163
1066−### Meson
1164+### Meson {#meson}
10671165
10681166Overrides 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.
10691167
1070−#### Variables controlling Meson
1168+#### Variables controlling Meson {#variables-controlling-meson}
10711169
1072−##### `mesonFlags`
1170+##### `mesonFlags` {#mesonflags}
10731171
10741172Controls the flags passed to meson.
10751173
1076−##### `mesonBuildType`
1174+##### `mesonBuildType` {#mesonbuildtype}
10771175
10781176Which [`--buildtype`](https://mesonbuild.com/Builtin-options.html#core-options) to pass to Meson. We default to `plain`.
10791177
1080−##### `mesonAutoFeatures`
1178+##### `mesonAutoFeatures` {#mesonautofeatures}
10811179
10821180What value to set [`-Dauto_features=`](https://mesonbuild.com/Builtin-options.html#core-options) to. We default to `enabled`.
10831181
1084−##### `mesonWrapMode`
1182+##### `mesonWrapMode` {#mesonwrapmode}
10851183
10861184What value to set [`-Dwrap_mode=`](https://mesonbuild.com/Builtin-options.html#core-options) to. We default to `nodownload` as we disallow network access.
10871185
1088−##### `dontUseMesonConfigure`
1186+##### `dontUseMesonConfigure` {#dontusemesonconfigure}
10891187
10901188Disables using Meson’s `configurePhase`.
10911189
1092−### ninja
1190+### ninja {#ninja}
10931191
10941192Overrides 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.
10951193
1096−### unzip
1194+### unzip {#unzip}
10971195
10981196This setup hook will allow you to unzip .zip files specified in `$src`. There are many similar packages like `unrar`, `undmg`, etc.
10991197
1100−### wafHook
1198+### wafHook {#wafhook}
11011199
11021200Overrides 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.
11031201
1104−### scons
1202+### scons {#scons}
11051203
11061204Overrides 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.
11071205
@@ -1117,9 +1215,13 @@ There are flags available to harden packages at compile or link-time. These can
11171215
11181216Both 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.
11191217
1218+For more in-depth information on these hardening flags and hardening in general, refer to the [Debian Wiki](https://wiki.debian.org/Hardening), [Ubuntu Wiki](https://wiki.ubuntu.com/Security/Features), [Gentoo Wiki](https://wiki.gentoo.org/wiki/Project:Hardened), and the [Arch Wiki](https://wiki.archlinux.org/title/Security).
1219+
1220+### Hardening flags enabled by default {#sec-hardening-flags-enabled-by-default}
1221+
11201222The following flags are enabled by default and might require disabling with `hardeningDisable` if the program to package is incompatible.
11211223
1122−### `format`
1224+#### `format` {#format}
11231225
11241226Adds the `-Wformat -Wformat-security -Werror=format-security` 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`.
11251227
@@ -1132,7 +1234,7 @@ This needs to be turned off or fixed for errors similar to:
11321234cc1plus: some warnings being treated as errors
11331235```
11341236
1135−### `stackprotector`
1237+#### `stackprotector` {#stackprotector}
11361238
11371239Adds the `-fstack-protector-strong --param ssp-buffer-size=4` 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).
11381240
@@ -1143,7 +1245,7 @@ bin/blib.a(bios_console.o): In function `bios_handle_cup':
11431245/tmp/nix-build-ipxe-20141124-5cbdc41.drv-0/ipxe-5cbdc41/src/arch/i386/firmware/pcbios/bios_console.c:86: undefined reference to `__stack_chk_fail'
11441246```
11451247
1146−### `fortify`
1248+#### `fortify` {#fortify}
11471249
11481250Adds the `-O2 -D_FORTIFY_SOURCE=2` 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.
11491251
@@ -1164,7 +1266,7 @@ installwatch.c:3751:5: error: conflicting types for '__open_2'
11641266fcntl2.h:50:4: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
11651267```
11661268
1167−### `pic`
1269+#### `pic` {#pic}
11681270
11691271Adds the `-fPIC` compiler options. This options adds support for position independent code in shared libraries and thus making ASLR possible.
11701272
@@ -1177,19 +1279,19 @@ ccbLfRgg.s: Assembler messages:
11771279ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_len@GOTOFF'
11781280```
11791281
1180−### `strictoverflow`
1282+#### `strictoverflow` {#strictoverflow}
11811283
11821284Signed 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 `-fno-strict-overflow` makes gcc behave as if signed integer overflows were defined.
11831285
11841286This flag should not trigger any build or runtime errors.
11851287
1186−### `relro`
1288+#### `relro` {#relro}
11871289
11881290Adds the `-z relro` 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.
11891291
11901292This 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.
11911293
1192−### `bindnow`
1294+#### `bindnow` {#bindnow}
11931295
11941296Adds the `-z bindnow` 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.
11951297
@@ -1199,16 +1301,22 @@ This flag can break dynamic shared object loading. For instance, the module syst
11991301intel_drv.so: undefined symbol: vgaHWFreeHWRec
12001302```
12011303
1304+### Hardening flags disabled by default {#sec-hardening-flags-disabled-by-default}
1305+
12021306The following flags are disabled by default and should be enabled with `hardeningEnable` for packages that take untrusted input like network services.
12031307
1204−### `pie`
1308+#### `pie` {#pie}
1309+
1310+This flag is disabled by default for normal `glibc` based NixOS package builds, but enabled by default for `musl` based package builds.
12051311
12061312Adds the `-fPIE` compiler and `-pie` 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.
12071313
1208−For more in-depth information on these hardening flags and hardening in general, refer to the [Debian Wiki](https://wiki.debian.org/Hardening), [Ubuntu Wiki](https://wiki.ubuntu.com/Security/Features), [Gentoo Wiki](https://wiki.gentoo.org/wiki/Project:Hardened), and the [Arch Wiki](https://wiki.archlinux.org/index.php/DeveloperWiki:Security).
1314+Static libraries need to be compiled with `-fPIE` so that executables can link them in with the `-pie` linker option.
1315+If the libraries lack `-fPIE`, you will get the error `recompile with -fPIE`.
12091316
12101317[^footnote-stdenv-ignored-build-platform]: 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.
12111318[^footnote-stdenv-native-dependencies-in-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`.
1319+[^footnote-stdenv-propagated-dependencies]: 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.
12121320[^footnote-stdenv-find-inputs-location]: The `findInputs` function, currently residing in `pkgs/stdenv/generic/setup.sh`, implements the propagation logic.
12131321[^footnote-stdenv-sys-lib-search-path]: It clears the `sys_lib_*search_path` variables in the Libtool script to prevent Libtool from using libraries in `/usr/lib` and such.
12141322[^footnote-stdenv-build-time-guessing-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.
doc/using/configuration.chapter.mdnew file+356
@@ -0,0 +1,356 @@
1+# Global configuration {#chap-packageconfig}
2+
3+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:
4+
5+- The package is thought to be broken, and has had its `meta.broken` set to `true`.
6+
7+- The package isn't intended to run on the given system, as none of its `meta.platforms` match the given system.
8+
9+- The package's `meta.license` is set to a license which is considered to be unfree.
10+
11+- 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`.
12+
13+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.
14+
15+Each of these criteria can be altered in the nixpkgs configuration.
16+
17+The nixpkgs configuration for a NixOS system is set in the `configuration.nix`, as in the following example:
18+
19+```nix
20+{
21+ nixpkgs.config = {
22+ allowUnfree = true;
23+ };
24+}
25+```
26+
27+However, this does not allow unfree software for individual users. Their configurations are managed separately.
28+
29+A user's nixpkgs configuration is stored in a user-specific configuration file located at `~/.config/nixpkgs/config.nix`. For example:
30+
31+```nix
32+{
33+ allowUnfree = true;
34+}
35+```
36+
37+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.
38+
39+## Installing broken packages {#sec-allow-broken}
40+
41+There are two ways to try compiling a package which has been marked as broken.
42+
43+- For allowing the build of a broken package once, you can use an environment variable for a single invocation of the nix tools:
44+
45+ ```ShellSession
46+ $ export NIXPKGS_ALLOW_BROKEN=1
47+ ```
48+
49+- For permanently allowing broken packages to be built, you may add `allowBroken = true;` to your user's configuration file, like this:
50+
51+ ```nix
52+ {
53+ allowBroken = true;
54+ }
55+ ```
56+
57+
58+## Installing packages on unsupported systems {#sec-allow-unsupported-system}
59+
60+There are also two ways to try compiling a package which has been marked as unsupported for the given system.
61+
62+- For allowing the build of an unsupported package once, you can use an environment variable for a single invocation of the nix tools:
63+
64+ ```ShellSession
65+ $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
66+ ```
67+
68+- For permanently allowing unsupported packages to be built, you may add `allowUnsupportedSystem = true;` to your user's configuration file, like this:
69+
70+ ```nix
71+ {
72+ allowUnsupportedSystem = true;
73+ }
74+ ```
75+
76+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.
77+
78+## Installing unfree packages {#sec-allow-unfree}
79+
80+There are several ways to tweak how Nix handles a package which has been marked as unfree.
81+
82+- To temporarily allow all unfree packages, you can use an environment variable for a single invocation of the nix tools:
83+
84+ ```ShellSession
85+ $ export NIXPKGS_ALLOW_UNFREE=1
86+ ```
87+
88+- 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.
89+
90+ 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:
91+
92+ ```nix
93+ {
94+ allowUnfreePredicate = (pkg: false);
95+ }
96+ ```
97+
98+ For a more useful example, try the following. This configuration only allows unfree packages named roon-server and visual studio code:
99+
100+ ```nix
101+ {
102+ allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
103+ "roon-server"
104+ "vscode"
105+ ];
106+ }
107+ ```
108+
109+- It is also possible to allow and block licenses that are specifically acceptable or not acceptable, using `allowlistedLicenses` and `blocklistedLicenses`, respectively.
110+
111+ The following example configuration allowlists the licenses `amd` and `wtfpl`:
112+
113+ ```nix
114+ {
115+ allowlistedLicenses = with lib.licenses; [ amd wtfpl ];
116+ }
117+ ```
118+
119+ The following example configuration blocklists the `gpl3Only` and `agpl3Only` licenses:
120+
121+ ```nix
122+ {
123+ blocklistedLicenses = with lib.licenses; [ agpl3Only gpl3Only ];
124+ }
125+ ```
126+
127+ Note that `allowlistedLicenses` only applies to unfree licenses unless `allowUnfree` is enabled. It is not a generic allowlist for all types of licenses. `blocklistedLicenses` applies to all licenses.
128+
129+A complete list of licenses can be found in the file `lib/licenses.nix` of the nixpkgs tree.
130+
131+## Installing insecure packages {#sec-allow-insecure}
132+
133+There are several ways to tweak how Nix handles a package which has been marked as insecure.
134+
135+- To temporarily allow all insecure packages, you can use an environment variable for a single invocation of the nix tools:
136+
137+ ```ShellSession
138+ $ export NIXPKGS_ALLOW_INSECURE=1
139+ ```
140+
141+- 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.
142+
143+ The following example configuration permits the installation of the hypothetically insecure package `hello`, version `1.2.3`:
144+
145+ ```nix
146+ {
147+ permittedInsecurePackages = [
148+ "hello-1.2.3"
149+ ];
150+ }
151+ ```
152+
153+- It is also possible to create a custom policy around which insecure packages to allow and deny, by overriding the `allowInsecurePredicate` configuration option.
154+
155+ The `allowInsecurePredicate` option is a function which accepts a package and returns a boolean, much like `allowUnfreePredicate`.
156+
157+ The following configuration example only allows insecure packages with very short names:
158+
159+ ```nix
160+ {
161+ allowInsecurePredicate = pkg: builtins.stringLength (lib.getName pkg) <= 5;
162+ }
163+ ```
164+
165+ Note that `permittedInsecurePackages` is only checked if `allowInsecurePredicate` is not specified.
166+
167+## Modify packages via `packageOverrides` {#sec-modify-via-packageOverrides}
168+
169+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.
170+
171+```nix
172+{
173+ packageOverrides = pkgs: rec {
174+ foo = pkgs.foo.override { ... };
175+ };
176+}
177+```
178+
179+## Declarative Package Management {#sec-declarative-package-management}
180+
181+### Build an environment {#sec-building-environment}
182+
183+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`:
184+
185+```nix
186+{
187+ packageOverrides = pkgs: with pkgs; {
188+ myPackages = pkgs.buildEnv {
189+ name = "my-packages";
190+ paths = [
191+ aspell
192+ bc
193+ coreutils
194+ gdb
195+ ffmpeg
196+ nixUnstable
197+ emscripten
198+ jq
199+ nox
200+ silver-searcher
201+ ];
202+ };
203+ };
204+}
205+```
206+
207+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:
208+
209+```nix
210+{
211+ packageOverrides = pkgs: with pkgs; {
212+ myPackages = pkgs.buildEnv {
213+ name = "my-packages";
214+ paths = [
215+ aspell
216+ bc
217+ coreutils
218+ gdb
219+ ffmpeg
220+ nixUnstable
221+ emscripten
222+ jq
223+ nox
224+ silver-searcher
225+ ];
226+ pathsToLink = [ "/share" "/bin" ];
227+ };
228+ };
229+}
230+```
231+
232+`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.
233+
234+### Getting documentation {#sec-getting-documentation}
235+
236+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.
237+
238+```nix
239+{
240+ packageOverrides = pkgs: with pkgs; {
241+ myPackages = pkgs.buildEnv {
242+ name = "my-packages";
243+ paths = [
244+ aspell
245+ bc
246+ coreutils
247+ ffmpeg
248+ nixUnstable
249+ emscripten
250+ jq
251+ nox
252+ silver-searcher
253+ ];
254+ pathsToLink = [ "/share/man" "/share/doc" "/bin" ];
255+ extraOutputsToInstall = [ "man" "doc" ];
256+ };
257+ };
258+}
259+```
260+
261+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.
262+
263+```nix
264+{
265+ packageOverrides = pkgs: with pkgs; rec {
266+ myProfile = writeText "my-profile" ''
267+ export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
268+ export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
269+ '';
270+ myPackages = pkgs.buildEnv {
271+ name = "my-packages";
272+ paths = [
273+ (runCommand "profile" {} ''
274+ mkdir -p $out/etc/profile.d
275+ cp ${myProfile} $out/etc/profile.d/my-profile.sh
276+ '')
277+ aspell
278+ bc
279+ coreutils
280+ ffmpeg
281+ man
282+ nixUnstable
283+ emscripten
284+ jq
285+ nox
286+ silver-searcher
287+ ];
288+ pathsToLink = [ "/share/man" "/share/doc" "/bin" "/etc" ];
289+ extraOutputsToInstall = [ "man" "doc" ];
290+ };
291+ };
292+}
293+```
294+
295+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:
296+
297+```ShellSession
298+#!/bin/sh
299+if [ -d $HOME/.nix-profile/etc/profile.d ]; then
300+ for i in $HOME/.nix-profile/etc/profile.d/*.sh; do
301+ if [ -r $i ]; then
302+ . $i
303+ fi
304+ done
305+fi
306+```
307+
308+Now just run `source $HOME/.profile` and you can starting loading man pages from your environment.
309+
310+### GNU info setup {#sec-gnu-info-setup}
311+
312+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.
313+
314+```nix
315+{
316+ packageOverrides = pkgs: with pkgs; rec {
317+ myProfile = writeText "my-profile" ''
318+ export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
319+ export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
320+ export INFOPATH=$HOME/.nix-profile/share/info:/nix/var/nix/profiles/default/share/info:/usr/share/info
321+ '';
322+ myPackages = pkgs.buildEnv {
323+ name = "my-packages";
324+ paths = [
325+ (runCommand "profile" {} ''
326+ mkdir -p $out/etc/profile.d
327+ cp ${myProfile} $out/etc/profile.d/my-profile.sh
328+ '')
329+ aspell
330+ bc
331+ coreutils
332+ ffmpeg
333+ man
334+ nixUnstable
335+ emscripten
336+ jq
337+ nox
338+ silver-searcher
339+ texinfoInteractive
340+ ];
341+ pathsToLink = [ "/share/man" "/share/doc" "/share/info" "/bin" "/etc" ];
342+ extraOutputsToInstall = [ "man" "doc" "info" ];
343+ postBuild = ''
344+ if [ -x $out/bin/install-info -a -w $out/share/info ]; then
345+ shopt -s nullglob
346+ for i in $out/share/info/*.info $out/share/info/*.info.gz; do
347+ $out/bin/install-info $i $out/share/info/dir
348+ done
349+ fi
350+ '';
351+ };
352+ };
353+}
354+```
355+
356+`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.
doc/using/configuration.xmldeleted−451
@@ -1,451 +0,0 @@
1−<chapter xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="chap-packageconfig">
4− <title>Global configuration</title>
5− <para>
6− 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:
7− </para>
8− <itemizedlist>
9− <listitem>
10− <para>
11− The package is thought to be broken, and has had its <literal>meta.broken</literal> set to <literal>true</literal>.
12− </para>
13− </listitem>
14− <listitem>
15− <para>
16− The package isn't intended to run on the given system, as none of its <literal>meta.platforms</literal> match the given system.
17− </para>
18− </listitem>
19− <listitem>
20− <para>
21− The package's <literal>meta.license</literal> is set to a license which is considered to be unfree.
22− </para>
23− </listitem>
24− <listitem>
25− <para>
26− 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 <literal>meta.knownVulnerabilities</literal>.
27− </para>
28− </listitem>
29− </itemizedlist>
30− <para>
31− 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. <literal>nix-env -qa</literal> will (attempt to) hide any packages that would be refused.
32− </para>
33− <para>
34− Each of these criteria can be altered in the nixpkgs configuration.
35− </para>
36− <para>
37− The nixpkgs configuration for a NixOS system is set in the <literal>configuration.nix</literal>, as in the following example:
38−<programlisting>
39−{
40− nixpkgs.config = {
41− allowUnfree = true;
42− };
43−}
44−</programlisting>
45− However, this does not allow unfree software for individual users. Their configurations are managed separately.
46− </para>
47− <para>
48− A user's nixpkgs configuration is stored in a user-specific configuration file located at <filename>~/.config/nixpkgs/config.nix</filename>. For example:
49−<programlisting>
50−{
51− allowUnfree = true;
52−}
53−</programlisting>
54− </para>
55− <para>
56− 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.
57− </para>
58− <section xml:id="sec-allow-broken">
59− <title>Installing broken packages</title>
60−
61− <para>
62− There are two ways to try compiling a package which has been marked as broken.
63− </para>
64−
65− <itemizedlist>
66− <listitem>
67− <para>
68− For allowing the build of a broken package once, you can use an environment variable for a single invocation of the nix tools:
69−<screen><prompt>$ </prompt>export NIXPKGS_ALLOW_BROKEN=1</screen>
70− </para>
71− </listitem>
72− <listitem>
73− <para>
74− For permanently allowing broken packages to be built, you may add <literal>allowBroken = true;</literal> to your user's configuration file, like this:
75−<programlisting>
76−{
77− allowBroken = true;
78−}
79−</programlisting>
80− </para>
81− </listitem>
82− </itemizedlist>
83− </section>
84− <section xml:id="sec-allow-unsupported-system">
85− <title>Installing packages on unsupported systems</title>
86−
87− <para>
88− There are also two ways to try compiling a package which has been marked as unsupported for the given system.
89− </para>
90−
91− <itemizedlist>
92− <listitem>
93− <para>
94− For allowing the build of an unsupported package once, you can use an environment variable for a single invocation of the nix tools:
95−<screen><prompt>$ </prompt>export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1</screen>
96− </para>
97− </listitem>
98− <listitem>
99− <para>
100− For permanently allowing unsupported packages to be built, you may add <literal>allowUnsupportedSystem = true;</literal> to your user's configuration file, like this:
101−<programlisting>
102−{
103− allowUnsupportedSystem = true;
104−}
105−</programlisting>
106− </para>
107− </listitem>
108− </itemizedlist>
109−
110− <para>
111− The difference between a package being unsupported on some system and being broken is admittedly a bit fuzzy. If a program <emphasis>ought</emphasis> to work on a certain platform, but doesn't, the platform should be included in <literal>meta.platforms</literal>, but marked as broken with e.g. <literal>meta.broken = !hostPlatform.isWindows</literal>. Of course, this begs the question of what "ought" means exactly. That is left to the package maintainer.
112− </para>
113− </section>
114− <section xml:id="sec-allow-unfree">
115− <title>Installing unfree packages</title>
116−
117− <para>
118− There are several ways to tweak how Nix handles a package which has been marked as unfree.
119− </para>
120−
121− <itemizedlist>
122− <listitem>
123− <para>
124− To temporarily allow all unfree packages, you can use an environment variable for a single invocation of the nix tools:
125−<screen><prompt>$ </prompt>export NIXPKGS_ALLOW_UNFREE=1</screen>
126− </para>
127− </listitem>
128− <listitem>
129− <para>
130− It is possible to permanently allow individual unfree packages, while still blocking unfree packages by default using the <literal>allowUnfreePredicate</literal> configuration option in the user configuration file.
131− </para>
132− <para>
133− 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:
134−<programlisting>
135−{
136− allowUnfreePredicate = (pkg: false);
137−}
138−</programlisting>
139− </para>
140− <para>
141− For a more useful example, try the following. This configuration only allows unfree packages named roon-server and visual studio code:
142−<programlisting>
143−{
144− allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
145− "roon-server"
146− "vscode"
147− ];
148−}
149−</programlisting>
150− </para>
151− </listitem>
152− <listitem>
153− <para>
154− It is also possible to allow and block licenses that are specifically acceptable or not acceptable, using <literal>allowlistedLicenses</literal> and <literal>blocklistedLicenses</literal>, respectively.
155− </para>
156− <para>
157− The following example configuration allowlists the licenses <literal>amd</literal> and <literal>wtfpl</literal>:
158−<programlisting>
159−{
160− allowlistedLicenses = with lib.licenses; [ amd wtfpl ];
161−}
162−</programlisting>
163− </para>
164− <para>
165− The following example configuration blocklists the <literal>gpl3Only</literal> and <literal>agpl3Only</literal> licenses:
166−<programlisting>
167−{
168− blocklistedLicenses = with lib.licenses; [ agpl3Only gpl3Only ];
169−}
170−</programlisting>
171− </para>
172− <para>
173− Note that <literal>allowlistedLicenses</literal> only applies to unfree licenses unless <literal>allowUnfree</literal> is enabled. It is not a generic allowlist for all types of licenses. <literal>blocklistedLicenses</literal> applies to all licenses.
174− </para>
175− </listitem>
176− </itemizedlist>
177−
178− <para>
179− A complete list of licenses can be found in the file <filename>lib/licenses.nix</filename> of the nixpkgs tree.
180− </para>
181− </section>
182− <section xml:id="sec-allow-insecure">
183− <title>Installing insecure packages</title>
184−
185− <para>
186− There are several ways to tweak how Nix handles a package which has been marked as insecure.
187− </para>
188−
189− <itemizedlist>
190− <listitem>
191− <para>
192− To temporarily allow all insecure packages, you can use an environment variable for a single invocation of the nix tools:
193−<screen><prompt>$ </prompt>export NIXPKGS_ALLOW_INSECURE=1</screen>
194− </para>
195− </listitem>
196− <listitem>
197− <para>
198− It is possible to permanently allow individual insecure packages, while still blocking other insecure packages by default using the <literal>permittedInsecurePackages</literal> configuration option in the user configuration file.
199− </para>
200− <para>
201− The following example configuration permits the installation of the hypothetically insecure package <literal>hello</literal>, version <literal>1.2.3</literal>:
202−<programlisting>
203−{
204− permittedInsecurePackages = [
205− "hello-1.2.3"
206− ];
207−}
208−</programlisting>
209− </para>
210− </listitem>
211− <listitem>
212− <para>
213− It is also possible to create a custom policy around which insecure packages to allow and deny, by overriding the <literal>allowInsecurePredicate</literal> configuration option.
214− </para>
215− <para>
216− The <literal>allowInsecurePredicate</literal> option is a function which accepts a package and returns a boolean, much like <literal>allowUnfreePredicate</literal>.
217− </para>
218− <para>
219− The following configuration example only allows insecure packages with very short names:
220−<programlisting>
221−{
222− allowInsecurePredicate = pkg: builtins.stringLength (lib.getName pkg) <= 5;
223−}
224−</programlisting>
225− </para>
226− <para>
227− Note that <literal>permittedInsecurePackages</literal> is only checked if <literal>allowInsecurePredicate</literal> is not specified.
228− </para>
229− </listitem>
230− </itemizedlist>
231− </section>
232−<!--============================================================-->
233− <section xml:id="sec-modify-via-packageOverrides">
234− <title>Modify packages via <literal>packageOverrides</literal></title>
235−
236− <para>
237− You can define a function called <varname>packageOverrides</varname> in your local <filename>~/.config/nixpkgs/config.nix</filename> to override Nix packages. It must be a function that takes pkgs as an argument and returns a modified set of packages.
238−<programlisting>
239−{
240− packageOverrides = pkgs: rec {
241− foo = pkgs.foo.override { ... };
242− };
243−}
244−</programlisting>
245− </para>
246− </section>
247− <section xml:id="sec-declarative-package-management">
248− <title>Declarative Package Management</title>
249−
250− <section xml:id="sec-building-environment">
251− <title>Build an environment</title>
252−
253− <para>
254− Using <literal>packageOverrides</literal>, 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 <literal>aspell</literal>, <literal>bc</literal>, <literal>ffmpeg</literal>, <literal>coreutils</literal>, <literal>gdb</literal>, <literal>nixUnstable</literal>, <literal>emscripten</literal>, <literal>jq</literal>, <literal>nox</literal>, and <literal>silver-searcher</literal>, we could use the following in <filename>~/.config/nixpkgs/config.nix</filename>:
255− </para>
256−
257−<screen>
258−{
259− packageOverrides = pkgs: with pkgs; {
260− myPackages = pkgs.buildEnv {
261− name = "my-packages";
262− paths = [
263− aspell
264− bc
265− coreutils
266− gdb
267− ffmpeg
268− nixUnstable
269− emscripten
270− jq
271− nox
272− silver-searcher
273− ];
274− };
275− };
276−}
277−</screen>
278−
279− <para>
280− To install it into our environment, you can just run <literal>nix-env -iA nixpkgs.myPackages</literal>. If you want to load the packages to be built from a working copy of <literal>nixpkgs</literal> you just run <literal>nix-env -f. -iA myPackages</literal>. To explore what's been installed, just look through <filename>~/.nix-profile/</filename>. 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:
281− </para>
282−
283−<screen>
284−{
285− packageOverrides = pkgs: with pkgs; {
286− myPackages = pkgs.buildEnv {
287− name = "my-packages";
288− paths = [
289− aspell
290− bc
291− coreutils
292− gdb
293− ffmpeg
294− nixUnstable
295− emscripten
296− jq
297− nox
298− silver-searcher
299− ];
300− pathsToLink = [ "/share" "/bin" ];
301− };
302− };
303−}
304−</screen>
305−
306− <para>
307− <literal>pathsToLink</literal> tells Nixpkgs to only link the paths listed which gets rid of the extra stuff in the profile. <filename>/bin</filename> and <filename>/share</filename> 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, <filename>/Applications</filename>, that makes GUI apps available.
308− </para>
309− </section>
310−
311− <section xml:id="sec-getting-documentation">
312− <title>Getting documentation</title>
313−
314− <para>
315− After building that new environment, look through <filename>~/.nix-profile</filename> to make sure everything is there that we wanted. Discerning readers will note that some files are missing. Look inside <filename>~/.nix-profile/share/man/man1/</filename> 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.
316− </para>
317−
318−<screen>
319−{
320− packageOverrides = pkgs: with pkgs; {
321− myPackages = pkgs.buildEnv {
322− name = "my-packages";
323− paths = [
324− aspell
325− bc
326− coreutils
327− ffmpeg
328− nixUnstable
329− emscripten
330− jq
331− nox
332− silver-searcher
333− ];
334− pathsToLink = [ "/share/man" "/share/doc" "/bin" ];
335− extraOutputsToInstall = [ "man" "doc" ];
336− };
337− };
338−}
339−</screen>
340−
341− <para>
342− 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.
343− </para>
344−
345−<screen>
346−{
347− packageOverrides = pkgs: with pkgs; rec {
348− myProfile = writeText "my-profile" ''
349− export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
350− export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
351− '';
352− myPackages = pkgs.buildEnv {
353− name = "my-packages";
354− paths = [
355− (runCommand "profile" {} ''
356− mkdir -p $out/etc/profile.d
357− cp ${myProfile} $out/etc/profile.d/my-profile.sh
358− '')
359− aspell
360− bc
361− coreutils
362− ffmpeg
363− man
364− nixUnstable
365− emscripten
366− jq
367− nox
368− silver-searcher
369− ];
370− pathsToLink = [ "/share/man" "/share/doc" "/bin" "/etc" ];
371− extraOutputsToInstall = [ "man" "doc" ];
372− };
373− };
374−}
375−</screen>
376−
377− <para>
378− For this to work fully, you must also have this script sourced when you are logged in. Try adding something like this to your <filename>~/.profile</filename> file:
379− </para>
380−
381−<screen>
382−#!/bin/sh
383−if [ -d $HOME/.nix-profile/etc/profile.d ]; then
384− for i in $HOME/.nix-profile/etc/profile.d/*.sh; do
385− if [ -r $i ]; then
386− . $i
387− fi
388− done
389−fi
390−</screen>
391−
392− <para>
393− Now just run <literal>source $HOME/.profile</literal> and you can starting loading man pages from your environment.
394− </para>
395− </section>
396−
397− <section xml:id="sec-gnu-info-setup">
398− <title>GNU info setup</title>
399−
400− <para>
401− 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.
402− </para>
403−
404−<screen>
405−{
406− packageOverrides = pkgs: with pkgs; rec {
407− myProfile = writeText "my-profile" ''
408− export PATH=$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/sbin:/bin:/usr/sbin:/usr/bin
409− export MANPATH=$HOME/.nix-profile/share/man:/nix/var/nix/profiles/default/share/man:/usr/share/man
410− export INFOPATH=$HOME/.nix-profile/share/info:/nix/var/nix/profiles/default/share/info:/usr/share/info
411− '';
412− myPackages = pkgs.buildEnv {
413− name = "my-packages";
414− paths = [
415− (runCommand "profile" {} ''
416− mkdir -p $out/etc/profile.d
417− cp ${myProfile} $out/etc/profile.d/my-profile.sh
418− '')
419− aspell
420− bc
421− coreutils
422− ffmpeg
423− man
424− nixUnstable
425− emscripten
426− jq
427− nox
428− silver-searcher
429− texinfoInteractive
430− ];
431− pathsToLink = [ "/share/man" "/share/doc" "/share/info" "/bin" "/etc" ];
432− extraOutputsToInstall = [ "man" "doc" "info" ];
433− postBuild = ''
434− if [ -x $out/bin/install-info -a -w $out/share/info ]; then
435− shopt -s nullglob
436− for i in $out/share/info/*.info $out/share/info/*.info.gz; do
437− $out/bin/install-info $i $out/share/info/dir
438− done
439− fi
440− '';
441− };
442− };
443−}
444−</screen>
445−
446− <para>
447− <literal>postBuild</literal> tells Nixpkgs to run a command after building the environment. In this case, <literal>install-info</literal> adds the installed info pages to <literal>dir</literal> which is GNU info's default root node. Note that <literal>texinfoInteractive</literal> is added to the environment to give the <literal>install-info</literal> command.
448− </para>
449− </section>
450− </section>
451−</chapter>
doc/using/overlays.chapter.mdnew file+167
@@ -0,0 +1,167 @@
1+# Overlays {#chap-overlays}
2+
3+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.
4+
5+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.
6+
7+## Installing overlays {#sec-overlays-install}
8+
9+The list of overlays can be set either explicitly in a Nix expression, or through `<nixpkgs-overlays>` or user configuration files.
10+
11+### Set overlays in NixOS or Nix expressions {#sec-overlays-argument}
12+
13+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](#sec-overlays-lookup) independently.
14+
15+The list of overlays can be passed explicitly when importing nixpkgs, for example `import <nixpkgs> { overlays = [ overlay1 overlay2 ]; }`.
16+
17+NOTE: DO NOT USE THIS in nixpkgs. 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.
18+
19+### Install overlays via configuration lookup {#sec-overlays-lookup}
20+
21+The list of overlays is determined as follows.
22+
23+1. First, if an [`overlays` argument](#sec-overlays-argument) to the Nixpkgs function itself is given, then that is used and no path lookup will be performed.
24+
25+2. Otherwise, if the Nix path entry `<nixpkgs-overlays>` exists, we look for overlays at that path, as described below.
26+
27+ See the section on `NIX_PATH` in the Nix manual for more details on how to set a value for `<nixpkgs-overlays>.`
28+
29+3. 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.
30+
31+If we are looking for overlays at a path, then there are two cases:
32+
33+- If the path is a file, then the file is imported as a Nix expression and used as the list of overlays.
34+
35+- 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:
36+
37+ - Importing the file, if it is a `.nix` file.
38+
39+ - Importing a top-level `default.nix` file, if it is a directory.
40+
41+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`.
42+
43+## Defining overlays {#sec-overlays-definition}
44+
45+Overlays are Nix functions which accept two arguments, conventionally called `self` and `super`, and return a set of packages. For example, the following is a valid overlay.
46+
47+```nix
48+self: super:
49+
50+{
51+ boost = super.boost.override {
52+ python = self.python3;
53+ };
54+ rr = super.callPackage ./pkgs/rr {
55+ stdenv = self.stdenv_32bit;
56+ };
57+}
58+```
59+
60+The first argument (`self`) corresponds to the final package set. You should use this set for the dependencies of all packages specified in your overlay. For example, all the dependencies of `rr` in the example above come from `self`, as well as the overridden dependencies used in the `boost` override.
61+
62+The second argument (`super`) corresponds to the result of the evaluation of the previous stages of Nixpkgs. It does not contain any of the packages added by the current overlay, nor any of the following overlays. This set should be used either to refer to packages you wish to override, or to access functions defined in Nixpkgs. For example, the original recipe of `boost` in the above example, comes from `super`, as well as the `callPackage` function.
63+
64+The value returned by this function should be a set similar to `pkgs/top-level/all-packages.nix`, containing overridden and/or new packages.
65+
66+Overlays are similar to other methods for customizing Nixpkgs, in particular the `packageOverrides` attribute described in [](#sec-modify-via-packageOverrides). Indeed, `packageOverrides` acts as an overlay with only the `super` argument. It is therefore appropriate for basic use, but overlays are more powerful and easier to distribute.
67+
68+## Using overlays to configure alternatives {#sec-overlays-alternatives}
69+
70+Certain software packages have different implementations of the same interface. Other distributions have functionality to switch between these. For example, Debian provides [DebianAlternatives](https://wiki.debian.org/DebianAlternatives). Nixpkgs has what we call `alternatives`, which are configured through overlays.
71+
72+### BLAS/LAPACK {#sec-overlays-alternatives-blas-lapack}
73+
74+In Nixpkgs, we have multiple implementations of the BLAS/LAPACK numerical linear algebra interfaces. They are:
75+
76+- [OpenBLAS](https://www.openblas.net/)
77+
78+ The Nixpkgs attribute is `openblas` for ILP64 (integer width = 64 bits) and `openblasCompat` for LP64 (integer width = 32 bits). `openblasCompat` is the default.
79+
80+- [LAPACK reference](http://www.netlib.org/lapack/) (also provides BLAS and CBLAS)
81+
82+ The Nixpkgs attribute is `lapack-reference`.
83+
84+- [Intel MKL](https://software.intel.com/en-us/mkl) (only works on the x86_64 architecture, unfree)
85+
86+ The Nixpkgs attribute is `mkl`.
87+
88+- [BLIS](https://github.com/flame/blis)
89+
90+ BLIS, available through the attribute `blis`, is a framework for linear algebra kernels. In addition, it implements the BLAS interface.
91+
92+- [AMD BLIS/LIBFLAME](https://developer.amd.com/amd-aocl/blas-library/) (optimized for modern AMD x86_64 CPUs)
93+
94+ The AMD fork of the BLIS library, with attribute `amd-blis`, extends BLIS with optimizations for modern AMD CPUs. The changes are usually submitted to the upstream BLIS project after some time. However, AMD BLIS typically provides some performance improvements on AMD Zen CPUs. The complementary AMD LIBFLAME library, with attribute `amd-libflame`, provides a LAPACK implementation.
95+
96+Introduced in [PR #83888](https://github.com/NixOS/nixpkgs/pull/83888), we are able to override the `blas` and `lapack` packages to use different implementations, through the `blasProvider` and `lapackProvider` argument. This can be used to select a different provider. BLAS providers will have symlinks in `$out/lib/libblas.so.3` and `$out/lib/libcblas.so.3` to their respective BLAS libraries. Likewise, LAPACK providers will have symlinks in `$out/lib/liblapack.so.3` and `$out/lib/liblapacke.so.3` to their respective LAPACK libraries. For example, Intel MKL is both a BLAS and LAPACK provider. An overlay can be created to use Intel MKL that looks like:
97+
98+```nix
99+self: super:
100+
101+{
102+ blas = super.blas.override {
103+ blasProvider = self.mkl;
104+ };
105+
106+ lapack = super.lapack.override {
107+ lapackProvider = self.mkl;
108+ };
109+}
110+```
111+
112+This overlay uses Intel's MKL library for both BLAS and LAPACK interfaces. Note that the same can be accomplished at runtime using `LD_LIBRARY_PATH` of `libblas.so.3` and `liblapack.so.3`. For instance:
113+
114+```ShellSession
115+$ LD_LIBRARY_PATH=$(nix-build -A mkl)/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH nix-shell -p octave --run octave
116+```
117+
118+Intel MKL requires an `openmp` implementation when running with multiple processors. By default, `mkl` will use Intel's `iomp` implementation if no other is specified, but this is a runtime-only dependency and binary compatible with the LLVM implementation. To use that one instead, Intel recommends users set it with `LD_PRELOAD`. Note that `mkl` is only available on `x86_64-linux` and `x86_64-darwin`. Moreover, Hydra is not building and distributing pre-compiled binaries using it.
119+
120+To override `blas` and `lapack` with its reference implementations (i.e. for development purposes), one can use the following overlay:
121+
122+```nix
123+self: super:
124+
125+{
126+ blas = super.blas.override {
127+ blasProvider = self.lapack-reference;
128+ };
129+
130+ lapack = super.lapack.override {
131+ lapackProvider = self.lapack-reference;
132+ };
133+}
134+```
135+
136+For BLAS/LAPACK switching to work correctly, all packages must depend on `blas` or `lapack`. This ensures that only one BLAS/LAPACK library is used at one time. There are two versions of BLAS/LAPACK currently in the wild, `LP64` (integer size = 32 bits) and `ILP64` (integer size = 64 bits). The attributes `blas` and `lapack` are `LP64` by default. Their `ILP64` version are provided through the attributes `blas-ilp64` and `lapack-ilp64`. Some software needs special flags or patches to work with `ILP64`. You can check if `ILP64` is used in Nixpkgs with `blas.isILP64` and `lapack.isILP64`. Some software does NOT work with `ILP64`, and derivations need to specify an assertion to prevent this. You can prevent `ILP64` from being used with the following:
137+
138+```nix
139+{ stdenv, blas, lapack, ... }:
140+
141+assert (!blas.isILP64) && (!lapack.isILP64);
142+
143+stdenv.mkDerivation {
144+ ...
145+}
146+```
147+
148+### Switching the MPI implementation {#sec-overlays-alternatives-mpi}
149+
150+All programs that are built with [MPI](https://en.wikipedia.org/wiki/Message_Passing_Interface) support use the generic attribute `mpi` as an input. At the moment Nixpkgs natively provides two different MPI implementations:
151+
152+- [Open MPI](https://www.open-mpi.org/) (default), attribute name
153+ `openmpi`
154+
155+- [MPICH](https://www.mpich.org/), attribute name `mpich`
156+
157+- [MVAPICH](https://mvapich.cse.ohio-state.edu/), attribute name `mvapich`
158+
159+To provide MPI enabled applications that use `MPICH`, instead of the default `Open MPI`, simply use the following overlay:
160+
161+```nix
162+self: super:
163+
164+{
165+ mpi = self.mpich;
166+}
167+```
doc/using/overlays.xmldeleted−279
@@ -1,279 +0,0 @@
1−<chapter xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="chap-overlays">
4− <title>Overlays</title>
5− <para>
6− 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.
7− </para>
8− <para>
9− 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.
10− </para>
11−<!--============================================================-->
12− <section xml:id="sec-overlays-install">
13− <title>Installing overlays</title>
14−
15− <para>
16− The list of overlays can be set either explicitly in a Nix expression, or through <literal><nixpkgs-overlays></literal> or user configuration files.
17− </para>
18−
19− <section xml:id="sec-overlays-argument">
20− <title>Set overlays in NixOS or Nix expressions</title>
21−
22− <para>
23− On a NixOS system the value of the <literal>nixpkgs.overlays</literal> 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. <literal>nix-env</literal>), which are <link xlink:href="#sec-overlays-lookup">looked</link> up independently.
24− </para>
25−
26− <para>
27− The list of overlays can be passed explicitly when importing nixpkgs, for example <literal>import <nixpkgs> { overlays = [ overlay1 overlay2 ]; }</literal>.
28− </para>
29−
30− <para>
31− NOTE: DO NOT USE THIS in nixpkgs. Further overlays can be added by calling the <literal>pkgs.extend</literal> or <literal>pkgs.appendOverlays</literal>, although it is often preferable to avoid these functions, because they recompute the Nixpkgs fixpoint, which is somewhat expensive to do.
32− </para>
33− </section>
34−
35− <section xml:id="sec-overlays-lookup">
36− <title>Install overlays via configuration lookup</title>
37−
38− <para>
39− The list of overlays is determined as follows.
40− </para>
41−
42− <para>
43− <orderedlist>
44− <listitem>
45− <para>
46− First, if an <link xlink:href="#sec-overlays-argument"><varname>overlays</varname> argument</link> to the Nixpkgs function itself is given, then that is used and no path lookup will be performed.
47− </para>
48− </listitem>
49− <listitem>
50− <para>
51− Otherwise, if the Nix path entry <literal><nixpkgs-overlays></literal> exists, we look for overlays at that path, as described below.
52− </para>
53− <para>
54− See the section on <literal>NIX_PATH</literal> in the Nix manual for more details on how to set a value for <literal><nixpkgs-overlays>.</literal>
55− </para>
56− </listitem>
57− <listitem>
58− <para>
59− If one of <filename>~/.config/nixpkgs/overlays.nix</filename> and <filename>~/.config/nixpkgs/overlays/</filename> exists, then we look for overlays at that path, as described below. It is an error if both exist.
60− </para>
61− </listitem>
62− </orderedlist>
63− </para>
64−
65− <para>
66− If we are looking for overlays at a path, then there are two cases:
67− <itemizedlist>
68− <listitem>
69− <para>
70− If the path is a file, then the file is imported as a Nix expression and used as the list of overlays.
71− </para>
72− </listitem>
73− <listitem>
74− <para>
75− 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:
76− <itemizedlist>
77− <listitem>
78− <para>
79− Importing the file, if it is a <literal>.nix</literal> file.
80− </para>
81− </listitem>
82− <listitem>
83− <para>
84− Importing a top-level <filename>default.nix</filename> file, if it is a directory.
85− </para>
86− </listitem>
87− </itemizedlist>
88− </para>
89− </listitem>
90− </itemizedlist>
91− </para>
92−
93− <para>
94− Because overlays that are set in NixOS configuration do not affect non-NixOS operations such as <literal>nix-env</literal>, the <filename>overlays.nix</filename> 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 <filename>overlays.nix</filename> and imported as the value of <literal>nixpkgs.overlays</literal>.
95− </para>
96−
97−<!-- TODO: Example of sharing overlays between NixOS configuration
98− and configuration lookup. Also reference the example
99− from the sec-overlays-argument paragraph about NixOS.
100− -->
101− </section>
102− </section>
103−<!--============================================================-->
104− <section xml:id="sec-overlays-definition">
105− <title>Defining overlays</title>
106−
107− <para>
108− Overlays are Nix functions which accept two arguments, conventionally called <varname>self</varname> and <varname>super</varname>, and return a set of packages. For example, the following is a valid overlay.
109− </para>
110−
111−<programlisting>
112−self: super:
113−
114−{
115− boost = super.boost.override {
116− python = self.python3;
117− };
118− rr = super.callPackage ./pkgs/rr {
119− stdenv = self.stdenv_32bit;
120− };
121−}
122−</programlisting>
123−
124− <para>
125− The first argument (<varname>self</varname>) corresponds to the final package set. You should use this set for the dependencies of all packages specified in your overlay. For example, all the dependencies of <varname>rr</varname> in the example above come from <varname>self</varname>, as well as the overridden dependencies used in the <varname>boost</varname> override.
126− </para>
127−
128− <para>
129− The second argument (<varname>super</varname>) corresponds to the result of the evaluation of the previous stages of Nixpkgs. It does not contain any of the packages added by the current overlay, nor any of the following overlays. This set should be used either to refer to packages you wish to override, or to access functions defined in Nixpkgs. For example, the original recipe of <varname>boost</varname> in the above example, comes from <varname>super</varname>, as well as the <varname>callPackage</varname> function.
130− </para>
131−
132− <para>
133− The value returned by this function should be a set similar to <filename>pkgs/top-level/all-packages.nix</filename>, containing overridden and/or new packages.
134− </para>
135−
136− <para>
137− Overlays are similar to other methods for customizing Nixpkgs, in particular the <literal>packageOverrides</literal> attribute described in <xref linkend="sec-modify-via-packageOverrides"/>. Indeed, <literal>packageOverrides</literal> acts as an overlay with only the <varname>super</varname> argument. It is therefore appropriate for basic use, but overlays are more powerful and easier to distribute.
138− </para>
139− </section>
140− <section xml:id="sec-overlays-alternatives">
141− <title>Using overlays to configure alternatives</title>
142−
143− <para>
144− Certain software packages have different implementations of the same interface. Other distributions have functionality to switch between these. For example, Debian provides <link
145− xlink:href="https://wiki.debian.org/DebianAlternatives">DebianAlternatives</link>. Nixpkgs has what we call <literal>alternatives</literal>, which are configured through overlays.
146− </para>
147−
148− <section xml:id="sec-overlays-alternatives-blas-lapack">
149− <title>BLAS/LAPACK</title>
150−
151− <para>
152− In Nixpkgs, we have multiple implementations of the BLAS/LAPACK numerical linear algebra interfaces. They are:
153− </para>
154−
155− <itemizedlist>
156− <listitem>
157− <para>
158− <link xlink:href="https://www.openblas.net/">OpenBLAS</link>
159− </para>
160− <para>
161− The Nixpkgs attribute is <literal>openblas</literal> for ILP64 (integer width = 64 bits) and <literal>openblasCompat</literal> for LP64 (integer width = 32 bits). <literal>openblasCompat</literal> is the default.
162− </para>
163− </listitem>
164− <listitem>
165− <para>
166− <link xlink:href="http://www.netlib.org/lapack/">LAPACK reference</link> (also provides BLAS)
167− </para>
168− <para>
169− The Nixpkgs attribute is <literal>lapack-reference</literal>.
170− </para>
171− </listitem>
172− <listitem>
173− <para>
174− <link
175− xlink:href="https://software.intel.com/en-us/mkl">Intel MKL</link> (only works on the x86_64 architecture, unfree)
176− </para>
177− <para>
178− The Nixpkgs attribute is <literal>mkl</literal>.
179− </para>
180− </listitem>
181− <listitem>
182− <para>
183− <link
184− xlink:href="https://github.com/flame/blis">BLIS</link>
185− </para>
186− <para>
187− BLIS, available through the attribute <literal>blis</literal>, is a framework for linear algebra kernels. In addition, it implements the BLAS interface.
188− </para>
189− </listitem>
190− <listitem>
191− <para>
192− <link
193− xlink:href="https://developer.amd.com/amd-aocl/blas-library/">AMD BLIS/LIBFLAME</link> (optimized for modern AMD x86_64 CPUs)
194− </para>
195− <para>
196− The AMD fork of the BLIS library, with attribute <literal>amd-blis</literal>, extends BLIS with optimizations for modern AMD CPUs. The changes are usually submitted to the upstream BLIS project after some time. However, AMD BLIS typically provides some performance improvements on AMD Zen CPUs. The complementary AMD LIBFLAME library, with attribute <literal>amd-libflame</literal>, provides a LAPACK implementation.
197− </para>
198− </listitem>
199− </itemizedlist>
200−
201− <para>
202− Introduced in <link
203− xlink:href="https://github.com/NixOS/nixpkgs/pull/83888">PR #83888</link>, we are able to override the <literal>blas</literal> and <literal>lapack</literal> packages to use different implementations, through the <literal>blasProvider</literal> and <literal>lapackProvider</literal> argument. This can be used to select a different provider. BLAS providers will have symlinks in <literal>$out/lib/libblas.so.3</literal> and <literal>$out/lib/libcblas.so.3</literal> to their respective BLAS libraries. Likewise, LAPACK providers will have symlinks in <literal>$out/lib/liblapack.so.3</literal> and <literal>$out/lib/liblapacke.so.3</literal> to their respective LAPACK libraries. For example, Intel MKL is both a BLAS and LAPACK provider. An overlay can be created to use Intel MKL that looks like:
204− </para>
205−
206−<programlisting>
207−self: super:
208−
209−{
210− blas = super.blas.override {
211− blasProvider = self.mkl;
212− };
213−
214− lapack = super.lapack.override {
215− lapackProvider = self.mkl;
216− };
217−}
218−</programlisting>
219−
220− <para>
221− This overlay uses Intel’s MKL library for both BLAS and LAPACK interfaces. Note that the same can be accomplished at runtime using <literal>LD_LIBRARY_PATH</literal> of <literal>libblas.so.3</literal> and <literal>liblapack.so.3</literal>. For instance:
222− </para>
223−
224−<screen>
225−<prompt>$ </prompt>LD_LIBRARY_PATH=$(nix-build -A mkl)/lib:$LD_LIBRARY_PATH nix-shell -p octave --run octave
226−</screen>
227−
228− <para>
229− Intel MKL requires an <literal>openmp</literal> implementation when running with multiple processors. By default, <literal>mkl</literal> will use Intel’s <literal>iomp</literal> implementation if no other is specified, but this is a runtime-only dependency and binary compatible with the LLVM implementation. To use that one instead, Intel recommends users set it with <literal>LD_PRELOAD</literal>. Note that <literal>mkl</literal> is only available on <literal>x86_64-linux</literal> and <literal>x86_64-darwin</literal>. Moreover, Hydra is not building and distributing pre-compiled binaries using it.
230− </para>
231−
232− <para>
233− For BLAS/LAPACK switching to work correctly, all packages must depend on <literal>blas</literal> or <literal>lapack</literal>. This ensures that only one BLAS/LAPACK library is used at one time. There are two versions of BLAS/LAPACK currently in the wild, <literal>LP64</literal> (integer size = 32 bits) and <literal>ILP64</literal> (integer size = 64 bits). Some software needs special flags or patches to work with <literal>ILP64</literal>. You can check if <literal>ILP64</literal> is used in Nixpkgs with <varname>blas.isILP64</varname> and <varname>lapack.isILP64</varname>. Some software does NOT work with <literal>ILP64</literal>, and derivations need to specify an assertion to prevent this. You can prevent <literal>ILP64</literal> from being used with the following:
234− </para>
235−
236−<programlisting>
237−{ stdenv, blas, lapack, ... }:
238−
239−assert (!blas.isILP64) && (!lapack.isILP64);
240−
241−stdenv.mkDerivation {
242− ...
243−}
244−</programlisting>
245− </section>
246−
247− <section xml:id="sec-overlays-alternatives-mpi">
248− <title>Switching the MPI implementation</title>
249−
250− <para>
251− All programs that are built with <link xlink:href="https://en.wikipedia.org/wiki/Message_Passing_Interface">MPI</link> support use the generic attribute <varname>mpi</varname> as an input. At the moment Nixpkgs natively provides two different MPI implementations:
252− <itemizedlist>
253− <listitem>
254− <para>
255− <link xlink:href="https://www.open-mpi.org/">Open MPI</link> (default), attribute name <varname>openmpi</varname>
256− </para>
257− </listitem>
258− <listitem>
259− <para>
260− <link xlink:href="https://www.mpich.org/">MPICH</link>, attribute name <varname>mpich</varname>
261− </para>
262− </listitem>
263− </itemizedlist>
264− </para>
265−
266− <para>
267− To provide MPI enabled applications that use <literal>MPICH</literal>, instead of the default <literal>Open MPI</literal>, simply use the following overlay:
268− </para>
269−
270−<programlisting>
271−self: super:
272−
273−{
274− mpi = self.mpich;
275−}
276− </programlisting>
277− </section>
278− </section>
279−</chapter>
doc/using/overrides.chapter.mdnew file+108
@@ -0,0 +1,108 @@
1+# Overriding {#chap-overrides}
2+
3+Sometimes one wants to override parts of `nixpkgs`, e.g. derivation attributes, the results of derivations.
4+
5+These functions are used to make changes to packages, returning only single packages. [Overlays](#chap-overlays), on the other hand, can be used to combine the overridden packages across the entire package set of Nixpkgs.
6+
7+## <pkg>.override {#sec-pkg-override}
8+
9+The function `override` is usually available for all the derivations in the nixpkgs expression (`pkgs`).
10+
11+It is used to override the arguments passed to a function.
12+
13+Example usages:
14+
15+```nix
16+pkgs.foo.override { arg1 = val1; arg2 = val2; ... }
17+```
18+
19+<!-- TODO: move below programlisting to a new section about extending and overlays and reference it -->
20+
21+```nix
22+import pkgs.path { overlays = [ (self: super: {
23+ foo = super.foo.override { barSupport = true ; };
24+ })]};
25+```
26+
27+```nix
28+mypkg = pkgs.callPackage ./mypkg.nix {
29+ mydep = pkgs.mydep.override { ... };
30+ }
31+```
32+
33+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.
34+
35+## <pkg>.overrideAttrs {#sec-pkg-overrideAttrs}
36+
37+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`.
38+
39+Example usage:
40+
41+```nix
42+helloWithDebug = pkgs.hello.overrideAttrs (finalAttrs: previousAttrs: {
43+ separateDebugInfo = true;
44+});
45+```
46+
47+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.
48+
49+The argument `previousAttrs` is conventionally used to refer to the attr set originally passed to `stdenv.mkDerivation`.
50+
51+The argument `finalAttrs` refers to the final attributes passed to `mkDerivation`, plus the `finalPackage` attribute which is equal to the result of `mkDerivation` or subsequent `overrideAttrs` calls.
52+
53+If only a one-argument function is written, the argument has the meaning of `previousAttrs`.
54+
55+::: {.note}
56+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).
57+:::
58+
59+## <pkg>.overrideDerivation {#sec-pkg-overrideDerivation}
60+
61+::: {.warning}
62+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`.
63+:::
64+
65+::: {.warning}
66+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`.
67+:::
68+
69+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.
70+
71+Example usage:
72+
73+```nix
74+mySed = pkgs.gnused.overrideDerivation (oldAttrs: {
75+ name = "sed-4.2.2-pre";
76+ src = fetchurl {
77+ url = ftp://alpha.gnu.org/gnu/sed/sed-4.2.2-pre.tar.bz2;
78+ sha256 = "11nq06d131y4wmf3drm0yk502d2xc6n5qy82cg88rb9nqd2lj41k";
79+ };
80+ patches = [];
81+});
82+```
83+
84+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.
85+
86+The argument `oldAttrs` is used to refer to the attribute set of the original derivation.
87+
88+::: {.note}
89+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.
90+:::
91+
92+## lib.makeOverridable {#sec-lib-makeOverridable}
93+
94+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.
95+
96+Example usage:
97+
98+```nix
99+f = { a, b }: { result = a+b; };
100+c = lib.makeOverridable f { a = 1; b = 2; };
101+```
102+
103+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.
104+
105+The variable `c` however also has some additional functions, like
106+[c.override](#sec-pkg-override) which can be used to override the
107+default arguments. In this example the value of
108+`(c.override { a = 4; }).result` is 6.
doc/using/overrides.xmldeleted−145
@@ -1,145 +0,0 @@
1−<chapter xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xmlns:xi="http://www.w3.org/2001/XInclude"
4− xml:id="chap-overrides">
5− <title>Overriding</title>
6− <para>
7− Sometimes one wants to override parts of <literal>nixpkgs</literal>, e.g. derivation attributes, the results of derivations.
8− </para>
9− <para>
10− These functions are used to make changes to packages, returning only single packages. <link xlink:href="#chap-overlays">Overlays</link>, on the other hand, can be used to combine the overridden packages across the entire package set of Nixpkgs.
11− </para>
12− <section xml:id="sec-pkg-override">
13− <title><pkg>.override</title>
14−
15− <para>
16− The function <varname>override</varname> is usually available for all the derivations in the nixpkgs expression (<varname>pkgs</varname>).
17− </para>
18−
19− <para>
20− It is used to override the arguments passed to a function.
21− </para>
22−
23− <para>
24− Example usages:
25−<programlisting>pkgs.foo.override { arg1 = val1; arg2 = val2; ... }</programlisting>
26−<!-- TODO: move below programlisting to a new section about extending and overlays
27− and reference it
28− -->
29−<programlisting>
30−import pkgs.path { overlays = [ (self: super: {
31− foo = super.foo.override { barSupport = true ; };
32− })]};
33−</programlisting>
34−<programlisting>
35−mypkg = pkgs.callPackage ./mypkg.nix {
36− mydep = pkgs.mydep.override { ... };
37− }
38−</programlisting>
39− </para>
40−
41− <para>
42− In the first example, <varname>pkgs.foo</varname> is the result of a function call with some default arguments, usually a derivation. Using <varname>pkgs.foo.override</varname> will call the same function with the given new arguments.
43− </para>
44− </section>
45− <section xml:id="sec-pkg-overrideAttrs">
46− <title><pkg>.overrideAttrs</title>
47−
48− <para>
49− The function <varname>overrideAttrs</varname> allows overriding the attribute set passed to a <varname>stdenv.mkDerivation</varname> call, producing a new derivation based on the original one. This function is available on all derivations produced by the <varname>stdenv.mkDerivation</varname> function, which is most packages in the nixpkgs expression <varname>pkgs</varname>.
50− </para>
51−
52− <para>
53− Example usage:
54−<programlisting>
55−helloWithDebug = pkgs.hello.overrideAttrs (oldAttrs: rec {
56− separateDebugInfo = true;
57−});
58−</programlisting>
59− </para>
60−
61− <para>
62− In the above example, the <varname>separateDebugInfo</varname> attribute is overridden to be true, thus building debug info for <varname>helloWithDebug</varname>, while all other attributes will be retained from the original <varname>hello</varname> package.
63− </para>
64−
65− <para>
66− The argument <varname>oldAttrs</varname> is conventionally used to refer to the attr set originally passed to <varname>stdenv.mkDerivation</varname>.
67− </para>
68−
69− <note>
70− <para>
71− Note that <varname>separateDebugInfo</varname> is processed only by the <varname>stdenv.mkDerivation</varname> function, not the generated, raw Nix derivation. Thus, using <varname>overrideDerivation</varname> will not work in this case, as it overrides only the attributes of the final derivation. It is for this reason that <varname>overrideAttrs</varname> should be preferred in (almost) all cases to <varname>overrideDerivation</varname>, i.e. to allow using <varname>stdenv.mkDerivation</varname> 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. <varname>buildInputs</varname> vs <varname>nativeBuildInputs</varname>), and it involves less typing).
72− </para>
73− </note>
74− </section>
75− <section xml:id="sec-pkg-overrideDerivation">
76− <title><pkg>.overrideDerivation</title>
77−
78− <warning>
79− <para>
80− You should prefer <varname>overrideAttrs</varname> in almost all cases, see its documentation for the reasons why. <varname>overrideDerivation</varname> is not deprecated and will continue to work, but is less nice to use and does not have as many abilities as <varname>overrideAttrs</varname>.
81− </para>
82− </warning>
83−
84− <warning>
85− <para>
86− 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 <filename>~/.config/nixpkgs/config.nix</filename>.
87− </para>
88− </warning>
89−
90− <para>
91− The function <varname>overrideDerivation</varname> 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 <varname>makeOverridable</varname> function. Most standard derivation-producing functions, such as <varname>stdenv.mkDerivation</varname>, are defined using this function, which means most packages in the nixpkgs expression, <varname>pkgs</varname>, have this function.
92− </para>
93−
94− <para>
95− Example usage:
96−<programlisting>
97−mySed = pkgs.gnused.overrideDerivation (oldAttrs: {
98− name = "sed-4.2.2-pre";
99− src = fetchurl {
100− url = ftp://alpha.gnu.org/gnu/sed/sed-4.2.2-pre.tar.bz2;
101− sha256 = "11nq06d131y4wmf3drm0yk502d2xc6n5qy82cg88rb9nqd2lj41k";
102− };
103− patches = [];
104−});
105−</programlisting>
106− </para>
107−
108− <para>
109− In the above example, the <varname>name</varname>, <varname>src</varname>, and <varname>patches</varname> of the derivation will be overridden, while all other attributes will be retained from the original derivation.
110− </para>
111−
112− <para>
113− The argument <varname>oldAttrs</varname> is used to refer to the attribute set of the original derivation.
114− </para>
115−
116− <note>
117− <para>
118− A package's attributes are evaluated *before* being modified by the <varname>overrideDerivation</varname> function. For example, the <varname>name</varname> attribute reference in <varname>url = "mirror://gnu/hello/${name}.tar.gz";</varname> is filled-in *before* the <varname>overrideDerivation</varname> function modifies the attribute set. This means that overriding the <varname>name</varname> attribute, in this example, *will not* change the value of the <varname>url</varname> attribute. Instead, we need to override both the <varname>name</varname> *and* <varname>url</varname> attributes.
119− </para>
120− </note>
121− </section>
122− <section xml:id="sec-lib-makeOverridable">
123− <title>lib.makeOverridable</title>
124−
125− <para>
126− The function <varname>lib.makeOverridable</varname> 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.
127− </para>
128−
129− <para>
130− Example usage:
131−<programlisting>
132−f = { a, b }: { result = a+b; };
133−c = lib.makeOverridable f { a = 1; b = 2; };
134−</programlisting>
135− </para>
136−
137− <para>
138− The variable <varname>c</varname> is the value of the <varname>f</varname> function applied with some default arguments. Hence the value of <varname>c.result</varname> is <literal>3</literal>, in this example.
139− </para>
140−
141− <para>
142− The variable <varname>c</varname> however also has some additional functions, like <link linkend="sec-pkg-override">c.override</link> which can be used to override the default arguments. In this example the value of <varname>(c.override { a = 4; }).result</varname> is 6.
143− </para>
144− </section>
145−</chapter>
flake.nix+9−40
@@ -11,54 +11,23 @@
1111
1212 lib = import ./lib;
1313
14− systems = [
15− "x86_64-linux"
16− "i686-linux"
17− "x86_64-darwin"
18− "aarch64-linux"
19− "armv6l-linux"
20− "armv7l-linux"
21− ];
14+ systems = lib.systems.supported.hydra;
2215
2316 forAllSystems = f: lib.genAttrs systems (system: f system);
2417
2518 in
2619 {
2720 lib = lib.extend (final: prev: {
28− nixosSystem = { modules, ... } @ args:
29− import ./nixos/lib/eval-config.nix (args // {
30− modules =
31− let
32− vmConfig = (import ./nixos/lib/eval-config.nix
33− (args // {
34− modules = modules ++ [ ./nixos/modules/virtualisation/qemu-vm.nix ];
35− })).config;
3621
37− vmWithBootLoaderConfig = (import ./nixos/lib/eval-config.nix
38− (args // {
39− modules = modules ++ [
40− ./nixos/modules/virtualisation/qemu-vm.nix
41− { virtualisation.useBootLoader = true; }
42− ({ config, ... }: {
43− virtualisation.useEFIBoot =
44− config.boot.loader.systemd-boot.enable ||
45− config.boot.loader.efi.canTouchEfiVariables;
46− })
47− ];
48− })).config;
49− in
50− modules ++ [
51− {
52− system.nixos.versionSuffix =
53− ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}";
54− system.nixos.revision = final.mkIf (self ? rev) self.rev;
22+ nixos = import ./nixos/lib { lib = final; };
5523
56− system.build = {
57− vm = vmConfig.system.build.vm;
58− vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
59− };
60− }
61− ];
24+ nixosSystem = args:
25+ import ./nixos/lib/eval-config.nix (args // {
26+ modules = args.modules ++ [ {
27+ system.nixos.versionSuffix =
28+ ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}";
29+ system.nixos.revision = final.mkIf (self ? rev) self.rev;
30+ } ];
6231 });
6332 });
6433
lib/asserts.nix+10−12
@@ -2,35 +2,33 @@
22
33rec {
44
5− /* Print a trace message if pred is false.
5+ /* Throw if pred is false, else return pred.
66 Intended to be used to augment asserts with helpful error messages.
77
88 Example:
99 assertMsg false "nope"
10− => false
11− stderr> trace: nope
10+ stderr> error: nope
1211
13− assert (assertMsg ("foo" == "bar") "foo is not bar, silly"); ""
14− stderr> trace: foo is not bar, silly
15− stderr> assert failed at …
12+ assert assertMsg ("foo" == "bar") "foo is not bar, silly"; ""
13+ stderr> error: foo is not bar, silly
1614
1715 Type:
1816 assertMsg :: Bool -> String -> Bool
1917 */
2018 # TODO(Profpatsch): add tests that check stderr
2119 assertMsg = pred: msg:
22− if pred
23− then true
24− else builtins.trace msg false;
20+ pred || builtins.throw msg;
2521
2622 /* Specialized `assertMsg` for checking if val is one of the elements
2723 of a list. Useful for checking enums.
2824
2925 Example:
30− let sslLibrary = "libressl"
26+ let sslLibrary = "libressl";
3127 in assertOneOf "sslLibrary" sslLibrary [ "openssl" "bearssl" ]
32− => false
33− stderr> trace: sslLibrary must be one of "openssl", "bearssl", but is: "libressl"
28+ stderr> error: sslLibrary must be one of [
29+ stderr> "openssl"
30+ stderr> "bearssl"
31+ stderr> ], but is: "libressl"
3432
3533 Type:
3634 assertOneOf :: String -> ComparableVal -> List ComparableVal -> Bool
lib/attrsets.nix+145−29
@@ -3,9 +3,9 @@
33
44let
55 inherit (builtins) head tail length;
6− inherit (lib.trivial) and;
7− inherit (lib.strings) concatStringsSep sanitizeDerivationName;
8− inherit (lib.lists) fold concatMap concatLists;
6+ inherit (lib.trivial) id;
7+ inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
8+ inherit (lib.lists) foldr foldl' concatMap concatLists elemAt all partition groupBy take foldl;
99in
1010
1111rec {
@@ -55,10 +55,13 @@ rec {
5555 => { a = { b = 3; }; }
5656 */
5757 setAttrByPath = attrPath: value:
58− if attrPath == [] then value
59− else listToAttrs
60− [ { name = head attrPath; value = setAttrByPath (tail attrPath) value; } ];
61−
58+ let
59+ len = length attrPath;
60+ atDepth = n:
61+ if n == len
62+ then value
63+ else { ${elemAt attrPath n} = atDepth (n + 1); };
64+ in atDepth 0;
6265
6366 /* Like `attrByPath' without a default value. If it doesn't find the
6467 path it will throw.
@@ -70,10 +73,107 @@ rec {
7073 getAttrFromPath ["z" "z"] x
7174 => error: cannot find attribute `z.z'
7275 */
73− getAttrFromPath = attrPath: set:
76+ getAttrFromPath = attrPath:
7477 let errorMsg = "cannot find attribute `" + concatStringsSep "." attrPath + "'";
75− in attrByPath attrPath (abort errorMsg) set;
78+ in attrByPath attrPath (abort errorMsg);
79+
80+
81+ /* Update or set specific paths of an attribute set.
82+
83+ Takes a list of updates to apply and an attribute set to apply them to,
84+ and returns the attribute set with the updates applied. Updates are
85+ represented as { path = ...; update = ...; } values, where `path` is a
86+ list of strings representing the attribute path that should be updated,
87+ and `update` is a function that takes the old value at that attribute path
88+ as an argument and returns the new
89+ value it should be.
90+
91+ Properties:
92+ - Updates to deeper attribute paths are applied before updates to more
93+ shallow attribute paths
94+ - Multiple updates to the same attribute path are applied in the order
95+ they appear in the update list
96+ - If any but the last `path` element leads into a value that is not an
97+ attribute set, an error is thrown
98+ - If there is an update for an attribute path that doesn't exist,
99+ accessing the argument in the update function causes an error, but
100+ intermediate attribute sets are implicitly created as needed
76101
102+ Example:
103+ updateManyAttrsByPath [
104+ {
105+ path = [ "a" "b" ];
106+ update = old: { d = old.c; };
107+ }
108+ {
109+ path = [ "a" "b" "c" ];
110+ update = old: old + 1;
111+ }
112+ {
113+ path = [ "x" "y" ];
114+ update = old: "xy";
115+ }
116+ ] { a.b.c = 0; }
117+ => { a = { b = { d = 1; }; }; x = { y = "xy"; }; }
118+ */
119+ updateManyAttrsByPath = let
120+ # When recursing into attributes, instead of updating the `path` of each
121+ # update using `tail`, which needs to allocate an entirely new list,
122+ # we just pass a prefix length to use and make sure to only look at the
123+ # path without the prefix length, so that we can reuse the original list
124+ # entries.
125+ go = prefixLength: hasValue: value: updates:
126+ let
127+ # Splits updates into ones on this level (split.right)
128+ # And ones on levels further down (split.wrong)
129+ split = partition (el: length el.path == prefixLength) updates;
130+
131+ # Groups updates on further down levels into the attributes they modify
132+ nested = groupBy (el: elemAt el.path prefixLength) split.wrong;
133+
134+ # Applies only nested modification to the input value
135+ withNestedMods =
136+ # Return the value directly if we don't have any nested modifications
137+ if split.wrong == [] then
138+ if hasValue then value
139+ else
140+ # Throw an error if there is no value. This `head` call here is
141+ # safe, but only in this branch since `go` could only be called
142+ # with `hasValue == false` for nested updates, in which case
143+ # it's also always called with at least one update
144+ let updatePath = (head split.right).path; in
145+ throw
146+ ( "updateManyAttrsByPath: Path '${showAttrPath updatePath}' does "
147+ + "not exist in the given value, but the first update to this "
148+ + "path tries to access the existing value.")
149+ else
150+ # If there are nested modifications, try to apply them to the value
151+ if ! hasValue then
152+ # But if we don't have a value, just use an empty attribute set
153+ # as the value, but simplify the code a bit
154+ mapAttrs (name: go (prefixLength + 1) false null) nested
155+ else if isAttrs value then
156+ # If we do have a value and it's an attribute set, override it
157+ # with the nested modifications
158+ value //
159+ mapAttrs (name: go (prefixLength + 1) (value ? ${name}) value.${name}) nested
160+ else
161+ # However if it's not an attribute set, we can't apply the nested
162+ # modifications, throw an error
163+ let updatePath = (head split.wrong).path; in
164+ throw
165+ ( "updateManyAttrsByPath: Path '${showAttrPath updatePath}' needs to "
166+ + "be updated, but path '${showAttrPath (take prefixLength updatePath)}' "
167+ + "of the given value is not an attribute set, so we can't "
168+ + "update an attribute inside of it.");
169+
170+ # We get the final result by applying all the updates on this level
171+ # after having applied all the nested updates
172+ # We use foldl instead of foldl' so that in case of multiple updates,
173+ # intermediate values aren't evaluated if not needed
174+ in foldl (acc: el: el.update acc) withNestedMods split.right;
175+
176+ in updates: value: go 0 true value updates;
77177
78178 /* Return the specified attributes from a set.
79179
@@ -151,12 +251,12 @@ rec {
151251 foldAttrs (n: a: [n] ++ a) [] [{ a = 2; } { a = 3; }]
152252 => { a = [ 2 3 ]; }
153253 */
154− foldAttrs = op: nul: list_of_attrs:
155− fold (n: a:
156− fold (name: o:
254+ foldAttrs = op: nul:
255+ foldr (n: a:
256+ foldr (name: o:
157257 o // { ${name} = op n.${name} (a.${name} or nul); }
158258 ) a (attrNames n)
159− ) {} list_of_attrs;
259+ ) {};
160260
161261
162262 /* Recursively collect sets that verify a given predicate named `pred'
@@ -195,7 +295,7 @@ rec {
195295 ]
196296 */
197297 cartesianProductOfSets = attrsOfLists:
198− lib.foldl' (listOfAttrs: attrName:
298+ foldl' (listOfAttrs: attrName:
199299 concatMap (attrs:
200300 map (listValue: attrs // { ${attrName} = listValue; }) attrsOfLists.${attrName}
201301 ) listOfAttrs
@@ -243,6 +343,10 @@ rec {
243343 /* Call a function for each attribute in the given set and return
244344 the result in a list.
245345
346+ Type:
347+ mapAttrsToList ::
348+ (String -> a -> b) -> AttrSet -> [b]
349+
246350 Example:
247351 mapAttrsToList (name: value: name + value)
248352 { x = "a"; y = "b"; }
@@ -269,7 +373,7 @@ rec {
269373
270374
271375 /* Like `mapAttrsRecursive', but it takes an additional predicate
272− function that tells it whether to recursive into an attribute
376+ function that tells it whether to recurse into an attribute
273377 set. If it returns false, `mapAttrsRecursiveCond' does not
274378 recurse, but does apply the map function. If it returns true, it
275379 does recurse, and does not apply the map function.
@@ -288,14 +392,14 @@ rec {
288392 */
289393 mapAttrsRecursiveCond = cond: f: set:
290394 let
291− recurse = path: set:
395+ recurse = path:
292396 let
293397 g =
294398 name: value:
295399 if isAttrs value && cond value
296400 then recurse (path ++ [name]) value
297401 else f (path ++ [name]) value;
298− in mapAttrs g set;
402+ in mapAttrs g;
299403 in recurse [] set;
300404
301405
@@ -320,7 +424,7 @@ rec {
320424 isDerivation "foobar"
321425 => false
322426 */
323− isDerivation = x: isAttrs x && x ? type && x.type == "derivation";
427+ isDerivation = x: x.type or null == "derivation";
324428
325429 /* Converts a store path to a fake derivation. */
326430 toDerivation = path:
@@ -362,7 +466,7 @@ rec {
362466 value = f name (catAttrs name sets);
363467 }) names);
364468
365− /* Implementation note: Common names appear multiple times in the list of
469+ /* Implementation note: Common names appear multiple times in the list of
366470 names, hopefully this does not affect the system because the maximal
367471 laziness avoid computing twice the same expression and listToAttrs does
368472 not care about duplicated attribute names.
@@ -371,7 +475,8 @@ rec {
371475 zipAttrsWith (name: values: values) [{a = "x";} {a = "y"; b = "z";}]
372476 => { a = ["x" "y"]; b = ["z"] }
373477 */
374− zipAttrsWith = f: sets: zipAttrsWithNames (concatMap attrNames sets) f sets;
478+ zipAttrsWith =
479+ builtins.zipAttrsWith or (f: sets: zipAttrsWithNames (concatMap attrNames sets) f sets);
375480 /* Like `zipAttrsWith' with `(name: values: values)' as the function.
376481
377482 Example:
@@ -412,8 +517,8 @@ rec {
412517 let f = attrPath:
413518 zipAttrsWith (n: values:
414519 let here = attrPath ++ [n]; in
415− if tail values == []
416− || pred here (head (tail values)) (head values) then
520+ if length values == 1
521+ || pred here (elemAt values 1) (head values) then
417522 head values
418523 else
419524 f here values
@@ -439,10 +544,7 @@ rec {
439544 }
440545
441546 */
442− recursiveUpdate = lhs: rhs:
443− recursiveUpdateUntil (path: lhs: rhs:
444− !(isAttrs lhs && isAttrs rhs)
445− ) lhs rhs;
547+ recursiveUpdate = recursiveUpdateUntil (path: lhs: rhs: !(isAttrs lhs && isAttrs rhs));
446548
447549 /* Returns true if the pattern is contained in the set. False otherwise.
448550
@@ -451,8 +553,8 @@ rec {
451553 => true
452554 */
453555 matchAttrs = pattern: attrs: assert isAttrs pattern;
454− fold and true (attrValues (zipAttrsWithNames (attrNames pattern) (n: values:
455− let pat = head values; val = head (tail values); in
556+ all id (attrValues (zipAttrsWithNames (attrNames pattern) (n: values:
557+ let pat = head values; val = elemAt values 1; in
456558 if length values == 1 then false
457559 else if isAttrs pat then isAttrs val && matchAttrs pat val
458560 else pat == val
@@ -472,6 +574,20 @@ rec {
472574 overrideExisting = old: new:
473575 mapAttrs (name: value: new.${name} or value) old;
474576
577+ /* Turns a list of strings into a human-readable description of those
578+ strings represented as an attribute path. The result of this function is
579+ not intended to be machine-readable.
580+
581+ Example:
582+ showAttrPath [ "foo" "10" "bar" ]
583+ => "foo.\"10\".bar"
584+ showAttrPath []
585+ => "<root attribute path>"
586+ */
587+ showAttrPath = path:
588+ if path == [] then "<root attribute path>"
589+ else concatMapStringsSep "." escapeNixIdentifier path;
590+
475591 /* Get a package output.
476592 If no output is found, fallback to `.out` and then to the default.
477593
@@ -480,7 +596,7 @@ rec {
480596 => "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev"
481597 */
482598 getOutput = output: pkg:
483− if pkg.outputUnspecified or false
599+ if ! pkg ? outputSpecified || ! pkg.outputSpecified
484600 then pkg.${output} or pkg.out or pkg
485601 else pkg;
486602
lib/customisation.nix+55−6
@@ -117,8 +117,55 @@ rec {
117117 callPackageWith = autoArgs: fn: args:
118118 let
119119 f = if lib.isFunction fn then fn else import fn;
120− auto = builtins.intersectAttrs (lib.functionArgs f) autoArgs;
121− in makeOverridable f (auto // args);
120+ fargs = lib.functionArgs f;
121+
122+ # All arguments that will be passed to the function
123+ # This includes automatic ones and ones passed explicitly
124+ allArgs = builtins.intersectAttrs fargs autoArgs // args;
125+
126+ # A list of argument names that the function requires, but
127+ # wouldn't be passed to it
128+ missingArgs = lib.attrNames
129+ # Filter out arguments that have a default value
130+ (lib.filterAttrs (name: value: ! value)
131+ # Filter out arguments that would be passed
132+ (removeAttrs fargs (lib.attrNames allArgs)));
133+
134+ # Get a list of suggested argument names for a given missing one
135+ getSuggestions = arg: lib.pipe (autoArgs // args) [
136+ lib.attrNames
137+ # Only use ones that are at most 2 edits away. While mork would work,
138+ # levenshteinAtMost is only fast for 2 or less.
139+ (lib.filter (lib.strings.levenshteinAtMost 2 arg))
140+ # Put strings with shorter distance first
141+ (lib.sort (x: y: lib.strings.levenshtein x arg < lib.strings.levenshtein y arg))
142+ # Only take the first couple results
143+ (lib.take 3)
144+ # Quote all entries
145+ (map (x: "\"" + x + "\""))
146+ ];
147+
148+ prettySuggestions = suggestions:
149+ if suggestions == [] then ""
150+ else if lib.length suggestions == 1 then ", did you mean ${lib.elemAt suggestions 0}?"
151+ else ", did you mean ${lib.concatStringsSep ", " (lib.init suggestions)} or ${lib.last suggestions}?";
152+
153+ errorForArg = arg:
154+ let
155+ loc = builtins.unsafeGetAttrPos arg fargs;
156+ # loc' can be removed once lib/minver.nix is >2.3.4, since that includes
157+ # https://github.com/NixOS/nix/pull/3468 which makes loc be non-null
158+ loc' = if loc != null then loc.file + ":" + toString loc.line
159+ else if ! lib.isFunction fn then
160+ toString fn + lib.optionalString (lib.sources.pathIsDirectory fn) "/default.nix"
161+ else "<unknown location>";
162+ in "Function called without required argument \"${arg}\" at "
163+ + "${loc'}${prettySuggestions (getSuggestions arg)}";
164+
165+ # Only show the error for the first missing argument
166+ error = errorForArg (lib.head missingArgs);
167+
168+ in if missingArgs == [] then makeOverridable f allArgs else throw error;
122169
123170
124171 /* Like callPackage, but for a function that returns an attribute
@@ -152,6 +199,7 @@ rec {
152199 { name = outputName;
153200 value = commonAttrs // {
154201 inherit (drv.${outputName}) type outputName;
202+ outputSpecified = true;
155203 drvPath = assert condition; drv.${outputName}.drvPath;
156204 outPath = assert condition; drv.${outputName}.outPath;
157205 };
@@ -159,7 +207,6 @@ rec {
159207
160208 outputsList = map outputToAttrListElement outputs;
161209 in commonAttrs // {
162− outputUnspecified = true;
163210 drvPath = assert condition; drv.drvPath;
164211 outPath = assert condition; drv.outPath;
165212 };
@@ -219,16 +266,17 @@ rec {
219266
220267 /* Like the above, but aims to support cross compilation. It's still ugly, but
221268 hopefully it helps a little bit. */
222− makeScopeWithSplicing = splicePackages: newScope: otherSplices: keep: f:
269+ makeScopeWithSplicing = splicePackages: newScope: otherSplices: keep: extra: f:
223270 let
224− spliced = splicePackages {
271+ spliced0 = splicePackages {
225272 pkgsBuildBuild = otherSplices.selfBuildBuild;
226273 pkgsBuildHost = otherSplices.selfBuildHost;
227274 pkgsBuildTarget = otherSplices.selfBuildTarget;
228275 pkgsHostHost = otherSplices.selfHostHost;
229276 pkgsHostTarget = self; # Not `otherSplices.selfHostTarget`;
230277 pkgsTargetTarget = otherSplices.selfTargetTarget;
231− } // keep self;
278+ };
279+ spliced = extra spliced0 // spliced0 // keep self;
232280 self = f self // {
233281 newScope = scope: newScope (spliced // scope);
234282 callPackage = newScope spliced; # == self.newScope {};
@@ -239,6 +287,7 @@ rec {
239287 newScope
240288 otherSplices
241289 keep
290+ extra
242291 (lib.fixedPoints.extends g f);
243292 packages = f;
244293 };
lib/default.nix+26−15
@@ -11,6 +11,9 @@ let
1111 callLibs = file: import file { lib = self; };
1212 in {
1313
14+ # interacting with flakes
15+ flakes = callLibs ./flakes.nix;
16+
1417 # often used, or depending on very little
1518 trivial = callLibs ./trivial.nix;
1619 fixedPoints = callLibs ./fixed-points.nix;
@@ -59,6 +62,7 @@ let
5962 # linux kernel configuration
6063 kernel = callLibs ./kernel.nix;
6164
65+ inherit (self.flakes) callLocklessFlake;
6266 inherit (builtins) add addErrorContext attrNames concatLists
6367 deepSeq elem elemAt filter genericClosure genList getAttr
6468 hasAttr head isAttrs isBool isInt isList isString length
@@ -66,8 +70,11 @@ let
6670 stringLength sub substring tail trace;
6771 inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor
6872 bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
69− importJSON importTOML warn info showWarnings nixpkgsVersion version mod compare
70− splitByAndCompare functionArgs setFunctionArgs isFunction toHexString toBaseDigits;
73+ importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum
74+ info showWarnings nixpkgsVersion version isInOldestRelease
75+ mod compare splitByAndCompare
76+ functionArgs setFunctionArgs isFunction toFunction
77+ toHexString toBaseDigits;
7178 inherit (self.fixedPoints) fix fix' converge extends composeExtensions
7279 composeManyExtensions makeExtensible makeExtensibleWithCustomName;
7380 inherit (self.attrsets) attrByPath hasAttrByPath setAttrByPath
@@ -76,9 +83,10 @@ let
7683 mapAttrs' mapAttrsToList mapAttrsRecursive mapAttrsRecursiveCond
7784 genAttrs isDerivation toDerivation optionalAttrs
7885 zipAttrsWithNames zipAttrsWith zipAttrs recursiveUpdateUntil
79− recursiveUpdate matchAttrs overrideExisting getOutput getBin
86+ recursiveUpdate matchAttrs overrideExisting showAttrPath getOutput getBin
8087 getLib getDev getMan chooseDevOutputs zipWithNames zip
81− recurseIntoAttrs dontRecurseIntoAttrs cartesianProductOfSets;
88+ recurseIntoAttrs dontRecurseIntoAttrs cartesianProductOfSets
89+ updateManyAttrsByPath;
8290 inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1
8391 concatMap flatten remove findSingle findFirst any all count
8492 optional optionals toList range partition zipListsWith zipLists
@@ -90,7 +98,8 @@ let
9098 concatImapStringsSep makeSearchPath makeSearchPathOutput
9199 makeLibraryPath makeBinPath optionalString
92100 hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
93− escapeShellArg escapeShellArgs replaceChars lowerChars
101+ escapeShellArg escapeShellArgs isValidPosixName toShellVar toShellVars
102+ escapeRegex escapeXML replaceChars lowerChars
94103 upperChars toLower toUpper addContextFrom splitString
95104 removePrefix removeSuffix versionOlder versionAtLeast
96105 getName getVersion
@@ -104,26 +113,28 @@ let
104113 makeScope makeScopeWithSplicing;
105114 inherit (self.meta) addMetaAttrs dontDistribute setName updateName
106115 appendToName mapDerivationAttrset setPrio lowPrio lowPrioSet hiPrio
107− hiPrioSet;
116+ hiPrioSet getLicenseFromSpdxId getExe;
108117 inherit (self.sources) pathType pathIsDirectory cleanSourceFilter
109118 cleanSource sourceByRegex sourceFilesBySuffices
110119 commitIdFromGitRepo cleanSourceWith pathHasContext
111120 canCleanSource pathIsRegularFile pathIsGitRepo;
112− inherit (self.modules) evalModules unifyModuleSyntax
113− applyIfFunction mergeModules
121+ inherit (self.modules) evalModules setDefaultModuleLocation
122+ unifyModuleSyntax applyModuleArgsIfFunction mergeModules
114123 mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions
115124 pushDownProperties dischargeProperties filterOverrides
116125 sortProperties fixupOptionType mkIf mkAssert mkMerge mkOverride
117− mkOptionDefault mkDefault mkForce mkVMOverride mkStrict
126+ mkOptionDefault mkDefault mkImageMediaOverride mkForce mkVMOverride
118127 mkFixStrictness mkOrder mkBefore mkAfter mkAliasDefinitions
119128 mkAliasAndWrapDefinitions fixMergeModules mkRemovedOptionModule
120− mkRenamedOptionModule mkMergedOptionModule mkChangedOptionModule
121− mkAliasOptionModule doRename;
129+ mkRenamedOptionModule mkRenamedOptionModuleWith
130+ mkMergedOptionModule mkChangedOptionModule
131+ mkAliasOptionModule mkDerivedConfig doRename;
122132 inherit (self.options) isOption mkEnableOption mkSinkUndeclaredOptions
123− mergeDefaultOption mergeOneOption mergeEqualOption getValues
124− getFiles optionAttrSetToDocList optionAttrSetToDocList'
125− scrubOptionValue literalExample showOption showFiles
126− unknownModule mkOption;
133+ mergeDefaultOption mergeOneOption mergeEqualOption mergeUniqueOption
134+ getValues getFiles
135+ optionAttrSetToDocList optionAttrSetToDocList'
136+ scrubOptionValue literalExpression literalExample literalDocBook
137+ showOption showFiles unknownModule mkOption mkPackageOption;
127138 inherit (self.types) isType setType defaultTypeMerge defaultFunctor
128139 isOptionType mkOptionType;
129140 inherit (self.asserts)
lib/deprecated.nix+5−5
@@ -77,11 +77,11 @@ rec {
7777 # Output : are reqs satisfied? It's asserted.
7878 checkReqs = attrSet: argList: condList:
7979 (
80− fold lib.and true
80+ foldr lib.and true
8181 (map (x: let name = (head x); in
8282
8383 ((checkFlag attrSet name) ->
84− (fold lib.and true
84+ (foldr lib.and true
8585 (map (y: let val=(getValue attrSet argList y); in
8686 (val!=null) && (val!=false))
8787 (tail x))))) condList));
@@ -177,7 +177,7 @@ rec {
177177 # merge attributes with custom function handling the case that the attribute
178178 # exists in both sets
179179 mergeAttrsWithFunc = f: set1: set2:
180− fold (n: set: if set ? ${n}
180+ foldr (n: set: if set ? ${n}
181181 then setAttr set n (f set.${n} set2.${n})
182182 else set )
183183 (set2 // set1) (attrNames set2);
@@ -196,7 +196,7 @@ rec {
196196 mergeAttrsNoOverride = { mergeLists ? ["buildInputs" "propagatedBuildInputs"],
197197 overrideSnd ? [ "buildPhase" ]
198198 }: attrs1: attrs2:
199− fold (n: set:
199+ foldr (n: set:
200200 setAttr set n ( if set ? ${n}
201201 then # merge
202202 if elem n mergeLists # attribute contains list, merge them by concatenating
@@ -224,7 +224,7 @@ rec {
224224 mergeAttrBy2 = { mergeAttrBy = lib.mergeAttrs; }
225225 // (maybeAttr "mergeAttrBy" {} x)
226226 // (maybeAttr "mergeAttrBy" {} y); in
227− fold lib.mergeAttrs {} [
227+ foldr lib.mergeAttrs {} [
228228 x y
229229 (mapAttrs ( a: v: # merge special names using given functions
230230 if x ? ${a}
lib/fixed-points.nix+5−5
@@ -72,10 +72,10 @@ rec {
7272 # into one where changes made in the first are available in the
7373 # 'super' of the second
7474 composeExtensions =
75− f: g: self: super:
76− let fApplied = f self super;
77− super' = super // fApplied;
78− in fApplied // g self super';
75+ f: g: final: prev:
76+ let fApplied = f final prev;
77+ prev' = prev // fApplied;
78+ in fApplied // g final prev';
7979
8080 # Compose several extending functions of the type expected by 'extends' into
8181 # one where changes made in preceding functions are made available to
@@ -84,7 +84,7 @@ rec {
8484 # composeManyExtensions : [packageSet -> packageSet -> packageSet] -> packageSet -> packageSet -> packageSet
8585 # ^final ^prev ^overrides ^final ^prev ^overrides
8686 composeManyExtensions =
87− lib.foldr (x: y: composeExtensions x y) (self: super: {});
87+ lib.foldr (x: y: composeExtensions x y) (final: prev: {});
8888
8989 # Create an overridable, recursive attribute set. For example:
9090 #
lib/flake.nixnew file+5
@@ -0,0 +1,5 @@
1+{
2+ description = "Library of low-level helper functions for nix expressions.";
3+
4+ outputs = { self }: { lib = import ./.; };
5+}
lib/flakes.nixnew file+22
@@ -0,0 +1,22 @@
1+{ lib }:
2+
3+rec {
4+
5+ /* imports a flake.nix without acknowledging its lock file, useful for
6+ referencing subflakes from a parent flake. The second argument allows
7+ specifying the inputs of this flake.
8+
9+ Example:
10+ callLocklessFlake {
11+ path = ./directoryContainingFlake;
12+ inputs = { inherit nixpkgs; };
13+ }
14+ */
15+ callLocklessFlake = { path, inputs ? { } }:
16+ let
17+ self = { outPath = path; } //
18+ ((import (path + "/flake.nix")).outputs (inputs // { self = self; }));
19+ in
20+ self;
21+
22+}
lib/generators.nix+101−5
@@ -10,7 +10,7 @@
1010 * are mostly generators themselves, called with
1111 * their respective default values; they can be reused.
1212 *
13− * Tests can be found in ./tests.nix
13+ * Tests can be found in ./tests/misc.nix
1414 * Documentation in the manual, #sec-generators
1515 */
1616{ lib }:
@@ -35,6 +35,8 @@ rec {
3535 ("generators.mkValueStringDefault: " +
3636 "${t} not supported: ${toPretty {} v}");
3737 in if isInt v then toString v
38+ # convert derivations to store paths
39+ else if lib.isDerivation v then toString v
3840 # we default to not quoting strings
3941 else if isString v then v
4042 # isString returns "1", which is not a good default
@@ -106,7 +108,7 @@ rec {
106108 * The mk* configuration attributes can generically change
107109 * the way sections and key-value strings are generated.
108110 *
109− * For more examples see the test cases in ./tests.nix.
111+ * For more examples see the test cases in ./tests/misc.nix.
110112 */
111113 toINI = {
112114 # apply transformations (e.g. escapes) to section names
@@ -128,6 +130,51 @@ rec {
128130 # map input to ini sections
129131 mapAttrsToStringsSep "\n" mkSection attrsOfAttrs;
130132
133+ /* Generate an INI-style config file from an attrset
134+ * specifying the global section (no header), and an
135+ * attrset of sections to an attrset of key-value pairs.
136+ *
137+ * generators.toINIWithGlobalSection {} {
138+ * globalSection = {
139+ * someGlobalKey = "hi";
140+ * };
141+ * sections = {
142+ * foo = { hi = "${pkgs.hello}"; ciao = "bar"; };
143+ * baz = { "also, integers" = 42; };
144+ * }
145+ *
146+ *> someGlobalKey=hi
147+ *>
148+ *> [baz]
149+ *> also, integers=42
150+ *>
151+ *> [foo]
152+ *> ciao=bar
153+ *> hi=/nix/store/y93qql1p5ggfnaqjjqhxcw0vqw95rlz0-hello-2.10
154+ *
155+ * The mk* configuration attributes can generically change
156+ * the way sections and key-value strings are generated.
157+ *
158+ * For more examples see the test cases in ./tests/misc.nix.
159+ *
160+ * If you don’t need a global section, you can also use
161+ * `generators.toINI` directly, which only takes
162+ * the part in `sections`.
163+ */
164+ toINIWithGlobalSection = {
165+ # apply transformations (e.g. escapes) to section names
166+ mkSectionName ? (name: libStr.escape [ "[" "]" ] name),
167+ # format a setting line from key and value
168+ mkKeyValue ? mkKeyValueDefault {} "=",
169+ # allow lists as values for duplicate keys
170+ listsAsDuplicateKeys ? false
171+ }: { globalSection, sections }:
172+ ( if globalSection == {}
173+ then ""
174+ else (toKeyValue { inherit mkKeyValue listsAsDuplicateKeys; } globalSection)
175+ + "\n")
176+ + (toINI { inherit mkSectionName mkKeyValue listsAsDuplicateKeys; } sections);
177+
131178 /* Generate a git-config file from an attrset.
132179 *
133180 * It has two major differences from the regular INI format:
@@ -169,7 +216,7 @@ rec {
169216 # converts { a.b.c = 5; } to { "a.b".c = 5; } for toINI
170217 gitFlattenAttrs = let
171218 recurse = path: value:
172− if isAttrs value then
219+ if isAttrs value && !lib.isDerivation value then
173220 lib.mapAttrsToList (name: value: recurse ([ name ] ++ path) value) value
174221 else if length path > 1 then {
175222 ${concatStringsSep "." (lib.reverseList (tail path))}.${head path} = value;
@@ -195,6 +242,30 @@ rec {
195242 */
196243 toYAML = {}@args: toJSON args;
197244
245+ withRecursion =
246+ args@{
247+ /* If this option is not null, the given value will stop evaluating at a certain depth */
248+ depthLimit
249+ /* If this option is true, an error will be thrown, if a certain given depth is exceeded */
250+ , throwOnDepthLimit ? true
251+ }:
252+ assert builtins.isInt depthLimit;
253+ let
254+ transform = depth:
255+ if depthLimit != null && depth > depthLimit then
256+ if throwOnDepthLimit
257+ then throw "Exceeded maximum eval-depth limit of ${toString depthLimit} while trying to evaluate with `generators.withRecursion'!"
258+ else const "<unevaluated>"
259+ else id;
260+ mapAny = with builtins; depth: v:
261+ let
262+ evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
263+ in
264+ if isAttrs v then mapAttrs (const evalNext) v
265+ else if isList v then map evalNext v
266+ else transform (depth + 1) v;
267+ in
268+ mapAny 0;
198269
199270 /* Pretty print a value, akin to `builtins.trace`.
200271 * Should probably be a builtin as well.
@@ -206,7 +277,8 @@ rec {
206277 allowPrettyValues ? false,
207278 /* If this option is true, the output is indented with newlines for attribute sets and lists */
208279 multiline ? true
209− }@args: let
280+ }@args:
281+ let
210282 go = indent: v: with builtins;
211283 let isPath = v: typeOf v == "path";
212284 introSpace = if multiline then "\n${indent} " else " ";
@@ -248,7 +320,7 @@ rec {
248320 then v.__pretty v.val
249321 else if v == {} then "{ }"
250322 else if v ? type && v.type == "derivation" then
251− "<derivation ${v.drvPath}>"
323+ "<derivation ${v.drvPath or "???"}>"
252324 else "{" + introSpace
253325 + libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
254326 (name: value:
@@ -307,4 +379,28 @@ rec {
307379${expr "" v}
308380</plist>'';
309381
382+ /* Translate a simple Nix expression to Dhall notation.
383+ * Note that integers are translated to Integer and never
384+ * the Natural type.
385+ */
386+ toDhall = { }@args: v:
387+ with builtins;
388+ let concatItems = lib.strings.concatStringsSep ", ";
389+ in if isAttrs v then
390+ "{ ${
391+ concatItems (lib.attrsets.mapAttrsToList
392+ (key: value: "${key} = ${toDhall args value}") v)
393+ } }"
394+ else if isList v then
395+ "[ ${concatItems (map (toDhall args) v)} ]"
396+ else if isInt v then
397+ "${if v < 0 then "" else "+"}${toString v}"
398+ else if isBool v then
399+ (if v then "True" else "False")
400+ else if isFunction v then
401+ abort "generators.toDhall: cannot convert a function to Dhall"
402+ else if isNull v then
403+ abort "generators.toDhall: cannot convert a null to Dhall"
404+ else
405+ builtins.toJSON v;
310406}
lib/licenses.nix+218−139
@@ -1,44 +1,56 @@
11{ lib }:
2−let
32
4− spdx = lic: lic // {
5− url = "https://spdx.org/licenses/${lic.spdxId}.html";
6− };
7−
8−in
9−
10−lib.mapAttrs (n: v: v // { shortName = n; }) ({
3+lib.mapAttrs (lname: lset: let
4+ defaultLicense = rec {
5+ shortName = lname;
6+ free = true; # Most of our licenses are Free, explicitly declare unfree additions as such!
7+ deprecated = false;
8+ };
9+
10+ mkLicense = licenseDeclaration: let
11+ applyDefaults = license: defaultLicense // license;
12+ applySpdx = license:
13+ if license ? spdxId
14+ then license // { url = "https://spdx.org/licenses/${license.spdxId}.html"; }
15+ else license;
16+ applyRedistributable = license: { redistributable = license.free; } // license;
17+ in lib.pipe licenseDeclaration [
18+ applyDefaults
19+ applySpdx
20+ applyRedistributable
21+ ];
22+in mkLicense lset) ({
1123 /* License identifiers from spdx.org where possible.
1224 * If you cannot find your license here, then look for a similar license or
1325 * add it to this list. The URL mentioned above is a good source for inspiration.
1426 */
1527
16− abstyles = spdx {
28+ abstyles = {
1729 spdxId = "Abstyles";
1830 fullName = "Abstyles License";
1931 };
2032
21− afl20 = spdx {
33+ afl20 = {
2234 spdxId = "AFL-2.0";
2335 fullName = "Academic Free License v2.0";
2436 };
2537
26− afl21 = spdx {
38+ afl21 = {
2739 spdxId = "AFL-2.1";
2840 fullName = "Academic Free License v2.1";
2941 };
3042
31− afl3 = spdx {
43+ afl3 = {
3244 spdxId = "AFL-3.0";
3345 fullName = "Academic Free License v3.0";
3446 };
3547
36− agpl3Only = spdx {
48+ agpl3Only = {
3749 spdxId = "AGPL-3.0-only";
3850 fullName = "GNU Affero General Public License v3.0 only";
3951 };
4052
41− agpl3Plus = spdx {
53+ agpl3Plus = {
4254 spdxId = "AGPL-3.0-or-later";
4355 fullName = "GNU Affero General Public License v3.0 or later";
4456 };
@@ -55,7 +67,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
5567 free = false;
5668 };
5769
58− apsl20 = spdx {
70+ aom = {
71+ fullName = "Alliance for Open Media Patent License 1.0";
72+ url = "https://aomedia.org/license/patent-license/";
73+ };
74+
75+ apsl20 = {
5976 spdxId = "APSL-2.0";
6077 fullName = "Apple Public Source License 2.0";
6178 };
@@ -65,67 +82,72 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
6582 url = "https://www.freedesktop.org/wiki/Arphic_Public_License/";
6683 };
6784
68− artistic1 = spdx {
85+ artistic1 = {
6986 spdxId = "Artistic-1.0";
7087 fullName = "Artistic License 1.0";
7188 };
7289
73− artistic2 = spdx {
90+ artistic2 = {
7491 spdxId = "Artistic-2.0";
7592 fullName = "Artistic License 2.0";
7693 };
7794
78− asl20 = spdx {
95+ asl20 = {
7996 spdxId = "Apache-2.0";
8097 fullName = "Apache License 2.0";
8198 };
8299
83− boost = spdx {
100+ boost = {
84101 spdxId = "BSL-1.0";
85102 fullName = "Boost Software License 1.0";
86103 };
87104
88− beerware = spdx {
105+ beerware = {
89106 spdxId = "Beerware";
90107 fullName = "Beerware License";
91108 };
92109
93− blueOak100 = spdx {
110+ blueOak100 = {
94111 spdxId = "BlueOak-1.0.0";
95112 fullName = "Blue Oak Model License 1.0.0";
96113 };
97114
98− bsd0 = spdx {
115+ bsd0 = {
99116 spdxId = "0BSD";
100117 fullName = "BSD Zero Clause License";
101118 };
102119
103− bsd1 = spdx {
120+ bsd1 = {
104121 spdxId = "BSD-1-Clause";
105122 fullName = "BSD 1-Clause License";
106123 };
107124
108− bsd2 = spdx {
125+ bsd2 = {
109126 spdxId = "BSD-2-Clause";
110127 fullName = ''BSD 2-clause "Simplified" License'';
111128 };
112129
113− bsd2Patent = spdx {
130+ bsd2Patent = {
114131 spdxId = "BSD-2-Clause-Patent";
115132 fullName = "BSD-2-Clause Plus Patent License";
116133 };
117134
118− bsd3 = spdx {
135+ bsd3 = {
119136 spdxId = "BSD-3-Clause";
120137 fullName = ''BSD 3-clause "New" or "Revised" License'';
121138 };
122139
123− bsdOriginal = spdx {
140+ bsdOriginal = {
124141 spdxId = "BSD-4-Clause";
125142 fullName = ''BSD 4-clause "Original" or "Old" License'';
126143 };
127144
128− bsdProtection = spdx {
145+ bsdOriginalUC = {
146+ spdxId = "BSD-4-Clause-UC";
147+ fullName = "BSD 4-Clause University of California-Specific";
148+ };
149+
150+ bsdProtection = {
129151 spdxId = "BSD-Protection";
130152 fullName = "BSD Protection License";
131153 };
@@ -136,119 +158,129 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
136158 free = false;
137159 };
138160
139− clArtistic = spdx {
161+ capec = {
162+ fullName = "Common Attack Pattern Enumeration and Classification";
163+ url = "https://capec.mitre.org/about/termsofuse.html";
164+ };
165+
166+ clArtistic = {
140167 spdxId = "ClArtistic";
141168 fullName = "Clarified Artistic License";
142169 };
143170
144− cc0 = spdx {
171+ cc0 = {
145172 spdxId = "CC0-1.0";
146173 fullName = "Creative Commons Zero v1.0 Universal";
147174 };
148175
149− cc-by-nc-sa-20 = spdx {
176+ cc-by-nc-sa-20 = {
150177 spdxId = "CC-BY-NC-SA-2.0";
151178 fullName = "Creative Commons Attribution Non Commercial Share Alike 2.0";
152179 free = false;
153180 };
154181
155− cc-by-nc-sa-25 = spdx {
182+ cc-by-nc-sa-25 = {
156183 spdxId = "CC-BY-NC-SA-2.5";
157184 fullName = "Creative Commons Attribution Non Commercial Share Alike 2.5";
158185 free = false;
159186 };
160187
161− cc-by-nc-sa-30 = spdx {
188+ cc-by-nc-sa-30 = {
162189 spdxId = "CC-BY-NC-SA-3.0";
163190 fullName = "Creative Commons Attribution Non Commercial Share Alike 3.0";
164191 free = false;
165192 };
166193
167− cc-by-nc-sa-40 = spdx {
194+ cc-by-nc-sa-40 = {
168195 spdxId = "CC-BY-NC-SA-4.0";
169196 fullName = "Creative Commons Attribution Non Commercial Share Alike 4.0";
170197 free = false;
171198 };
172199
173− cc-by-nc-30 = spdx {
200+ cc-by-nc-30 = {
174201 spdxId = "CC-BY-NC-3.0";
175202 fullName = "Creative Commons Attribution Non Commercial 3.0 Unported";
176203 free = false;
177204 };
178205
179− cc-by-nc-40 = spdx {
206+ cc-by-nc-40 = {
180207 spdxId = "CC-BY-NC-4.0";
181208 fullName = "Creative Commons Attribution Non Commercial 4.0 International";
182209 free = false;
183210 };
184211
185− cc-by-nd-30 = spdx {
212+ cc-by-nd-30 = {
186213 spdxId = "CC-BY-ND-3.0";
187214 fullName = "Creative Commons Attribution-No Derivative Works v3.00";
188215 free = false;
189216 };
190217
191− cc-by-sa-25 = spdx {
218+ cc-by-sa-25 = {
192219 spdxId = "CC-BY-SA-2.5";
193220 fullName = "Creative Commons Attribution Share Alike 2.5";
194221 };
195222
196− cc-by-30 = spdx {
223+ cc-by-30 = {
197224 spdxId = "CC-BY-3.0";
198225 fullName = "Creative Commons Attribution 3.0";
199226 };
200227
201− cc-by-sa-30 = spdx {
228+ cc-by-sa-30 = {
202229 spdxId = "CC-BY-SA-3.0";
203230 fullName = "Creative Commons Attribution Share Alike 3.0";
204231 };
205232
206− cc-by-40 = spdx {
233+ cc-by-40 = {
207234 spdxId = "CC-BY-4.0";
208235 fullName = "Creative Commons Attribution 4.0";
209236 };
210237
211− cc-by-sa-40 = spdx {
238+ cc-by-sa-40 = {
212239 spdxId = "CC-BY-SA-4.0";
213240 fullName = "Creative Commons Attribution Share Alike 4.0";
214241 };
215242
216− cddl = spdx {
243+ cddl = {
217244 spdxId = "CDDL-1.0";
218245 fullName = "Common Development and Distribution License 1.0";
219246 };
220247
221− cecill20 = spdx {
248+ cecill20 = {
222249 spdxId = "CECILL-2.0";
223250 fullName = "CeCILL Free Software License Agreement v2.0";
224251 };
225252
226− cecill-b = spdx {
253+ cecill21 = {
254+ spdxId = "CECILL-2.1";
255+ fullName = "CeCILL Free Software License Agreement v2.1";
256+ };
257+
258+ cecill-b = {
227259 spdxId = "CECILL-B";
228260 fullName = "CeCILL-B Free Software License Agreement";
229261 };
230262
231− cecill-c = spdx {
263+ cecill-c = {
232264 spdxId = "CECILL-C";
233265 fullName = "CeCILL-C Free Software License Agreement";
234266 };
235267
236− cpal10 = spdx {
268+ cpal10 = {
237269 spdxId = "CPAL-1.0";
238270 fullName = "Common Public Attribution License 1.0";
239271 };
240272
241− cpl10 = spdx {
273+ cpl10 = {
242274 spdxId = "CPL-1.0";
243275 fullName = "Common Public License 1.0";
244276 };
245277
246− curl = spdx {
278+ curl = {
247279 spdxId = "curl";
248280 fullName = "curl License";
249281 };
250282
251− doc = spdx {
283+ doc = {
252284 spdxId = "DOC";
253285 fullName = "DOC License";
254286 };
@@ -259,12 +291,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
259291 free = false;
260292 };
261293
262− efl10 = spdx {
294+ efl10 = {
263295 spdxId = "EFL-1.0";
264296 fullName = "Eiffel Forum License v1.0";
265297 };
266298
267− efl20 = spdx {
299+ efl20 = {
268300 spdxId = "EFL-2.0";
269301 fullName = "Eiffel Forum License v2.0";
270302 };
@@ -275,12 +307,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
275307 free = false;
276308 };
277309
278− epl10 = spdx {
310+ epl10 = {
279311 spdxId = "EPL-1.0";
280312 fullName = "Eclipse Public License 1.0";
281313 };
282314
283− epl20 = spdx {
315+ epl20 = {
284316 spdxId = "EPL-2.0";
285317 fullName = "Eclipse Public License 2.0";
286318 };
@@ -291,42 +323,42 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
291323 free = false;
292324 };
293325
294− eupl11 = spdx {
326+ eupl11 = {
295327 spdxId = "EUPL-1.1";
296328 fullName = "European Union Public License 1.1";
297329 };
298330
299− eupl12 = spdx {
331+ eupl12 = {
300332 spdxId = "EUPL-1.2";
301333 fullName = "European Union Public License 1.2";
302334 };
303335
304− fdl11Only = spdx {
336+ fdl11Only = {
305337 spdxId = "GFDL-1.1-only";
306338 fullName = "GNU Free Documentation License v1.1 only";
307339 };
308340
309− fdl11Plus = spdx {
341+ fdl11Plus = {
310342 spdxId = "GFDL-1.1-or-later";
311343 fullName = "GNU Free Documentation License v1.1 or later";
312344 };
313345
314− fdl12Only = spdx {
346+ fdl12Only = {
315347 spdxId = "GFDL-1.2-only";
316348 fullName = "GNU Free Documentation License v1.2 only";
317349 };
318350
319− fdl12Plus = spdx {
351+ fdl12Plus = {
320352 spdxId = "GFDL-1.2-or-later";
321353 fullName = "GNU Free Documentation License v1.2 or later";
322354 };
323355
324− fdl13Only = spdx {
356+ fdl13Only = {
325357 spdxId = "GFDL-1.3-only";
326358 fullName = "GNU Free Documentation License v1.3 only";
327359 };
328360
329− fdl13Plus = spdx {
361+ fdl13Plus = {
330362 spdxId = "GFDL-1.3-or-later";
331363 fullName = "GNU Free Documentation License v1.3 or later";
332364 };
@@ -341,6 +373,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
341373 fullName = "Unspecified free software license";
342374 };
343375
376+ ftl = {
377+ spdxId = "FTL";
378+ fullName = "Freetype Project License";
379+ };
380+
344381 g4sl = {
345382 fullName = "Geant4 Software License";
346383 url = "https://geant4.web.cern.ch/geant4/license/LICENSE.html";
@@ -352,22 +389,27 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
352389 free = false;
353390 };
354391
355− gpl1Only = spdx {
392+ generaluser = {
393+ fullName = "GeneralUser GS License v2.0";
394+ url = "http://www.schristiancollins.com/generaluser.php"; # license included in sources
395+ };
396+
397+ gpl1Only = {
356398 spdxId = "GPL-1.0-only";
357399 fullName = "GNU General Public License v1.0 only";
358400 };
359401
360− gpl1Plus = spdx {
402+ gpl1Plus = {
361403 spdxId = "GPL-1.0-or-later";
362404 fullName = "GNU General Public License v1.0 or later";
363405 };
364406
365− gpl2Only = spdx {
407+ gpl2Only = {
366408 spdxId = "GPL-2.0-only";
367409 fullName = "GNU General Public License v2.0 only";
368410 };
369411
370− gpl2Classpath = spdx {
412+ gpl2Classpath = {
371413 spdxId = "GPL-2.0-with-classpath-exception";
372414 fullName = "GNU General Public License v2.0 only (with Classpath exception)";
373415 };
@@ -382,17 +424,17 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
382424 url = "https://www.mysql.com/about/legal/licensing/foss-exception";
383425 };
384426
385− gpl2Plus = spdx {
427+ gpl2Plus = {
386428 spdxId = "GPL-2.0-or-later";
387429 fullName = "GNU General Public License v2.0 or later";
388430 };
389431
390− gpl3Only = spdx {
432+ gpl3Only = {
391433 spdxId = "GPL-3.0-only";
392434 fullName = "GNU General Public License v3.0 only";
393435 };
394436
395− gpl3Plus = spdx {
437+ gpl3Plus = {
396438 spdxId = "GPL-3.0-or-later";
397439 fullName = "GNU General Public License v3.0 or later";
398440 };
@@ -402,12 +444,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
402444 url = "https://fedoraproject.org/wiki/Licensing/GPL_Classpath_Exception";
403445 };
404446
405− hpnd = spdx {
447+ hpnd = {
406448 spdxId = "HPND";
407449 fullName = "Historic Permission Notice and Disclaimer";
408450 };
409451
410− hpndSellVariant = spdx {
452+ hpndSellVariant = {
411453 fullName = "Historical Permission Notice and Disclaimer - sell variant";
412454 spdxId = "HPND-sell-variant";
413455 };
@@ -418,39 +460,44 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
418460 url = "https://old.calculate-linux.org/packages/licenses/iASL";
419461 };
420462
421− ijg = spdx {
463+ ijg = {
422464 spdxId = "IJG";
423465 fullName = "Independent JPEG Group License";
424466 };
425467
426− imagemagick = spdx {
468+ imagemagick = {
427469 fullName = "ImageMagick License";
428470 spdxId = "imagemagick";
429471 };
430472
473+ imlib2 = {
474+ spdxId = "Imlib2";
475+ fullName = "Imlib2 License";
476+ };
477+
431478 inria-compcert = {
432479 fullName = "INRIA Non-Commercial License Agreement for the CompCert verified compiler";
433− url = "http://compcert.inria.fr/doc/LICENSE"; # https is broken
480+ url = "https://compcert.org/doc/LICENSE.txt";
434481 free = false;
435482 };
436483
437484 inria-icesl = {
438485 fullName = "INRIA Non-Commercial License Agreement for IceSL";
439− url = "http://shapeforge.loria.fr/icesl/EULA_IceSL_binary.pdf"; # https is broken
486+ url = "https://icesl.loria.fr/assets/pdf/EULA_IceSL_binary.pdf";
440487 free = false;
441488 };
442489
443− ipa = spdx {
490+ ipa = {
444491 spdxId = "IPA";
445492 fullName = "IPA Font License";
446493 };
447494
448− ipl10 = spdx {
495+ ipl10 = {
449496 spdxId = "IPL-1.0";
450497 fullName = "IBM Public License v1.0";
451498 };
452499
453− isc = spdx {
500+ isc = {
454501 spdxId = "ISC";
455502 fullName = "ISC License";
456503 };
@@ -468,52 +515,52 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
468515 free = false;
469516 };
470517
471− lgpl2Only = spdx {
518+ lgpl2Only = {
472519 spdxId = "LGPL-2.0-only";
473520 fullName = "GNU Library General Public License v2 only";
474521 };
475522
476− lgpl2Plus = spdx {
523+ lgpl2Plus = {
477524 spdxId = "LGPL-2.0-or-later";
478525 fullName = "GNU Library General Public License v2 or later";
479526 };
480527
481− lgpl21Only = spdx {
528+ lgpl21Only = {
482529 spdxId = "LGPL-2.1-only";
483530 fullName = "GNU Lesser General Public License v2.1 only";
484531 };
485532
486− lgpl21Plus = spdx {
533+ lgpl21Plus = {
487534 spdxId = "LGPL-2.1-or-later";
488535 fullName = "GNU Lesser General Public License v2.1 or later";
489536 };
490537
491− lgpl3Only = spdx {
538+ lgpl3Only = {
492539 spdxId = "LGPL-3.0-only";
493540 fullName = "GNU Lesser General Public License v3.0 only";
494541 };
495542
496− lgpl3Plus = spdx {
543+ lgpl3Plus = {
497544 spdxId = "LGPL-3.0-or-later";
498545 fullName = "GNU Lesser General Public License v3.0 or later";
499546 };
500547
501− lgpllr = spdx {
548+ lgpllr = {
502549 spdxId = "LGPLLR";
503550 fullName = "Lesser General Public License For Linguistic Resources";
504551 };
505552
506− libpng = spdx {
553+ libpng = {
507554 spdxId = "Libpng";
508555 fullName = "libpng License";
509556 };
510557
511− libpng2 = spdx {
558+ libpng2 = {
512559 spdxId = "libpng-2.0"; # Used since libpng 1.6.36.
513560 fullName = "PNG Reference Library version 2";
514561 };
515562
516− libtiff = spdx {
563+ libtiff = {
517564 spdxId = "libtiff";
518565 fullName = "libtiff License";
519566 };
@@ -523,22 +570,22 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
523570 url = "https://opensource.franz.com/preamble.html";
524571 };
525572
526− llvm-exception = spdx {
573+ llvm-exception = {
527574 spdxId = "LLVM-exception";
528575 fullName = "LLVM Exception"; # LLVM exceptions to the Apache 2.0 License
529576 };
530577
531− lppl12 = spdx {
578+ lppl12 = {
532579 spdxId = "LPPL-1.2";
533580 fullName = "LaTeX Project Public License v1.2";
534581 };
535582
536− lppl13c = spdx {
583+ lppl13c = {
537584 spdxId = "LPPL-1.3c";
538585 fullName = "LaTeX Project Public License v1.3c";
539586 };
540587
541− lpl-102 = spdx {
588+ lpl-102 = {
542589 spdxId = "LPL-1.02";
543590 fullName = "Lucent Public License v1.02";
544591 };
@@ -550,43 +597,58 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
550597
551598 # spdx.org does not (yet) differentiate between the X11 and Expat versions
552599 # for details see https://en.wikipedia.org/wiki/MIT_License#Various_versions
553− mit = spdx {
600+ mit = {
554601 spdxId = "MIT";
555602 fullName = "MIT License";
556603 };
604+ # https://spdx.org/licenses/MIT-feh.html
605+ mit-feh = {
606+ spdxId = "MIT-feh";
607+ fullName = "feh License";
608+ };
609+
610+ mitAdvertising = {
611+ spdxId = "MIT-advertising";
612+ fullName = "Enlightenment License (e16)";
613+ };
557614
558− mpl10 = spdx {
615+ mit0 = {
616+ spdxId = "MIT-0";
617+ fullName = "MIT No Attribution";
618+ };
619+
620+ mpl10 = {
559621 spdxId = "MPL-1.0";
560622 fullName = "Mozilla Public License 1.0";
561623 };
562624
563− mpl11 = spdx {
625+ mpl11 = {
564626 spdxId = "MPL-1.1";
565627 fullName = "Mozilla Public License 1.1";
566628 };
567629
568− mpl20 = spdx {
630+ mpl20 = {
569631 spdxId = "MPL-2.0";
570632 fullName = "Mozilla Public License 2.0";
571633 };
572634
573− mspl = spdx {
635+ mspl = {
574636 spdxId = "MS-PL";
575637 fullName = "Microsoft Public License";
576638 };
577639
578− nasa13 = spdx {
640+ nasa13 = {
579641 spdxId = "NASA-1.3";
580642 fullName = "NASA Open Source Agreement 1.3";
581643 free = false;
582644 };
583645
584− ncsa = spdx {
646+ ncsa = {
585647 spdxId = "NCSA";
586648 fullName = "University of Illinois/NCSA Open Source License";
587649 };
588650
589− nposl3 = spdx {
651+ nposl3 = {
590652 spdxId = "NPOSL-3.0";
591653 fullName = "Non-Profit Open Software License 3.0";
592654 };
@@ -603,53 +665,53 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
603665 free = false;
604666 };
605667
606− odbl = spdx {
668+ odbl = {
607669 spdxId = "ODbL-1.0";
608670 fullName = "Open Data Commons Open Database License v1.0";
609671 };
610672
611− ofl = spdx {
673+ ofl = {
612674 spdxId = "OFL-1.1";
613675 fullName = "SIL Open Font License 1.1";
614676 };
615677
616− openldap = spdx {
678+ openldap = {
617679 spdxId = "OLDAP-2.8";
618680 fullName = "Open LDAP Public License v2.8";
619681 };
620682
621− openssl = spdx {
683+ openssl = {
622684 spdxId = "OpenSSL";
623685 fullName = "OpenSSL License";
624686 };
625687
626− osl2 = spdx {
688+ osl2 = {
627689 spdxId = "OSL-2.0";
628690 fullName = "Open Software License 2.0";
629691 };
630692
631− osl21 = spdx {
693+ osl21 = {
632694 spdxId = "OSL-2.1";
633695 fullName = "Open Software License 2.1";
634696 };
635697
636− osl3 = spdx {
698+ osl3 = {
637699 spdxId = "OSL-3.0";
638700 fullName = "Open Software License 3.0";
639701 };
640702
641− parity70 = spdx {
703+ parity70 = {
642704 spdxId = "Parity-7.0.0";
643705 fullName = "Parity Public License 7.0.0";
644706 url = "https://paritylicense.com/versions/7.0.0.html";
645707 };
646708
647− php301 = spdx {
709+ php301 = {
648710 spdxId = "PHP-3.01";
649711 fullName = "PHP License v3.01";
650712 };
651713
652− postgresql = spdx {
714+ postgresql = {
653715 spdxId = "PostgreSQL";
654716 fullName = "PostgreSQL License";
655717 };
@@ -660,7 +722,7 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
660722 free = false;
661723 };
662724
663− psfl = spdx {
725+ psfl = {
664726 spdxId = "Python-2.0";
665727 fullName = "Python Software Foundation License version 2";
666728 url = "https://docs.python.org/license.html";
@@ -681,12 +743,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
681743 url = "https://prosperitylicense.com/versions/3.0.0.html";
682744 };
683745
684− qhull = spdx {
746+ qhull = {
685747 spdxId = "Qhull";
686748 fullName = "Qhull License";
687749 };
688750
689− qpl = spdx {
751+ qpl = {
690752 spdxId = "QPL-1.0";
691753 fullName = "Q Public License 1.0";
692754 };
@@ -696,22 +758,22 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
696758 url = "https://qwt.sourceforge.io/qwtlicense.html";
697759 };
698760
699− ruby = spdx {
761+ ruby = {
700762 spdxId = "Ruby";
701763 fullName = "Ruby License";
702764 };
703765
704− sendmail = spdx {
766+ sendmail = {
705767 spdxId = "Sendmail";
706768 fullName = "Sendmail License";
707769 };
708770
709− sgi-b-20 = spdx {
771+ sgi-b-20 = {
710772 spdxId = "SGI-B-2.0";
711773 fullName = "SGI Free Software License B v2.0";
712774 };
713775
714− sleepycat = spdx {
776+ sleepycat = {
715777 spdxId = "Sleepycat";
716778 fullName = "Sleepycat License";
717779 };
@@ -727,9 +789,19 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
727789 fullName = "Server Side Public License";
728790 url = "https://www.mongodb.com/licensing/server-side-public-license";
729791 free = false;
792+ # NOTE Debatable.
793+ # The license a slightly modified AGPL but still considered unfree by the
794+ # OSI for what seem like political reasons
795+ redistributable = true; # Definitely redistributable though, it's an AGPL derivative
796+ };
797+
798+ stk = {
799+ shortName = "stk";
800+ fullName = "Synthesis Tool Kit 4.3";
801+ url = "https://github.com/thestk/stk/blob/master/LICENSE";
730802 };
731803
732− tcltk = spdx {
804+ tcltk = {
733805 spdxId = "TCL";
734806 fullName = "TCL/TK License";
735807 };
@@ -747,20 +819,27 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
747819 unfreeRedistributable = {
748820 fullName = "Unfree redistributable";
749821 free = false;
822+ redistributable = true;
750823 };
751824
752825 unfreeRedistributableFirmware = {
753826 fullName = "Unfree redistributable firmware";
827+ redistributable = true;
754828 # Note: we currently consider these "free" for inclusion in the
755829 # channel and NixOS images.
756830 };
757831
758− unicode-dfs-2016 = spdx {
832+ unicode-dfs-2015 = {
833+ spdxId = "Unicode-DFS-2015";
834+ fullName = "Unicode License Agreement - Data Files and Software (2015)";
835+ };
836+
837+ unicode-dfs-2016 = {
759838 spdxId = "Unicode-DFS-2016";
760839 fullName = "Unicode License Agreement - Data Files and Software (2016)";
761840 };
762841
763− unlicense = spdx {
842+ unlicense = {
764843 spdxId = "Unlicense";
765844 fullName = "The Unlicense";
766845 };
@@ -770,7 +849,7 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
770849 url = "https://oss.oracle.com/licenses/upl/";
771850 };
772851
773− vim = spdx {
852+ vim = {
774853 spdxId = "Vim";
775854 fullName = "Vim License";
776855 };
@@ -781,17 +860,17 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
781860 free = false;
782861 };
783862
784− vsl10 = spdx {
863+ vsl10 = {
785864 spdxId = "VSL-1.0";
786865 fullName = "Vovida Software License v1.0";
787866 };
788867
789− watcom = spdx {
868+ watcom = {
790869 spdxId = "Watcom-1.0";
791870 fullName = "Sybase Open Watcom Public License 1.0";
792871 };
793872
794− w3c = spdx {
873+ w3c = {
795874 spdxId = "W3C";
796875 fullName = "W3C Software Notice and License";
797876 };
@@ -801,12 +880,12 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
801880 url = "https://fedoraproject.org/wiki/Licensing:Wadalab?rd=Licensing/Wadalab";
802881 };
803882
804− wtfpl = spdx {
883+ wtfpl = {
805884 spdxId = "WTFPL";
806885 fullName = "Do What The F*ck You Want To Public License";
807886 };
808887
809− wxWindows = spdx {
888+ wxWindows = {
810889 spdxId = "wxWindows";
811890 fullName = "wxWindows Library Licence, Version 3.1";
812891 };
@@ -816,68 +895,68 @@ lib.mapAttrs (n: v: v // { shortName = n; }) ({
816895 url = "http://mcj.sourceforge.net/authors.html#xfig"; # https is broken
817896 };
818897
819− zlib = spdx {
898+ zlib = {
820899 spdxId = "Zlib";
821900 fullName = "zlib License";
822901 };
823902
824− zpl20 = spdx {
903+ zpl20 = {
825904 spdxId = "ZPL-2.0";
826905 fullName = "Zope Public License 2.0";
827906 };
828907
829− zpl21 = spdx {
908+ zpl21 = {
830909 spdxId = "ZPL-2.1";
831910 fullName = "Zope Public License 2.1";
832911 };
833912} // {
834913 # TODO: remove legacy aliases
835− agpl3 = spdx {
914+ agpl3 = {
836915 spdxId = "AGPL-3.0";
837916 fullName = "GNU Affero General Public License v3.0";
838917 deprecated = true;
839918 };
840− fdl11 = spdx {
919+ fdl11 = {
841920 spdxId = "GFDL-1.1";
842921 fullName = "GNU Free Documentation License v1.1";
843922 deprecated = true;
844923 };
845− fdl12 = spdx {
924+ fdl12 = {
846925 spdxId = "GFDL-1.2";
847926 fullName = "GNU Free Documentation License v1.2";
848927 deprecated = true;
849928 };
850− fdl13 = spdx {
929+ fdl13 = {
851930 spdxId = "GFDL-1.3";
852931 fullName = "GNU Free Documentation License v1.3";
853932 deprecated = true;
854933 };
855− gpl1 = spdx {
934+ gpl1 = {
856935 spdxId = "GPL-1.0";
857936 fullName = "GNU General Public License v1.0";
858937 deprecated = true;
859938 };
860− gpl2 = spdx {
939+ gpl2 = {
861940 spdxId = "GPL-2.0";
862941 fullName = "GNU General Public License v2.0";
863942 deprecated = true;
864943 };
865− gpl3 = spdx {
944+ gpl3 = {
866945 spdxId = "GPL-3.0";
867946 fullName = "GNU General Public License v3.0";
868947 deprecated = true;
869948 };
870− lgpl2 = spdx {
949+ lgpl2 = {
871950 spdxId = "LGPL-2.0";
872951 fullName = "GNU Library General Public License v2";
873952 deprecated = true;
874953 };
875− lgpl21 = spdx {
954+ lgpl21 = {
876955 spdxId = "LGPL-2.1";
877956 fullName = "GNU Lesser General Public License v2.1";
878957 deprecated = true;
879958 };
880− lgpl3 = spdx {
959+ lgpl3 = {
881960 spdxId = "LGPL-3.0";
882961 fullName = "GNU Lesser General Public License v3.0";
883962 deprecated = true;
lib/lists.nix+11−13
@@ -4,6 +4,7 @@
44let
55 inherit (lib.strings) toInt;
66 inherit (lib.trivial) compare min;
7+ inherit (lib.attrsets) mapAttrs;
78in
89rec {
910
@@ -340,15 +341,15 @@ rec {
340341 groupBy' builtins.add 0 (x: boolToString (x > 2)) [ 5 1 2 3 4 ]
341342 => { true = 12; false = 3; }
342343 */
343− groupBy' = op: nul: pred: lst:
344− foldl' (r: e:
345− let
346− key = pred e;
347− in
348− r // { ${key} = op (r.${key} or nul) e; }
349− ) {} lst;
344+ groupBy' = op: nul: pred: lst: mapAttrs (name: foldl op nul) (groupBy pred lst);
350345
351− groupBy = groupBy' (sum: e: sum ++ [e]) [];
346+ groupBy = builtins.groupBy or (
347+ pred: foldl' (r: e:
348+ let
349+ key = pred e;
350+ in
351+ r // { ${key} = (r.${key} or []) ++ [e]; }
352+ ) {});
352353
353354 /* Merges two lists of the same size together. If the sizes aren't the same
354355 the merging stops at the shortest. How both lists are merged is defined
@@ -642,7 +643,7 @@ rec {
642643 unique [ 3 2 3 4 ]
643644 => [ 3 2 4 ]
644645 */
645− unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
646+ unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
646647
647648 /* Intersects list 'e' and another list. O(nm) complexity.
648649
@@ -663,9 +664,6 @@ rec {
663664 /* Test if two lists have no common element.
664665 It should be slightly more efficient than (intersectLists a b == [])
665666 */
666− mutuallyExclusive = a: b:
667− (builtins.length a) == 0 ||
668− (!(builtins.elem (builtins.head a) b) &&
669− mutuallyExclusive (builtins.tail a) b);
667+ mutuallyExclusive = a: b: length a == 0 || !(any (x: elem x a) b);
670668
671669}
lib/meta.nix+54−1
@@ -78,7 +78,7 @@ rec {
7878
7979 2. (modern) a pattern for the platform `parsed` field.
8080
81− We can inject these into a patten for the whole of a structured platform,
81+ We can inject these into a pattern for the whole of a structured platform,
8282 and then match that.
8383 */
8484 platformMatch = platform: elem: let
@@ -87,4 +87,57 @@ rec {
8787 then { system = elem; }
8888 else { parsed = elem; };
8989 in lib.matchAttrs pattern platform;
90+
91+ /* Check if a package is available on a given platform.
92+
93+ A package is available on a platform if both
94+
95+ 1. One of `meta.platforms` pattern matches the given platform.
96+
97+ 2. None of `meta.badPlatforms` pattern matches the given platform.
98+ */
99+ availableOn = platform: pkg:
100+ lib.any (platformMatch platform) pkg.meta.platforms &&
101+ lib.all (elem: !platformMatch platform elem) (pkg.meta.badPlatforms or []);
102+
103+ /* Get the corresponding attribute in lib.licenses
104+ from the SPDX ID.
105+ For SPDX IDs, see
106+ https://spdx.org/licenses
107+
108+ Type:
109+ getLicenseFromSpdxId :: str -> AttrSet
110+
111+ Example:
112+ lib.getLicenseFromSpdxId "MIT" == lib.licenses.mit
113+ => true
114+ lib.getLicenseFromSpdxId "mIt" == lib.licenses.mit
115+ => true
116+ lib.getLicenseFromSpdxId "MY LICENSE"
117+ => trace: warning: getLicenseFromSpdxId: No license matches the given SPDX ID: MY LICENSE
118+ => { shortName = "MY LICENSE"; }
119+ */
120+ getLicenseFromSpdxId =
121+ let
122+ spdxLicenses = lib.mapAttrs (id: ls: assert lib.length ls == 1; builtins.head ls)
123+ (lib.groupBy (l: lib.toLower l.spdxId) (lib.filter (l: l ? spdxId) (lib.attrValues lib.licenses)));
124+ in licstr:
125+ spdxLicenses.${ lib.toLower licstr } or (
126+ lib.warn "getLicenseFromSpdxId: No license matches the given SPDX ID: ${licstr}"
127+ { shortName = licstr; }
128+ );
129+
130+ /* Get the path to the main program of a derivation with either
131+ meta.mainProgram or pname or name
132+
133+ Type: getExe :: derivation -> string
134+
135+ Example:
136+ getExe pkgs.hello
137+ => "/nix/store/g124820p9hlv4lj8qplzxw1c44dxaw1k-hello-2.12/bin/hello"
138+ getExe pkgs.mustache-go
139+ => "/nix/store/am9ml4f4ywvivxnkiaqwr0hyxka1xjsf-mustache-go-1.3.0/bin/mustache"
140+ */
141+ getExe = x:
142+ "${lib.getBin x}/bin/${x.meta.mainProgram or (lib.getName x)}";
90143}
lib/modules.nix+362−100
@@ -9,12 +9,10 @@ let
99 catAttrs
1010 concatLists
1111 concatMap
12− count
12+ concatStringsSep
1313 elem
1414 filter
1515 findFirst
16− flip
17− foldl
1816 foldl'
1917 getAttrFromPath
2018 head
@@ -23,6 +21,7 @@ let
2321 isAttrs
2422 isBool
2523 isFunction
24+ isList
2625 isString
2726 length
2827 mapAttrs
@@ -37,7 +36,8 @@ let
3736 setAttrByPath
3837 toList
3938 types
40− warn
39+ warnIf
40+ zipAttrsWith
4141 ;
4242 inherit (lib.options)
4343 isOption
@@ -46,20 +46,63 @@ let
4646 showFiles
4747 showOption
4848 unknownModule
49+ literalExpression
4950 ;
51+
52+ showDeclPrefix = loc: decl: prefix:
53+ " - option(s) with prefix `${showOption (loc ++ [prefix])}' in module `${decl._file}'";
54+ showRawDecls = loc: decls:
55+ concatStringsSep "\n"
56+ (sort (a: b: a < b)
57+ (concatMap
58+ (decl: map
59+ (showDeclPrefix loc decl)
60+ (attrNames decl.options)
61+ )
62+ decls
63+ ));
64+
5065in
5166
5267rec {
5368
54− /* Evaluate a set of modules. The result is a set of two
55− attributes: ‘options’: the nested set of all option declarations,
56− and ‘config’: the nested set of all option values.
69+ /*
70+ Evaluate a set of modules. The result is a set with the attributes:
71+
72+ ‘options’: The nested set of all option declarations,
73+
74+ ‘config’: The nested set of all option values.
75+
76+ ‘type’: A module system type representing the module set as a submodule,
77+ to be extended by configuration from the containing module set.
78+
79+ This is also available as the module argument ‘moduleType’.
80+
81+ ‘extendModules’: A function similar to ‘evalModules’ but building on top
82+ of the module set. Its arguments, ‘modules’ and ‘specialArgs’ are
83+ added to the existing values.
84+
85+ Using ‘extendModules’ a few times has no performance impact as long
86+ as you only reference the final ‘options’ and ‘config’.
87+ If you do reference multiple ‘config’ (or ‘options’) from before and
88+ after ‘extendModules’, performance is the same as with multiple
89+ ‘evalModules’ invocations, because the new modules' ability to
90+ override existing configuration fundamentally requires a new
91+ fixpoint to be constructed.
92+
93+ This is also available as a module argument.
94+
95+ ‘_module’: A portion of the configuration tree which is elided from
96+ ‘config’. It contains some values that are mostly internal to the
97+ module system implementation.
98+
5799 !!! Please think twice before adding to this argument list! The more
58100 that is specified here instead of in the modules themselves the harder
59101 it is to transparently move a set of modules to be a submodule of another
60102 config (as the proper arguments need to be replicated at each call to
61103 evalModules) and the less declarative the module set is. */
62− evalModules = { modules
104+ evalModules = evalModulesArgs@
105+ { modules
63106 , prefix ? []
64107 , # This should only be used for special arguments that need to be evaluated
65108 # when resolving module structure (like in imports). For everything else,
@@ -70,13 +113,39 @@ rec {
70113 args ? {}
71114 , # This would be remove in the future, Prefer _module.check option instead.
72115 check ? true
116+ # Internal variable to avoid `_key` collisions regardless
117+ # of `extendModules`. Used in `submoduleWith`.
118+ # Test case: lib/tests/modules, "168767"
119+ , extensionOffset ? 0
73120 }:
74121 let
122+ withWarnings = x:
123+ lib.warnIf (evalModulesArgs?args) "The args argument to evalModules is deprecated. Please set config._module.args instead."
124+ lib.warnIf (evalModulesArgs?check) "The check argument to evalModules is deprecated. Please set config._module.check instead."
125+ x;
126+
127+ legacyModules =
128+ optional (evalModulesArgs?args) {
129+ config = {
130+ _module.args = args;
131+ };
132+ }
133+ ++ optional (evalModulesArgs?check) {
134+ config = {
135+ _module.check = mkDefault check;
136+ };
137+ };
138+ regularModules = modules ++ legacyModules;
139+
75140 # This internal module declare internal options under the `_module'
76141 # attribute. These options are fragile, as they are used by the
77142 # module system to change the interpretation of modules.
143+ #
144+ # When extended with extendModules or moduleType, a fresh instance of
145+ # this module is used, to avoid conflicts and allow chaining of
146+ # extendModules.
78147 internalModule = rec {
79− _file = ./modules.nix;
148+ _file = "lib/modules.nix";
80149
81150 key = _file;
82151
@@ -88,21 +157,106 @@ rec {
88157 # support for that, in turn it's lazy in its values. This means e.g.
89158 # a `_module.args.pkgs = import (fetchTarball { ... }) {}` won't
90159 # start a download when `pkgs` wasn't evaluated.
91− type = types.lazyAttrsOf types.unspecified;
92− internal = true;
93− description = "Arguments passed to each module.";
160+ type = types.lazyAttrsOf types.raw;
161+ # Only render documentation once at the root of the option tree,
162+ # not for all individual submodules.
163+ # Allow merging option decls to make this internal regardless.
164+ ${if prefix == []
165+ then null # unset => visible
166+ else "internal"} = true;
167+ # TODO: Change the type of this option to a submodule with a
168+ # freeformType, so that individual arguments can be documented
169+ # separately
170+ description = ''
171+ Additional arguments passed to each module in addition to ones
172+ like <literal>lib</literal>, <literal>config</literal>,
173+ and <literal>pkgs</literal>, <literal>modulesPath</literal>.
174+ </para>
175+ <para>
176+ This option is also available to all submodules. Submodules do not
177+ inherit args from their parent module, nor do they provide args to
178+ their parent module or sibling submodules. The sole exception to
179+ this is the argument <literal>name</literal> which is provided by
180+ parent modules to a submodule and contains the attribute name
181+ the submodule is bound to, or a unique generated name if it is
182+ not bound to an attribute.
183+ </para>
184+ <para>
185+ Some arguments are already passed by default, of which the
186+ following <emphasis>cannot</emphasis> be changed with this option:
187+ <itemizedlist>
188+ <listitem>
189+ <para>
190+ <varname>lib</varname>: The nixpkgs library.
191+ </para>
192+ </listitem>
193+ <listitem>
194+ <para>
195+ <varname>config</varname>: The results of all options after merging the values from all modules together.
196+ </para>
197+ </listitem>
198+ <listitem>
199+ <para>
200+ <varname>options</varname>: The options declared in all modules.
201+ </para>
202+ </listitem>
203+ <listitem>
204+ <para>
205+ <varname>specialArgs</varname>: The <literal>specialArgs</literal> argument passed to <literal>evalModules</literal>.
206+ </para>
207+ </listitem>
208+ <listitem>
209+ <para>
210+ All attributes of <varname>specialArgs</varname>
211+ </para>
212+ <para>
213+ Whereas option values can generally depend on other option values
214+ thanks to laziness, this does not apply to <literal>imports</literal>, which
215+ must be computed statically before anything else.
216+ </para>
217+ <para>
218+ For this reason, callers of the module system can provide <literal>specialArgs</literal>
219+ which are available during import resolution.
220+ </para>
221+ <para>
222+ For NixOS, <literal>specialArgs</literal> includes
223+ <varname>modulesPath</varname>, which allows you to import
224+ extra modules from the nixpkgs package tree without having to
225+ somehow make the module aware of the location of the
226+ <literal>nixpkgs</literal> or NixOS directories.
227+ <programlisting>
228+ { modulesPath, ... }: {
229+ imports = [
230+ (modulesPath + "/profiles/minimal.nix")
231+ ];
232+ }
233+ </programlisting>
234+ </para>
235+ </listitem>
236+ </itemizedlist>
237+ </para>
238+ <para>
239+ For NixOS, the default value for this option includes at least this argument:
240+ <itemizedlist>
241+ <listitem>
242+ <para>
243+ <varname>pkgs</varname>: The nixpkgs package set according to
244+ the <option>nixpkgs.pkgs</option> option.
245+ </para>
246+ </listitem>
247+ </itemizedlist>
248+ '';
94249 };
95250
96251 _module.check = mkOption {
97252 type = types.bool;
98253 internal = true;
99− default = check;
254+ default = true;
100255 description = "Whether to check whether all option definitions have matching declarations.";
101256 };
102257
103258 _module.freeformType = mkOption {
104− # Disallow merging for now, but could be implemented nicely with a `types.optionType`
105− type = types.nullOr (types.uniq types.attrs);
259+ type = types.nullOr types.optionType;
106260 internal = true;
107261 default = null;
108262 description = ''
@@ -119,15 +273,18 @@ rec {
119273 };
120274
121275 config = {
122− _module.args = args;
276+ _module.args = {
277+ inherit extendModules;
278+ moduleType = type;
279+ };
123280 };
124281 };
125282
126283 merged =
127284 let collected = collectModules
128285 (specialArgs.modulesPath or "")
129− (modules ++ [ internalModule ])
130− ({ inherit lib options config; } // specialArgs);
286+ (regularModules ++ [ internalModule ])
287+ ({ inherit lib options config specialArgs; } // specialArgs);
131288 in mergeModules prefix (reverseList collected);
132289
133290 options = merged.matchedOptions;
@@ -161,20 +318,51 @@ rec {
161318 baseMsg = "The option `${showOption (prefix ++ firstDef.prefix)}' does not exist. Definition values:${showDefs [ firstDef ]}";
162319 in
163320 if attrNames options == [ "_module" ]
164− then throw ''
165− ${baseMsg}
166−
167− However there are no options defined in `${showOption prefix}'. Are you sure you've
168− declared your options properly? This can happen if you e.g. declared your options in `types.submodule'
169− under `config' rather than `options'.
170− ''
321+ then
322+ let
323+ optionName = showOption prefix;
324+ in
325+ if optionName == ""
326+ then throw ''
327+ ${baseMsg}
328+
329+ It seems as if you're trying to declare an option by placing it into `config' rather than `options'!
330+ ''
331+ else
332+ throw ''
333+ ${baseMsg}
334+
335+ However there are no options defined in `${showOption prefix}'. Are you sure you've
336+ declared your options properly? This can happen if you e.g. declared your options in `types.submodule'
337+ under `config' rather than `options'.
338+ ''
171339 else throw baseMsg
172340 else null;
173341
174− result = builtins.seq checkUnmatched {
175− inherit options;
176− config = removeAttrs config [ "_module" ];
177− inherit (config) _module;
342+ checked = builtins.seq checkUnmatched;
343+
344+ extendModules = extendArgs@{
345+ modules ? [],
346+ specialArgs ? {},
347+ prefix ? [],
348+ extensionOffset ? length modules,
349+ }:
350+ evalModules (evalModulesArgs // {
351+ modules = regularModules ++ modules;
352+ specialArgs = evalModulesArgs.specialArgs or {} // specialArgs;
353+ prefix = extendArgs.prefix or evalModulesArgs.prefix;
354+ inherit extensionOffset;
355+ });
356+
357+ type = lib.types.submoduleWith {
358+ inherit modules specialArgs extensionOffset;
359+ };
360+
361+ result = withWarnings {
362+ options = checked options;
363+ config = checked (removeAttrs config [ "_module" ]);
364+ _module = checked (config._module);
365+ inherit extendModules type;
178366 };
179367 in result;
180368
@@ -187,8 +375,11 @@ rec {
187375 # Like unifyModuleSyntax, but also imports paths and calls functions if necessary
188376 loadModule = args: fallbackFile: fallbackKey: m:
189377 if isFunction m || isAttrs m then
190− unifyModuleSyntax fallbackFile fallbackKey (applyIfFunction fallbackKey m args)
191− else unifyModuleSyntax (toString m) (toString m) (applyIfFunction (toString m) (import m) args);
378+ unifyModuleSyntax fallbackFile fallbackKey (applyModuleArgsIfFunction fallbackKey m args)
379+ else if isList m then
380+ let defs = [{ file = fallbackFile; value = m; }]; in
381+ throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}"
382+ else unifyModuleSyntax (toString m) (toString m) (applyModuleArgsIfFunction (toString m) (import m) args);
192383
193384 /*
194385 Collects all modules recursively into the form
@@ -249,6 +440,10 @@ rec {
249440 in modulesPath: initialModules: args:
250441 filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
251442
443+ /* Wrap a module with a default location for reporting errors. */
444+ setDefaultModuleLocation = file: m:
445+ { _file = file; imports = [ m ]; };
446+
252447 /* Massage a module into canonical form, that is, a set consisting
253448 of ‘options’, ‘config’ and ‘imports’ attributes. */
254449 unifyModuleSyntax = file: key: m:
@@ -281,7 +476,7 @@ rec {
281476 config = addFreeformType (addMeta (removeAttrs m ["_file" "key" "disabledModules" "require" "imports" "freeformType"]));
282477 };
283478
284− applyIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then
479+ applyModuleArgsIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then
285480 let
286481 # Module arguments are resolved in a strict manner when attribute set
287482 # deconstruction is used. As the arguments are now defined with the
@@ -295,13 +490,11 @@ rec {
295490 # a module will resolve strictly the attributes used as argument but
296491 # not their values. The values are forwarding the result of the
297492 # evaluation of the option.
298− requiredArgs = builtins.attrNames (lib.functionArgs f);
299493 context = name: ''while evaluating the module argument `${name}' in "${key}":'';
300− extraArgs = builtins.listToAttrs (map (name: {
301− inherit name;
302− value = builtins.addErrorContext (context name)
303− (args.${name} or config._module.args.${name});
304− }) requiredArgs);
494+ extraArgs = builtins.mapAttrs (name: _:
495+ builtins.addErrorContext (context name)
496+ (args.${name} or config._module.args.${name})
497+ ) (lib.functionArgs f);
305498
306499 # Note: we append in the opposite order such that we can add an error
307500 # context on the explicited arguments of "args" too. This update
@@ -360,12 +553,21 @@ rec {
360553 }
361554 */
362555 byName = attr: f: modules:
363− foldl' (acc: module:
364− acc // (mapAttrs (n: v:
365− (acc.${n} or []) ++ f module v
366− ) module.${attr}
367− )
368− ) {} modules;
556+ zipAttrsWith (n: concatLists)
557+ (map (module: let subtree = module.${attr}; in
558+ if !(builtins.isAttrs subtree) then
559+ throw ''
560+ You're trying to declare a value of type `${builtins.typeOf subtree}'
561+ rather than an attribute-set for the option
562+ `${builtins.concatStringsSep "." prefix}'!
563+
564+ This usually happens if `${builtins.concatStringsSep "." prefix}' has option
565+ definitions inside that are not matched. Please check how to properly define
566+ this option by e.g. referring to `man 5 configuration.nix'!
567+ ''
568+ else
569+ mapAttrs (n: f module) subtree
570+ ) modules);
369571 # an attrset 'name' => list of submodules that declare ‘name’.
370572 declsByName = byName "options" (module: option:
371573 [{ inherit (module) _file; options = option; }]
@@ -379,28 +581,63 @@ rec {
379581 [{ inherit (module) file; inherit value; }]
380582 ) configs;
381583
382− resultsByName = flip mapAttrs declsByName (name: decls:
584+ # Convert an option tree decl to a submodule option decl
585+ optionTreeToOption = decl:
586+ if isOption decl.options
587+ then decl
588+ else decl // {
589+ options = mkOption {
590+ type = types.submoduleWith {
591+ modules = [ { options = decl.options; } ];
592+ # `null` is not intended for use by modules. It is an internal
593+ # value that means "whatever the user has declared elsewhere".
594+ # This might become obsolete with https://github.com/NixOS/nixpkgs/issues/162398
595+ shorthandOnlyDefinesConfig = null;
596+ };
597+ };
598+ };
599+
600+ resultsByName = mapAttrs (name: decls:
383601 # We're descending into attribute ‘name’.
384602 let
385603 loc = prefix ++ [name];
386604 defns = defnsByName.${name} or [];
387605 defns' = defnsByName'.${name} or [];
388− nrOptions = count (m: isOption m.options) decls;
606+ optionDecls = filter (m: isOption m.options) decls;
389607 in
390− if nrOptions == length decls then
608+ if length optionDecls == length decls then
391609 let opt = fixupOptionType loc (mergeOptionDecls loc decls);
392610 in {
393611 matchedOptions = evalOptionValue loc opt defns';
394612 unmatchedDefns = [];
395613 }
396− else if nrOptions != 0 then
397− let
398− firstOption = findFirst (m: isOption m.options) "" decls;
399− firstNonOption = findFirst (m: !isOption m.options) "" decls;
400− in
401− throw "The option `${showOption loc}' in `${firstOption._file}' is a prefix of options in `${firstNonOption._file}'."
614+ else if optionDecls != [] then
615+ if all (x: x.options.type.name == "submodule") optionDecls
616+ # Raw options can only be merged into submodules. Merging into
617+ # attrsets might be nice, but ambiguous. Suppose we have
618+ # attrset as a `attrsOf submodule`. User declares option
619+ # attrset.foo.bar, this could mean:
620+ # a. option `bar` is only available in `attrset.foo`
621+ # b. option `foo.bar` is available in all `attrset.*`
622+ # c. reject and require "<name>" as a reminder that it behaves like (b).
623+ # d. magically combine (a) and (c).
624+ # All of the above are merely syntax sugar though.
625+ then
626+ let opt = fixupOptionType loc (mergeOptionDecls loc (map optionTreeToOption decls));
627+ in {
628+ matchedOptions = evalOptionValue loc opt defns';
629+ unmatchedDefns = [];
630+ }
631+ else
632+ let
633+ firstNonOption = findFirst (m: !isOption m.options) "" decls;
634+ nonOptions = filter (m: !isOption m.options) decls;
635+ in
636+ throw "The option `${showOption loc}' in module `${(lib.head optionDecls)._file}' would be a parent of the following options, but its type `${(lib.head optionDecls).options.type.description or "<no description>"}' does not support nested options.\n${
637+ showRawDecls loc nonOptions
638+ }"
402639 else
403− mergeModules' loc decls defns);
640+ mergeModules' loc decls defns) declsByName;
404641
405642 matchedOptions = mapAttrs (n: v: v.matchedOptions) resultsByName;
406643
@@ -414,12 +651,19 @@ rec {
414651 inherit matchedOptions;
415652
416653 # Transforms unmatchedDefnsByName into a list of definitions
417− unmatchedDefns = concatLists (mapAttrsToList (name: defs:
418− map (def: def // {
419− # Set this so we know when the definition first left unmatched territory
420− prefix = [name] ++ (def.prefix or []);
421− }) defs
422− ) unmatchedDefnsByName);
654+ unmatchedDefns =
655+ if configs == []
656+ then
657+ # When no config values exist, there can be no unmatched config, so
658+ # we short circuit and avoid evaluating more _options_ than necessary.
659+ []
660+ else
661+ concatLists (mapAttrsToList (name: defs:
662+ map (def: def // {
663+ # Set this so we know when the definition first left unmatched territory
664+ prefix = [name] ++ (def.prefix or []);
665+ }) defs
666+ ) unmatchedDefnsByName);
423667 };
424668
425669 /* Merge multiple option declarations into a single declaration. In
@@ -435,11 +679,9 @@ rec {
435679 correspond to the definition of 'loc' in 'opt.file'. */
436680 mergeOptionDecls =
437681 let
438− packSubmodule = file: m:
439− { _file = file; imports = [ m ]; };
440682 coerceOption = file: opt:
441− if isFunction opt then packSubmodule file opt
442− else packSubmodule file { options = opt; };
683+ if isFunction opt then setDefaultModuleLocation file opt
684+ else setDefaultModuleLocation file { options = opt; };
443685 in loc: opts:
444686 foldl' (res: opt:
445687 let t = res.type;
@@ -460,17 +702,9 @@ rec {
460702 throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
461703 else
462704 let
463− /* Add the modules of the current option to the list of modules
464− already collected. The options attribute except either a list of
465− submodules or a submodule. For each submodule, we add the file of the
466− current option declaration as the file use for the submodule. If the
467− submodule defines any filename, then we ignore the enclosing option file. */
468− options' = toList opt.options.options;
469−
470705 getSubModules = opt.options.type.getSubModules or null;
471706 submodules =
472− if getSubModules != null then map (packSubmodule opt._file) getSubModules ++ res.options
473− else if opt.options ? options then map (coerceOption opt._file) options' ++ res.options
707+ if getSubModules != null then map (setDefaultModuleLocation opt._file) getSubModules ++ res.options
474708 else res.options;
475709 in opt.options // res //
476710 { declarations = res.declarations ++ [opt._file];
@@ -505,8 +739,8 @@ rec {
505739 value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue;
506740
507741 warnDeprecation =
508− if opt.type.deprecationMessage == null then id
509− else warn "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}";
742+ warnIf (opt.type.deprecationMessage != null)
743+ "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}";
510744
511745 in warnDeprecation opt //
512746 { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
@@ -514,6 +748,8 @@ rec {
514748 definitions = map (def: def.value) res.defsFinal;
515749 files = map (def: def.file) res.defsFinal;
516750 inherit (res) isDefined;
751+ # This allows options to be correctly displayed using `${options.path.to.it}`
752+ __toString = _: showOption loc;
517753 };
518754
519755 # Merge definitions of a value of a given type.
@@ -651,26 +887,13 @@ rec {
651887 compare = a: b: (a.priority or 1000) < (b.priority or 1000);
652888 in sort compare defs';
653889
654− /* Hack for backward compatibility: convert options of type
655− optionSet to options of type submodule. FIXME: remove
656− eventually. */
890+ # This calls substSubModules, whose entire purpose is only to ensure that
891+ # option declarations in submodules have accurate position information.
892+ # TODO: Merge this into mergeOptionDecls
657893 fixupOptionType = loc: opt:
658− let
659− options = opt.options or
660− (throw "Option `${showOption loc}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
661− f = tp:
662− let optionSetIn = type: (tp.name == type) && (tp.functor.wrapped.name == "optionSet");
663− in
664− if tp.name == "option set" || tp.name == "submodule" then
665− throw "The option ${showOption loc} uses submodules without a wrapping type, in ${showFiles opt.declarations}."
666− else if optionSetIn "attrsOf" then types.attrsOf (types.submodule options)
667− else if optionSetIn "listOf" then types.listOf (types.submodule options)
668− else if optionSetIn "nullOr" then types.nullOr (types.submodule options)
669− else tp;
670− in
671− if opt.type.getSubModules or null == null
672− then opt // { type = f (opt.type or types.unspecified); }
673− else opt // { type = opt.type.substSubModules opt.options; options = []; };
894+ if opt.type.getSubModules or null == null
895+ then opt // { type = opt.type or types.unspecified; }
896+ else opt // { type = opt.type.substSubModules opt.options; options = []; };
674897
675898
676899 /* Properties. */
@@ -697,12 +920,11 @@ rec {
697920
698921 mkOptionDefault = mkOverride 1500; # priority of option defaults
699922 mkDefault = mkOverride 1000; # used in config sections of non-user modules to set a default
923+ mkImageMediaOverride = mkOverride 60; # image media profiles can be derived by inclusion into host config, hence needing to override host config, but do allow user to mkForce
700924 mkForce = mkOverride 50;
701925 mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’
702926
703− mkStrict = builtins.trace "`mkStrict' is obsolete; use `mkOverride 0' instead." (mkOverride 0);
704−
705− mkFixStrictness = id; # obsolete, no-op
927+ mkFixStrictness = lib.warn "lib.mkFixStrictness has no effect and will be removed. It returns its argument unmodified, so you can just remove any calls." id;
706928
707929 mkOrder = priority: content:
708930 { _type = "order";
@@ -803,6 +1025,26 @@ rec {
8031025 use = builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'.";
8041026 };
8051027
1028+ mkRenamedOptionModuleWith = {
1029+ /* Old option path as list of strings. */
1030+ from,
1031+ /* New option path as list of strings. */
1032+ to,
1033+
1034+ /*
1035+ Release number of the first release that contains the rename, ignoring backports.
1036+ Set it to the upcoming release, matching the nixpkgs/.version file.
1037+ */
1038+ sinceRelease,
1039+
1040+ }: doRename {
1041+ inherit from to;
1042+ visible = false;
1043+ warn = lib.isInOldestRelease sinceRelease;
1044+ use = lib.warnIf (lib.isInOldestRelease sinceRelease)
1045+ "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'.";
1046+ };
1047+
8061048 /* Return a module that causes a warning to be shown if any of the "from"
8071049 option is defined; the defined values can be used in the "mergeFn" to set
8081050 the "to" value.
@@ -834,7 +1076,7 @@ rec {
8341076 mkMergedOptionModule = from: to: mergeFn:
8351077 { config, options, ... }:
8361078 {
837− options = foldl recursiveUpdate {} (map (path: setAttrByPath path (mkOption {
1079+ options = foldl' recursiveUpdate {} (map (path: setAttrByPath path (mkOption {
8381080 visible = false;
8391081 # To use the value in mergeFn without triggering errors
8401082 default = "_mkMergedOptionModule";
@@ -889,6 +1131,26 @@ rec {
8891131 use = id;
8901132 };
8911133
1134+ /* mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b
1135+
1136+ Create config definitions with the same priority as the definition of another option.
1137+ This should be used for option definitions where one option sets the value of another as a convenience.
1138+ For instance a config file could be set with a `text` or `source` option, where text translates to a `source`
1139+ value using `mkDerivedConfig options.text (pkgs.writeText "filename.conf")`.
1140+
1141+ It takes care of setting the right priority using `mkOverride`.
1142+ */
1143+ # TODO: make the module system error message include information about `opt` in
1144+ # error messages about conflicts. E.g. introduce a variation of `mkOverride` which
1145+ # adds extra location context to the definition object. This will allow context to be added
1146+ # to all messages that report option locations "this value was derived from <full option name>
1147+ # which was defined in <locations>". It can provide a trace of options that contributed
1148+ # to definitions.
1149+ mkDerivedConfig = opt: f:
1150+ mkOverride
1151+ (opt.highestPrio or defaultPriority)
1152+ (f opt.value);
1153+
8921154 doRename = { from, to, visible, warn, use, withPriority ? true }:
8931155 { config, options, ... }:
8941156 let
@@ -918,7 +1180,7 @@ rec {
9181180
9191181 /* Use this function to import a JSON file as NixOS configuration.
9201182
921− importJSON -> path -> attrs
1183+ modules.importJSON :: path -> attrs
9221184 */
9231185 importJSON = file: {
9241186 _file = file;
@@ -927,7 +1189,7 @@ rec {
9271189
9281190 /* Use this function to import a TOML file as NixOS configuration.
9291191
930− importTOML -> path -> attrs
1192+ modules.importTOML :: path -> attrs
9311193 */
9321194 importTOML = file: {
9331195 _file = file;
lib/options.nix+84−19
@@ -11,6 +11,7 @@ let
1111 filter
1212 foldl'
1313 head
14+ tail
1415 isAttrs
1516 isBool
1617 isDerivation
@@ -25,6 +26,7 @@ let
2526 take
2627 ;
2728 inherit (lib.attrsets)
29+ attrByPath
2830 optionalAttrs
2931 ;
3032 inherit (lib.strings)
@@ -53,7 +55,7 @@ rec {
5355
5456 Example:
5557 mkOption { } // => { _type = "option"; }
56− mkOption { defaultText = "foo"; } // => { _type = "option"; defaultText = "foo"; }
58+ mkOption { default = "foo"; } // => { _type = "option"; default = "foo"; }
5759 */
5860 mkOption =
5961 {
@@ -73,12 +75,10 @@ rec {
7375 apply ? null,
7476 # Whether the option is for NixOS developers only.
7577 internal ? null,
76− # Whether the option shows up in the manual.
78+ # Whether the option shows up in the manual. Default: true. Use false to hide the option and any sub-options from submodules. Use "shallow" to hide only sub-options.
7779 visible ? null,
7880 # Whether the option can be set only once
7981 readOnly ? null,
80− # Deprecated, used by types.optionSet.
81− options ? null
8282 } @ attrs:
8383 attrs // { _type = "option"; };
8484
@@ -98,6 +98,49 @@ rec {
9898 type = lib.types.bool;
9999 };
100100
101+ /* Creates an Option attribute set for an option that specifies the
102+ package a module should use for some purpose.
103+
104+ Type: mkPackageOption :: pkgs -> string -> { default :: [string], example :: null | string | [string] } -> option
105+
106+ The package is specified as a list of strings representing its attribute path in nixpkgs.
107+
108+ Because of this, you need to pass nixpkgs itself as the first argument.
109+
110+ The second argument is the name of the option, used in the description "The <name> package to use.".
111+
112+ You can also pass an example value, either a literal string or a package's attribute path.
113+
114+ You can omit the default path if the name of the option is also attribute path in nixpkgs.
115+
116+ Example:
117+ mkPackageOption pkgs "hello" { }
118+ => { _type = "option"; default = «derivation /nix/store/3r2vg51hlxj3cx5vscp0vkv60bqxkaq0-hello-2.10.drv»; defaultText = { ... }; description = "The hello package to use."; type = { ... }; }
119+
120+ Example:
121+ mkPackageOption pkgs "GHC" {
122+ default = [ "ghc" ];
123+ example = "pkgs.haskell.package.ghc922.ghc.withPackages (hkgs: [ hkgs.primes ])";
124+ }
125+ => { _type = "option"; default = «derivation /nix/store/jxx55cxsjrf8kyh3fp2ya17q99w7541r-ghc-8.10.7.drv»; defaultText = { ... }; description = "The GHC package to use."; example = { ... }; type = { ... }; }
126+ */
127+ mkPackageOption =
128+ # Package set (a specific version of nixpkgs)
129+ pkgs:
130+ # Name for the package, shown in option description
131+ name:
132+ { default ? [ name ], example ? null }:
133+ let default' = if !isList default then [ default ] else default;
134+ in mkOption {
135+ type = lib.types.package;
136+ description = "The ${name} package to use.";
137+ default = attrByPath default'
138+ (throw "${concatStringsSep "." default'} cannot be found in pkgs") pkgs;
139+ defaultText = literalExpression ("pkgs." + concatStringsSep "." default');
140+ ${if example != null then "example" else null} = literalExpression
141+ (if isList example then "pkgs." + concatStringsSep "." example else example);
142+ };
143+
101144 /* This option accepts anything, but it does not produce any result.
102145
103146 This is useful for sharing a module across different module sets
@@ -127,11 +170,13 @@ rec {
127170 else if all isInt list && all (x: x == head list) list then head list
128171 else throw "Cannot merge definitions of `${showOption loc}'. Definition values:${showDefs defs}";
129172
130− mergeOneOption = loc: defs:
131− if defs == [] then abort "This case should never happen."
132− else if length defs != 1 then
133− throw "The unique option `${showOption loc}' is defined multiple times. Definition values:${showDefs defs}"
134− else (head defs).value;
173+ mergeOneOption = mergeUniqueOption { message = ""; };
174+
175+ mergeUniqueOption = { message }: loc: defs:
176+ if length defs == 1
177+ then (head defs).value
178+ else assert length defs > 1;
179+ throw "The option `${showOption loc}' is defined multiple times.\n${message}\nDefinition values:${showDefs defs}";
135180
136181 /* "Merge" option definitions by checking that they all have the same value. */
137182 mergeEqualOption = loc: defs:
@@ -144,7 +189,7 @@ rec {
144189 if def.value != first.value then
145190 throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}"
146191 else
147− first) (head defs) defs).value;
192+ first) (head defs) (tail defs)).value;
148193
149194 /* Extracts values of all "value" keys of the given list.
150195
@@ -176,12 +221,15 @@ rec {
176221 docOption = rec {
177222 loc = opt.loc;
178223 name = showOption opt.loc;
179− description = opt.description or (lib.warn "Option `${name}' has no description." "This option has no description.");
224+ description = opt.description or null;
180225 declarations = filter (x: x != unknownModule) opt.declarations;
181226 internal = opt.internal or false;
182− visible = opt.visible or true;
227+ visible =
228+ if (opt?visible && opt.visible == "shallow")
229+ then true
230+ else opt.visible or true;
183231 readOnly = opt.readOnly or false;
184− type = opt.type.description or null;
232+ type = opt.type.description or "unspecified";
185233 }
186234 // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; }
187235 // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; }
@@ -191,8 +239,9 @@ rec {
191239 subOptions =
192240 let ss = opt.type.getSubOptions opt.loc;
193241 in if ss != {} then optionAttrSetToDocList' opt.loc ss else [];
242+ subOptionsVisible = docOption.visible && opt.visible or null != "shallow";
194243 in
195− [ docOption ] ++ optionals docOption.visible subOptions) (collect isOption options);
244+ [ docOption ] ++ optionals subOptionsVisible subOptions) (collect isOption options);
196245
197246
198247 /* This function recursively removes all derivation attributes from
@@ -211,11 +260,25 @@ rec {
211260 else x;
212261
213262
214− /* For use in the `example` option attribute. It causes the given
215− text to be included verbatim in documentation. This is necessary
216− for example values that are not simple values, e.g., functions.
263+ /* For use in the `defaultText` and `example` option attributes. Causes the
264+ given string to be rendered verbatim in the documentation as Nix code. This
265+ is necessary for complex values, e.g. functions, or values that depend on
266+ other values or packages.
267+ */
268+ literalExpression = text:
269+ if ! isString text then throw "literalExpression expects a string."
270+ else { _type = "literalExpression"; inherit text; };
271+
272+ literalExample = lib.warn "literalExample is deprecated, use literalExpression instead, or use literalDocBook for a non-Nix description." literalExpression;
273+
274+
275+ /* For use in the `defaultText` and `example` option attributes. Causes the
276+ given DocBook text to be inserted verbatim in the documentation, for when
277+ a `literalExpression` would be too hard to read.
217278 */
218− literalExample = text: { _type = "literalExample"; inherit text; };
279+ literalDocBook = text:
280+ if ! isString text then throw "literalDocBook expects a string."
281+ else { _type = "literalDocBook"; inherit text; };
219282
220283 # Helper functions.
221284
@@ -246,7 +309,9 @@ rec {
246309 showDefs = defs: concatMapStrings (def:
247310 let
248311 # Pretty print the value for display, if successful
249− prettyEval = builtins.tryEval (lib.generators.toPretty {} def.value);
312+ prettyEval = builtins.tryEval
313+ (lib.generators.toPretty { }
314+ (lib.generators.withRecursion { depthLimit = 10; throwOnDepthLimit = false; } def.value));
250315 # Split it into its lines
251316 lines = filter (v: ! isList v) (builtins.split "\n" prettyEval.value);
252317 # Only display the first 5 lines, and indent them for better visibility
lib/sources.nix+177−72
@@ -1,6 +1,7 @@
11# Functions for copying sources to the Nix store.
22{ lib }:
33
4+# Tested in lib/tests/sources.sh
45let
56 inherit (builtins)
67 hasContext
@@ -11,26 +12,34 @@ let
1112 tryEval
1213 ;
1314 inherit (lib)
15+ boolToString
1416 filter
1517 getAttr
1618 isString
1719 pathExists
1820 readFile
1921 ;
20−in
21−rec {
2222
23− # Returns the type of a path: regular (for file), symlink, or directory
24− pathType = p: getAttr (baseNameOf p) (readDir (dirOf p));
23+ /*
24+ Returns the type of a path: regular (for file), symlink, or directory.
25+ */
26+ pathType = path: getAttr (baseNameOf path) (readDir (dirOf path));
2527
26− # Returns true if the path exists and is a directory, false otherwise
27− pathIsDirectory = p: if pathExists p then (pathType p) == "directory" else false;
28+ /*
29+ Returns true if the path exists and is a directory, false otherwise.
30+ */
31+ pathIsDirectory = path: if pathExists path then (pathType path) == "directory" else false;
2832
29− # Returns true if the path exists and is a regular file, false otherwise
30− pathIsRegularFile = p: if pathExists p then (pathType p) == "regular" else false;
33+ /*
34+ Returns true if the path exists and is a regular file, false otherwise.
35+ */
36+ pathIsRegularFile = path: if pathExists path then (pathType path) == "regular" else false;
3137
32− # Bring in a path as a source, filtering out all Subversion and CVS
33− # directories, as well as backup files (*~).
38+ /*
39+ A basic filter for `cleanSourceWith` that removes
40+ directories of version control system, backup files (*~)
41+ and some generated files.
42+ */
3443 cleanSourceFilter = name: type: let baseName = baseNameOf (toString name); in ! (
3544 # Filter out version control software files/directories
3645 (baseName == ".git" || type == "directory" && (baseName == ".svn" || baseName == "CVS" || baseName == ".hg")) ||
@@ -43,62 +52,89 @@ rec {
4352 lib.hasSuffix ".o" baseName ||
4453 lib.hasSuffix ".so" baseName ||
4554 # Filter out nix-build result symlinks
46− (type == "symlink" && lib.hasPrefix "result" baseName)
55+ (type == "symlink" && lib.hasPrefix "result" baseName) ||
56+ # Filter out sockets and other types of files we can't have in the store.
57+ (type == "unknown")
4758 );
4859
49− # Filters a source tree removing version control files and directories using cleanSourceWith
50− #
51− # Example:
52− # cleanSource ./.
60+ /*
61+ Filters a source tree removing version control files and directories using cleanSourceFilter.
62+
63+ Example:
64+ cleanSource ./.
65+ */
5366 cleanSource = src: cleanSourceWith { filter = cleanSourceFilter; inherit src; };
5467
55− # Like `builtins.filterSource`, except it will compose with itself,
56− # allowing you to chain multiple calls together without any
57− # intermediate copies being put in the nix store.
58− #
59− # lib.cleanSourceWith {
60− # filter = f;
61− # src = lib.cleanSourceWith {
62− # filter = g;
63− # src = ./.;
64− # };
65− # }
66− # # Succeeds!
67− #
68− # builtins.filterSource f (builtins.filterSource g ./.)
69− # # Fails!
70− #
71− # Parameters:
72− #
73− # src: A path or cleanSourceWith result to filter and/or rename.
74− #
75− # filter: A function (path -> type -> bool)
76− # Optional with default value: constant true (include everything)
77− # The function will be combined with the && operator such
78− # that src.filter is called lazily.
79− # For implementing a filter, see
80− # https://nixos.org/nix/manual/#builtin-filterSource
81− #
82− # name: Optional name to use as part of the store path.
83− # This defaults to `src.name` or otherwise `"source"`.
84− #
85− cleanSourceWith = { filter ? _path: _type: true, src, name ? null }:
68+ /*
69+ Like `builtins.filterSource`, except it will compose with itself,
70+ allowing you to chain multiple calls together without any
71+ intermediate copies being put in the nix store.
72+
73+ Example:
74+ lib.cleanSourceWith {
75+ filter = f;
76+ src = lib.cleanSourceWith {
77+ filter = g;
78+ src = ./.;
79+ };
80+ }
81+ # Succeeds!
82+
83+ builtins.filterSource f (builtins.filterSource g ./.)
84+ # Fails!
85+
86+ */
87+ cleanSourceWith =
88+ {
89+ # A path or cleanSourceWith result to filter and/or rename.
90+ src,
91+ # Optional with default value: constant true (include everything)
92+ # The function will be combined with the && operator such
93+ # that src.filter is called lazily.
94+ # For implementing a filter, see
95+ # https://nixos.org/nix/manual/#builtin-filterSource
96+ # Type: A function (path -> type -> bool)
97+ filter ? _path: _type: true,
98+ # Optional name to use as part of the store path.
99+ # This defaults to `src.name` or otherwise `"source"`.
100+ name ? null
101+ }:
86102 let
87− isFiltered = src ? _isLibCleanSourceWith;
88− origSrc = if isFiltered then src.origSrc else src;
89− filter' = if isFiltered then name: type: filter name type && src.filter name type else filter;
90− name' = if name != null then name else if isFiltered then src.name else "source";
91− in {
92− inherit origSrc;
93− filter = filter';
94− outPath = builtins.path { filter = filter'; path = origSrc; name = name'; };
95− _isLibCleanSourceWith = true;
96− name = name';
103+ orig = toSourceAttributes src;
104+ in fromSourceAttributes {
105+ inherit (orig) origSrc;
106+ filter = path: type: filter path type && orig.filter path type;
107+ name = if name != null then name else orig.name;
97108 };
98109
99− # Filter sources by a list of regular expressions.
100− #
101− # E.g. `src = sourceByRegex ./my-subproject [".*\.py$" "^database.sql$"]`
110+ /*
111+ Add logging to a source, for troubleshooting the filtering behavior.
112+ Type:
113+ sources.trace :: sourceLike -> Source
114+ */
115+ trace =
116+ # Source to debug. The returned source will behave like this source, but also log its filter invocations.
117+ src:
118+ let
119+ attrs = toSourceAttributes src;
120+ in
121+ fromSourceAttributes (
122+ attrs // {
123+ filter = path: type:
124+ let
125+ r = attrs.filter path type;
126+ in
127+ builtins.trace "${attrs.name}.filter ${path} = ${boolToString r}" r;
128+ }
129+ ) // {
130+ satisfiesSubpathInvariant = src ? satisfiesSubpathInvariant && src.satisfiesSubpathInvariant;
131+ };
132+
133+ /*
134+ Filter sources by a list of regular expressions.
135+
136+ Example: src = sourceByRegex ./my-subproject [".*\.py$" "^database.sql$"]
137+ */
102138 sourceByRegex = src: regexes:
103139 let
104140 isFiltered = src ? _isLibCleanSourceWith;
@@ -110,19 +146,34 @@ rec {
110146 inherit src;
111147 };
112148
113− # Get all files ending with the specified suffices from the given
114− # directory or its descendants. E.g. `sourceFilesBySuffices ./dir
115− # [".xml" ".c"]'.
116− sourceFilesBySuffices = path: exts:
149+ /*
150+ Get all files ending with the specified suffices from the given
151+ source directory or its descendants, omitting files that do not match
152+ any suffix. The result of the example below will include files like
153+ `./dir/module.c` and `./dir/subdir/doc.xml` if present.
154+
155+ Type: sourceLike -> [String] -> Source
156+
157+ Example:
158+ sourceFilesBySuffices ./. [ ".xml" ".c" ]
159+ */
160+ sourceFilesBySuffices =
161+ # Path or source containing the files to be returned
162+ src:
163+ # A list of file suffix strings
164+ exts:
117165 let filter = name: type:
118166 let base = baseNameOf (toString name);
119167 in type == "directory" || lib.any (ext: lib.hasSuffix ext base) exts;
120− in cleanSourceWith { inherit filter; src = path; };
168+ in cleanSourceWith { inherit filter src; };
121169
122170 pathIsGitRepo = path: (tryEval (commitIdFromGitRepo path)).success;
123171
124− # Get the commit id of a git repo
125− # Example: commitIdFromGitRepo <nixpkgs/.git>
172+ /*
173+ Get the commit id of a git repo.
174+
175+ Example: commitIdFromGitRepo <nixpkgs/.git>
176+ */
126177 commitIdFromGitRepo =
127178 let readCommitFromFile = file: path:
128179 let fileName = toString path + "/" + file;
@@ -138,12 +189,13 @@ rec {
138189 in if m == null
139190 then throw ("File contains no gitdir reference: " + path)
140191 else
141− let gitDir = absolutePath (dirOf path) (lib.head m);
142− commonDir' = if pathIsRegularFile "${gitDir}/commondir"
143− then lib.fileContents "${gitDir}/commondir"
144− else gitDir;
145− commonDir = absolutePath gitDir commonDir';
146− refFile = lib.removePrefix "${commonDir}/" "${gitDir}/${file}";
192+ let gitDir = absolutePath (dirOf path) (lib.head m);
193+ commonDir'' = if pathIsRegularFile "${gitDir}/commondir"
194+ then lib.fileContents "${gitDir}/commondir"
195+ else gitDir;
196+ commonDir' = lib.removeSuffix "/" commonDir'';
197+ commonDir = absolutePath gitDir commonDir';
198+ refFile = lib.removePrefix "${commonDir}/" "${gitDir}/${file}";
147199 in readCommitFromFile refFile commonDir
148200
149201 else if pathIsRegularFile fileName
@@ -176,4 +228,57 @@ rec {
176228 pathHasContext = builtins.hasContext or (lib.hasPrefix storeDir);
177229
178230 canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext (toString src));
231+
232+ # -------------------------------------------------------------------------- #
233+ # Internal functions
234+ #
235+
236+ # toSourceAttributes : sourceLike -> SourceAttrs
237+ #
238+ # Convert any source-like object into a simple, singular representation.
239+ # We don't expose this representation in order to avoid having a fifth path-
240+ # like class of objects in the wild.
241+ # (Existing ones being: paths, strings, sources and x//{outPath})
242+ # So instead of exposing internals, we build a library of combinator functions.
243+ toSourceAttributes = src:
244+ let
245+ isFiltered = src ? _isLibCleanSourceWith;
246+ in
247+ {
248+ # The original path
249+ origSrc = if isFiltered then src.origSrc else src;
250+ filter = if isFiltered then src.filter else _: _: true;
251+ name = if isFiltered then src.name else "source";
252+ };
253+
254+ # fromSourceAttributes : SourceAttrs -> Source
255+ #
256+ # Inverse of toSourceAttributes for Source objects.
257+ fromSourceAttributes = { origSrc, filter, name }:
258+ {
259+ _isLibCleanSourceWith = true;
260+ inherit origSrc filter name;
261+ outPath = builtins.path { inherit filter name; path = origSrc; };
262+ };
263+
264+in {
265+ inherit
266+ pathType
267+ pathIsDirectory
268+ pathIsRegularFile
269+
270+ pathIsGitRepo
271+ commitIdFromGitRepo
272+
273+ cleanSource
274+ cleanSourceWith
275+ cleanSourceFilter
276+ pathHasContext
277+ canCleanSource
278+
279+ sourceByRegex
280+ sourceFilesBySuffices
281+
282+ trace
283+ ;
179284}
lib/strings.nix+217−13
@@ -17,6 +17,7 @@ rec {
1717 head
1818 isInt
1919 isList
20+ isAttrs
2021 isString
2122 match
2223 parseDrvName
@@ -89,13 +90,13 @@ rec {
8990 => "usr/local/bin"
9091 */
9192 concatStringsSep = builtins.concatStringsSep or (separator: list:
92− concatStrings (intersperse separator list));
93+ lib.foldl' (x: y: x + y) "" (intersperse separator list));
9394
9495 /* Maps a function over a list of strings and then concatenates the
9596 result with the specified separator interspersed between
9697 elements.
9798
98− Type: concatMapStringsSep :: string -> (string -> string) -> [string] -> string
99+ Type: concatMapStringsSep :: string -> (a -> string) -> [a] -> string
99100
100101 Example:
101102 concatMapStringsSep "-" (x: toUpper x) ["foo" "bar" "baz"]
@@ -112,7 +113,7 @@ rec {
112113 /* Same as `concatMapStringsSep`, but the mapping function
113114 additionally receives the position of its argument.
114115
115− Type: concatIMapStringsSep :: string -> (int -> string -> string) -> [string] -> string
116+ Type: concatIMapStringsSep :: string -> (int -> a -> string) -> [a] -> string
116117
117118 Example:
118119 concatImapStringsSep "-" (pos: x: toString (x / pos)) [ 6 6 6 ]
@@ -253,10 +254,7 @@ rec {
253254 => false
254255 */
255256 hasInfix = infix: content:
256− let
257− drop = x: substring 1 (stringLength x) x;
258− in hasPrefix infix content
259− || content != "" && hasInfix infix (drop content);
257+ builtins.match ".*${escapeRegex infix}.*" "${content}" != null;
260258
261259 /* Convert a string to a list of characters (i.e. singleton strings).
262260 This allows you to, e.g., map a function over each character. However,
@@ -327,6 +325,65 @@ rec {
327325 */
328326 escapeShellArgs = concatMapStringsSep " " escapeShellArg;
329327
328+ /* Test whether the given name is a valid POSIX shell variable name.
329+
330+ Type: string -> bool
331+
332+ Example:
333+ isValidPosixName "foo_bar000"
334+ => true
335+ isValidPosixName "0-bad.jpg"
336+ => false
337+ */
338+ isValidPosixName = name: match "[a-zA-Z_][a-zA-Z0-9_]*" name != null;
339+
340+ /* Translate a Nix value into a shell variable declaration, with proper escaping.
341+
342+ Supported value types are strings (mapped to regular variables), lists of strings
343+ (mapped to Bash-style arrays) and attribute sets of strings (mapped to Bash-style
344+ associative arrays). Note that "strings" include string-coercible values like paths.
345+
346+ Strings are translated into POSIX sh-compatible code; lists and attribute sets
347+ assume a shell that understands Bash syntax (e.g. Bash or ZSH).
348+
349+ Type: string -> (string | listOf string | attrsOf string) -> string
350+
351+ Example:
352+ ''
353+ ${toShellVar "foo" "some string"}
354+ [[ "$foo" == "some string" ]]
355+ ''
356+ */
357+ toShellVar = name: value:
358+ lib.throwIfNot (isValidPosixName name) "toShellVar: ${name} is not a valid shell variable name" (
359+ if isAttrs value then
360+ "declare -A ${name}=(${
361+ concatStringsSep " " (lib.mapAttrsToList (n: v:
362+ "[${escapeShellArg n}]=${escapeShellArg v}"
363+ ) value)
364+ })"
365+ else if isList value then
366+ "declare -a ${name}=(${escapeShellArgs value})"
367+ else
368+ "${name}=${escapeShellArg value}"
369+ );
370+
371+ /* Translate an attribute set into corresponding shell variable declarations
372+ using `toShellVar`.
373+
374+ Type: attrsOf (string | listOf string | attrsOf string) -> string
375+
376+ Example:
377+ let
378+ foo = "value";
379+ bar = foo;
380+ in ''
381+ ${toShellVars { inherit foo bar; }}
382+ [[ "$foo" == "$bar" ]]
383+ ''
384+ */
385+ toShellVars = vars: concatStringsSep "\n" (lib.mapAttrsToList toShellVar vars);
386+
330387 /* Turn a string into a Nix expression representing that string
331388
332389 Type: string -> string
@@ -362,6 +419,19 @@ rec {
362419 if match "[a-zA-Z_][a-zA-Z0-9_'-]*" s != null
363420 then s else escapeNixString s;
364421
422+ /* Escapes a string such that it is safe to include verbatim in an XML
423+ document.
424+
425+ Type: string -> string
426+
427+ Example:
428+ escapeXML ''"test" 'test' < & >''
429+ => ""test" 'test' < & >"
430+ */
431+ escapeXML = builtins.replaceStrings
432+ ["\"" "'" "<" ">" "&"]
433+ [""" "'" "<" ">" "&"];
434+
365435 # Obsolete - use replaceStrings instead.
366436 replaceChars = builtins.replaceStrings or (
367437 del: new: s:
@@ -606,7 +676,7 @@ rec {
606676 This function will fail if the input string is longer than the
607677 requested length.
608678
609− Type: fixedWidthString :: int -> string -> string
679+ Type: fixedWidthString :: int -> string -> string -> string
610680
611681 Example:
612682 fixedWidthString 5 "0" (toString 15)
@@ -644,8 +714,8 @@ rec {
644714 floatToString = float: let
645715 result = toString float;
646716 precise = float == fromJSON result;
647− in if precise then result
648− else lib.warn "Imprecise conversion from float to string ${result}" result;
717+ in lib.warnIf (!precise) "Imprecise conversion from float to string ${result}"
718+ result;
649719
650720 /* Check whether a value can be coerced to a string */
651721 isCoercibleToString = x:
@@ -659,7 +729,7 @@ rec {
659729 Example:
660730 isStorePath "/nix/store/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11/bin/python"
661731 => false
662− isStorePath "/nix/store/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11/"
732+ isStorePath "/nix/store/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11"
663733 => true
664734 isStorePath pkgs.python
665735 => true
@@ -667,7 +737,7 @@ rec {
667737 => false
668738 */
669739 isStorePath = x:
670− if isCoercibleToString x then
740+ if !(isList x) && isCoercibleToString x then
671741 let str = toString x; in
672742 substring 0 1 str == "/"
673743 && dirOf str == storeDir
@@ -743,7 +813,14 @@ rec {
743813 sanitizeDerivationName pkgs.hello
744814 => "-nix-store-2g75chlbpxlrqn15zlby2dfh8hr9qwbk-hello-2.10"
745815 */
746− sanitizeDerivationName = string: lib.pipe string [
816+ sanitizeDerivationName =
817+ let okRegex = match "[[:alnum:]+_?=-][[:alnum:]+._?=-]*";
818+ in
819+ string:
820+ # First detect the common case of already valid strings, to speed those up
821+ if stringLength string <= 207 && okRegex string != null
822+ then unsafeDiscardStringContext string
823+ else lib.pipe string [
747824 # Get rid of string context. This is safe under the assumption that the
748825 # resulting string is only used as a derivation name
749826 unsafeDiscardStringContext
@@ -761,4 +838,131 @@ rec {
761838 (x: if stringLength x == 0 then "unknown" else x)
762839 ];
763840
841+ /* Computes the Levenshtein distance between two strings.
842+ Complexity O(n*m) where n and m are the lengths of the strings.
843+ Algorithm adjusted from https://stackoverflow.com/a/9750974/6605742
844+
845+ Type: levenshtein :: string -> string -> int
846+
847+ Example:
848+ levenshtein "foo" "foo"
849+ => 0
850+ levenshtein "book" "hook"
851+ => 1
852+ levenshtein "hello" "Heyo"
853+ => 3
854+ */
855+ levenshtein = a: b: let
856+ # Two dimensional array with dimensions (stringLength a + 1, stringLength b + 1)
857+ arr = lib.genList (i:
858+ lib.genList (j:
859+ dist i j
860+ ) (stringLength b + 1)
861+ ) (stringLength a + 1);
862+ d = x: y: lib.elemAt (lib.elemAt arr x) y;
863+ dist = i: j:
864+ let c = if substring (i - 1) 1 a == substring (j - 1) 1 b
865+ then 0 else 1;
866+ in
867+ if j == 0 then i
868+ else if i == 0 then j
869+ else lib.min
870+ ( lib.min (d (i - 1) j + 1) (d i (j - 1) + 1))
871+ ( d (i - 1) (j - 1) + c );
872+ in d (stringLength a) (stringLength b);
873+
874+ /* Returns the length of the prefix common to both strings.
875+ */
876+ commonPrefixLength = a: b:
877+ let
878+ m = lib.min (stringLength a) (stringLength b);
879+ go = i: if i >= m then m else if substring i 1 a == substring i 1 b then go (i + 1) else i;
880+ in go 0;
881+
882+ /* Returns the length of the suffix common to both strings.
883+ */
884+ commonSuffixLength = a: b:
885+ let
886+ m = lib.min (stringLength a) (stringLength b);
887+ go = i: if i >= m then m else if substring (stringLength a - i - 1) 1 a == substring (stringLength b - i - 1) 1 b then go (i + 1) else i;
888+ in go 0;
889+
890+ /* Returns whether the levenshtein distance between two strings is at most some value
891+ Complexity is O(min(n,m)) for k <= 2 and O(n*m) otherwise
892+
893+ Type: levenshteinAtMost :: int -> string -> string -> bool
894+
895+ Example:
896+ levenshteinAtMost 0 "foo" "foo"
897+ => true
898+ levenshteinAtMost 1 "foo" "boa"
899+ => false
900+ levenshteinAtMost 2 "foo" "boa"
901+ => true
902+ levenshteinAtMost 2 "This is a sentence" "this is a sentense."
903+ => false
904+ levenshteinAtMost 3 "This is a sentence" "this is a sentense."
905+ => true
906+
907+ */
908+ levenshteinAtMost = let
909+ infixDifferAtMost1 = x: y: stringLength x <= 1 && stringLength y <= 1;
910+
911+ # This function takes two strings stripped by their common pre and suffix,
912+ # and returns whether they differ by at most two by Levenshtein distance.
913+ # Because of this stripping, if they do indeed differ by at most two edits,
914+ # we know that those edits were (if at all) done at the start or the end,
915+ # while the middle has to have stayed the same. This fact is used in the
916+ # implementation.
917+ infixDifferAtMost2 = x: y:
918+ let
919+ xlen = stringLength x;
920+ ylen = stringLength y;
921+ # This function is only called with |x| >= |y| and |x| - |y| <= 2, so
922+ # diff is one of 0, 1 or 2
923+ diff = xlen - ylen;
924+
925+ # Infix of x and y, stripped by the left and right most character
926+ xinfix = substring 1 (xlen - 2) x;
927+ yinfix = substring 1 (ylen - 2) y;
928+
929+ # x and y but a character deleted at the left or right
930+ xdelr = substring 0 (xlen - 1) x;
931+ xdell = substring 1 (xlen - 1) x;
932+ ydelr = substring 0 (ylen - 1) y;
933+ ydell = substring 1 (ylen - 1) y;
934+ in
935+ # A length difference of 2 can only be gotten with 2 delete edits,
936+ # which have to have happened at the start and end of x
937+ # Example: "abcdef" -> "bcde"
938+ if diff == 2 then xinfix == y
939+ # A length difference of 1 can only be gotten with a deletion on the
940+ # right and a replacement on the left or vice versa.
941+ # Example: "abcdef" -> "bcdez" or "zbcde"
942+ else if diff == 1 then xinfix == ydelr || xinfix == ydell
943+ # No length difference can either happen through replacements on both
944+ # sides, or a deletion on the left and an insertion on the right or
945+ # vice versa
946+ # Example: "abcdef" -> "zbcdez" or "bcdefz" or "zabcde"
947+ else xinfix == yinfix || xdelr == ydell || xdell == ydelr;
948+
949+ in k: if k <= 0 then a: b: a == b else
950+ let f = a: b:
951+ let
952+ alen = stringLength a;
953+ blen = stringLength b;
954+ prelen = commonPrefixLength a b;
955+ suflen = commonSuffixLength a b;
956+ presuflen = prelen + suflen;
957+ ainfix = substring prelen (alen - presuflen) a;
958+ binfix = substring prelen (blen - presuflen) b;
959+ in
960+ # Make a be the bigger string
961+ if alen < blen then f b a
962+ # If a has over k more characters than b, even with k deletes on a, b can't be reached
963+ else if alen - blen > k then false
964+ else if k == 1 then infixDifferAtMost1 ainfix binfix
965+ else if k == 2 then infixDifferAtMost2 ainfix binfix
966+ else levenshtein ainfix binfix <= k;
967+ in f;
764968}
lib/systems/default.nix+30−1
@@ -8,6 +8,7 @@ rec {
88 platforms = import ./platforms.nix { inherit lib; };
99 examples = import ./examples.nix { inherit lib; };
1010 architectures = import ./architectures.nix { inherit lib; };
11+ supported = import ./supported.nix { inherit lib; };
1112
1213 # Elaborate a `localSystem` or `crossSystem` so that it contains everything
1314 # necessary.
@@ -41,6 +42,19 @@ rec {
4142 else if final.isNetBSD then "nblibc"
4243 # TODO(@Ericson2314) think more about other operating systems
4344 else "native/impure";
45+ # Choose what linker we wish to use by default. Someday we might also
46+ # choose the C compiler, runtime library, C++ standard library, etc. in
47+ # this way, nice and orthogonally, and deprecate `useLLVM`. But due to
48+ # the monolithic GCC build we cannot actually make those choices
49+ # independently, so we are just doing `linker` and keeping `useLLVM` for
50+ # now.
51+ linker =
52+ /**/ if final.useLLVM or false then "lld"
53+ else if final.isDarwin then "cctools"
54+ # "bfd" and "gold" both come from GNU binutils. The existance of Gold
55+ # is why we use the more obscure "bfd" and not "binutils" for this
56+ # choice.
57+ else "bfd";
4458 extensions = {
4559 sharedLibrary =
4660 /**/ if final.isDarwin then ".dylib"
@@ -91,9 +105,11 @@ rec {
91105 else if final.isAarch64 then "arm64"
92106 else if final.isx86_32 then "i386"
93107 else if final.isx86_64 then "x86_64"
94− else if final.isMips then "mips"
108+ else if final.isMips32 then "mips"
109+ else if final.isMips64 then "mips" # linux kernel does not distinguish mips32/mips64
95110 else if final.isPower then "powerpc"
96111 else if final.isRiscV then "riscv"
112+ else if final.isS390 then "s390"
97113 else final.parsed.cpu.name;
98114
99115 qemuArch =
@@ -112,6 +128,19 @@ rec {
112128 aarch64 = "arm64";
113129 }.${final.parsed.cpu.name} or final.parsed.cpu.name;
114130
131+ darwinPlatform =
132+ if final.isMacOS then "macos"
133+ else if final.isiOS then "ios"
134+ else null;
135+ # The canonical name for this attribute is darwinSdkVersion, but some
136+ # platforms define the old name "sdkVer".
137+ darwinSdkVersion = final.sdkVer or (if final.isAarch64 then "11.0" else "10.12");
138+ darwinMinVersion = final.darwinSdkVersion;
139+ darwinMinVersionVariable =
140+ if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET"
141+ else if final.isiOS then "IPHONEOS_DEPLOYMENT_TARGET"
142+ else null;
143+
115144 emulator = pkgs: let
116145 qemu-user = pkgs.qemu.override {
117146 smartcardSupport = false;
lib/systems/doubles.nix+46−26
@@ -6,43 +6,55 @@ let
66 inherit (lib.attrsets) matchAttrs;
77
88 all = [
9− "aarch64-linux"
10− "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux"
9+ # Cygwin
10+ "i686-cygwin" "x86_64-cygwin"
1111
12− "mipsel-linux"
12+ # Darwin
13+ "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin"
1314
14− "i686-cygwin" "i686-freebsd" "i686-linux" "i686-netbsd" "i686-openbsd"
15+ # FreeBSD
16+ "i686-freebsd" "x86_64-freebsd"
1517
16− "x86_64-cygwin" "x86_64-freebsd" "x86_64-linux"
17− "x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris"
18+ # Genode
19+ "aarch64-genode" "i686-genode" "x86_64-genode"
1820
19− "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin"
21+ # illumos
22+ "x86_64-solaris"
2023
21− "x86_64-windows" "i686-windows"
24+ # JS
25+ "js-ghcjs"
2226
23− "wasm64-wasi" "wasm32-wasi"
27+ # Linux
28+ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux"
29+ "armv7l-linux" "i686-linux" "m68k-linux" "mipsel-linux" "mips64el-linux"
30+ "powerpc64-linux" "powerpc64le-linux" "riscv32-linux"
31+ "riscv64-linux" "s390-linux" "s390x-linux" "x86_64-linux"
2432
25− "x86_64-redox"
33+ # MMIXware
34+ "mmix-mmixware"
2635
27− "powerpc64-linux"
28− "powerpc64le-linux"
36+ # NetBSD
37+ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd"
38+ "i686-netbsd" "m68k-netbsd" "mipsel-netbsd" "powerpc-netbsd"
39+ "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd"
2940
30− "riscv32-linux" "riscv64-linux"
41+ # none
42+ "aarch64_be-none" "aarch64-none" "arm-none" "armv6l-none" "avr-none" "i686-none"
43+ "msp430-none" "or1k-none" "m68k-none" "powerpc-none" "powerpcle-none"
44+ "riscv32-none" "riscv64-none" "s390-none" "s390x-none" "vc4-none"
45+ "x86_64-none"
3146
32− "arm-none" "armv6l-none" "aarch64-none"
33− "avr-none"
34− "i686-none" "x86_64-none"
35− "powerpc-none"
36− "msp430-none"
37− "riscv64-none" "riscv32-none"
38− "vc4-none"
39− "or1k-none"
47+ # OpenBSD
48+ "i686-openbsd" "x86_64-openbsd"
4049
41− "mmix-mmixware"
50+ # Redox
51+ "x86_64-redox"
4252
43− "js-ghcjs"
53+ # WASI
54+ "wasm64-wasi" "wasm32-wasi"
4455
45− "aarch64-genode" "i686-genode" "x86_64-genode"
56+ # Windows
57+ "x86_64-windows" "i686-windows"
4658 ];
4759
4860 allParsed = map parse.mkSystemFromString all;
@@ -62,8 +74,12 @@ in {
6274 mips = filterDoubles predicates.isMips;
6375 mmix = filterDoubles predicates.isMmix;
6476 riscv = filterDoubles predicates.isRiscV;
77+ riscv32 = filterDoubles predicates.isRiscV32;
78+ riscv64 = filterDoubles predicates.isRiscV64;
6579 vc4 = filterDoubles predicates.isVc4;
6680 or1k = filterDoubles predicates.isOr1k;
81+ m68k = filterDoubles predicates.isM68k;
82+ s390 = filterDoubles predicates.isS390;
6783 js = filterDoubles predicates.isJavaScript;
6884
6985 bigEndian = filterDoubles predicates.isBigEndian;
@@ -73,7 +89,11 @@ in {
7389 darwin = filterDoubles predicates.isDarwin;
7490 freebsd = filterDoubles predicates.isFreeBSD;
7591 # Should be better, but MinGW is unclear.
76− gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv1; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv2; });
92+ gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; })
93+ ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; })
94+ ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; })
95+ ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnuabin32; })
96+ ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnuabi64; });
7797 illumos = filterDoubles predicates.isSunOS;
7898 linux = filterDoubles predicates.isLinux;
7999 netbsd = filterDoubles predicates.isNetBSD;
@@ -86,5 +106,5 @@ in {
86106
87107 embedded = filterDoubles predicates.isNone;
88108
89− mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux"];
109+ mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux" "aarch64-darwin" "riscv64-linux"];
90110}
lib/systems/examples.nix+70−8
@@ -21,14 +21,10 @@ rec {
2121 config = "powerpc64le-unknown-linux-musl";
2222 };
2323
24− ppc64-elfv1 = {
25− config = "powerpc64-unknown-linux-elfv1";
26− };
27− ppc64-elfv2 = {
28− config = "powerpc64-unknown-linux-elfv2";
24+ ppc64 = {
25+ config = "powerpc64-unknown-linux-gnu";
26+ gcc = { abi = "elfv2"; }; # for gcc configuration
2927 };
30− ppc64 = ppc64-elfv2; # default to modern elfv2
31−
3228 ppc64-musl = {
3329 config = "powerpc64-unknown-linux-musl";
3430 gcc = { abi = "elfv2"; }; # for gcc configuration
@@ -60,6 +56,7 @@ rec {
6056
6157 armv7a-android-prebuilt = {
6258 config = "armv7a-unknown-linux-androideabi";
59+ rustc.config = "armv7-linux-androideabi";
6360 sdkVer = "29";
6461 ndkVer = "21";
6562 useAndroidPrebuilt = true;
@@ -67,11 +64,21 @@ rec {
6764
6865 aarch64-android-prebuilt = {
6966 config = "aarch64-unknown-linux-android";
67+ rustc.config = "aarch64-linux-android";
7068 sdkVer = "29";
7169 ndkVer = "21";
7270 useAndroidPrebuilt = true;
7371 };
7472
73+ aarch64-android = {
74+ config = "aarch64-unknown-linux-android";
75+ sdkVer = "30";
76+ ndkVer = "21";
77+ libc = "bionic";
78+ useAndroidPrebuilt = false;
79+ useLLVM = true;
80+ };
81+
7582 scaleway-c1 = armv7l-hf-multiplatform // platforms.scaleway-c1;
7683
7784 pogoplug4 = {
@@ -86,6 +93,26 @@ rec {
8693 config = "mipsel-unknown-linux-gnu";
8794 } // platforms.fuloong2f_n32;
8895
96+ # MIPS ABI table transcribed from here: https://wiki.debian.org/Multiarch/Tuples
97+
98+ # can execute on 32bit chip
99+ mips-linux-gnu = { config = "mips-linux-gnu"; } // platforms.gcc_mips32r2_o32;
100+ mipsel-linux-gnu = { config = "mipsel-linux-gnu"; } // platforms.gcc_mips32r2_o32;
101+ mipsisa32r6-linux-gnu = { config = "mipsisa32r6-linux-gnu"; } // platforms.gcc_mips32r6_o32;
102+ mipsisa32r6el-linux-gnu = { config = "mipsisa32r6el-linux-gnu"; } // platforms.gcc_mips32r6_o32;
103+
104+ # require 64bit chip (for more registers, 64-bit floating point, 64-bit "long long") but use 32bit pointers
105+ mips64-linux-gnuabin32 = { config = "mips64-linux-gnuabin32"; } // platforms.gcc_mips64r2_n32;
106+ mips64el-linux-gnuabin32 = { config = "mips64el-linux-gnuabin32"; } // platforms.gcc_mips64r2_n32;
107+ mipsisa64r6-linux-gnuabin32 = { config = "mipsisa64r6-linux-gnuabin32"; } // platforms.gcc_mips64r6_n32;
108+ mipsisa64r6el-linux-gnuabin32 = { config = "mipsisa64r6el-linux-gnuabin32"; } // platforms.gcc_mips64r6_n32;
109+
110+ # 64bit pointers
111+ mips64-linux-gnuabi64 = { config = "mips64-linux-gnuabi64"; } // platforms.gcc_mips64r2_64;
112+ mips64el-linux-gnuabi64 = { config = "mips64el-linux-gnuabi64"; } // platforms.gcc_mips64r2_64;
113+ mipsisa64r6-linux-gnuabi64 = { config = "mipsisa64r6-linux-gnuabi64"; } // platforms.gcc_mips64r6_64;
114+ mipsisa64r6el-linux-gnuabi64 = { config = "mipsisa64r6el-linux-gnuabi64"; } // platforms.gcc_mips64r6_64;
115+
89116 muslpi = raspberryPi // {
90117 config = "armv6l-unknown-linux-musleabihf";
91118 };
@@ -137,6 +164,18 @@ rec {
137164 libc = "newlib";
138165 };
139166
167+ m68k = {
168+ config = "m68k-unknown-linux-gnu";
169+ };
170+
171+ s390 = {
172+ config = "s390-unknown-linux-gnu";
173+ };
174+
175+ s390x = {
176+ config = "s390x-unknown-linux-gnu";
177+ };
178+
140179 arm-embedded = {
141180 config = "arm-none-eabi";
142181 libc = "newlib";
@@ -219,6 +258,7 @@ rec {
219258 sdkVer = "14.3";
220259 xcodeVer = "12.3";
221260 xcodePlatform = "iPhoneSimulator";
261+ darwinPlatform = "ios-simulator";
222262 useiOSPrebuilt = true;
223263 };
224264
@@ -228,9 +268,22 @@ rec {
228268 sdkVer = "14.3";
229269 xcodeVer = "12.3";
230270 xcodePlatform = "iPhoneSimulator";
271+ darwinPlatform = "ios-simulator";
231272 useiOSPrebuilt = true;
232273 };
233274
275+ aarch64-darwin = {
276+ config = "aarch64-apple-darwin";
277+ xcodePlatform = "MacOSX";
278+ platform = {};
279+ };
280+
281+ x86_64-darwin = {
282+ config = "x86_64-apple-darwin";
283+ xcodePlatform = "MacOSX";
284+ platform = {};
285+ };
286+
234287 #
235288 # Windows
236289 #
@@ -250,11 +303,20 @@ rec {
250303
251304 # BSDs
252305
253− amd64-netbsd = {
306+ amd64-netbsd = lib.warn "The amd64-netbsd system example is deprecated. Use x86_64-netbsd instead." x86_64-netbsd;
307+
308+ x86_64-netbsd = {
254309 config = "x86_64-unknown-netbsd";
255310 libc = "nblibc";
256311 };
257312
313+ # this is broken and never worked fully
314+ x86_64-netbsd-llvm = {
315+ config = "x86_64-unknown-netbsd";
316+ libc = "nblibc";
317+ useLLVM = true;
318+ };
319+
258320 #
259321 # WASM
260322 #
lib/systems/inspect.nix+11−1
@@ -13,12 +13,19 @@ rec {
1313 isx86_64 = { cpu = { family = "x86"; bits = 64; }; };
1414 isPowerPC = { cpu = cpuTypes.powerpc; };
1515 isPower = { cpu = { family = "power"; }; };
16+ isPower64 = { cpu = { family = "power"; bits = 64; }; };
1617 isx86 = { cpu = { family = "x86"; }; };
1718 isAarch32 = { cpu = { family = "arm"; bits = 32; }; };
1819 isAarch64 = { cpu = { family = "arm"; bits = 64; }; };
1920 isMips = { cpu = { family = "mips"; }; };
21+ isMips32 = { cpu = { family = "mips"; bits = 32; }; };
22+ isMips64 = { cpu = { family = "mips"; bits = 64; }; };
23+ isMips64n32 = { cpu = { family = "mips"; bits = 64; }; abi = { abi = "n32"; }; };
24+ isMips64n64 = { cpu = { family = "mips"; bits = 64; }; abi = { abi = "64"; }; };
2025 isMmix = { cpu = { family = "mmix"; }; };
2126 isRiscV = { cpu = { family = "riscv"; }; };
27+ isRiscV32 = { cpu = { family = "riscv"; bits = 32; }; };
28+ isRiscV64 = { cpu = { family = "riscv"; bits = 64; }; };
2229 isSparc = { cpu = { family = "sparc"; }; };
2330 isWasm = { cpu = { family = "wasm"; }; };
2431 isMsp430 = { cpu = { family = "msp430"; }; };
@@ -26,6 +33,8 @@ rec {
2633 isAvr = { cpu = { family = "avr"; }; };
2734 isAlpha = { cpu = { family = "alpha"; }; };
2835 isOr1k = { cpu = { family = "or1k"; }; };
36+ isM68k = { cpu = { family = "m68k"; }; };
37+ isS390 = { cpu = { family = "s390"; }; };
2938 isJavaScript = { cpu = cpuTypes.js; };
3039
3140 is32bit = { cpu = { bits = 32; }; };
@@ -54,7 +63,8 @@ rec {
5463 isNone = { kernel = kernels.none; };
5564
5665 isAndroid = [ { abi = abis.android; } { abi = abis.androideabi; } ];
57− isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ];
66+ isGnu = with abis; map (a: { abi = a; }) [ gnuabi64 gnu gnueabi gnueabihf ];
67+ isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf muslabin32 muslabi64 ];
5868 isUClibc = with abis; map (a: { abi = a; }) [ uclibc uclibceabi uclibceabihf ];
5969
6070 isEfi = map (family: { cpu.family = family; })
lib/systems/parse.nix+42−21
@@ -95,6 +95,8 @@ rec {
9595
9696 mmix = { bits = 64; significantByte = bigEndian; family = "mmix"; };
9797
98+ m68k = { bits = 32; significantByte = bigEndian; family = "m68k"; };
99+
98100 powerpc = { bits = 32; significantByte = bigEndian; family = "power"; };
99101 powerpc64 = { bits = 64; significantByte = bigEndian; family = "power"; };
100102 powerpc64le = { bits = 64; significantByte = littleEndian; family = "power"; };
@@ -103,6 +105,9 @@ rec {
103105 riscv32 = { bits = 32; significantByte = littleEndian; family = "riscv"; };
104106 riscv64 = { bits = 64; significantByte = littleEndian; family = "riscv"; };
105107
108+ s390 = { bits = 32; significantByte = bigEndian; family = "s390"; };
109+ s390x = { bits = 64; significantByte = bigEndian; family = "s390"; };
110+
106111 sparc = { bits = 32; significantByte = bigEndian; family = "sparc"; };
107112 sparc64 = { bits = 64; significantByte = bigEndian; family = "sparc"; };
108113
@@ -121,15 +126,29 @@ rec {
121126 js = { bits = 32; significantByte = littleEndian; family = "js"; };
122127 };
123128
124− # Determine where two CPUs are compatible with each other. That is,
125− # can we run code built for system b on system a? For that to
126− # happen, then the set of all possible possible programs that system
127− # b accepts must be a subset of the set of all programs that system
128− # a accepts. This compatibility relation forms a category where each
129− # CPU is an object and each arrow from a to b represents
130− # compatibility. CPUs with multiple modes of Endianness are
131− # isomorphic while all CPUs are endomorphic because any program
132− # built for a CPU can run on that CPU.
129+ # GNU build systems assume that older NetBSD architectures are using a.out.
130+ gnuNetBSDDefaultExecFormat = cpu:
131+ if (cpu.family == "arm" && cpu.bits == 32) ||
132+ (cpu.family == "sparc" && cpu.bits == 32) ||
133+ (cpu.family == "m68k" && cpu.bits == 32) ||
134+ (cpu.family == "x86" && cpu.bits == 32)
135+ then execFormats.aout
136+ else execFormats.elf;
137+
138+ # Determine when two CPUs are compatible with each other. That is,
139+ # can code built for system B run on system A? For that to happen,
140+ # the programs that system B accepts must be a subset of the
141+ # programs that system A accepts.
142+ #
143+ # We have the following properties of the compatibility relation,
144+ # which must be preserved when adding compatibility information for
145+ # additional CPUs.
146+ # - (reflexivity)
147+ # Every CPU is compatible with itself.
148+ # - (transitivity)
149+ # If A is compatible with B and B is compatible with C then A is compatible with C.
150+ # - (compatible under multiple endianness)
151+ # CPUs with multiple modes of endianness are pairwise compatible.
133152 isCompatible = a: b: with cpuTypes; lib.any lib.id [
134153 # x86
135154 (b == i386 && isCompatible a i486)
@@ -271,7 +290,7 @@ rec {
271290
272291 kernels = with execFormats; with kernelFamilies; setTypes types.openKernel {
273292 # TODO(@Ericson2314): Don't want to mass-rebuild yet to keeping 'darwin' as
274− # the nnormalized name for macOS.
293+ # the normalized name for macOS.
275294 macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; };
276295 ios = { execFormat = macho; families = { inherit darwin; }; };
277296 freebsd = { execFormat = elf; families = { inherit bsd; }; };
@@ -337,24 +356,23 @@ rec {
337356 The "gnu" ABI is ambiguous on 32-bit ARM. Use "gnueabi" or "gnueabihf" instead.
338357 '';
339358 }
340− { assertion = platform: platform.system != "powerpc64-linux";
341− message = ''
342− The "gnu" ABI is ambiguous on big-endian 64-bit PPC. Use "elfv1" or "elfv2" instead.
343− '';
344− }
345359 ];
346360 };
347361 gnuabi64 = { abi = "64"; };
362+ muslabi64 = { abi = "64"; };
348363
349− elfv1 = { abi = "elfv1"; };
350− elfv2 = { abi = "elfv2"; };
364+ # NOTE: abi=n32 requires a 64-bit MIPS chip! That is not a typo.
365+ # It is basically the 64-bit abi with 32-bit pointers. Details:
366+ # https://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf
367+ gnuabin32 = { abi = "n32"; };
368+ muslabin32 = { abi = "n32"; };
351369
352370 musleabi = { float = "soft"; };
353371 musleabihf = { float = "hard"; };
354372 musl = {};
355373
356− uclibceabihf = { float = "soft"; };
357− uclibceabi = { float = "hard"; };
374+ uclibceabi = { float = "soft"; };
375+ uclibceabihf = { float = "hard"; };
358376 uclibc = {};
359377
360378 unknown = {};
@@ -452,7 +470,6 @@ rec {
452470 if lib.versionAtLeast (parsed.cpu.version or "0") "6"
453471 then abis.gnueabihf
454472 else abis.gnueabi
455− else if cpu == "powerpc64" then abis.elfv2
456473 else abis.gnu
457474 else abis.unknown;
458475 };
@@ -467,8 +484,12 @@ rec {
467484 else "${cpu.name}-${kernel.name}";
468485
469486 tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let
487+ optExecFormat =
488+ lib.optionalString (kernel.name == "netbsd" &&
489+ gnuNetBSDDefaultExecFormat cpu != kernel.execFormat)
490+ kernel.execFormat.name;
470491 optAbi = lib.optionalString (abi != abis.unknown) "-${abi.name}";
471− in "${cpu.name}-${vendor.name}-${kernel.name}${optAbi}";
492+ in "${cpu.name}-${vendor.name}-${kernel.name}${optExecFormat}${optAbi}";
472493
473494 ################################################################################
474495
lib/systems/platforms.nix+73−8
@@ -1,3 +1,10 @@
1+# Note: lib/systems/default.nix takes care of producing valid,
2+# fully-formed "platform" values (e.g. hostPlatform, buildPlatform,
3+# targetPlatform, etc) containing at least the minimal set of attrs
4+# required (see types.parsedPlatform in lib/systems/parse.nix). This
5+# file takes an already-valid platform and further elaborates it with
6+# optional fields; currently these are: linux-kernel, gcc, and rustc.
7+
18{ lib }:
29rec {
310 pc = {
@@ -20,15 +27,17 @@ rec {
2027 name = "PowerNV";
2128
2229 baseConfig = "powernv_defconfig";
23− target = "zImage";
24− installTarget = "install";
25− file = "vmlinux";
30+ target = "vmlinux";
2631 autoModules = true;
2732 # avoid driver/FS trouble arising from unusual page size
2833 extraConfig = ''
2934 PPC_64K_PAGES n
3035 PPC_4K_PAGES y
3136 IPV6 y
37+
38+ ATA_BMDMA y
39+ ATA_SFF y
40+ VIRTIO_MENU y
3241 '';
3342 };
3443 };
@@ -233,7 +242,7 @@ rec {
233242 };
234243 };
235244
236− scaleway-c1 = lib.recursiveUpdate armv7l-hf-multiplatform {
245+ scaleway-c1 = armv7l-hf-multiplatform // {
237246 gcc = {
238247 cpu = "cortex-a9";
239248 fpu = "vfpv3";
@@ -315,6 +324,12 @@ rec {
315324 # Disable OABI to have seccomp_filter (required for systemd)
316325 # https://github.com/raspberrypi/firmware/issues/651
317326 OABI_COMPAT n
327+
328+ # >=5.12 fails with:
329+ # drivers/net/ethernet/micrel/ks8851_common.o: in function `ks8851_probe_common':
330+ # ks8851_common.c:(.text+0x179c): undefined reference to `__this_module'
331+ # See: https://lore.kernel.org/netdev/20210116164828.40545-1-marex@denx.de/T/
332+ KS8851_MLL y
318333 '';
319334 };
320335 gcc = {
@@ -375,6 +390,13 @@ rec {
375390 };
376391 };
377392
393+ apple-m1 = {
394+ gcc = {
395+ arch = "armv8.3-a+crypto+sha2+aes+crc+fp16+lse+simd+ras+rdm+rcpc";
396+ cpu = "apple-a13";
397+ };
398+ };
399+
378400 ##
379401 ## MIPS
380402 ##
@@ -467,6 +489,43 @@ rec {
467489 };
468490 };
469491
492+ # can execute on 32bit chip
493+ gcc_mips32r2_o32 = { gcc = { arch = "mips32r2"; abi = "o32"; }; };
494+ gcc_mips32r6_o32 = { gcc = { arch = "mips32r6"; abi = "o32"; }; };
495+ gcc_mips64r2_n32 = { gcc = { arch = "mips64r2"; abi = "n32"; }; };
496+ gcc_mips64r6_n32 = { gcc = { arch = "mips64r6"; abi = "n32"; }; };
497+ gcc_mips64r2_64 = { gcc = { arch = "mips64r2"; abi = "64"; }; };
498+ gcc_mips64r6_64 = { gcc = { arch = "mips64r6"; abi = "64"; }; };
499+
500+ # based on:
501+ # https://www.mail-archive.com/qemu-discuss@nongnu.org/msg05179.html
502+ # https://gmplib.org/~tege/qemu.html#mips64-debian
503+ mips64el-qemu-linux-gnuabi64 = {
504+ linux-kernel = {
505+ name = "mips64el";
506+ baseConfig = "64r2el_defconfig";
507+ target = "vmlinuz";
508+ autoModules = false;
509+ DTB = true;
510+ # for qemu 9p passthrough filesystem
511+ extraConfig = ''
512+ MIPS_MALTA y
513+ PAGE_SIZE_4KB y
514+ CPU_LITTLE_ENDIAN y
515+ CPU_MIPS64_R2 y
516+ 64BIT y
517+ CPU_MIPS64_R2 y
518+
519+ NET_9P y
520+ NET_9P_VIRTIO y
521+ 9P_FS y
522+ 9P_FS_POSIX_ACL y
523+ PCI y
524+ VIRTIO_PCI y
525+ '';
526+ };
527+ };
528+
470529 ##
471530 ## Other
472531 ##
@@ -474,16 +533,19 @@ rec {
474533 riscv-multiplatform = {
475534 linux-kernel = {
476535 name = "riscv-multiplatform";
477− target = "vmlinux";
536+ target = "Image";
478537 autoModules = true;
479538 baseConfig = "defconfig";
539+ DTB = true;
480540 extraConfig = ''
481− FTRACE n
482541 SERIAL_OF_PLATFORM y
483542 '';
484543 };
485544 };
486545
546+ # This function takes a minimally-valid "platform" and returns an
547+ # attrset containing zero or more additional attrs which should be
548+ # included in the platform in order to further elaborate it.
487549 select = platform:
488550 # x86
489551 /**/ if platform.isx86 then pc
@@ -495,7 +557,10 @@ rec {
495557 else if lib.versionOlder version "6" then sheevaplug
496558 else if lib.versionOlder version "7" then raspberrypi
497559 else armv7l-hf-multiplatform
498− else if platform.isAarch64 then aarch64-multiplatform
560+
561+ else if platform.isAarch64 then
562+ if platform.isDarwin then apple-m1
563+ else aarch64-multiplatform
499564
500565 else if platform.isRiscV then riscv-multiplatform
501566
@@ -503,5 +568,5 @@ rec {
503568
504569 else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv
505570
506− else pc;
571+ else { };
507572}
lib/systems/supported.nixnew file+26
@@ -0,0 +1,26 @@
1+# Supported systems according to RFC0046's definition.
2+#
3+# https://github.com/NixOS/rfcs/blob/master/rfcs/0046-platform-support-tiers.md
4+{ lib }:
5+rec {
6+ # List of systems that are built by Hydra.
7+ hydra = tier1 ++ tier2 ++ tier3 ++ [
8+ "aarch64-darwin"
9+ ];
10+
11+ tier1 = [
12+ "x86_64-linux"
13+ ];
14+
15+ tier2 = [
16+ "aarch64-linux"
17+ "x86_64-darwin"
18+ ];
19+
20+ tier3 = [
21+ "armv6l-linux"
22+ "armv7l-linux"
23+ "i686-linux"
24+ "mipsel-linux"
25+ ];
26+}
lib/tests/flakes/subflakeTest/flake.nixnew file+8
@@ -0,0 +1,8 @@
1+{
2+ outputs = { self, subflake, callLocklessFlake }: rec {
3+ x = (callLocklessFlake {
4+ path = subflake;
5+ inputs = {};
6+ }).subflakeOutput;
7+ };
8+}
lib/tests/flakes/subflakeTest/subflake/flake.nixnew file+5
@@ -0,0 +1,5 @@
1+{
2+ outputs = { self }: {
3+ subflakeOutput = 1;
4+ };
5+}
lib/tests/maintainers.nix+6−2
@@ -16,6 +16,10 @@ let
1616 email = lib.mkOption {
1717 type = types.str;
1818 };
19+ matrix = lib.mkOption {
20+ type = types.nullOr types.str;
21+ default = null;
22+ };
1923 github = lib.mkOption {
2024 type = types.nullOr types.str;
2125 default = null;
@@ -61,9 +65,9 @@ let
6165
6266 missingGithubIds = lib.concatLists (lib.mapAttrsToList checkMaintainer lib.maintainers);
6367
64− success = pkgs.runCommandNoCC "checked-maintainers-success" {} ">$out";
68+ success = pkgs.runCommand "checked-maintainers-success" {} ">$out";
6569
66− failure = pkgs.runCommandNoCC "checked-maintainers-failure" {
70+ failure = pkgs.runCommand "checked-maintainers-failure" {
6771 nativeBuildInputs = [ pkgs.curl pkgs.jq ];
6872 outputHash = "sha256:${lib.fakeSha256}";
6973 outputHAlgo = "sha256";
lib/tests/misc.nix+464−2
@@ -22,6 +22,15 @@ in
2222
2323runTests {
2424
25+# FLAKES
26+
27+ testCallLocklessFlake = {
28+ expr = callLocklessFlake {
29+ path = ./flakes/subflakeTest;
30+ inputs = { subflake = ./flakes/subflakeTest/subflake; inherit callLocklessFlake; };
31+ };
32+ expected = { x = 1; outPath = ./flakes/subflakeTest; };
33+ };
2534
2635# TRIVIAL
2736
@@ -132,6 +141,16 @@ runTests {
132141 expected = [ 1 1 0 ];
133142 };
134143
144+ testFunctionArgsFunctor = {
145+ expr = functionArgs { __functor = self: { a, b }: null; };
146+ expected = { a = false; b = false; };
147+ };
148+
149+ testFunctionArgsSetFunctionArgs = {
150+ expr = functionArgs (setFunctionArgs (args: args.x) { x = false; });
151+ expected = { x = false; };
152+ };
153+
135154# STRINGS
136155
137156 testConcatMapStrings = {
@@ -236,6 +255,61 @@ runTests {
236255 };
237256 };
238257
258+ testEscapeXML = {
259+ expr = escapeXML ''"test" 'test' < & >'';
260+ expected = ""test" 'test' < & >";
261+ };
262+
263+ testToShellVars = {
264+ expr = ''
265+ ${toShellVars {
266+ STRing01 = "just a 'string'";
267+ _array_ = [ "with" "more strings" ];
268+ assoc."with some" = ''
269+ strings
270+ possibly newlines
271+ '';
272+ }}
273+ '';
274+ expected = ''
275+ STRing01='just a '\'''string'\''''
276+ declare -a _array_=('with' 'more strings')
277+ declare -A assoc=(['with some']='strings
278+ possibly newlines
279+ ')
280+ '';
281+ };
282+
283+ testHasInfixFalse = {
284+ expr = hasInfix "c" "abde";
285+ expected = false;
286+ };
287+
288+ testHasInfixTrue = {
289+ expr = hasInfix "c" "abcde";
290+ expected = true;
291+ };
292+
293+ testHasInfixDerivation = {
294+ expr = hasInfix "hello" (import ../.. { system = "x86_64-linux"; }).hello;
295+ expected = true;
296+ };
297+
298+ testHasInfixPath = {
299+ expr = hasInfix "tests" ./.;
300+ expected = true;
301+ };
302+
303+ testHasInfixPathStoreDir = {
304+ expr = hasInfix builtins.storeDir ./.;
305+ expected = true;
306+ };
307+
308+ testHasInfixToString = {
309+ expr = hasInfix "a" { __toString = _: "a"; };
310+ expected = true;
311+ };
312+
239313# LISTS
240314
241315 testFilter = {
@@ -456,6 +530,66 @@ runTests {
456530 '';
457531 };
458532
533+ testToINIWithGlobalSectionEmpty = {
534+ expr = generators.toINIWithGlobalSection {} {
535+ globalSection = {
536+ };
537+ sections = {
538+ };
539+ };
540+ expected = ''
541+ '';
542+ };
543+
544+ testToINIWithGlobalSectionGlobalEmptyIsTheSameAsToINI =
545+ let
546+ sections = {
547+ "section 1" = {
548+ attribute1 = 5;
549+ x = "Me-se JarJar Binx";
550+ };
551+ "foo" = {
552+ "he\\h=he" = "this is okay";
553+ };
554+ };
555+ in {
556+ expr =
557+ generators.toINIWithGlobalSection {} {
558+ globalSection = {};
559+ sections = sections;
560+ };
561+ expected = generators.toINI {} sections;
562+ };
563+
564+ testToINIWithGlobalSectionFull = {
565+ expr = generators.toINIWithGlobalSection {} {
566+ globalSection = {
567+ foo = "bar";
568+ test = false;
569+ };
570+ sections = {
571+ "section 1" = {
572+ attribute1 = 5;
573+ x = "Me-se JarJar Binx";
574+ };
575+ "foo" = {
576+ "he\\h=he" = "this is okay";
577+ };
578+ };
579+ };
580+ expected = ''
581+ foo=bar
582+ test=false
583+
584+ [foo]
585+ he\h\=he=this is okay
586+
587+ [section 1]
588+ attribute1=5
589+ x=Me-se JarJar Binx
590+ '';
591+ };
592+
459593 /* right now only invocation check */
460594 testToJSONSimple =
461595 let val = {
@@ -481,7 +615,7 @@ runTests {
481615
482616 testToPretty =
483617 let
484− deriv = derivation { name = "test"; builder = "/bin/sh"; system = builtins.currentSystem; };
618+ deriv = derivation { name = "test"; builder = "/bin/sh"; system = "aarch64-linux"; };
485619 in {
486620 expr = mapAttrs (const (generators.toPretty { multiline = false; })) rec {
487621 int = 42;
@@ -519,6 +653,25 @@ runTests {
519653 };
520654 };
521655
656+ testToPrettyLimit =
657+ let
658+ a.b = 1;
659+ a.c = a;
660+ in {
661+ expr = generators.toPretty { } (generators.withRecursion { throwOnDepthLimit = false; depthLimit = 2; } a);
662+ expected = "{\n b = 1;\n c = {\n b = \"<unevaluated>\";\n c = {\n b = \"<unevaluated>\";\n c = \"<unevaluated>\";\n };\n };\n}";
663+ };
664+
665+ testToPrettyLimitThrow =
666+ let
667+ a.b = 1;
668+ a.c = a;
669+ in {
670+ expr = (builtins.tryEval
671+ (generators.toPretty { } (generators.withRecursion { depthLimit = 2; } a))).success;
672+ expected = false;
673+ };
674+
522675 testToPrettyMultiline = {
523676 expr = mapAttrs (const (generators.toPretty { })) rec {
524677 list = [ 3 4 [ false ] ];
@@ -615,6 +768,11 @@ runTests {
615768 expected = "foo";
616769 };
617770
771+ testSanitizeDerivationNameUnicode = testSanitizeDerivationName {
772+ name = "fö";
773+ expected = "f-";
774+ };
775+
618776 testSanitizeDerivationNameAscii = testSanitizeDerivationName {
619777 name = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
620778 expected = "-+--.-0123456789-=-?-ABCDEFGHIJKLMNOPQRSTUVWXYZ-_-abcdefghijklmnopqrstuvwxyz-";
@@ -657,7 +815,7 @@ runTests {
657815
658816 locs = filter (o: ! o.internal) (optionAttrSetToDocList options);
659817 in map (o: o.loc) locs;
660− expected = [ [ "foo" ] [ "foo" "<name>" "bar" ] [ "foo" "bar" ] ];
818+ expected = [ [ "_module" "args" ] [ "foo" ] [ "foo" "<name>" "bar" ] [ "foo" "bar" ] ];
661819 };
662820
663821 testCartesianProductOfEmptySet = {
@@ -727,4 +885,308 @@ runTests {
727885 { a = 3; b = 30; c = 300; }
728886 ];
729887 };
888+
889+ # The example from the showAttrPath documentation
890+ testShowAttrPathExample = {
891+ expr = showAttrPath [ "foo" "10" "bar" ];
892+ expected = "foo.\"10\".bar";
893+ };
894+
895+ testShowAttrPathEmpty = {
896+ expr = showAttrPath [];
897+ expected = "<root attribute path>";
898+ };
899+
900+ testShowAttrPathVarious = {
901+ expr = showAttrPath [
902+ "."
903+ "foo"
904+ "2"
905+ "a2-b"
906+ "_bc'de"
907+ ];
908+ expected = ''".".foo."2".a2-b._bc'de'';
909+ };
910+
911+ testGroupBy = {
912+ expr = groupBy (n: toString (mod n 5)) (range 0 16);
913+ expected = {
914+ "0" = [ 0 5 10 15 ];
915+ "1" = [ 1 6 11 16 ];
916+ "2" = [ 2 7 12 ];
917+ "3" = [ 3 8 13 ];
918+ "4" = [ 4 9 14 ];
919+ };
920+ };
921+
922+ testGroupBy' = {
923+ expr = groupBy' builtins.add 0 (x: boolToString (x > 2)) [ 5 1 2 3 4 ];
924+ expected = { false = 3; true = 12; };
925+ };
926+
927+ # The example from the updateManyAttrsByPath documentation
928+ testUpdateManyAttrsByPathExample = {
929+ expr = updateManyAttrsByPath [
930+ {
931+ path = [ "a" "b" ];
932+ update = old: { d = old.c; };
933+ }
934+ {
935+ path = [ "a" "b" "c" ];
936+ update = old: old + 1;
937+ }
938+ {
939+ path = [ "x" "y" ];
940+ update = old: "xy";
941+ }
942+ ] { a.b.c = 0; };
943+ expected = { a = { b = { d = 1; }; }; x = { y = "xy"; }; };
944+ };
945+
946+ # If there are no updates, the value is passed through
947+ testUpdateManyAttrsByPathNone = {
948+ expr = updateManyAttrsByPath [] "something";
949+ expected = "something";
950+ };
951+
952+ # A single update to the root path is just like applying the function directly
953+ testUpdateManyAttrsByPathSingleIncrement = {
954+ expr = updateManyAttrsByPath [
955+ {
956+ path = [ ];
957+ update = old: old + 1;
958+ }
959+ ] 0;
960+ expected = 1;
961+ };
962+
963+ # Multiple updates can be applied are done in order
964+ testUpdateManyAttrsByPathMultipleIncrements = {
965+ expr = updateManyAttrsByPath [
966+ {
967+ path = [ ];
968+ update = old: old + "a";
969+ }
970+ {
971+ path = [ ];
972+ update = old: old + "b";
973+ }
974+ {
975+ path = [ ];
976+ update = old: old + "c";
977+ }
978+ ] "";
979+ expected = "abc";
980+ };
981+
982+ # If an update doesn't use the value, all previous updates are not evaluated
983+ testUpdateManyAttrsByPathLazy = {
984+ expr = updateManyAttrsByPath [
985+ {
986+ path = [ ];
987+ update = old: old + throw "nope";
988+ }
989+ {
990+ path = [ ];
991+ update = old: "untainted";
992+ }
993+ ] (throw "start");
994+ expected = "untainted";
995+ };
996+
997+ # Deeply nested attributes can be updated without affecting others
998+ testUpdateManyAttrsByPathDeep = {
999+ expr = updateManyAttrsByPath [
1000+ {
1001+ path = [ "a" "b" "c" ];
1002+ update = old: old + 1;
1003+ }
1004+ ] {
1005+ a.b.c = 0;
1006+
1007+ a.b.z = 0;
1008+ a.y.z = 0;
1009+ x.y.z = 0;
1010+ };
1011+ expected = {
1012+ a.b.c = 1;
1013+
1014+ a.b.z = 0;
1015+ a.y.z = 0;
1016+ x.y.z = 0;
1017+ };
1018+ };
1019+
1020+ # Nested attributes are updated first
1021+ testUpdateManyAttrsByPathNestedBeforehand = {
1022+ expr = updateManyAttrsByPath [
1023+ {
1024+ path = [ "a" ];
1025+ update = old: old // { x = old.b; };
1026+ }
1027+ {
1028+ path = [ "a" "b" ];
1029+ update = old: old + 1;
1030+ }
1031+ ] {
1032+ a.b = 0;
1033+ };
1034+ expected = {
1035+ a.b = 1;
1036+ a.x = 1;
1037+ };
1038+ };
1039+
1040+ ## Levenshtein distance functions and co.
1041+ testCommonPrefixLengthEmpty = {
1042+ expr = strings.commonPrefixLength "" "hello";
1043+ expected = 0;
1044+ };
1045+
1046+ testCommonPrefixLengthSame = {
1047+ expr = strings.commonPrefixLength "hello" "hello";
1048+ expected = 5;
1049+ };
1050+
1051+ testCommonPrefixLengthDiffering = {
1052+ expr = strings.commonPrefixLength "hello" "hey";
1053+ expected = 2;
1054+ };
1055+
1056+ testCommonSuffixLengthEmpty = {
1057+ expr = strings.commonSuffixLength "" "hello";
1058+ expected = 0;
1059+ };
1060+
1061+ testCommonSuffixLengthSame = {
1062+ expr = strings.commonSuffixLength "hello" "hello";
1063+ expected = 5;
1064+ };
1065+
1066+ testCommonSuffixLengthDiffering = {
1067+ expr = strings.commonSuffixLength "test" "rest";
1068+ expected = 3;
1069+ };
1070+
1071+ testLevenshteinEmpty = {
1072+ expr = strings.levenshtein "" "";
1073+ expected = 0;
1074+ };
1075+
1076+ testLevenshteinOnlyAdd = {
1077+ expr = strings.levenshtein "" "hello there";
1078+ expected = 11;
1079+ };
1080+
1081+ testLevenshteinOnlyRemove = {
1082+ expr = strings.levenshtein "hello there" "";
1083+ expected = 11;
1084+ };
1085+
1086+ testLevenshteinOnlyTransform = {
1087+ expr = strings.levenshtein "abcdef" "ghijkl";
1088+ expected = 6;
1089+ };
1090+
1091+ testLevenshteinMixed = {
1092+ expr = strings.levenshtein "kitchen" "sitting";
1093+ expected = 5;
1094+ };
1095+
1096+ testLevenshteinAtMostZeroFalse = {
1097+ expr = strings.levenshteinAtMost 0 "foo" "boo";
1098+ expected = false;
1099+ };
1100+
1101+ testLevenshteinAtMostZeroTrue = {
1102+ expr = strings.levenshteinAtMost 0 "foo" "foo";
1103+ expected = true;
1104+ };
1105+
1106+ testLevenshteinAtMostOneFalse = {
1107+ expr = strings.levenshteinAtMost 1 "car" "ct";
1108+ expected = false;
1109+ };
1110+
1111+ testLevenshteinAtMostOneTrue = {
1112+ expr = strings.levenshteinAtMost 1 "car" "cr";
1113+ expected = true;
1114+ };
1115+
1116+ # We test levenshteinAtMost 2 particularly well because it uses a complicated
1117+ # implementation
1118+ testLevenshteinAtMostTwoIsEmpty = {
1119+ expr = strings.levenshteinAtMost 2 "" "";
1120+ expected = true;
1121+ };
1122+
1123+ testLevenshteinAtMostTwoIsZero = {
1124+ expr = strings.levenshteinAtMost 2 "abcdef" "abcdef";
1125+ expected = true;
1126+ };
1127+
1128+ testLevenshteinAtMostTwoIsOne = {
1129+ expr = strings.levenshteinAtMost 2 "abcdef" "abddef";
1130+ expected = true;
1131+ };
1132+
1133+ testLevenshteinAtMostTwoDiff0False = {
1134+ expr = strings.levenshteinAtMost 2 "abcdef" "aczyef";
1135+ expected = false;
1136+ };
1137+
1138+ testLevenshteinAtMostTwoDiff0Outer = {
1139+ expr = strings.levenshteinAtMost 2 "abcdef" "zbcdez";
1140+ expected = true;
1141+ };
1142+
1143+ testLevenshteinAtMostTwoDiff0DelLeft = {
1144+ expr = strings.levenshteinAtMost 2 "abcdef" "bcdefz";
1145+ expected = true;
1146+ };
1147+
1148+ testLevenshteinAtMostTwoDiff0DelRight = {
1149+ expr = strings.levenshteinAtMost 2 "abcdef" "zabcde";
1150+ expected = true;
1151+ };
1152+
1153+ testLevenshteinAtMostTwoDiff1False = {
1154+ expr = strings.levenshteinAtMost 2 "abcdef" "bddez";
1155+ expected = false;
1156+ };
1157+
1158+ testLevenshteinAtMostTwoDiff1DelLeft = {
1159+ expr = strings.levenshteinAtMost 2 "abcdef" "bcdez";
1160+ expected = true;
1161+ };
1162+
1163+ testLevenshteinAtMostTwoDiff1DelRight = {
1164+ expr = strings.levenshteinAtMost 2 "abcdef" "zbcde";
1165+ expected = true;
1166+ };
1167+
1168+ testLevenshteinAtMostTwoDiff2False = {
1169+ expr = strings.levenshteinAtMost 2 "hello" "hxo";
1170+ expected = false;
1171+ };
1172+
1173+ testLevenshteinAtMostTwoDiff2True = {
1174+ expr = strings.levenshteinAtMost 2 "hello" "heo";
1175+ expected = true;
1176+ };
1177+
1178+ testLevenshteinAtMostTwoDiff3 = {
1179+ expr = strings.levenshteinAtMost 2 "hello" "ho";
1180+ expected = false;
1181+ };
1182+
1183+ testLevenshteinAtMostThreeFalse = {
1184+ expr = strings.levenshteinAtMost 3 "hello" "Holla!";
1185+ expected = false;
1186+ };
1187+
1188+ testLevenshteinAtMostThreeTrue = {
1189+ expr = strings.levenshteinAtMost 3 "hello" "Holla";
1190+ expected = true;
1191+ };
7301192}
lib/tests/modules.sh+182−120
@@ -1,8 +1,11 @@
1−#!/bin/sh
1+#!/usr/bin/env bash
22#
33# This script is used to test that the module system is working as expected.
44# By default it test the version of nixpkgs which is defined in the NIX_PATH.
55
6+set -o errexit -o noclobber -o nounset -o pipefail
7+shopt -s failglob inherit_errexit
8+
69# https://stackoverflow.com/a/246128/6605742
710DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
811
@@ -13,101 +16,103 @@ fail=0
1316
1417evalConfig() {
1518 local attr=$1
16− shift;
17− local script="import ./default.nix { modules = [ $@ ];}"
19+ shift
20+ local script="import ./default.nix { modules = [ $* ];}"
1821 nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only --show-trace --read-write-mode
1922}
2023
2124reportFailure() {
2225 local attr=$1
23− shift;
24− local script="import ./default.nix { modules = [ $@ ];}"
26+ shift
27+ local script="import ./default.nix { modules = [ $* ];}"
2528 echo 2>&1 "$ nix-instantiate -E '$script' -A '$attr' --eval-only"
26− evalConfig "$attr" "$@"
27− fail=$((fail + 1))
29+ evalConfig "$attr" "$@" || true
30+ ((++fail))
2831}
2932
3033checkConfigOutput() {
3134 local outputContains=$1
32− shift;
35+ shift
3336 if evalConfig "$@" 2>/dev/null | grep --silent "$outputContains" ; then
34− pass=$((pass + 1))
35− return 0;
37+ ((++pass))
3638 else
3739 echo 2>&1 "error: Expected result matching '$outputContains', while evaluating"
3840 reportFailure "$@"
39− return 1
4041 fi
4142}
4243
4344checkConfigError() {
4445 local errorContains=$1
4546 local err=""
46− shift;
47− if err==$(evalConfig "$@" 2>&1 >/dev/null); then
47+ shift
48+ if err="$(evalConfig "$@" 2>&1 >/dev/null)"; then
4849 echo 2>&1 "error: Expected error code, got exit code 0, while evaluating"
4950 reportFailure "$@"
50− return 1
5151 else
5252 if echo "$err" | grep -zP --silent "$errorContains" ; then
53− pass=$((pass + 1))
54− return 0;
53+ ((++pass))
5554 else
5655 echo 2>&1 "error: Expected error matching '$errorContains', while evaluating"
5756 reportFailure "$@"
58− return 1
5957 fi
6058 fi
6159}
6260
6361# Check boolean option.
64−checkConfigOutput "false" config.enable ./declare-enable.nix
65−checkConfigError 'The option .* does not exist. Definition values:\n- In .*: true' config.enable ./define-enable.nix
62+checkConfigOutput '^false$' config.enable ./declare-enable.nix
63+checkConfigError 'The option .* does not exist. Definition values:\n\s*- In .*: true' config.enable ./define-enable.nix
64+
65+checkConfigOutput '^1$' config.bare-submodule.nested ./declare-bare-submodule.nix ./declare-bare-submodule-nested-option.nix
66+checkConfigOutput '^2$' config.bare-submodule.deep ./declare-bare-submodule.nix ./declare-bare-submodule-deep-option.nix
67+checkConfigOutput '^42$' config.bare-submodule.nested ./declare-bare-submodule.nix ./declare-bare-submodule-nested-option.nix ./declare-bare-submodule-deep-option.nix ./define-bare-submodule-values.nix
68+checkConfigOutput '^420$' config.bare-submodule.deep ./declare-bare-submodule.nix ./declare-bare-submodule-nested-option.nix ./declare-bare-submodule-deep-option.nix ./define-bare-submodule-values.nix
69+checkConfigOutput '^2$' config.bare-submodule.deep ./declare-bare-submodule.nix ./declare-bare-submodule-deep-option.nix ./define-shorthandOnlyDefinesConfig-true.nix
70+checkConfigError 'The option .bare-submodule.deep. in .*/declare-bare-submodule-deep-option.nix. is already declared in .*/declare-bare-submodule-deep-option-duplicate.nix' config.bare-submodule.deep ./declare-bare-submodule.nix ./declare-bare-submodule-deep-option.nix ./declare-bare-submodule-deep-option-duplicate.nix
6671
6772# Check integer types.
6873# unsigned
69−checkConfigOutput "42" config.value ./declare-int-unsigned-value.nix ./define-value-int-positive.nix
70−checkConfigError 'A definition for option .* is not of type.*unsigned integer.*. Definition values:\n- In .*: -23' config.value ./declare-int-unsigned-value.nix ./define-value-int-negative.nix
74+checkConfigOutput '^42$' config.value ./declare-int-unsigned-value.nix ./define-value-int-positive.nix
75+checkConfigError 'A definition for option .* is not of type.*unsigned integer.*. Definition values:\n\s*- In .*: -23' config.value ./declare-int-unsigned-value.nix ./define-value-int-negative.nix
7176# positive
72−checkConfigError 'A definition for option .* is not of type.*positive integer.*. Definition values:\n- In .*: 0' config.value ./declare-int-positive-value.nix ./define-value-int-zero.nix
77+checkConfigError 'A definition for option .* is not of type.*positive integer.*. Definition values:\n\s*- In .*: 0' config.value ./declare-int-positive-value.nix ./define-value-int-zero.nix
7378# between
74−checkConfigOutput "42" config.value ./declare-int-between-value.nix ./define-value-int-positive.nix
75−checkConfigError 'A definition for option .* is not of type.*between.*-21 and 43.*inclusive.*. Definition values:\n- In .*: -23' config.value ./declare-int-between-value.nix ./define-value-int-negative.nix
79+checkConfigOutput '^42$' config.value ./declare-int-between-value.nix ./define-value-int-positive.nix
80+checkConfigError 'A definition for option .* is not of type.*between.*-21 and 43.*inclusive.*. Definition values:\n\s*- In .*: -23' config.value ./declare-int-between-value.nix ./define-value-int-negative.nix
7681
7782# Check either types
7883# types.either
79−checkConfigOutput "42" config.value ./declare-either.nix ./define-value-int-positive.nix
80−checkConfigOutput "\"24\"" config.value ./declare-either.nix ./define-value-string.nix
84+checkConfigOutput '^42$' config.value ./declare-either.nix ./define-value-int-positive.nix
85+checkConfigOutput '^"24"$' config.value ./declare-either.nix ./define-value-string.nix
8186# types.oneOf
82−checkConfigOutput "42" config.value ./declare-oneOf.nix ./define-value-int-positive.nix
83−checkConfigOutput "[ ]" config.value ./declare-oneOf.nix ./define-value-list.nix
84−checkConfigOutput "\"24\"" config.value ./declare-oneOf.nix ./define-value-string.nix
87+checkConfigOutput '^42$' config.value ./declare-oneOf.nix ./define-value-int-positive.nix
88+checkConfigOutput '^\[ \]$' config.value ./declare-oneOf.nix ./define-value-list.nix
89+checkConfigOutput '^"24"$' config.value ./declare-oneOf.nix ./define-value-string.nix
8590
8691# Check mkForce without submodules.
8792set -- config.enable ./declare-enable.nix ./define-enable.nix
88−checkConfigOutput "true" "$@"
89−checkConfigOutput "false" "$@" ./define-force-enable.nix
90−checkConfigOutput "false" "$@" ./define-enable-force.nix
93+checkConfigOutput '^true$' "$@"
94+checkConfigOutput '^false$' "$@" ./define-force-enable.nix
95+checkConfigOutput '^false$' "$@" ./define-enable-force.nix
9196
9297# Check mkForce with option and submodules.
9398checkConfigError 'attribute .*foo.* .* not found' config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix
94−checkConfigOutput 'false' config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix
99+checkConfigOutput '^false$' config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix
95100set -- config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo-enable.nix
96−checkConfigOutput 'true' "$@"
97−checkConfigOutput 'false' "$@" ./define-force-attrsOfSub-foo-enable.nix
98−checkConfigOutput 'false' "$@" ./define-attrsOfSub-force-foo-enable.nix
99−checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-force-enable.nix
100−checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-enable-force.nix
101+checkConfigOutput '^true$' "$@"
102+checkConfigOutput '^false$' "$@" ./define-force-attrsOfSub-foo-enable.nix
103+checkConfigOutput '^false$' "$@" ./define-attrsOfSub-force-foo-enable.nix
104+checkConfigOutput '^false$' "$@" ./define-attrsOfSub-foo-force-enable.nix
105+checkConfigOutput '^false$' "$@" ./define-attrsOfSub-foo-enable-force.nix
101106
102107# Check overriding effect of mkForce on submodule definitions.
103108checkConfigError 'attribute .*bar.* .* not found' config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix
104−checkConfigOutput 'false' config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix ./define-attrsOfSub-bar.nix
109+checkConfigOutput '^false$' config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix ./define-attrsOfSub-bar.nix
105110set -- config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix ./define-attrsOfSub-bar-enable.nix
106−checkConfigOutput 'true' "$@"
111+checkConfigOutput '^true$' "$@"
107112checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-force-attrsOfSub-foo-enable.nix
108113checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-attrsOfSub-force-foo-enable.nix
109−checkConfigOutput 'true' "$@" ./define-attrsOfSub-foo-force-enable.nix
110−checkConfigOutput 'true' "$@" ./define-attrsOfSub-foo-enable-force.nix
114+checkConfigOutput '^true$' "$@" ./define-attrsOfSub-foo-force-enable.nix
115+checkConfigOutput '^true$' "$@" ./define-attrsOfSub-foo-enable-force.nix
111116
112117# Check mkIf with submodules.
113118checkConfigError 'attribute .*foo.* .* not found' config.attrsOfSub.foo.enable ./declare-enable.nix ./declare-attrsOfSub-any-enable.nix
@@ -115,24 +120,24 @@ set -- config.attrsOfSub.foo.enable ./declare-enable.nix ./declare-attrsOfSub-an
115120checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-if-attrsOfSub-foo-enable.nix
116121checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-attrsOfSub-if-foo-enable.nix
117122checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-attrsOfSub-foo-if-enable.nix
118−checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-enable-if.nix
119−checkConfigOutput 'true' "$@" ./define-enable.nix ./define-if-attrsOfSub-foo-enable.nix
120−checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-if-foo-enable.nix
121−checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-foo-if-enable.nix
122−checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-foo-enable-if.nix
123+checkConfigOutput '^false$' "$@" ./define-attrsOfSub-foo-enable-if.nix
124+checkConfigOutput '^true$' "$@" ./define-enable.nix ./define-if-attrsOfSub-foo-enable.nix
125+checkConfigOutput '^true$' "$@" ./define-enable.nix ./define-attrsOfSub-if-foo-enable.nix
126+checkConfigOutput '^true$' "$@" ./define-enable.nix ./define-attrsOfSub-foo-if-enable.nix
127+checkConfigOutput '^true$' "$@" ./define-enable.nix ./define-attrsOfSub-foo-enable-if.nix
123128
124129# Check disabledModules with config definitions and option declarations.
125130set -- config.enable ./define-enable.nix ./declare-enable.nix
126−checkConfigOutput "true" "$@"
127−checkConfigOutput "false" "$@" ./disable-define-enable.nix
128−checkConfigError "The option .*enable.* does not exist. Definition values:\n- In .*: true" "$@" ./disable-declare-enable.nix
131+checkConfigOutput '^true$' "$@"
132+checkConfigOutput '^false$' "$@" ./disable-define-enable.nix
133+checkConfigError "The option .*enable.* does not exist. Definition values:\n\s*- In .*: true" "$@" ./disable-declare-enable.nix
129134checkConfigError "attribute .*enable.* in selection path .*config.enable.* not found" "$@" ./disable-define-enable.nix ./disable-declare-enable.nix
130135checkConfigError "attribute .*enable.* in selection path .*config.enable.* not found" "$@" ./disable-enable-modules.nix
131136
132137# Check _module.args.
133138set -- config.enable ./declare-enable.nix ./define-enable-with-custom-arg.nix
134139checkConfigError 'while evaluating the module argument .*custom.* in .*define-enable-with-custom-arg.nix.*:' "$@"
135−checkConfigOutput "true" "$@" ./define-_module-args-custom.nix
140+checkConfigOutput '^true$' "$@" ./define-_module-args-custom.nix
136141
137142# Check that using _module.args on imports cause infinite recursions, with
138143# the proper error context.
@@ -142,68 +147,78 @@ checkConfigError 'infinite recursion encountered' "$@"
142147
143148# Check _module.check.
144149set -- config.enable ./declare-enable.nix ./define-enable.nix ./define-attrsOfSub-foo.nix
145−checkConfigError 'The option .* does not exist. Definition values:\n- In .*' "$@"
146−checkConfigOutput "true" "$@" ./define-module-check.nix
150+checkConfigError 'The option .* does not exist. Definition values:\n\s*- In .*' "$@"
151+checkConfigOutput '^true$' "$@" ./define-module-check.nix
147152
148153# Check coerced value.
149−checkConfigOutput "\"42\"" config.value ./declare-coerced-value.nix
150−checkConfigOutput "\"24\"" config.value ./declare-coerced-value.nix ./define-value-string.nix
151−checkConfigError 'A definition for option .* is not.*string or signed integer convertible to it.*. Definition values:\n- In .*: \[ \]' config.value ./declare-coerced-value.nix ./define-value-list.nix
154+checkConfigOutput '^"42"$' config.value ./declare-coerced-value.nix
155+checkConfigOutput '^"24"$' config.value ./declare-coerced-value.nix ./define-value-string.nix
156+checkConfigError 'A definition for option .* is not.*string or signed integer convertible to it.*. Definition values:\n\s*- In .*: \[ \]' config.value ./declare-coerced-value.nix ./define-value-list.nix
152157
153158# Check coerced value with unsound coercion
154−checkConfigOutput "12" config.value ./declare-coerced-value-unsound.nix
155−checkConfigError 'A definition for option .* is not of type .*. Definition values:\n- In .*: "1000"' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix
156−checkConfigError 'unrecognised JSON value' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix
159+checkConfigOutput '^12$' config.value ./declare-coerced-value-unsound.nix
160+checkConfigError 'A definition for option .* is not of type .*. Definition values:\n\s*- In .*: "1000"' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix
161+checkConfigError 'json.exception.parse_error' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix
157162
158163# Check mkAliasOptionModule.
159−checkConfigOutput "true" config.enable ./alias-with-priority.nix
160−checkConfigOutput "true" config.enableAlias ./alias-with-priority.nix
161−checkConfigOutput "false" config.enable ./alias-with-priority-can-override.nix
162−checkConfigOutput "false" config.enableAlias ./alias-with-priority-can-override.nix
164+checkConfigOutput '^true$' config.enable ./alias-with-priority.nix
165+checkConfigOutput '^true$' config.enableAlias ./alias-with-priority.nix
166+checkConfigOutput '^false$' config.enable ./alias-with-priority-can-override.nix
167+checkConfigOutput '^false$' config.enableAlias ./alias-with-priority-can-override.nix
163168
164169# submoduleWith
165170
166171## specialArgs should work
167−checkConfigOutput "foo" config.submodule.foo ./declare-submoduleWith-special.nix
172+checkConfigOutput '^"foo"$' config.submodule.foo ./declare-submoduleWith-special.nix
168173
169174## shorthandOnlyDefines config behaves as expected
170−checkConfigOutput "true" config.submodule.config ./declare-submoduleWith-shorthand.nix ./define-submoduleWith-shorthand.nix
175+checkConfigOutput '^true$' config.submodule.config ./declare-submoduleWith-shorthand.nix ./define-submoduleWith-shorthand.nix
171176checkConfigError 'is not of type `boolean' config.submodule.config ./declare-submoduleWith-shorthand.nix ./define-submoduleWith-noshorthand.nix
172−checkConfigError 'value is a boolean while a set was expected' config.submodule.config ./declare-submoduleWith-noshorthand.nix ./define-submoduleWith-shorthand.nix
173−checkConfigOutput "true" config.submodule.config ./declare-submoduleWith-noshorthand.nix ./define-submoduleWith-noshorthand.nix
177+checkConfigError "You're trying to declare a value of type \`bool'\n\s*rather than an attribute-set for the option" config.submodule.config ./declare-submoduleWith-noshorthand.nix ./define-submoduleWith-shorthand.nix
178+checkConfigOutput '^true$' config.submodule.config ./declare-submoduleWith-noshorthand.nix ./define-submoduleWith-noshorthand.nix
174179
175180## submoduleWith should merge all modules in one swoop
176−checkConfigOutput "true" config.submodule.inner ./declare-submoduleWith-modules.nix
177−checkConfigOutput "true" config.submodule.outer ./declare-submoduleWith-modules.nix
181+checkConfigOutput '^true$' config.submodule.inner ./declare-submoduleWith-modules.nix
182+checkConfigOutput '^true$' config.submodule.outer ./declare-submoduleWith-modules.nix
183+# Should also be able to evaluate the type name (which evaluates freeformType,
184+# which evaluates all the modules defined by the type)
185+checkConfigOutput '^"submodule"$' options.submodule.type.description ./declare-submoduleWith-modules.nix
186+
187+## submodules can be declared using (evalModules {...}).type
188+checkConfigOutput '^true$' config.submodule.inner ./declare-submodule-via-evalModules.nix
189+checkConfigOutput '^true$' config.submodule.outer ./declare-submodule-via-evalModules.nix
190+# Should also be able to evaluate the type name (which evaluates freeformType,
191+# which evaluates all the modules defined by the type)
192+checkConfigOutput '^"submodule"$' options.submodule.type.description ./declare-submodule-via-evalModules.nix
178193
179194## Paths should be allowed as values and work as expected
180−checkConfigOutput "true" config.submodule.enable ./declare-submoduleWith-path.nix
195+checkConfigOutput '^true$' config.submodule.enable ./declare-submoduleWith-path.nix
181196
182197# Check that disabledModules works recursively and correctly
183−checkConfigOutput "true" config.enable ./disable-recursive/main.nix
184−checkConfigOutput "true" config.enable ./disable-recursive/{main.nix,disable-foo.nix}
185−checkConfigOutput "true" config.enable ./disable-recursive/{main.nix,disable-bar.nix}
186−checkConfigError 'The option .* does not exist. Definition values:\n- In .*: true' config.enable ./disable-recursive/{main.nix,disable-foo.nix,disable-bar.nix}
198+checkConfigOutput '^true$' config.enable ./disable-recursive/main.nix
199+checkConfigOutput '^true$' config.enable ./disable-recursive/{main.nix,disable-foo.nix}
200+checkConfigOutput '^true$' config.enable ./disable-recursive/{main.nix,disable-bar.nix}
201+checkConfigError 'The option .* does not exist. Definition values:\n\s*- In .*: true' config.enable ./disable-recursive/{main.nix,disable-foo.nix,disable-bar.nix}
187202
188203# Check that imports can depend on derivations
189−checkConfigOutput "true" config.enable ./import-from-store.nix
204+checkConfigOutput '^true$' config.enable ./import-from-store.nix
190205
191206# Check that configs can be conditional on option existence
192−checkConfigOutput true config.enable ./define-option-dependently.nix ./declare-enable.nix ./declare-int-positive-value.nix
193−checkConfigOutput 360 config.value ./define-option-dependently.nix ./declare-enable.nix ./declare-int-positive-value.nix
194−checkConfigOutput 7 config.value ./define-option-dependently.nix ./declare-int-positive-value.nix
195−checkConfigOutput true config.set.enable ./define-option-dependently-nested.nix ./declare-enable-nested.nix ./declare-int-positive-value-nested.nix
196−checkConfigOutput 360 config.set.value ./define-option-dependently-nested.nix ./declare-enable-nested.nix ./declare-int-positive-value-nested.nix
197−checkConfigOutput 7 config.set.value ./define-option-dependently-nested.nix ./declare-int-positive-value-nested.nix
207+checkConfigOutput '^true$' config.enable ./define-option-dependently.nix ./declare-enable.nix ./declare-int-positive-value.nix
208+checkConfigOutput '^360$' config.value ./define-option-dependently.nix ./declare-enable.nix ./declare-int-positive-value.nix
209+checkConfigOutput '^7$' config.value ./define-option-dependently.nix ./declare-int-positive-value.nix
210+checkConfigOutput '^true$' config.set.enable ./define-option-dependently-nested.nix ./declare-enable-nested.nix ./declare-int-positive-value-nested.nix
211+checkConfigOutput '^360$' config.set.value ./define-option-dependently-nested.nix ./declare-enable-nested.nix ./declare-int-positive-value-nested.nix
212+checkConfigOutput '^7$' config.set.value ./define-option-dependently-nested.nix ./declare-int-positive-value-nested.nix
198213
199214# Check attrsOf and lazyAttrsOf. Only lazyAttrsOf should be lazy, and only
200215# attrsOf should work with conditional definitions
201216# In addition, lazyAttrsOf should honor an options emptyValue
202217checkConfigError "is not lazy" config.isLazy ./declare-attrsOf.nix ./attrsOf-lazy-check.nix
203−checkConfigOutput "true" config.isLazy ./declare-lazyAttrsOf.nix ./attrsOf-lazy-check.nix
204−checkConfigOutput "true" config.conditionalWorks ./declare-attrsOf.nix ./attrsOf-conditional-check.nix
205−checkConfigOutput "false" config.conditionalWorks ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
206−checkConfigOutput "empty" config.value.foo ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
218+checkConfigOutput '^true$' config.isLazy ./declare-lazyAttrsOf.nix ./attrsOf-lazy-check.nix
219+checkConfigOutput '^true$' config.conditionalWorks ./declare-attrsOf.nix ./attrsOf-conditional-check.nix
220+checkConfigOutput '^false$' config.conditionalWorks ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
221+checkConfigOutput '^"empty"$' config.value.foo ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
207222
208223
209224# Even with multiple assignments, a type error should be thrown if any of them aren't valid
@@ -212,62 +227,109 @@ checkConfigError 'A definition for option .* is not of type .*' \
212227
213228## Freeform modules
214229# Assigning without a declared option should work
215−checkConfigOutput 24 config.value ./freeform-attrsOf.nix ./define-value-string.nix
230+checkConfigOutput '^"24"$' config.value ./freeform-attrsOf.nix ./define-value-string.nix
216231# No freeform assigments shouldn't make it error
217−checkConfigOutput '{ }' config ./freeform-attrsOf.nix
232+checkConfigOutput '^{ }$' config ./freeform-attrsOf.nix
218233# but only if the type matches
219234checkConfigError 'A definition for option .* is not of type .*' config.value ./freeform-attrsOf.nix ./define-value-list.nix
220235# and properties should be applied
221−checkConfigOutput yes config.value ./freeform-attrsOf.nix ./define-value-string-properties.nix
236+checkConfigOutput '^"yes"$' config.value ./freeform-attrsOf.nix ./define-value-string-properties.nix
222237# Options should still be declarable, and be able to have a type that doesn't match the freeform type
223−checkConfigOutput false config.enable ./freeform-attrsOf.nix ./define-value-string.nix ./declare-enable.nix
224−checkConfigOutput 24 config.value ./freeform-attrsOf.nix ./define-value-string.nix ./declare-enable.nix
238+checkConfigOutput '^false$' config.enable ./freeform-attrsOf.nix ./define-value-string.nix ./declare-enable.nix
239+checkConfigOutput '^"24"$' config.value ./freeform-attrsOf.nix ./define-value-string.nix ./declare-enable.nix
225240# and this should work too with nested values
226−checkConfigOutput false config.nest.foo ./freeform-attrsOf.nix ./freeform-nested.nix
227−checkConfigOutput bar config.nest.bar ./freeform-attrsOf.nix ./freeform-nested.nix
241+checkConfigOutput '^false$' config.nest.foo ./freeform-attrsOf.nix ./freeform-nested.nix
242+checkConfigOutput '^"bar"$' config.nest.bar ./freeform-attrsOf.nix ./freeform-nested.nix
228243# Check whether a declared option can depend on an freeform-typed one
229−checkConfigOutput null config.foo ./freeform-attrsOf.nix ./freeform-str-dep-unstr.nix
230−checkConfigOutput 24 config.foo ./freeform-attrsOf.nix ./freeform-str-dep-unstr.nix ./define-value-string.nix
244+checkConfigOutput '^null$' config.foo ./freeform-attrsOf.nix ./freeform-str-dep-unstr.nix
245+checkConfigOutput '^"24"$' config.foo ./freeform-attrsOf.nix ./freeform-str-dep-unstr.nix ./define-value-string.nix
231246# Check whether an freeform-typed value can depend on a declared option, this can only work with lazyAttrsOf
232247checkConfigError 'infinite recursion encountered' config.foo ./freeform-attrsOf.nix ./freeform-unstr-dep-str.nix
233248checkConfigError 'The option .* is used but not defined' config.foo ./freeform-lazyAttrsOf.nix ./freeform-unstr-dep-str.nix
234−checkConfigOutput 24 config.foo ./freeform-lazyAttrsOf.nix ./freeform-unstr-dep-str.nix ./define-value-string.nix
249+checkConfigOutput '^"24"$' config.foo ./freeform-lazyAttrsOf.nix ./freeform-unstr-dep-str.nix ./define-value-string.nix
250+# submodules in freeformTypes should have their locations annotated
251+checkConfigOutput '/freeform-submodules.nix"$' config.fooDeclarations.0 ./freeform-submodules.nix
252+# freeformTypes can get merged using `types.type`, including submodules
253+checkConfigOutput '^10$' config.free.xxx.foo ./freeform-submodules.nix
254+checkConfigOutput '^10$' config.free.yyy.bar ./freeform-submodules.nix
235255
236256## types.anything
237257# Check that attribute sets are merged recursively
238−checkConfigOutput null config.value.foo ./types-anything/nested-attrs.nix
239−checkConfigOutput null config.value.l1.foo ./types-anything/nested-attrs.nix
240−checkConfigOutput null config.value.l1.l2.foo ./types-anything/nested-attrs.nix
241−checkConfigOutput null config.value.l1.l2.l3.foo ./types-anything/nested-attrs.nix
258+checkConfigOutput '^null$' config.value.foo ./types-anything/nested-attrs.nix
259+checkConfigOutput '^null$' config.value.l1.foo ./types-anything/nested-attrs.nix
260+checkConfigOutput '^null$' config.value.l1.l2.foo ./types-anything/nested-attrs.nix
261+checkConfigOutput '^null$' config.value.l1.l2.l3.foo ./types-anything/nested-attrs.nix
242262# Attribute sets that are coercible to strings shouldn't be recursed into
243−checkConfigOutput foo config.value.outPath ./types-anything/attrs-coercible.nix
263+checkConfigOutput '^"foo"$' config.value.outPath ./types-anything/attrs-coercible.nix
244264# Multiple lists aren't concatenated together
245265checkConfigError 'The option .* has conflicting definitions' config.value ./types-anything/lists.nix
246266# Check that all equalizable atoms can be used as long as all definitions are equal
247−checkConfigOutput 0 config.value.int ./types-anything/equal-atoms.nix
248−checkConfigOutput false config.value.bool ./types-anything/equal-atoms.nix
249−checkConfigOutput '""' config.value.string ./types-anything/equal-atoms.nix
250−checkConfigOutput / config.value.path ./types-anything/equal-atoms.nix
251−checkConfigOutput null config.value.null ./types-anything/equal-atoms.nix
252−checkConfigOutput 0.1 config.value.float ./types-anything/equal-atoms.nix
267+checkConfigOutput '^0$' config.value.int ./types-anything/equal-atoms.nix
268+checkConfigOutput '^false$' config.value.bool ./types-anything/equal-atoms.nix
269+checkConfigOutput '^""$' config.value.string ./types-anything/equal-atoms.nix
270+checkConfigOutput '^/$' config.value.path ./types-anything/equal-atoms.nix
271+checkConfigOutput '^null$' config.value.null ./types-anything/equal-atoms.nix
272+checkConfigOutput '^0.1$' config.value.float ./types-anything/equal-atoms.nix
253273# Functions can't be merged together
254−checkConfigError "The option .* has conflicting definition values" config.value.multiple-lambdas ./types-anything/functions.nix
255−checkConfigOutput '<LAMBDA>' config.value.single-lambda ./types-anything/functions.nix
274+checkConfigError "The option .value.multiple-lambdas.<function body>. has conflicting option types" config.applied.multiple-lambdas ./types-anything/functions.nix
275+checkConfigOutput '^<LAMBDA>$' config.value.single-lambda ./types-anything/functions.nix
276+checkConfigOutput '^null$' config.applied.merging-lambdas.x ./types-anything/functions.nix
277+checkConfigOutput '^null$' config.applied.merging-lambdas.y ./types-anything/functions.nix
256278# Check that all mk* modifiers are applied
257279checkConfigError 'attribute .* not found' config.value.mkiffalse ./types-anything/mk-mods.nix
258−checkConfigOutput '{ }' config.value.mkiftrue ./types-anything/mk-mods.nix
259−checkConfigOutput 1 config.value.mkdefault ./types-anything/mk-mods.nix
260−checkConfigOutput '{ }' config.value.mkmerge ./types-anything/mk-mods.nix
261−checkConfigOutput true config.value.mkbefore ./types-anything/mk-mods.nix
262−checkConfigOutput 1 config.value.nested.foo ./types-anything/mk-mods.nix
263−checkConfigOutput baz config.value.nested.bar.baz ./types-anything/mk-mods.nix
280+checkConfigOutput '^{ }$' config.value.mkiftrue ./types-anything/mk-mods.nix
281+checkConfigOutput '^1$' config.value.mkdefault ./types-anything/mk-mods.nix
282+checkConfigOutput '^{ }$' config.value.mkmerge ./types-anything/mk-mods.nix
283+checkConfigOutput '^true$' config.value.mkbefore ./types-anything/mk-mods.nix
284+checkConfigOutput '^1$' config.value.nested.foo ./types-anything/mk-mods.nix
285+checkConfigOutput '^"baz"$' config.value.nested.bar.baz ./types-anything/mk-mods.nix
264286
265287## types.functionTo
266−checkConfigOutput "input is input" config.result ./functionTo/trivial.nix
267−checkConfigOutput "a b" config.result ./functionTo/merging-list.nix
268−checkConfigError 'A definition for option .fun.\[function body\]. is not of type .string.. Definition values:\n- In .*wrong-type.nix' config.result ./functionTo/wrong-type.nix
269−checkConfigOutput "b a" config.result ./functionTo/list-order.nix
270−checkConfigOutput "a c" config.result ./functionTo/merging-attrs.nix
288+checkConfigOutput '^"input is input"$' config.result ./functionTo/trivial.nix
289+checkConfigOutput '^"a b"$' config.result ./functionTo/merging-list.nix
290+checkConfigError 'A definition for option .fun.\[function body\]. is not of type .string.. Definition values:\n\s*- In .*wrong-type.nix' config.result ./functionTo/wrong-type.nix
291+checkConfigOutput '^"b a"$' config.result ./functionTo/list-order.nix
292+checkConfigOutput '^"a c"$' config.result ./functionTo/merging-attrs.nix
293+
294+# moduleType
295+checkConfigOutput '^"a b"$' config.resultFoo ./declare-variants.nix ./define-variant.nix
296+checkConfigOutput '^"a b y z"$' config.resultFooBar ./declare-variants.nix ./define-variant.nix
297+checkConfigOutput '^"a b c"$' config.resultFooFoo ./declare-variants.nix ./define-variant.nix
298+
299+## emptyValue's
300+checkConfigOutput "[ ]" config.list.a ./emptyValues.nix
301+checkConfigOutput "{ }" config.attrs.a ./emptyValues.nix
302+checkConfigOutput "null" config.null.a ./emptyValues.nix
303+checkConfigOutput "{ }" config.submodule.a ./emptyValues.nix
304+# These types don't have empty values
305+checkConfigError 'The option .int.a. is used but not defined' config.int.a ./emptyValues.nix
306+checkConfigError 'The option .nonEmptyList.a. is used but not defined' config.nonEmptyList.a ./emptyValues.nix
307+
308+## types.raw
309+checkConfigOutput "{ foo = <CODE>; }" config.unprocessedNesting ./raw.nix
310+checkConfigOutput "10" config.processedToplevel ./raw.nix
311+checkConfigError "The option .multiple. is defined multiple times" config.multiple ./raw.nix
312+checkConfigOutput "bar" config.priorities ./raw.nix
313+
314+## Option collision
315+checkConfigError \
316+ 'The option .set. in module .*/declare-set.nix. would be a parent of the following options, but its type .attribute set of signed integers. does not support nested options.\n\s*- option[(]s[)] with prefix .set.enable. in module .*/declare-enable-nested.nix.' \
317+ config.set \
318+ ./declare-set.nix ./declare-enable-nested.nix
319+
320+# Test that types.optionType merges types correctly
321+checkConfigOutput '^10$' config.theOption.int ./optionTypeMerging.nix
322+checkConfigOutput '^"hello"$' config.theOption.str ./optionTypeMerging.nix
323+
324+# Test that types.optionType correctly annotates option locations
325+checkConfigError 'The option .theOption.nested. in .other.nix. is already declared in .optionTypeFile.nix.' config.theOption.nested ./optionTypeFile.nix
326+
327+# Test that types.optionType leaves types untouched as long as they don't need to be merged
328+checkConfigOutput 'ok' config.freeformItems.foo.bar ./adhoc-freeformType-survives-type-merge.nix
329+
330+# Anonymous submodules don't get nixed by import resolution/deduplication
331+# because of an `extendModules` bug, issue 168767.
332+checkConfigOutput '^1$' config.sub.specialisation.value ./extendModules-168767-imports.nix
271333
272334cat <<EOF
273335====== module tests ======
@@ -275,7 +337,7 @@ $pass Pass
275337$fail Fail
276338EOF
277339
278−if test $fail -ne 0; then
340+if [ "$fail" -ne 0 ]; then
279341 exit 1
280342fi
281343exit 0
lib/tests/modules/adhoc-freeformType-survives-type-merge.nixnew file+14
@@ -0,0 +1,14 @@
1+{ lib, ... }: {
2+ options.dummy = lib.mkOption { type = lib.types.anything; default = {}; };
3+ freeformType =
4+ let
5+ a = lib.types.attrsOf (lib.types.submodule { options.bar = lib.mkOption { }; });
6+ in
7+ # modifying types like this breaks type merging.
8+ # This test makes sure that type merging is not performed when only a single declaration exists.
9+ # Don't modify types in practice!
10+ a // {
11+ merge = loc: defs: { freeformItems = a.merge loc defs; };
12+ };
13+ config.foo.bar = "ok";
14+}
lib/tests/modules/declare-attrsOf.nix+8−1
@@ -1,6 +1,13 @@
1−{ lib, ... }: {
1+{ lib, ... }:
2+let
3+ deathtrapArgs = lib.mapAttrs
4+ (k: _: throw "The module system is too strict, accessing an unused option's ${k} mkOption-attribute.")
5+ (lib.functionArgs lib.mkOption);
6+in
7+{
28 options.value = lib.mkOption {
39 type = lib.types.attrsOf lib.types.str;
410 default = {};
511 };
12+ options.testing-laziness-so-don't-read-me = lib.mkOption deathtrapArgs;
613}
lib/tests/modules/declare-bare-submodule-deep-option-duplicate.nixnew file+10
@@ -0,0 +1,10 @@
1+{ lib, ... }:
2+let
3+ inherit (lib) mkOption types;
4+in
5+{
6+ options.bare-submodule.deep = mkOption {
7+ type = types.int;
8+ default = 2;
9+ };
10+}
lib/tests/modules/declare-bare-submodule-deep-option.nixnew file+10
@@ -0,0 +1,10 @@
1+{ lib, ... }:
2+let
3+ inherit (lib) mkOption types;
4+in
5+{
6+ options.bare-submodule.deep = mkOption {
7+ type = types.int;
8+ default = 2;
9+ };
10+}
lib/tests/modules/declare-bare-submodule-nested-option.nixnew file+19
@@ -0,0 +1,19 @@
1+{ config, lib, ... }:
2+let
3+ inherit (lib) mkOption types;
4+in
5+{
6+ options.bare-submodule = mkOption {
7+ type = types.submoduleWith {
8+ shorthandOnlyDefinesConfig = config.shorthandOnlyDefinesConfig;
9+ modules = [
10+ {
11+ options.nested = mkOption {
12+ type = types.int;
13+ default = 1;
14+ };
15+ }
16+ ];
17+ };
18+ };
19+}
lib/tests/modules/declare-bare-submodule.nixnew file+18
@@ -0,0 +1,18 @@
1+{ config, lib, ... }:
2+let
3+ inherit (lib) mkOption types;
4+in
5+{
6+ options.bare-submodule = mkOption {
7+ type = types.submoduleWith {
8+ modules = [ ];
9+ shorthandOnlyDefinesConfig = config.shorthandOnlyDefinesConfig;
10+ };
11+ default = {};
12+ };
13+
14+ # config-dependent options: won't recommend, but useful for making this test parameterized
15+ options.shorthandOnlyDefinesConfig = mkOption {
16+ default = false;
17+ };
18+}
lib/tests/modules/declare-set.nixnew file+12
@@ -0,0 +1,12 @@
1+{ lib, ... }:
2+
3+{
4+ options.set = lib.mkOption {
5+ default = { };
6+ example = { a = 1; };
7+ type = lib.types.attrsOf lib.types.int;
8+ description = ''
9+ Some descriptive text
10+ '';
11+ };
12+}
lib/tests/modules/declare-submodule-via-evalModules.nixnew file+28
@@ -0,0 +1,28 @@
1+{ lib, ... }: {
2+ options.submodule = lib.mkOption {
3+ inherit (lib.evalModules {
4+ modules = [
5+ {
6+ options.inner = lib.mkOption {
7+ type = lib.types.bool;
8+ default = false;
9+ };
10+ }
11+ ];
12+ }) type;
13+ default = {};
14+ };
15+
16+ config.submodule = lib.mkMerge [
17+ ({ lib, ... }: {
18+ options.outer = lib.mkOption {
19+ type = lib.types.bool;
20+ default = false;
21+ };
22+ })
23+ {
24+ inner = true;
25+ outer = true;
26+ }
27+ ];
28+}
lib/tests/modules/declare-submoduleWith-modules.nix+1−3
@@ -8,9 +8,6 @@
88 default = false;
99 };
1010 }
11− {
12− outer = true;
13− }
1411 ];
1512 };
1613 default = {};
@@ -25,6 +22,7 @@
2522 })
2623 {
2724 inner = true;
25+ outer = true;
2826 }
2927 ];
3028}
lib/tests/modules/declare-variants.nixnew file+9
@@ -0,0 +1,9 @@
1+{ lib, moduleType, ... }:
2+let inherit (lib) mkOption types;
3+in
4+{
5+ options.variants = mkOption {
6+ type = types.lazyAttrsOf moduleType;
7+ default = {};
8+ };
9+}
lib/tests/modules/define-bare-submodule-values.nixnew file+4
@@ -0,0 +1,4 @@
1+{
2+ bare-submodule.nested = 42;
3+ bare-submodule.deep = 420;
4+}
lib/tests/modules/define-shorthandOnlyDefinesConfig-true.nixnew file+1
@@ -0,0 +1 @@
1+{ shorthandOnlyDefinesConfig = true; }
lib/tests/modules/define-variant.nixnew file+22
@@ -0,0 +1,22 @@
1+{ config, lib, ... }:
2+let inherit (lib) types mkOption attrNames;
3+in
4+{
5+ options = {
6+ attrs = mkOption { type = types.attrsOf lib.types.int; };
7+ result = mkOption { };
8+ resultFoo = mkOption { };
9+ resultFooBar = mkOption { };
10+ resultFooFoo = mkOption { };
11+ };
12+ config = {
13+ attrs.a = 1;
14+ variants.foo.attrs.b = 1;
15+ variants.bar.attrs.y = 1;
16+ variants.foo.variants.bar.attrs.z = 1;
17+ variants.foo.variants.foo.attrs.c = 3;
18+ resultFoo = lib.concatMapStringsSep " " toString (attrNames config.variants.foo.attrs);
19+ resultFooBar = lib.concatMapStringsSep " " toString (attrNames config.variants.foo.variants.bar.attrs);
20+ resultFooFoo = lib.concatMapStringsSep " " toString (attrNames config.variants.foo.variants.foo.attrs);
21+ };
22+}
lib/tests/modules/emptyValues.nixnew file+36
@@ -0,0 +1,36 @@
1+{ lib, ... }:
2+let
3+ inherit (lib) types;
4+in {
5+
6+ options = {
7+ int = lib.mkOption {
8+ type = types.lazyAttrsOf types.int;
9+ };
10+ list = lib.mkOption {
11+ type = types.lazyAttrsOf (types.listOf types.int);
12+ };
13+ nonEmptyList = lib.mkOption {
14+ type = types.lazyAttrsOf (types.nonEmptyListOf types.int);
15+ };
16+ attrs = lib.mkOption {
17+ type = types.lazyAttrsOf (types.attrsOf types.int);
18+ };
19+ null = lib.mkOption {
20+ type = types.lazyAttrsOf (types.nullOr types.int);
21+ };
22+ submodule = lib.mkOption {
23+ type = types.lazyAttrsOf (types.submodule {});
24+ };
25+ };
26+
27+ config = {
28+ int.a = lib.mkIf false null;
29+ list.a = lib.mkIf false null;
30+ nonEmptyList.a = lib.mkIf false null;
31+ attrs.a = lib.mkIf false null;
32+ null.a = lib.mkIf false null;
33+ submodule.a = lib.mkIf false null;
34+ };
35+
36+}
lib/tests/modules/extendModules-168767-imports.nixnew file+41
@@ -0,0 +1,41 @@
1+{ lib
2+, extendModules
3+, ...
4+}:
5+with lib;
6+{
7+ imports = [
8+
9+ {
10+ options.sub = mkOption {
11+ default = { };
12+ type = types.submodule (
13+ { config
14+ , extendModules
15+ , ...
16+ }:
17+ {
18+ options.value = mkOption {
19+ type = types.int;
20+ };
21+
22+ options.specialisation = mkOption {
23+ default = { };
24+ inherit
25+ (extendModules {
26+ modules = [{
27+ specialisation = mkOverride 0 { };
28+ }];
29+ })
30+ type;
31+ };
32+ }
33+ );
34+ };
35+ }
36+
37+ { config.sub.value = 1; }
38+
39+
40+ ];
41+}
lib/tests/modules/freeform-nested.nix+8−1
@@ -1,7 +1,14 @@
1−{ lib, ... }: {
1+{ lib, ... }:
2+let
3+ deathtrapArgs = lib.mapAttrs
4+ (k: _: throw "The module system is too strict, accessing an unused option's ${k} mkOption-attribute.")
5+ (lib.functionArgs lib.mkOption);
6+in
7+{
28 options.nest.foo = lib.mkOption {
39 type = lib.types.bool;
410 default = false;
511 };
12+ options.nest.unused = lib.mkOption deathtrapArgs;
613 config.nest.bar = "bar";
714}
lib/tests/modules/freeform-submodules.nixnew file+22
@@ -0,0 +1,22 @@
1+{ lib, options, ... }: with lib.types; {
2+
3+ options.fooDeclarations = lib.mkOption {
4+ default = (options.free.type.getSubOptions [])._freeformOptions.foo.declarations;
5+ };
6+
7+ options.free = lib.mkOption {
8+ type = submodule {
9+ config._module.freeformType = lib.mkMerge [
10+ (attrsOf (submodule {
11+ options.foo = lib.mkOption {};
12+ }))
13+ (attrsOf (submodule {
14+ options.bar = lib.mkOption {};
15+ }))
16+ ];
17+ };
18+ };
19+
20+ config.free.xxx.foo = 10;
21+ config.free.yyy.bar = 10;
22+}
lib/tests/modules/optionTypeFile.nixnew file+28
@@ -0,0 +1,28 @@
1+{ config, lib, ... }: {
2+
3+ _file = "optionTypeFile.nix";
4+
5+ options.theType = lib.mkOption {
6+ type = lib.types.optionType;
7+ };
8+
9+ options.theOption = lib.mkOption {
10+ type = config.theType;
11+ default = {};
12+ };
13+
14+ config.theType = lib.mkMerge [
15+ (lib.types.submodule {
16+ options.nested = lib.mkOption {
17+ type = lib.types.int;
18+ };
19+ })
20+ (lib.types.submodule {
21+ _file = "other.nix";
22+ options.nested = lib.mkOption {
23+ type = lib.types.str;
24+ };
25+ })
26+ ];
27+
28+}
lib/tests/modules/optionTypeMerging.nixnew file+27
@@ -0,0 +1,27 @@
1+{ config, lib, ... }: {
2+
3+ options.theType = lib.mkOption {
4+ type = lib.types.optionType;
5+ };
6+
7+ options.theOption = lib.mkOption {
8+ type = config.theType;
9+ };
10+
11+ config.theType = lib.mkMerge [
12+ (lib.types.submodule {
13+ options.int = lib.mkOption {
14+ type = lib.types.int;
15+ default = 10;
16+ };
17+ })
18+ (lib.types.submodule {
19+ options.str = lib.mkOption {
20+ type = lib.types.str;
21+ };
22+ })
23+ ];
24+
25+ config.theOption.str = "hello";
26+
27+}
lib/tests/modules/raw.nixnew file+30
@@ -0,0 +1,30 @@
1+{ lib, ... }: {
2+
3+ options = {
4+ processedToplevel = lib.mkOption {
5+ type = lib.types.raw;
6+ };
7+ unprocessedNesting = lib.mkOption {
8+ type = lib.types.raw;
9+ };
10+ multiple = lib.mkOption {
11+ type = lib.types.raw;
12+ };
13+ priorities = lib.mkOption {
14+ type = lib.types.raw;
15+ };
16+ };
17+
18+ config = {
19+ processedToplevel = lib.mkIf true 10;
20+ unprocessedNesting.foo = throw "foo";
21+ multiple = lib.mkMerge [
22+ "foo"
23+ "foo"
24+ ];
25+ priorities = lib.mkMerge [
26+ "foo"
27+ (lib.mkForce "bar")
28+ ];
29+ };
30+}
lib/tests/modules/types-anything/functions.nix+9−3
@@ -1,16 +1,22 @@
1−{ lib, ... }: {
1+{ lib, config, ... }: {
22
33 options.value = lib.mkOption {
44 type = lib.types.anything;
55 };
66
7+ options.applied = lib.mkOption {
8+ default = lib.mapAttrs (name: fun: fun null) config.value;
9+ };
10+
711 config = lib.mkMerge [
812 {
913 value.single-lambda = x: x;
10− value.multiple-lambdas = x: x;
14+ value.multiple-lambdas = x: { inherit x; };
15+ value.merging-lambdas = x: { inherit x; };
1116 }
1217 {
13− value.multiple-lambdas = x: x;
18+ value.multiple-lambdas = x: [ x ];
19+ value.merging-lambdas = y: { inherit y; };
1420 }
1521 ];
1622
lib/tests/release.nix+9−1
@@ -3,7 +3,7 @@
33 pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; }
44}:
55
6−pkgs.runCommandNoCC "nixpkgs-lib-tests" {
6+pkgs.runCommand "nixpkgs-lib-tests" {
77 buildInputs = [
88 pkgs.nix
99 (import ./check-eval.nix)
@@ -23,10 +23,18 @@ pkgs.runCommandNoCC "nixpkgs-lib-tests" {
2323 export NIX_STORE_DIR=$TEST_ROOT/store
2424 export PAGER=cat
2525 cacheDir=$TEST_ROOT/binary-cache
26+
27+ mkdir -p $NIX_CONF_DIR
28+ echo "experimental-features = nix-command" >> $NIX_CONF_DIR/nix.conf
29+
2630 nix-store --init
2731
2832 cp -r ${../.} lib
33+ echo "Running lib/tests/modules.sh"
2934 bash lib/tests/modules.sh
3035
36+ echo "Running lib/tests/sources.sh"
37+ TEST_LIB=$PWD/lib bash lib/tests/sources.sh
38+
3139 touch $out
3240''
lib/tests/sources.shnew file+61
@@ -0,0 +1,61 @@
1+#!/usr/bin/env bash
2+set -euo pipefail
3+shopt -s inherit_errexit
4+
5+# Use
6+# || die
7+die() {
8+ echo >&2 "test case failed: " "$@"
9+ exit 1
10+}
11+
12+if test -n "${TEST_LIB:-}"; then
13+ NIX_PATH=nixpkgs="$(dirname "$TEST_LIB")"
14+else
15+ NIX_PATH=nixpkgs="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.."; pwd)"
16+fi
17+export NIX_PATH
18+
19+work="$(mktemp -d)"
20+clean_up() {
21+ rm -rf "$work"
22+}
23+trap clean_up EXIT
24+cd "$work"
25+
26+touch {README.md,module.o,foo.bar}
27+
28+# nix-instantiate doesn't write out the source, only computing the hash, so
29+# this uses the experimental nix command instead.
30+
31+dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
32+ cleanSource ./.
33+}")')"
34+(cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
35+.
36+./foo.bar
37+./README.md
38+EOF
39+) || die "cleanSource 1"
40+
41+
42+dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
43+ cleanSourceWith { src = '"$work"'; filter = path: type: ! hasSuffix ".bar" path; }
44+}")')"
45+(cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
46+.
47+./module.o
48+./README.md
49+EOF
50+) || die "cleanSourceWith 1"
51+
52+dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
53+ cleanSourceWith { src = cleanSource '"$work"'; filter = path: type: ! hasSuffix ".bar" path; }
54+}")')"
55+(cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
56+.
57+./README.md
58+EOF
59+) || die "cleanSourceWith + cleanSource"
60+
61+echo >&2 tests ok
lib/tests/systems.nix+7−4
@@ -15,10 +15,13 @@ in
1515with lib.systems.doubles; lib.runTests {
1616 testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ mmix ++ js ++ genode ++ redox);
1717
18− testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-none" "armv7a-linux" "armv7l-linux" "arm-none" "armv7a-darwin" ];
18+ testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-netbsd" "armv6l-none" "armv7a-linux" "armv7a-netbsd" "armv7l-linux" "armv7l-netbsd" "arm-none" "armv7a-darwin" ];
1919 testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ];
20− testmips = mseteq mips [ "mipsel-linux" ];
20+ testmips = mseteq mips [ "mips64el-linux" "mipsel-linux" "mipsel-netbsd" ];
2121 testmmix = mseteq mmix [ "mmix-mmixware" ];
22+ testriscv = mseteq riscv [ "riscv32-linux" "riscv64-linux" "riscv32-netbsd" "riscv64-netbsd" "riscv32-none" "riscv64-none" ];
23+ testriscv32 = mseteq riscv32 [ "riscv32-linux" "riscv32-netbsd" "riscv32-none" ];
24+ testriscv64 = mseteq riscv64 [ "riscv64-linux" "riscv64-netbsd" "riscv64-none" ];
2225 testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-genode" "x86_64-redox" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" "x86_64-none" ];
2326
2427 testcygwin = mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ];
@@ -28,8 +31,8 @@ with lib.systems.doubles; lib.runTests {
2831 testredox = mseteq redox [ "x86_64-redox" ];
2932 testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */);
3033 testillumos = mseteq illumos [ "x86_64-solaris" ];
31− testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" ];
32− testnetbsd = mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ];
34+ testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mips64el-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" "s390-linux" "s390x-linux" ];
35+ testnetbsd = mseteq netbsd [ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "m68k-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" ];
3336 testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ];
3437 testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ];
3538 testunix = mseteq unix (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ cygwin ++ redox);
lib/trivial.nix+131−10
@@ -61,11 +61,11 @@ rec {
6161 pipe = val: functions:
6262 let reverseApply = x: f: f x;
6363 in builtins.foldl' reverseApply val functions;
64− /* note please don’t add a function like `compose = flip pipe`.
65− This would confuse users, because the order of the functions
66− in the list is not clear. With pipe, it’s obvious that it
67− goes first-to-last. With `compose`, not so much.
68− */
64+
65+ # note please don’t add a function like `compose = flip pipe`.
66+ # This would confuse users, because the order of the functions
67+ # in the list is not clear. With pipe, it’s obvious that it
68+ # goes first-to-last. With `compose`, not so much.
6969
7070 ## Named versions corresponding to some builtin operators.
7171
@@ -158,7 +158,7 @@ rec {
158158 seq deepSeq genericClosure;
159159
160160
161− ## nixpks version strings
161+ ## nixpkgs version strings
162162
163163 /* Returns the current full nixpkgs version number. */
164164 version = release + versionSuffix;
@@ -166,12 +166,36 @@ rec {
166166 /* Returns the current nixpkgs release number as string. */
167167 release = lib.strings.fileContents ../.version;
168168
169+ /* The latest release that is supported, at the time of release branch-off,
170+ if applicable.
171+
172+ Ideally, out-of-tree modules should be able to evaluate cleanly with all
173+ supported Nixpkgs versions (master, release and old release until EOL).
174+ So if possible, deprecation warnings should take effect only when all
175+ out-of-tree expressions/libs/modules can upgrade to the new way without
176+ losing support for supported Nixpkgs versions.
177+
178+ This release number allows deprecation warnings to be implemented such that
179+ they take effect as soon as the oldest release reaches end of life. */
180+ oldestSupportedRelease =
181+ # Update on master only. Do not backport.
182+ 2111;
183+
184+ /* Whether a feature is supported in all supported releases (at the time of
185+ release branch-off, if applicable). See `oldestSupportedRelease`. */
186+ isInOldestRelease =
187+ /* Release number of feature introduction as an integer, e.g. 2111 for 21.11.
188+ Set it to the upcoming release, matching the nixpkgs/.version file.
189+ */
190+ release:
191+ release <= lib.trivial.oldestSupportedRelease;
192+
169193 /* Returns the current nixpkgs release code name.
170194
171195 On each release the first letter is bumped and a new animal is chosen
172196 starting with that new letter.
173197 */
174− codeName = "Okapi";
198+ codeName = "Quokka";
175199
176200 /* Returns the current nixpkgs version suffix as string. */
177201 versionSuffix =
@@ -297,15 +321,90 @@ rec {
297321 # Usage:
298322 # {
299323 # foo = lib.warn "foo is deprecated" oldFoo;
324+ # bar = lib.warnIf (bar == "") "Empty bar is deprecated" bar;
300325 # }
301326 #
302327 # TODO: figure out a clever way to integrate location information from
303328 # something like __unsafeGetAttrPos.
304329
305− warn = msg: builtins.trace "[1;31mwarning: ${msg}[0m";
330+ /*
331+ Print a warning before returning the second argument. This function behaves
332+ like `builtins.trace`, but requires a string message and formats it as a
333+ warning, including the `warning: ` prefix.
334+
335+ To get a call stack trace and abort evaluation, set the environment variable
336+ `NIX_ABORT_ON_WARN=true` and set the Nix options `--option pure-eval false --show-trace`
337+
338+ Type: string -> a -> a
339+ */
340+ warn =
341+ if lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") ["1" "true" "yes"]
342+ then msg: builtins.trace "[1;31mwarning: ${msg}[0m" (abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors.")
343+ else msg: builtins.trace "[1;31mwarning: ${msg}[0m";
344+
345+ /*
346+ Like warn, but only warn when the first argument is `true`.
347+
348+ Type: bool -> string -> a -> a
349+ */
350+ warnIf = cond: msg: if cond then warn msg else x: x;
351+
352+ /*
353+ Like warnIf, but negated (warn if the first argument is `false`).
354+
355+ Type: bool -> string -> a -> a
356+ */
357+ warnIfNot = cond: msg: if cond then x: x else warn msg;
358+
359+ /*
360+ Like the `assert b; e` expression, but with a custom error message and
361+ without the semicolon.
362+
363+ If true, return the identity function, `r: r`.
364+
365+ If false, throw the error message.
366+
367+ Calls can be juxtaposed using function application, as `(r: r) a = a`, so
368+ `(r: r) (r: r) a = a`, and so forth.
369+
370+ Type: bool -> string -> a -> a
371+
372+ Example:
373+
374+ throwIfNot (lib.isList overlays) "The overlays argument to nixpkgs must be a list."
375+ lib.foldr (x: throwIfNot (lib.isFunction x) "All overlays passed to nixpkgs must be functions.") (r: r) overlays
376+ pkgs
377+
378+ */
379+ throwIfNot = cond: msg: if cond then x: x else throw msg;
380+
381+ /*
382+ Like throwIfNot, but negated (throw if the first argument is `true`).
383+
384+ Type: bool -> string -> a -> a
385+ */
386+ throwIf = cond: msg: if cond then throw msg else x: x;
387+
388+ /* Check if the elements in a list are valid values from a enum, returning the identity function, or throwing an error message otherwise.
389+
390+ Example:
391+ let colorVariants = ["bright" "dark" "black"]
392+ in checkListOfEnum "color variants" [ "standard" "light" "dark" ] colorVariants;
393+ =>
394+ error: color variants: bright, black unexpected; valid ones: standard, light, dark
395+
396+ Type: String -> List ComparableVal -> List ComparableVal -> a -> a
397+ */
398+ checkListOfEnum = msg: valid: given:
399+ let
400+ unexpected = lib.subtractLists valid given;
401+ in
402+ lib.throwIfNot (unexpected == [])
403+ "${msg}: ${builtins.concatStringsSep ", " (builtins.map builtins.toString unexpected)} unexpected; valid ones: ${builtins.concatStringsSep ", " (builtins.map builtins.toString valid)}";
404+
306405 info = msg: builtins.trace "INFO: ${msg}";
307406
308− showWarnings = warnings: res: lib.fold (w: x: warn w x) res warnings;
407+ showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
309408
310409 ## Function annotations
311410
@@ -331,7 +430,10 @@ rec {
331430 has the same return type and semantics as builtins.functionArgs.
332431 setFunctionArgs : (a → b) → Map String Bool.
333432 */
334− functionArgs = f: f.__functionArgs or (builtins.functionArgs f);
433+ functionArgs = f:
434+ if f ? __functor
435+ then f.__functionArgs or (lib.functionArgs (f.__functor f))
436+ else builtins.functionArgs f;
335437
336438 /* Check whether something is a function or something
337439 annotated with function args.
@@ -339,6 +441,25 @@ rec {
339441 isFunction = f: builtins.isFunction f ||
340442 (f ? __functor && isFunction (f.__functor f));
341443
444+ /*
445+ Turns any non-callable values into constant functions.
446+ Returns callable values as is.
447+
448+ Example:
449+
450+ nix-repl> lib.toFunction 1 2
451+ 1
452+
453+ nix-repl> lib.toFunction (x: x + 1) 2
454+ 3
455+ */
456+ toFunction =
457+ # Any value
458+ v:
459+ if isFunction v
460+ then v
461+ else k: v;
462+
342463 /* Convert the given positive integer to a string of its hexadecimal
343464 representation. For example:
344465
lib/types.nix+176−58
This diff is too big to show here.
maintainers/maintainer-list.nix+3760−252
This diff is too big to show here.
maintainers/scripts/build.nix+10−2
This diff is too big to show here.
maintainers/scripts/check-hydra-by-maintainer.nix+1
This diff is too big to show here.
maintainers/scripts/check-maintainer-github-handles.sh+9−9
This diff is too big to show here.
maintainers/scripts/copy-tarballs.pl+15−1
This diff is too big to show here.
maintainers/scripts/db-to-md.shnew file+88
This diff is too big to show here.
maintainers/scripts/dep-licenses.sh+1−1
This diff is too big to show here.
maintainers/scripts/doc/escape-code-markup.pynew file+97
This diff is too big to show here.
maintainers/scripts/doc/replace-xrefs-by-empty-links.pynew file+32
This diff is too big to show here.
maintainers/scripts/doc/unknown-code-language.luanew file+12
This diff is too big to show here.
maintainers/scripts/feature-freeze-teams.plnew file+98
This diff is too big to show here.
maintainers/scripts/find-tarballs.nix+1−1
This diff is too big to show here.
maintainers/scripts/haskell/dependencies.nixnew file+10
This diff is too big to show here.
maintainers/scripts/haskell/hydra-report.hsnew file+490
This diff is too big to show here.
maintainers/scripts/haskell/maintained-broken-pkgs.nixnew file+22
This diff is too big to show here.
maintainers/scripts/haskell/maintainer-handles.nixnew file+7
This diff is too big to show here.
maintainers/scripts/haskell/mark-broken.shnew file+47
This diff is too big to show here.
maintainers/scripts/haskell/merge-and-open-pr.shnew file+122
This diff is too big to show here.
maintainers/scripts/haskell/regenerate-hackage-packages.shnew file+46
This diff is too big to show here.
maintainers/scripts/haskell/regenerate-transitive-broken-packages.shnew file+15
This diff is too big to show here.
maintainers/scripts/haskell/test-configurations.nixnew file+136
This diff is too big to show here.
maintainers/scripts/haskell/transitive-broken-packages.nixnew file+16
This diff is too big to show here.
maintainers/scripts/haskell/update-cabal2nix-unstable.shnew file+17
This diff is too big to show here.
maintainers/scripts/haskell/update-hackage.shnew file+35
This diff is too big to show here.
maintainers/scripts/haskell/update-stackage.shnew file+70
This diff is too big to show here.
maintainers/scripts/haskell/upload-nixos-package-list-to-hackage.shnew file+22
This diff is too big to show here.
maintainers/scripts/luarocks-packages.csv+87−86
This diff is too big to show here.
maintainers/scripts/nix-generate-from-cpan.nix+1−1
This diff is too big to show here.
maintainers/scripts/pluginupdate.py+383−208
This diff is too big to show here.
maintainers/scripts/rebuild-amount.sh+86−79
This diff is too big to show here.
maintainers/scripts/remove-old-aliases.pynew file+211
This diff is too big to show here.
maintainers/scripts/update-luarocks-packages+207−125
This diff is too big to show here.
maintainers/scripts/update-luarocks-shell.nix+7−3
This diff is too big to show here.
maintainers/scripts/update-ruby-packages+4−1
This diff is too big to show here.
maintainers/scripts/update.nix+17−5
This diff is too big to show here.
maintainers/scripts/update.py+8−1
This diff is too big to show here.
maintainers/scripts/vanity.sh+19−19
This diff is too big to show here.
maintainers/team-list.nix+521−6
This diff is too big to show here.
nixos/default.nix+1−24
This diff is too big to show here.
nixos/doc/manual/Makefile+1−1
This diff is too big to show here.
nixos/doc/manual/READMEdeleted−3
This diff is too big to show here.
nixos/doc/manual/README.mdnew file+3
This diff is too big to show here.
nixos/doc/manual/administration/boot-problems.section.mdnew file+41
This diff is too big to show here.
nixos/doc/manual/administration/boot-problems.xmldeleted−126
This diff is too big to show here.
nixos/doc/manual/administration/cleaning-store.chapter.mdnew file+62
This diff is too big to show here.
nixos/doc/manual/administration/cleaning-store.xmldeleted−63
This diff is too big to show here.
nixos/doc/manual/administration/container-networking.section.mdnew file+44
This diff is too big to show here.
nixos/doc/manual/administration/container-networking.xmldeleted−59
This diff is too big to show here.
nixos/doc/manual/administration/containers.chapter.mdnew file+28
This diff is too big to show here.
nixos/doc/manual/administration/containers.xmldeleted−34
This diff is too big to show here.
nixos/doc/manual/administration/control-groups.chapter.mdnew file+59
This diff is too big to show here.
nixos/doc/manual/administration/control-groups.xmldeleted−65
This diff is too big to show here.
nixos/doc/manual/administration/declarative-containers.section.mdnew file+48
This diff is too big to show here.
nixos/doc/manual/administration/declarative-containers.xmldeleted−60
This diff is too big to show here.
nixos/doc/manual/administration/imperative-containers.section.mdnew file+115
This diff is too big to show here.
nixos/doc/manual/administration/imperative-containers.xmldeleted−123
This diff is too big to show here.
nixos/doc/manual/administration/logging.chapter.mdnew file+38
This diff is too big to show here.
nixos/doc/manual/administration/logging.xmldeleted−43
This diff is too big to show here.
nixos/doc/manual/administration/maintenance-mode.section.mdnew file+11
This diff is too big to show here.
nixos/doc/manual/administration/maintenance-mode.xmldeleted−16
This diff is too big to show here.
nixos/doc/manual/administration/network-problems.section.mdnew file+21
This diff is too big to show here.
nixos/doc/manual/administration/network-problems.xmldeleted−27
This diff is too big to show here.
nixos/doc/manual/administration/rebooting.chapter.mdnew file+30
This diff is too big to show here.
nixos/doc/manual/administration/rebooting.xmldeleted−35
This diff is too big to show here.
nixos/doc/manual/administration/rollback.section.mdnew file+38
This diff is too big to show here.
nixos/doc/manual/administration/rollback.xmldeleted−41
This diff is too big to show here.
nixos/doc/manual/administration/running.xml+8−8
This diff is too big to show here.
nixos/doc/manual/administration/service-mgmt.chapter.mdnew file+120
This diff is too big to show here.
nixos/doc/manual/administration/service-mgmt.xmldeleted−140
This diff is too big to show here.
nixos/doc/manual/administration/store-corruption.section.mdnew file+28
This diff is too big to show here.
nixos/doc/manual/administration/store-corruption.xmldeleted−36
This diff is too big to show here.
nixos/doc/manual/administration/troubleshooting.chapter.mdnew file+12
This diff is too big to show here.
nixos/doc/manual/administration/troubleshooting.xmldeleted−16
This diff is too big to show here.
nixos/doc/manual/administration/user-sessions.chapter.mdnew file+43
This diff is too big to show here.
nixos/doc/manual/administration/user-sessions.xmldeleted−45
This diff is too big to show here.
nixos/doc/manual/configuration/abstractions.section.mdnew file+80
This diff is too big to show here.
nixos/doc/manual/configuration/abstractions.xmldeleted−101
This diff is too big to show here.
nixos/doc/manual/configuration/ad-hoc-network-config.section.mdnew file+13
This diff is too big to show here.
nixos/doc/manual/configuration/ad-hoc-network-config.xmldeleted−20
This diff is too big to show here.
nixos/doc/manual/configuration/ad-hoc-packages.section.mdnew file+51
This diff is too big to show here.
nixos/doc/manual/configuration/ad-hoc-packages.xmldeleted−61
This diff is too big to show here.
nixos/doc/manual/configuration/adding-custom-packages.section.mdnew file+74
This diff is too big to show here.
nixos/doc/manual/configuration/adding-custom-packages.xmldeleted−73
This diff is too big to show here.
nixos/doc/manual/configuration/config-file.section.mdnew file+175
This diff is too big to show here.
nixos/doc/manual/configuration/config-file.xmldeleted−216
This diff is too big to show here.
nixos/doc/manual/configuration/config-syntax.chapter.mdnew file+19
This diff is too big to show here.
nixos/doc/manual/configuration/config-syntax.xmldeleted−25
This diff is too big to show here.
nixos/doc/manual/configuration/configuration.xml+13−13
This diff is too big to show here.
nixos/doc/manual/configuration/customizing-packages.section.mdnew file+74
This diff is too big to show here.
nixos/doc/manual/configuration/customizing-packages.xmldeleted−86
This diff is too big to show here.
nixos/doc/manual/configuration/declarative-packages.section.mdnew file+46
This diff is too big to show here.
nixos/doc/manual/configuration/declarative-packages.xmldeleted−54
This diff is too big to show here.
nixos/doc/manual/configuration/file-systems.chapter.mdnew file+42
This diff is too big to show here.
nixos/doc/manual/configuration/file-systems.xmldeleted−57
This diff is too big to show here.
nixos/doc/manual/configuration/firewall.section.mdnew file+32
This diff is too big to show here.
nixos/doc/manual/configuration/firewall.xmldeleted−37
This diff is too big to show here.
nixos/doc/manual/configuration/gpu-accel.chapter.mdnew file+204
This diff is too big to show here.
nixos/doc/manual/configuration/gpu-accel.xmldeleted−263
This diff is too big to show here.
nixos/doc/manual/configuration/ipv4-config.section.mdnew file+35
This diff is too big to show here.
nixos/doc/manual/configuration/ipv4-config.xmldeleted−43
This diff is too big to show here.
nixos/doc/manual/configuration/ipv6-config.section.mdnew file+42
This diff is too big to show here.
nixos/doc/manual/configuration/ipv6-config.xmldeleted−50
This diff is too big to show here.
nixos/doc/manual/configuration/kubernetes.chapter.mdnew file+104
This diff is too big to show here.
nixos/doc/manual/configuration/kubernetes.xmldeleted−112
This diff is too big to show here.
nixos/doc/manual/configuration/linux-kernel.chapter.mdnew file+140
This diff is too big to show here.
nixos/doc/manual/configuration/linux-kernel.xmldeleted−138
This diff is too big to show here.
nixos/doc/manual/configuration/luks-file-systems.section.mdnew file+77
This diff is too big to show here.
nixos/doc/manual/configuration/luks-file-systems.xmldeleted−74
This diff is too big to show here.
nixos/doc/manual/configuration/modularity.section.mdnew file+133
This diff is too big to show here.
nixos/doc/manual/configuration/modularity.xmldeleted−146
This diff is too big to show here.
nixos/doc/manual/configuration/network-manager.section.mdnew file+42
This diff is too big to show here.
nixos/doc/manual/configuration/network-manager.xmldeleted−48
This diff is too big to show here.
nixos/doc/manual/configuration/networking.chapter.mdnew file+16
This diff is too big to show here.
nixos/doc/manual/configuration/networking.xmldeleted−20
This diff is too big to show here.
nixos/doc/manual/configuration/package-mgmt.chapter.mdnew file+18
This diff is too big to show here.
nixos/doc/manual/configuration/package-mgmt.xmldeleted−31
This diff is too big to show here.
nixos/doc/manual/configuration/profiles.chapter.mdnew file+34
This diff is too big to show here.
nixos/doc/manual/configuration/profiles.xmldeleted−39
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/all-hardware.section.mdnew file+11
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/all-hardware.xmldeleted−21
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/base.section.mdnew file+7
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/base.xmldeleted−15
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/clone-config.section.mdnew file+11
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/clone-config.xmldeleted−21
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/demo.section.mdnew file+4
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/demo.xmldeleted−14
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/docker-container.section.mdnew file+7
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/docker-container.xmldeleted−16
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/graphical.section.mdnew file+10
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/graphical.xmldeleted−20
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/hardened.section.mdnew file+20
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/hardened.xmldeleted−32
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/headless.section.mdnew file+9
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/headless.xmldeleted−19
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/installation-device.section.mdnew file+24
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/installation-device.xmldeleted−36
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/minimal.section.mdnew file+9
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/minimal.xmldeleted−17
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/qemu-guest.section.mdnew file+7
This diff is too big to show here.
nixos/doc/manual/configuration/profiles/qemu-guest.xmldeleted−17
This diff is too big to show here.
nixos/doc/manual/configuration/renaming-interfaces.section.mdnew file+51
This diff is too big to show here.
nixos/doc/manual/configuration/renaming-interfaces.xmldeleted−67
This diff is too big to show here.
nixos/doc/manual/configuration/ssh.section.mdnew file+19
This diff is too big to show here.
nixos/doc/manual/configuration/ssh.xmldeleted−27
This diff is too big to show here.
nixos/doc/manual/configuration/sshfs-file-systems.section.mdnew file+104
This diff is too big to show here.
nixos/doc/manual/configuration/subversion.chapter.mdnew file+102
This diff is too big to show here.
nixos/doc/manual/configuration/subversion.xmldeleted−140
This diff is too big to show here.
nixos/doc/manual/configuration/summary.section.mdnew file+46
This diff is too big to show here.
nixos/doc/manual/configuration/summary.xmldeleted−227
This diff is too big to show here.
nixos/doc/manual/configuration/user-mgmt.chapter.mdnew file+92
This diff is too big to show here.
nixos/doc/manual/configuration/user-mgmt.xmldeleted−88
This diff is too big to show here.
nixos/doc/manual/configuration/wayland.chapter.mdnew file+27
This diff is too big to show here.
nixos/doc/manual/configuration/wayland.xmldeleted−23
This diff is too big to show here.
nixos/doc/manual/configuration/wireless.section.mdnew file+67
This diff is too big to show here.
nixos/doc/manual/configuration/wireless.xmldeleted−70
This diff is too big to show here.
nixos/doc/manual/configuration/x-windows.chapter.mdnew file+337
This diff is too big to show here.
nixos/doc/manual/configuration/x-windows.xmldeleted−335
This diff is too big to show here.
nixos/doc/manual/configuration/xfce.chapter.mdnew file+52
This diff is too big to show here.
nixos/doc/manual/configuration/xfce.xmldeleted−59
This diff is too big to show here.
nixos/doc/manual/contributing-to-this-manual.chapter.mdnew file+13
This diff is too big to show here.
nixos/doc/manual/contributing-to-this-manual.xmldeleted−22
This diff is too big to show here.
nixos/doc/manual/default.nix+19−6
This diff is too big to show here.
nixos/doc/manual/development/activation-script.section.mdnew file+72
This diff is too big to show here.
nixos/doc/manual/development/assertions.section.mdnew file+40
This diff is too big to show here.
nixos/doc/manual/development/assertions.xmldeleted−74
This diff is too big to show here.
nixos/doc/manual/development/building-nixos.xmldeleted−33
This diff is too big to show here.
nixos/doc/manual/development/building-parts.chapter.mdnew file+74
This diff is too big to show here.
nixos/doc/manual/development/building-parts.xmldeleted−121
This diff is too big to show here.
nixos/doc/manual/development/development.xml+7−8
This diff is too big to show here.
nixos/doc/manual/development/freeform-modules.section.mdnew file+79
This diff is too big to show here.
nixos/doc/manual/development/freeform-modules.xmldeleted−68
This diff is too big to show here.
nixos/doc/manual/development/importing-modules.section.mdnew file+46
This diff is too big to show here.
nixos/doc/manual/development/importing-modules.xmldeleted−56
This diff is too big to show here.
nixos/doc/manual/development/linking-nixos-tests-to-packages.section.mdnew file+6
This diff is too big to show here.
nixos/doc/manual/development/meta-attributes.section.mdnew file+66
This diff is too big to show here.
nixos/doc/manual/development/meta-attributes.xmldeleted−63
This diff is too big to show here.
nixos/doc/manual/development/nixos-tests.chapter.mdnew file+13
This diff is too big to show here.
nixos/doc/manual/development/nixos-tests.xmldeleted−19
This diff is too big to show here.
nixos/doc/manual/development/option-declarations.section.mdnew file+221
This diff is too big to show here.
nixos/doc/manual/development/option-declarations.xmldeleted−199
This diff is too big to show here.
nixos/doc/manual/development/option-def.section.mdnew file+91
This diff is too big to show here.
nixos/doc/manual/development/option-def.xmldeleted−99
This diff is too big to show here.
nixos/doc/manual/development/option-types.section.mdnew file+583
This diff is too big to show here.
nixos/doc/manual/development/option-types.xmldeleted−914
This diff is too big to show here.
nixos/doc/manual/development/releases.xmldeleted−366
This diff is too big to show here.
nixos/doc/manual/development/replace-modules.section.mdnew file+64
This diff is too big to show here.
nixos/doc/manual/development/replace-modules.xmldeleted−79
This diff is too big to show here.
nixos/doc/manual/development/running-nixos-tests-interactively.section.mdnew file+35
This diff is too big to show here.
nixos/doc/manual/development/running-nixos-tests-interactively.xmldeleted−49
This diff is too big to show here.
nixos/doc/manual/development/running-nixos-tests.section.mdnew file+31
This diff is too big to show here.
nixos/doc/manual/development/running-nixos-tests.xmldeleted−36
This diff is too big to show here.
nixos/doc/manual/development/settings-options.section.mdnew file+251
This diff is too big to show here.
nixos/doc/manual/development/settings-options.xmldeleted−216
This diff is too big to show here.
nixos/doc/manual/development/sources.chapter.mdnew file+77
This diff is too big to show here.
nixos/doc/manual/development/sources.xmldeleted−85
This diff is too big to show here.
nixos/doc/manual/development/testing-installer.chapter.mdnew file+18
This diff is too big to show here.
nixos/doc/manual/development/testing-installer.xmldeleted−22
This diff is too big to show here.
nixos/doc/manual/development/unit-handling.section.mdnew file+62
This diff is too big to show here.
nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.mdnew file+53
This diff is too big to show here.
nixos/doc/manual/development/writing-documentation.chapter.mdnew file+93
This diff is too big to show here.
nixos/doc/manual/development/writing-documentation.xmldeleted−149
This diff is too big to show here.
nixos/doc/manual/development/writing-modules.chapter.mdnew file+208
This diff is too big to show here.
nixos/doc/manual/development/writing-modules.xmldeleted−191
This diff is too big to show here.
nixos/doc/manual/development/writing-nixos-tests.section.mdnew file+382
This diff is too big to show here.
nixos/doc/manual/development/writing-nixos-tests.xmldeleted−464
This diff is too big to show here.
nixos/doc/manual/from_md/README.mdnew file+5
This diff is too big to show here.
nixos/doc/manual/from_md/administration/boot-problems.section.xmlnew file+144
This diff is too big to show here.
nixos/doc/manual/from_md/administration/cleaning-store.chapter.xmlnew file+72
This diff is too big to show here.
nixos/doc/manual/from_md/administration/container-networking.section.xmlnew file+54
This diff is too big to show here.
nixos/doc/manual/from_md/administration/containers.chapter.xmlnew file+31
This diff is too big to show here.
nixos/doc/manual/from_md/administration/control-groups.chapter.xmlnew file+67
This diff is too big to show here.
nixos/doc/manual/from_md/administration/declarative-containers.section.xmlnew file+60
This diff is too big to show here.
nixos/doc/manual/from_md/administration/imperative-containers.section.xmlnew file+132
This diff is too big to show here.
nixos/doc/manual/from_md/administration/logging.chapter.xmlnew file+45
This diff is too big to show here.
nixos/doc/manual/from_md/administration/maintenance-mode.section.xmlnew file+14
This diff is too big to show here.
nixos/doc/manual/from_md/administration/network-problems.section.xmlnew file+25
This diff is too big to show here.
nixos/doc/manual/from_md/administration/rebooting.chapter.xmlnew file+38
This diff is too big to show here.
nixos/doc/manual/from_md/administration/rollback.section.xmlnew file+42
This diff is too big to show here.
nixos/doc/manual/from_md/administration/service-mgmt.chapter.xmlnew file+141
This diff is too big to show here.
nixos/doc/manual/from_md/administration/store-corruption.section.xmlnew file+34
This diff is too big to show here.
nixos/doc/manual/from_md/administration/troubleshooting.chapter.xmlnew file+12
This diff is too big to show here.
nixos/doc/manual/from_md/administration/user-sessions.chapter.xmlnew file+46
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/abstractions.section.xmlnew file+101
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/ad-hoc-network-config.section.xmlnew file+16
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/ad-hoc-packages.section.xmlnew file+59
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/adding-custom-packages.section.xmlnew file+80
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/config-file.section.xmlnew file+231
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/config-syntax.chapter.xmlnew file+21
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/customizing-packages.section.xmlnew file+90
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/declarative-packages.section.xmlnew file+53
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/file-systems.chapter.xmlnew file+55
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/firewall.section.xmlnew file+39
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/gpu-accel.chapter.xmlnew file+239
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/ipv4-config.section.xmlnew file+43
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/ipv6-config.section.xmlnew file+47
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/kubernetes.chapter.xmlnew file+126
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xmlnew file+157
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/luks-file-systems.section.xmlnew file+84
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/modularity.section.xmlnew file+152
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/network-manager.section.xmlnew file+49
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/networking.chapter.xmlnew file+15
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/package-mgmt.chapter.xmlnew file+28
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles.chapter.xmlnew file+38
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/all-hardware.section.xmlnew file+15
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/base.section.xmlnew file+10
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/clone-config.section.xmlnew file+16
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/demo.section.xmlnew file+10
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/docker-container.section.xmlnew file+12
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/graphical.section.xmlnew file+14
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/hardened.section.xmlnew file+25
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/headless.section.xmlnew file+15
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/installation-device.section.xmlnew file+32
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/minimal.section.xmlnew file+13
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/profiles/qemu-guest.section.xmlnew file+11
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/renaming-interfaces.section.xmlnew file+62
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/ssh.section.xmlnew file+23
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/sshfs-file-systems.section.xmlnew file+139
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/subversion.chapter.xmlnew file+121
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/summary.section.xmlnew file+332
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/user-mgmt.chapter.xmlnew file+105
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/wayland.chapter.xmlnew file+31
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/wireless.section.xmlnew file+73
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/x-windows.chapter.xmlnew file+381
This diff is too big to show here.
nixos/doc/manual/from_md/configuration/xfce.chapter.xmlnew file+62
This diff is too big to show here.
nixos/doc/manual/from_md/contributing-to-this-manual.chapter.xmlnew file+22
This diff is too big to show here.
nixos/doc/manual/from_md/development/activation-script.section.xmlnew file+150
This diff is too big to show here.
nixos/doc/manual/from_md/development/assertions.section.xmlnew file+58
This diff is too big to show here.
nixos/doc/manual/from_md/development/building-parts.chapter.xmlnew file+124
This diff is too big to show here.
nixos/doc/manual/from_md/development/freeform-modules.section.xmlnew file+87
This diff is too big to show here.
nixos/doc/manual/from_md/development/importing-modules.section.xmlnew file+47
This diff is too big to show here.
nixos/doc/manual/from_md/development/linking-nixos-tests-to-packages.section.xmlnew file+10
This diff is too big to show here.
nixos/doc/manual/from_md/development/meta-attributes.section.xmlnew file+95
This diff is too big to show here.
nixos/doc/manual/from_md/development/nixos-tests.chapter.xmlnew file+14
This diff is too big to show here.
nixos/doc/manual/from_md/development/option-declarations.section.xmlnew file+327
This diff is too big to show here.
nixos/doc/manual/from_md/development/option-def.section.xmlnew file+104
This diff is too big to show here.
nixos/doc/manual/from_md/development/option-types.section.xmlnew file+1038
This diff is too big to show here.
nixos/doc/manual/from_md/development/replace-modules.section.xmlnew file+70
This diff is too big to show here.
nixos/doc/manual/from_md/development/running-nixos-tests-interactively.section.xmlnew file+39
This diff is too big to show here.
nixos/doc/manual/from_md/development/running-nixos-tests.section.xmlnew file+34
This diff is too big to show here.
nixos/doc/manual/from_md/development/settings-options.section.xmlnew file+421
This diff is too big to show here.
nixos/doc/manual/from_md/development/sources.chapter.xmlnew file+90
This diff is too big to show here.
nixos/doc/manual/from_md/development/testing-installer.chapter.xmlnew file+22
This diff is too big to show here.
nixos/doc/manual/from_md/development/unit-handling.section.xmlnew file+131
This diff is too big to show here.
nixos/doc/manual/from_md/development/what-happens-during-a-system-switch.chapter.xmlnew file+122
This diff is too big to show here.
nixos/doc/manual/from_md/development/writing-documentation.chapter.xmlnew file+144
This diff is too big to show here.
nixos/doc/manual/from_md/development/writing-modules.chapter.xmlnew file+245
This diff is too big to show here.
nixos/doc/manual/from_md/development/writing-nixos-tests.section.xmlnew file+655
This diff is too big to show here.
nixos/doc/manual/from_md/installation/building-nixos.chapter.xmlnew file+106
This diff is too big to show here.
nixos/doc/manual/from_md/installation/changing-config.chapter.xmlnew file+117
This diff is too big to show here.
nixos/doc/manual/from_md/installation/installing-behind-a-proxy.section.xmlnew file+41
This diff is too big to show here.
nixos/doc/manual/from_md/installation/installing-from-other-distro.section.xmlnew file+388
This diff is too big to show here.
nixos/doc/manual/from_md/installation/installing-pxe.section.xmlnew file+42
This diff is too big to show here.
nixos/doc/manual/from_md/installation/installing-usb.section.xmlnew file+35
This diff is too big to show here.
nixos/doc/manual/from_md/installation/installing-virtualbox-guest.section.xmlnew file+92
This diff is too big to show here.
nixos/doc/manual/from_md/installation/installing.chapter.xmlnew file+645
This diff is too big to show here.
nixos/doc/manual/from_md/installation/obtaining.chapter.xmlnew file+48
This diff is too big to show here.
nixos/doc/manual/from_md/installation/upgrading.chapter.xmlnew file+152
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1310.section.xmlnew file+6
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1404.section.xmlnew file+189
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1412.section.xmlnew file+466
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1509.section.xmlnew file+776
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1603.section.xmlnew file+695
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1609.section.xmlnew file+273
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1703.section.xmlnew file+818
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1709.section.xmlnew file+922
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1803.section.xmlnew file+879
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1809.section.xmlnew file+941
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1903.section.xmlnew file+790
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-1909.section.xmlnew file+1197
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-2003.section.xmlnew file+1497
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-2009.section.xmlnew file+2210
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-2105.section.xmlnew file+1567
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-2111.section.xmlnew file+2091
This diff is too big to show here.
nixos/doc/manual/from_md/release-notes/rl-2205.section.xmlnew file+2470
This diff is too big to show here.
nixos/doc/manual/installation/building-nixos.chapter.mdnew file+77
This diff is too big to show here.
nixos/doc/manual/installation/changing-config.chapter.mdnew file+100
This diff is too big to show here.
nixos/doc/manual/installation/changing-config.xmldeleted−97
This diff is too big to show here.
nixos/doc/manual/installation/installation.xml+5−4
This diff is too big to show here.
nixos/doc/manual/installation/installing-behind-a-proxy.section.mdnew file+29
This diff is too big to show here.
nixos/doc/manual/installation/installing-behind-a-proxy.xmldeleted−48
This diff is too big to show here.
nixos/doc/manual/installation/installing-from-other-distro.section.mdnew file+279
This diff is too big to show here.
nixos/doc/manual/installation/installing-from-other-distro.xmldeleted−364
This diff is too big to show here.
nixos/doc/manual/installation/installing-pxe.section.mdnew file+32
This diff is too big to show here.
nixos/doc/manual/installation/installing-pxe.xmldeleted−50
This diff is too big to show here.
nixos/doc/manual/installation/installing-usb.section.mdnew file+31
This diff is too big to show here.
nixos/doc/manual/installation/installing-usb.xmldeleted−40
This diff is too big to show here.
nixos/doc/manual/installation/installing-virtualbox-guest.section.mdnew file+59
This diff is too big to show here.
nixos/doc/manual/installation/installing-virtualbox-guest.xmldeleted−103
This diff is too big to show here.
nixos/doc/manual/installation/installing.chapter.mdnew file+482
This diff is too big to show here.
nixos/doc/manual/installation/installing.xmldeleted−573
This diff is too big to show here.
nixos/doc/manual/installation/obtaining.chapter.mdnew file+26
This diff is too big to show here.
nixos/doc/manual/installation/obtaining.xmldeleted−54
This diff is too big to show here.
nixos/doc/manual/installation/upgrading.chapter.mdnew file+118
This diff is too big to show here.
nixos/doc/manual/installation/upgrading.xmldeleted−139
This diff is too big to show here.
nixos/doc/manual/man-nixos-install.xml+9−4
This diff is too big to show here.
nixos/doc/manual/man-nixos-rebuild.xml+68−11
This diff is too big to show here.
nixos/doc/manual/man-pages.xml+7−2
This diff is too big to show here.
nixos/doc/manual/manual.xml+1−1
This diff is too big to show here.
nixos/doc/manual/md-to-db.shnew file+49
This diff is too big to show here.
nixos/doc/manual/preface.xml+7−6
This diff is too big to show here.
nixos/doc/manual/release-notes/release-notes.xml+17−15
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1310.section.mdnew file+3
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1310.xmldeleted−11
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1404.section.mdnew file+81
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1404.xmldeleted−179
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1412.section.mdnew file+171
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1412.xmldeleted−467
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1509.section.mdnew file+319
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1509.xmldeleted−750
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1603.section.mdnew file+282
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1603.xmldeleted−671
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1609.section.mdnew file+73
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1609.xmldeleted−277
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1703.section.mdnew file+303
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1703.xmldeleted−817
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1709.section.mdnew file+316
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1709.xmldeleted−899
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1803.section.mdnew file+286
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1803.xmldeleted−855
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1809.section.mdnew file+332
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1809.xmldeleted−933
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1903.section.mdnew file+214
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1903.xmldeleted−768
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1909.section.mdnew file+313
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-1909.xmldeleted−902
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-2003.section.mdnew file+507
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-2003.xmldeleted−1252
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-2009.section.mdnew file+747
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-2009.xmldeleted−1830
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-2105.section.mdnew file+428
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-2105.xmldeleted−888
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-2111.section.mdnew file+575
This diff is too big to show here.
nixos/doc/manual/release-notes/rl-2205.section.mdnew file+878
This diff is too big to show here.
nixos/doc/manual/shell.nix+1−1
This diff is too big to show here.
nixos/lib/build-vms.nix+23−9
This diff is too big to show here.
nixos/lib/default.nixnew file+33
This diff is too big to show here.
nixos/lib/eval-cacheable-options.nixnew file+53
This diff is too big to show here.
nixos/lib/eval-config-minimal.nixnew file+49
This diff is too big to show here.
nixos/lib/eval-config.nix+54−16
This diff is too big to show here.
nixos/lib/make-disk-image.nix+138−29
This diff is too big to show here.
nixos/lib/make-ext4-fs.nix+3−5
This diff is too big to show here.
nixos/lib/make-iso9660-image.sh+1
This diff is too big to show here.
nixos/lib/make-multi-disk-zfs-image.nixnew file+333
This diff is too big to show here.
nixos/lib/make-options-doc/default.nix+79−78
This diff is too big to show here.
nixos/lib/make-options-doc/generateAsciiDoc.pynew file+37
This diff is too big to show here.
nixos/lib/make-options-doc/generateCommonMark.pynew file+27
This diff is too big to show here.
nixos/lib/make-options-doc/mergeJSON.pynew file+95
This diff is too big to show here.
nixos/lib/make-options-doc/options-to-docbook.xsl+30−20
This diff is too big to show here.
nixos/lib/make-options-doc/optionsJSONtoXML.nixnew file+6
This diff is too big to show here.
nixos/lib/make-options-doc/sortXML.pynew file+27
This diff is too big to show here.
nixos/lib/make-single-disk-zfs-image.nixnew file+322
This diff is too big to show here.
nixos/lib/make-squashfs.nix+8−1
This diff is too big to show here.
nixos/lib/qemu-common.nixnew file+32
This diff is too big to show here.
nixos/lib/qemu-flags.nixdeleted−32
This diff is too big to show here.
nixos/lib/systemd-lib.nixnew file+426
This diff is too big to show here.
nixos/lib/systemd-types.nixnew file+69
This diff is too big to show here.
nixos/lib/systemd-unit-options.nixnew file+711
This diff is too big to show here.
nixos/lib/test-driver/default.nixnew file+32
This diff is too big to show here.
nixos/lib/test-driver/setup.pynew file+13
This diff is too big to show here.
nixos/lib/test-driver/test-driver.pydeleted−966
This diff is too big to show here.
nixos/lib/test-driver/test_driver/__init__.pynew file+128
This diff is too big to show here.
nixos/lib/test-driver/test_driver/driver.pynew file+226
This diff is too big to show here.
nixos/lib/test-driver/test_driver/logger.pynew file+105
This diff is too big to show here.
nixos/lib/test-driver/test_driver/machine.pynew file+1023
This diff is too big to show here.
nixos/lib/test-driver/test_driver/polling_condition.pynew file+77
This diff is too big to show here.
nixos/lib/test-driver/test_driver/vlan.pynew file+58
This diff is too big to show here.
nixos/lib/testing-python.nix+186−237
This diff is too big to show here.
nixos/lib/utils.nix+78−6
This diff is too big to show here.
nixos/maintainers/scripts/azure-new/examples/basic/image.nix+1−1
This diff is too big to show here.
nixos/maintainers/scripts/azure-new/examples/basic/system.nix+1−1
This diff is too big to show here.
nixos/maintainers/scripts/cloudstack/cloudstack-image.nix−1
This diff is too big to show here.
nixos/maintainers/scripts/ec2/amazon-image-zfs.nixnew file+12
This diff is too big to show here.
nixos/maintainers/scripts/ec2/amazon-image.nix+100−29
This diff is too big to show here.
nixos/maintainers/scripts/ec2/create-amis.sh+83−45
This diff is too big to show here.
nixos/maintainers/scripts/gce/create-gce.sh+12
This diff is too big to show here.
nixos/maintainers/scripts/lxd/lxd-image-inner.nixnew file+102
This diff is too big to show here.
nixos/maintainers/scripts/lxd/lxd-image.nixnew file+34
This diff is too big to show here.
nixos/maintainers/scripts/lxd/nix.tplnew file+9
This diff is too big to show here.
nixos/maintainers/scripts/openstack/openstack-image-zfs.nixnew file+101
This diff is too big to show here.
nixos/maintainers/scripts/openstack/openstack-image.nix+10−9
This diff is too big to show here.
nixos/modules/config/console.nix+31−13
This diff is too big to show here.
nixos/modules/config/fonts/fontconfig.nix+35−17
This diff is too big to show here.
nixos/modules/config/fonts/fontdir.nix+2−2
This diff is too big to show here.
nixos/modules/config/fonts/fonts.nix+46−21
This diff is too big to show here.
nixos/modules/config/gtk/gtk-icon-cache.nix+1
This diff is too big to show here.
nixos/modules/config/i18n.nix+7−1
This diff is too big to show here.
nixos/modules/config/iproute2.nix+9−9
This diff is too big to show here.
nixos/modules/config/krb5/default.nix+8−8
This diff is too big to show here.
nixos/modules/config/ldap.nix+1−1
This diff is too big to show here.
nixos/modules/config/malloc.nix+28−2
This diff is too big to show here.
nixos/modules/config/networking.nix+11−7
This diff is too big to show here.
nixos/modules/config/nsswitch.nix+9−6
This diff is too big to show here.
nixos/modules/config/power-management.nix+2−2
This diff is too big to show here.
nixos/modules/config/pulseaudio.nix+12−11
This diff is too big to show here.
nixos/modules/config/resolvconf.nix+2−4
This diff is too big to show here.
nixos/modules/config/shells-environment.nix+15−5
This diff is too big to show here.
nixos/modules/config/swap.nix+34−7
This diff is too big to show here.
nixos/modules/config/sysctl.nix+1−1
This diff is too big to show here.
nixos/modules/config/system-environment.nix+34−36
This diff is too big to show here.
nixos/modules/config/system-path.nix+30−12
This diff is too big to show here.
nixos/modules/config/terminfo.nix+25−1
This diff is too big to show here.
nixos/modules/config/unix-odbc-drivers.nix+1−1
This diff is too big to show here.
nixos/modules/config/update-users-groups.pl+29−16
This diff is too big to show here.
nixos/modules/config/users-groups.nix+107−50
This diff is too big to show here.
nixos/modules/config/xdg/mime.nix+64−2
This diff is too big to show here.
nixos/modules/config/xdg/portal.nix+23−12
This diff is too big to show here.
nixos/modules/config/xdg/portals/wlr.nixnew file+67
This diff is too big to show here.
nixos/modules/hardware/all-firmware.nix+25−7
This diff is too big to show here.
nixos/modules/hardware/ckb-next.nix+1−1
This diff is too big to show here.
nixos/modules/hardware/corectrl.nixnew file+62
This diff is too big to show here.
nixos/modules/hardware/cpu/intel-sgx.nixnew file+69
This diff is too big to show here.
nixos/modules/hardware/device-tree.nix+5−5
This diff is too big to show here.
nixos/modules/hardware/digitalbitbox.nix+1−1
This diff is too big to show here.
nixos/modules/hardware/flirc.nixnew file+12
This diff is too big to show here.
nixos/modules/hardware/gkraken.nixnew file+18
This diff is too big to show here.
nixos/modules/hardware/gpgsmartcards.nixnew file+37
This diff is too big to show here.
nixos/modules/hardware/hackrf.nixnew file+23
This diff is too big to show here.
nixos/modules/hardware/keyboard/teck.nixnew file+16
This diff is too big to show here.
nixos/modules/hardware/keyboard/zsa.nix−3
This diff is too big to show here.
nixos/modules/hardware/network/b43.nix−4
This diff is too big to show here.
nixos/modules/hardware/onlykey.udevdeleted−4
This diff is too big to show here.
nixos/modules/hardware/onlykey.nix → nixos/modules/hardware/onlykey/default.nixrenamed
The content is the same.
nixos/modules/hardware/onlykey/onlykey.udevnew file+18
This diff is too big to show here.
nixos/modules/hardware/opengl.nix+3−4
This diff is too big to show here.
nixos/modules/hardware/openrazer.nix+18−5
This diff is too big to show here.
nixos/modules/hardware/opentabletdriver.nix+1−1
This diff is too big to show here.
nixos/modules/hardware/pcmcia.nix+1
This diff is too big to show here.
nixos/modules/hardware/printers.nix+7−12
This diff is too big to show here.
nixos/modules/hardware/raid/hpsa.nix+4−1
This diff is too big to show here.
nixos/modules/hardware/rtl-sdr.nix+9−6
This diff is too big to show here.
nixos/modules/hardware/sata.nixnew file+100
This diff is too big to show here.
nixos/modules/hardware/sensor/iio.nix+1−1
This diff is too big to show here.
nixos/modules/hardware/system-76.nix+36−3
This diff is too big to show here.
nixos/modules/hardware/ubertooth.nixnew file+29
This diff is too big to show here.
nixos/modules/hardware/video/amdgpu-pro.nix+25−22
This diff is too big to show here.
nixos/modules/hardware/video/amdgpu.nixdeleted−9
This diff is too big to show here.
nixos/modules/hardware/video/ati.nixdeleted−40
This diff is too big to show here.
nixos/modules/hardware/video/capture/mwprocapture.nix−5
This diff is too big to show here.
nixos/modules/hardware/video/nvidia.nix+59−24
This diff is too big to show here.
nixos/modules/hardware/video/uvcvideo/default.nix+1−1
This diff is too big to show here.
nixos/modules/hardware/video/webcam/facetimehd.nix+14−6
This diff is too big to show here.
nixos/modules/hardware/xone.nixnew file+23
This diff is too big to show here.
nixos/modules/hardware/xpadneo.nix+1−1
This diff is too big to show here.
nixos/modules/i18n/input-method/default.nix+2−1
This diff is too big to show here.
nixos/modules/i18n/input-method/default.xml+22
This diff is too big to show here.
nixos/modules/i18n/input-method/fcitx.nix+4−1
This diff is too big to show here.
nixos/modules/i18n/input-method/fcitx5.nix+32−18
This diff is too big to show here.
nixos/modules/i18n/input-method/ibus.nix+5−2
This diff is too big to show here.
nixos/modules/i18n/input-method/kime.nixnew file+51
This diff is too big to show here.
nixos/modules/installer/cd-dvd/channel.nix+2−1
This diff is too big to show here.
nixos/modules/installer/cd-dvd/installation-cd-base.nix+16
This diff is too big to show here.
nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix+14−8
This diff is too big to show here.
nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nixnew file+59
This diff is too big to show here.
nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nixnew file+49
This diff is too big to show here.
nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares.nixnew file+20
This diff is too big to show here.
nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix+4−6
This diff is too big to show here.
nixos/modules/installer/cd-dvd/installation-cd-graphical-plasma5.nix+1−3
This diff is too big to show here.
nixos/modules/installer/cd-dvd/iso-image.nix+182−88
This diff is too big to show here.
nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nixdeleted−14
This diff is too big to show here.
nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix+1−1
This diff is too big to show here.
nixos/modules/installer/cd-dvd/system-tarball-pc.nix+1−1
This diff is too big to show here.
nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix+4−4
This diff is too big to show here.
nixos/modules/installer/cd-dvd/system-tarball.nix+2−2
This diff is too big to show here.
nixos/modules/installer/kexec/kexec-boot.nixnew file+51
This diff is too big to show here.
nixos/modules/installer/netboot/netboot.nix+14−6
This diff is too big to show here.
nixos/modules/installer/sd-card/sd-image-aarch64.nix+15−7
This diff is too big to show here.
nixos/modules/installer/sd-card/sd-image-raspberrypi.nix+1−1
This diff is too big to show here.
nixos/modules/installer/sd-card/sd-image-raspberrypi4-installer.nixdeleted−10
This diff is too big to show here.
nixos/modules/installer/sd-card/sd-image-raspberrypi4.nixdeleted−8
This diff is too big to show here.
nixos/modules/installer/sd-card/sd-image-riscv64-qemu-installer.nixnew file+10
This diff is too big to show here.
nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nixnew file+32
This diff is too big to show here.
nixos/modules/installer/sd-card/sd-image-x86_64.nixnew file+27
This diff is too big to show here.
nixos/modules/installer/sd-card/sd-image.nix+31−7
This diff is too big to show here.
nixos/modules/installer/tools/nix-fallback-paths.nix+5−4
This diff is too big to show here.
nixos/modules/installer/tools/nixos-build-vms/build-vms.nix+18−5
This diff is too big to show here.
nixos/modules/installer/tools/nixos-build-vms/nixos-build-vms.sh+4−3
This diff is too big to show here.
nixos/modules/installer/tools/nixos-enter.sh+33−1
This diff is too big to show here.
nixos/modules/installer/tools/nixos-generate-config.pl+24−6
This diff is too big to show here.
nixos/modules/installer/tools/nixos-install.sh+20−19
This diff is too big to show here.
nixos/modules/installer/tools/nixos-option/default.nix+1−11
This diff is too big to show here.
nixos/modules/installer/tools/nixos-version.sh+1
This diff is too big to show here.
nixos/modules/installer/tools/tools.nix+33−8
This diff is too big to show here.
nixos/modules/installer/virtualbox-demo.nix+2−2
This diff is too big to show here.
nixos/modules/misc/crashdump.nix+1−1
This diff is too big to show here.
nixos/modules/misc/documentation.nix+129−53
This diff is too big to show here.
nixos/modules/misc/extra-arguments.nix+2−2
This diff is too big to show here.
nixos/modules/misc/ids.nix+74−61
This diff is too big to show here.
nixos/modules/misc/locate.nix+134−69
This diff is too big to show here.
nixos/modules/misc/man-db.nixnew file+73
This diff is too big to show here.
nixos/modules/misc/mandoc.nixnew file+61
This diff is too big to show here.
nixos/modules/misc/meta.nix+16−1
This diff is too big to show here.
nixos/modules/misc/nixpkgs.nix+18−10
This diff is too big to show here.
nixos/modules/misc/nixpkgs/test.nixnew file+8
This diff is too big to show here.
nixos/modules/misc/version.nix+52−18
This diff is too big to show here.
nixos/modules/misc/wordlist.nixnew file+59
This diff is too big to show here.
nixos/modules/module-list.nix+229−52
This diff is too big to show here.
nixos/modules/profiles/all-hardware.nix+63−2
This diff is too big to show here.
nixos/modules/profiles/base.nix+1
This diff is too big to show here.
nixos/modules/profiles/hardened.nix+2−1
This diff is too big to show here.
nixos/modules/profiles/headless.nix+1−1
This diff is too big to show here.
nixos/modules/profiles/installation-device.nix+18
This diff is too big to show here.
nixos/modules/profiles/minimal.nix+2
This diff is too big to show here.
nixos/modules/profiles/qemu-guest.nix+2−2
This diff is too big to show here.
nixos/modules/programs/_1password-gui.nixnew file+68
This diff is too big to show here.
nixos/modules/programs/_1password.nixnew file+44
This diff is too big to show here.
nixos/modules/programs/adb.nix+1−2
This diff is too big to show here.
nixos/modules/programs/appgate-sdp.nix+5−3
This diff is too big to show here.
nixos/modules/programs/atop.nix+127−8
This diff is too big to show here.
nixos/modules/programs/bandwhich.nix+3−1
This diff is too big to show here.
nixos/modules/programs/bash/bash-completion.nixnew file+37
This diff is too big to show here.
nixos/modules/programs/bash/bash.nix+10−43
This diff is too big to show here.
nixos/modules/programs/bash/ls-colors.nixnew file+20
This diff is too big to show here.
nixos/modules/programs/bash/undistract-me.nixnew file+36
This diff is too big to show here.
nixos/modules/programs/bcc.nix+3−3
This diff is too big to show here.
nixos/modules/programs/calls.nixnew file+27
This diff is too big to show here.
nixos/modules/programs/captive-browser.nix+45−19
This diff is too big to show here.
nixos/modules/programs/ccache.nix+3−1
This diff is too big to show here.
nixos/modules/programs/chromium.nix+13−2
This diff is too big to show here.
nixos/modules/programs/cnping.nixnew file+21
This diff is too big to show here.
nixos/modules/programs/command-not-found/command-not-found.nix+7−9
This diff is too big to show here.
nixos/modules/programs/command-not-found/command-not-found.pl+38−13
This diff is too big to show here.
nixos/modules/programs/dconf.nix+3−1
This diff is too big to show here.
nixos/modules/programs/digitalbitbox/default.nix+1−1
This diff is too big to show here.
nixos/modules/programs/dmrconfig.nix+1−1
This diff is too big to show here.
nixos/modules/programs/droidcam.nixnew file+16
This diff is too big to show here.
nixos/modules/programs/environment.nix+9−2
This diff is too big to show here.
nixos/modules/programs/evince.nix+13−4
This diff is too big to show here.
nixos/modules/programs/extra-container.nixnew file+17
This diff is too big to show here.
nixos/modules/programs/feedbackd.nixnew file+33
This diff is too big to show here.
nixos/modules/programs/file-roller.nix+13−4
This diff is too big to show here.
nixos/modules/programs/firejail.nix+15−8
This diff is too big to show here.
nixos/modules/programs/fish.nix+18
This diff is too big to show here.
nixos/modules/programs/flashrom.nixnew file+26
This diff is too big to show here.
nixos/modules/programs/flexoptix-app.nixnew file+25
This diff is too big to show here.
nixos/modules/programs/freetds.nix+1−1
This diff is too big to show here.
nixos/modules/programs/gamemode.nixnew file+98
This diff is too big to show here.
nixos/modules/programs/geary.nix+3−3
This diff is too big to show here.
nixos/modules/programs/git.nixnew file+69
This diff is too big to show here.
nixos/modules/programs/gnome-disks.nix+2−2
This diff is too big to show here.
nixos/modules/programs/gnome-documents.nix+5−5
This diff is too big to show here.
nixos/modules/programs/gnome-terminal.nix+3−3
This diff is too big to show here.
nixos/modules/programs/gnupg.nix+4−1
This diff is too big to show here.
nixos/modules/programs/gpaste.nix+4−4
This diff is too big to show here.
nixos/modules/programs/hamster.nix+1−1
This diff is too big to show here.
nixos/modules/programs/htop.nixnew file+58
This diff is too big to show here.
nixos/modules/programs/iftop.nix+3−1
This diff is too big to show here.
nixos/modules/programs/iotop.nix+3−1
This diff is too big to show here.
nixos/modules/programs/java.nix+1−1
This diff is too big to show here.
nixos/modules/programs/k3b.nixnew file+52
This diff is too big to show here.
nixos/modules/programs/k40-whisperer.nixnew file+40
This diff is too big to show here.
nixos/modules/programs/kbdlight.nix+6−1
This diff is too big to show here.
nixos/modules/programs/kclock.nixnew file+13
This diff is too big to show here.
nixos/modules/programs/kdeconnect.nixnew file+35
This diff is too big to show here.
nixos/modules/programs/less.nix+9−6
This diff is too big to show here.
nixos/modules/programs/liboping.nix+3−1
This diff is too big to show here.
nixos/modules/programs/mininet.nix+3−3
This diff is too big to show here.
nixos/modules/programs/mosh.nix+1−1
This diff is too big to show here.
nixos/modules/programs/msmtp.nix+2
This diff is too big to show here.
nixos/modules/programs/mtr.nix+4−1
This diff is too big to show here.
nixos/modules/programs/nbd.nixnew file+19
This diff is too big to show here.
nixos/modules/programs/neovim.nix+29−28
This diff is too big to show here.
nixos/modules/programs/nethoscope.nixnew file+30
This diff is too big to show here.
nixos/modules/programs/nix-ld.nixnew file+12
This diff is too big to show here.
nixos/modules/programs/nncp.nixnew file+101
This diff is too big to show here.
nixos/modules/programs/noisetorch.nixnew file+28
This diff is too big to show here.
nixos/modules/programs/npm.nix+3−2
This diff is too big to show here.
nixos/modules/programs/pantheon-tweaks.nixnew file+19
This diff is too big to show here.
nixos/modules/programs/phosh.nixnew file+162
This diff is too big to show here.
nixos/modules/programs/plotinus.nix+1−1
This diff is too big to show here.
nixos/modules/programs/proxychains.nix+1−1
This diff is too big to show here.
nixos/modules/programs/qt5ct.nix+1−1
This diff is too big to show here.
nixos/modules/programs/seahorse.nix+3−3
This diff is too big to show here.
nixos/modules/programs/shadow.nix+15−8
This diff is too big to show here.
nixos/modules/programs/singularity.nix+6−1
This diff is too big to show here.
nixos/modules/programs/slock.nix+6−1
This diff is too big to show here.
nixos/modules/programs/spacefm.nix+6−6
This diff is too big to show here.
nixos/modules/programs/ssh.nix+72−18
This diff is too big to show here.
nixos/modules/programs/ssmtp.nixdeleted−187
This diff is too big to show here.
nixos/modules/programs/starship.nixnew file+51
This diff is too big to show here.
nixos/modules/programs/sway.nix+29−16
This diff is too big to show here.
nixos/modules/programs/thefuck.nix+7−6
This diff is too big to show here.
nixos/modules/programs/tilp2.nixdeleted−28
This diff is too big to show here.
nixos/modules/programs/tmux.nix+14−1
This diff is too big to show here.
nixos/modules/programs/traceroute.nix+3−1
This diff is too big to show here.
nixos/modules/programs/tsm-client.nix+8−8
This diff is too big to show here.
nixos/modules/programs/udevil.nix+6−1
This diff is too big to show here.
nixos/modules/programs/vim.nix+2−2
This diff is too big to show here.
nixos/modules/programs/wavemon.nix+3−1
This diff is too big to show here.
nixos/modules/programs/weylus.nixnew file+47
This diff is too big to show here.
nixos/modules/programs/wireshark.nix+1−1
This diff is too big to show here.
nixos/modules/programs/wshowkeys.nix+6−1
This diff is too big to show here.
nixos/modules/programs/xonsh.nix+2−1
This diff is too big to show here.
nixos/modules/programs/xss-lock.nix+2−1
This diff is too big to show here.
nixos/modules/programs/xwayland.nix+13−8
This diff is too big to show here.
nixos/modules/programs/yabar.nix+2−1
This diff is too big to show here.
nixos/modules/programs/zsh/oh-my-zsh.nix+1−1
This diff is too big to show here.
nixos/modules/programs/zsh/zsh-autoenv.nix+1−1
This diff is too big to show here.
nixos/modules/programs/zsh/zsh-autosuggestions.nix+20−11
This diff is too big to show here.
nixos/modules/programs/zsh/zsh-syntax-highlighting.nix+2−2
This diff is too big to show here.
nixos/modules/programs/zsh/zsh.nix+14−6
This diff is too big to show here.
nixos/modules/rename.nix+63−43
This diff is too big to show here.
nixos/modules/security/acme.nixdeleted−730
This diff is too big to show here.
nixos/modules/security/acme.xmldeleted−298
This diff is too big to show here.
nixos/modules/security/acme/default.nixnew file+921
This diff is too big to show here.
nixos/modules/security/acme/doc.xmlnew file+413
This diff is too big to show here.
nixos/modules/security/acme/mk-cert-ownership-assertion.nixnew file+4
This diff is too big to show here.
nixos/modules/security/apparmor-suid.nixdeleted−49
This diff is too big to show here.
nixos/modules/security/apparmor.nix+208−51
This diff is too big to show here.
nixos/modules/security/apparmor/includes.nixnew file+317
This diff is too big to show here.
nixos/modules/security/apparmor/profiles.nixnew file+11
This diff is too big to show here.
nixos/modules/security/ca.nix+11−17
This diff is too big to show here.
nixos/modules/security/chromium-suid-sandbox.nix+6−1
This diff is too big to show here.
nixos/modules/security/dhparams.nix+5−3
This diff is too big to show here.
nixos/modules/security/doas.nix+8−5
This diff is too big to show here.
nixos/modules/security/duosec.nix+6−1
This diff is too big to show here.
nixos/modules/security/google_oslogin.nix+6−3
This diff is too big to show here.
nixos/modules/security/lock-kernel-modules.nix+19−9
This diff is too big to show here.
nixos/modules/security/misc.nix+6−2
This diff is too big to show here.
nixos/modules/security/pam.nix+504−145
This diff is too big to show here.
nixos/modules/security/pam_mount.nix+102−7
This diff is too big to show here.
nixos/modules/security/pam_usb.nix+12−2
This diff is too big to show here.
nixos/modules/security/polkit.nix+15−7
This diff is too big to show here.
nixos/modules/security/rtkit.nix+4−1
This diff is too big to show here.
nixos/modules/security/sudo.nix+28−6
This diff is too big to show here.
nixos/modules/security/systemd-confinement.nix+7−9
This diff is too big to show here.
nixos/modules/security/tpm2.nix+5−5
This diff is too big to show here.
nixos/modules/security/wrappers/default.nix+195−96
This diff is too big to show here.
nixos/modules/services/admin/meshcentral.nixnew file+53
This diff is too big to show here.
nixos/modules/services/admin/oxidized.nix+2−2
This diff is too big to show here.
nixos/modules/services/admin/pgadmin.nixnew file+127
This diff is too big to show here.
nixos/modules/services/amqp/activemq/default.nix+2−1
This diff is too big to show here.
nixos/modules/services/amqp/rabbitmq.nix+26−9
This diff is too big to show here.
nixos/modules/services/audio/alsa.nix+8−8
This diff is too big to show here.
nixos/modules/services/audio/botamusique.nixnew file+115
This diff is too big to show here.
nixos/modules/services/audio/hqplayerd.nixnew file+142
This diff is too big to show here.
nixos/modules/services/audio/icecast.nix+1
This diff is too big to show here.
nixos/modules/services/audio/jack.nix+8−8
This diff is too big to show here.
nixos/modules/services/audio/jmusicbot.nixnew file+48
This diff is too big to show here.
nixos/modules/services/audio/liquidsoap.nix+3−3
This diff is too big to show here.
nixos/modules/services/audio/mopidy.nix+1−1
This diff is too big to show here.
nixos/modules/services/audio/mpd.nix+27−44
This diff is too big to show here.
nixos/modules/services/audio/mpdscribble.nix+13−2
This diff is too big to show here.
nixos/modules/services/audio/navidrome.nixnew file+71
This diff is too big to show here.
nixos/modules/services/audio/networkaudiod.nixnew file+19
This diff is too big to show here.
nixos/modules/services/audio/roon-bridge.nixnew file+76
This diff is too big to show here.
nixos/modules/services/audio/roon-server.nix+9−4
This diff is too big to show here.
nixos/modules/services/audio/slimserver.nix+2−1
This diff is too big to show here.
nixos/modules/services/audio/snapserver.nix+43−26
This diff is too big to show here.
nixos/modules/services/audio/spotifyd.nix+26−1
This diff is too big to show here.
nixos/modules/services/audio/squeezelite.nix+17−21
This diff is too big to show here.
nixos/modules/services/audio/ympd.nix+1−1
This diff is too big to show here.
nixos/modules/services/backup/automysqlbackup.nix+3−2
This diff is too big to show here.
nixos/modules/services/backup/bacula.nix+3
This diff is too big to show here.
nixos/modules/services/backup/borgbackup.nix+78−23
This diff is too big to show here.
nixos/modules/services/backup/btrbk.nixnew file+220
This diff is too big to show here.
nixos/modules/services/backup/duplicati.nix+31−12
This diff is too big to show here.
nixos/modules/services/backup/duplicity.nix+73−18
This diff is too big to show here.
nixos/modules/services/backup/mysql-backup.nix+4−3
This diff is too big to show here.
nixos/modules/services/backup/postgresql-backup.nix+45−10
This diff is too big to show here.
nixos/modules/services/backup/postgresql-wal-receiver.nix+5−5
This diff is too big to show here.
nixos/modules/services/backup/restic-rest-server.nix+5−1
This diff is too big to show here.
nixos/modules/services/backup/restic.nix+17−5
This diff is too big to show here.
nixos/modules/services/backup/sanoid.nix+143−152
This diff is too big to show here.
nixos/modules/services/backup/syncoid.nix+390−185
This diff is too big to show here.
nixos/modules/services/backup/tarsnap.nix+25−18
This diff is too big to show here.
nixos/modules/services/backup/tsm.nix+33−14
This diff is too big to show here.
nixos/modules/services/backup/znapzend.nix+8−8
This diff is too big to show here.
nixos/modules/services/backup/zrepl.nix+3
This diff is too big to show here.
nixos/modules/services/blockchain/ethereum/geth.nix+3−2
This diff is too big to show here.
nixos/modules/services/cluster/corosync/default.nixnew file+112
This diff is too big to show here.
nixos/modules/services/cluster/hadoop/conf.nix+25−12
This diff is too big to show here.
nixos/modules/services/cluster/hadoop/default.nix+175−23
This diff is too big to show here.
nixos/modules/services/cluster/hadoop/hdfs.nix+175−44
This diff is too big to show here.
nixos/modules/services/cluster/hadoop/yarn.nix+155−29
This diff is too big to show here.
nixos/modules/services/cluster/k3s/default.nix+35−13
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/addon-manager.nix+8−4
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/addons/dashboard.nixdeleted−332
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/addons/dns.nix+50−15
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/apiserver.nix+12−9
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/controller-manager.nix+11−2
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/default.nix+33−22
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/flannel.nix+4−2
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/kubelet.nix+17−6
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/pki.nix+5−1
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/proxy.nix+11−3
This diff is too big to show here.
nixos/modules/services/cluster/kubernetes/scheduler.nix+11−4
This diff is too big to show here.
nixos/modules/services/cluster/pacemaker/default.nixnew file+52
This diff is too big to show here.
nixos/modules/services/cluster/spark/default.nixnew file+162
This diff is too big to show here.
nixos/modules/services/computing/boinc/client.nix+2−2
This diff is too big to show here.
nixos/modules/services/computing/foldingathome/client.nix+11−1
This diff is too big to show here.
nixos/modules/services/computing/slurm/slurm.nix+19−12
This diff is too big to show here.
nixos/modules/services/continuous-integration/buildbot/master.nix+12−9
This diff is too big to show here.
nixos/modules/services/continuous-integration/buildbot/worker.nix+7−5
This diff is too big to show here.
nixos/modules/services/continuous-integration/buildkite-agents.nix+12−8
This diff is too big to show here.
nixos/modules/services/continuous-integration/github-runner.nixnew file+320
This diff is too big to show here.
nixos/modules/services/continuous-integration/gitlab-runner.nix+22−9
This diff is too big to show here.
nixos/modules/services/continuous-integration/gocd-agent/default.nix+12−2
This diff is too big to show here.
nixos/modules/services/continuous-integration/gocd-server/default.nix+17−2
This diff is too big to show here.
nixos/modules/services/continuous-integration/hail.nix+1−1
This diff is too big to show here.
nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix+98−24
This diff is too big to show here.
nixos/modules/services/continuous-integration/hercules-ci-agent/default.nix+21−5
This diff is too big to show here.
nixos/modules/services/continuous-integration/hydra/default.nix+18−12
This diff is too big to show here.
nixos/modules/services/continuous-integration/jenkins/default.nix+30−9
This diff is too big to show here.
nixos/modules/services/continuous-integration/jenkins/job-builder.nix+52−16
This diff is too big to show here.
nixos/modules/services/continuous-integration/jenkins/slave.nix+15−1
This diff is too big to show here.
nixos/modules/services/databases/aerospike.nix+1−1
This diff is too big to show here.
nixos/modules/services/databases/cassandra.nix+245−174
This diff is too big to show here.
nixos/modules/services/databases/clickhouse.nix+14−4
This diff is too big to show here.
nixos/modules/services/databases/cockroachdb.nix+38−30
This diff is too big to show here.
nixos/modules/services/databases/couchdb.nix+27−19
This diff is too big to show here.
nixos/modules/services/databases/firebird.nix+15−11
This diff is too big to show here.
nixos/modules/services/databases/hbase.nix+39−17
This diff is too big to show here.
nixos/modules/services/databases/influxdb.nix+4−4
This diff is too big to show here.
nixos/modules/services/databases/influxdb2.nixnew file+66
This diff is too big to show here.
nixos/modules/services/databases/memcached.nix+2
This diff is too big to show here.
nixos/modules/services/databases/monetdb.nix+1−1
This diff is too big to show here.
nixos/modules/services/databases/mongodb.nix+4−2
This diff is too big to show here.
nixos/modules/services/databases/mysql.nix+191−201
This diff is too big to show here.
nixos/modules/services/databases/neo4j.nix+12−2
This diff is too big to show here.
nixos/modules/services/databases/openldap.nix+7−6
This diff is too big to show here.
nixos/modules/services/databases/opentsdb.nix+1−2
This diff is too big to show here.
nixos/modules/services/databases/pgmanage.nix+2−1
This diff is too big to show here.
nixos/modules/services/databases/postgresql.nix+30−15
This diff is too big to show here.
nixos/modules/services/databases/postgresql.xml+54−32
This diff is too big to show here.
nixos/modules/services/databases/redis.nix+311−208
This diff is too big to show here.
nixos/modules/services/databases/riak.nix+1−2
This diff is too big to show here.
nixos/modules/services/databases/victoriametrics.nix+9−1
This diff is too big to show here.
nixos/modules/services/databases/virtuoso.nixdeleted−99
This diff is too big to show here.
nixos/modules/services/desktops/bamf.nix+2−2
This diff is too big to show here.
nixos/modules/services/desktops/cpupower-gui.nixnew file+56
This diff is too big to show here.
nixos/modules/services/desktops/espanso.nix−1
This diff is too big to show here.
nixos/modules/services/desktops/flatpak.nix+3−13
This diff is too big to show here.
nixos/modules/services/desktops/geoclue2.nix+7−5
This diff is too big to show here.
nixos/modules/services/desktops/gnome/at-spi2-core.nixnew file+57
This diff is too big to show here.
nixos/modules/services/desktops/gnome/chrome-gnome-shell.nixnew file+41
This diff is too big to show here.
nixos/modules/services/desktops/gnome/evolution-data-server.nixnew file+71
This diff is too big to show here.
nixos/modules/services/desktops/gnome/glib-networking.nixnew file+45
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/gnome-initial-setup.nix → nixos/modules/services/desktops/gnome/gnome-initial-setup.nixrenamed+12−4
This diff is too big to show here.
nixos/modules/services/desktops/gnome/gnome-keyring.nixnew file+63
This diff is too big to show here.
nixos/modules/services/desktops/gnome/gnome-online-accounts.nixnew file+51
This diff is too big to show here.
nixos/modules/services/desktops/gnome/gnome-online-miners.nixnew file+51
This diff is too big to show here.
nixos/modules/services/desktops/gnome/gnome-remote-desktop.nixnew file+32
This diff is too big to show here.
nixos/modules/services/desktops/gnome/gnome-settings-daemon.nixnew file+70
This diff is too big to show here.
nixos/modules/services/desktops/gnome/gnome-user-share.nixnew file+48
This diff is too big to show here.
nixos/modules/services/desktops/gnome/rygel.nixnew file+44
This diff is too big to show here.
nixos/modules/services/desktops/gnome/sushi.nixnew file+50
This diff is too big to show here.
nixos/modules/services/desktops/gnome/tracker-miners.nixnew file+54
This diff is too big to show here.
nixos/modules/services/desktops/gnome/tracker.nixnew file+76
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/at-spi2-core.nixdeleted−49
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/chrome-gnome-shell.nixdeleted−33
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/evolution-data-server.nixdeleted−59
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/glib-networking.nixdeleted−37
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/gnome-keyring.nixdeleted−53
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/gnome-online-accounts.nixdeleted−43
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/gnome-online-miners.nixdeleted−43
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/gnome-remote-desktop.nixdeleted−24
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/gnome-settings-daemon.nixdeleted−78
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/gnome-user-share.nixdeleted−40
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/rygel.nixdeleted−36
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/sushi.nixdeleted−42
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/tracker-miners.nixdeleted−44
This diff is too big to show here.
nixos/modules/services/desktops/gnome3/tracker.nixdeleted−45
This diff is too big to show here.
nixos/modules/services/desktops/gsignond.nix+1−1
This diff is too big to show here.
nixos/modules/services/desktops/gvfs.nix+4−3
This diff is too big to show here.
nixos/modules/services/desktops/pantheon/files.nixdeleted−13
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/bluez-monitor.conf.jsondeleted−30
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/client-rt.conf.jsondeleted−26
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/client.conf.jsondeleted−19
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/daemon/client-rt.conf.jsonnew file+39
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/daemon/client.conf.jsonnew file+31
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/daemon/jack.conf.jsonnew file+38
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/daemon/minimal.conf.jsonnew file+118
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/daemon/pipewire-pulse.conf.jsonnew file+100
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/daemon/pipewire.conf.jsonnew file+96
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/jack.conf.jsondeleted−21
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/media-session.conf.jsondeleted−53
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/alsa-monitor.conf.json → nixos/modules/services/desktops/pipewire/media-session/alsa-monitor.conf.jsonrenamed
The content is the same.
nixos/modules/services/desktops/pipewire/media-session/bluez-monitor.conf.jsonnew file+36
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/media-session/media-session.conf.jsonnew file+68
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/v4l2-monitor.conf.json → nixos/modules/services/desktops/pipewire/media-session/v4l2-monitor.conf.jsonrenamed
The content is the same.
nixos/modules/services/desktops/pipewire/pipewire-media-session.nix+67−55
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/pipewire-pulse.conf.jsondeleted−28
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/pipewire.conf.jsondeleted−55
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/pipewire.nix+100−70
This diff is too big to show here.
nixos/modules/services/desktops/pipewire/wireplumber.nixnew file+54
This diff is too big to show here.
nixos/modules/services/desktops/telepathy.nix+1−1
This diff is too big to show here.
nixos/modules/services/desktops/tumbler.nix+2−2
This diff is too big to show here.
nixos/modules/services/desktops/zeitgeist.nix+2−2
This diff is too big to show here.
nixos/modules/services/development/blackfire.nix+4−9
This diff is too big to show here.
nixos/modules/services/development/blackfire.xml+2−1
This diff is too big to show here.
nixos/modules/services/development/distccd.nixnew file+155
This diff is too big to show here.
nixos/modules/services/development/hoogle.nix+5−4
This diff is too big to show here.
nixos/modules/services/development/jupyter/default.nix+5−6
This diff is too big to show here.
nixos/modules/services/development/jupyter/kernel-options.nix+4−4
This diff is too big to show here.
nixos/modules/services/development/jupyterhub/default.nix+21−9
This diff is too big to show here.
nixos/modules/services/development/lorri.nix+1−2
This diff is too big to show here.
nixos/modules/services/development/rstudio-server/default.nixnew file+107
This diff is too big to show here.
nixos/modules/services/development/zammad.nixnew file+323
This diff is too big to show here.
nixos/modules/services/display-managers/greetd.nixnew file+111
This diff is too big to show here.
nixos/modules/services/editors/emacs.nix+1−1
This diff is too big to show here.
nixos/modules/services/editors/haste.nixnew file+86
This diff is too big to show here.
nixos/modules/services/editors/infinoted.nix+2−2
This diff is too big to show here.
nixos/modules/services/finance/odoo.nixnew file+122
This diff is too big to show here.
nixos/modules/services/games/asf.nixnew file+236
This diff is too big to show here.
nixos/modules/services/games/crossfire-server.nixnew file+179
This diff is too big to show here.
nixos/modules/services/games/deliantra-server.nixnew file+172
This diff is too big to show here.
nixos/modules/services/games/factorio.nix+26−6
This diff is too big to show here.
nixos/modules/services/games/minecraft-server.nix+29−6
This diff is too big to show here.
nixos/modules/services/games/quake3-server.nixnew file+112
This diff is too big to show here.
nixos/modules/services/games/terraria.nix+18−4
This diff is too big to show here.
nixos/modules/services/hardware/acpid.nix+1−1
This diff is too big to show here.
nixos/modules/services/hardware/actkbd.nix+2−2
This diff is too big to show here.
nixos/modules/services/hardware/auto-cpufreq.nix+8−2
This diff is too big to show here.
nixos/modules/services/hardware/bluetooth.nix+3−7
This diff is too big to show here.
nixos/modules/services/hardware/brltty.nix+32−25
This diff is too big to show here.
nixos/modules/services/hardware/ddccontrol.nixnew file+39
This diff is too big to show here.
nixos/modules/services/hardware/fancontrol.nix+10−7
This diff is too big to show here.
nixos/modules/services/hardware/freefall.nix+1−1
This diff is too big to show here.
nixos/modules/services/hardware/fwupd.nix+2−1
This diff is too big to show here.
nixos/modules/services/hardware/interception-tools.nix+1
This diff is too big to show here.
nixos/modules/services/hardware/joycond.nixnew file+36
This diff is too big to show here.
nixos/modules/services/hardware/lirc.nix+1−1
This diff is too big to show here.
nixos/modules/services/hardware/pcscd.nix+45−41
This diff is too big to show here.
nixos/modules/services/hardware/power-profiles-daemon.nix+2
This diff is too big to show here.
nixos/modules/services/hardware/rasdaemon.nixnew file+170
This diff is too big to show here.
nixos/modules/services/hardware/sane.nix+40−3
This diff is too big to show here.
nixos/modules/services/hardware/sane_extra_backends/brscan4.nix+4−4
This diff is too big to show here.
nixos/modules/services/hardware/sane_extra_backends/brscan4_etc_files.nix+1−2
This diff is too big to show here.
nixos/modules/services/hardware/sane_extra_backends/brscan5.nixnew file+110
This diff is too big to show here.
nixos/modules/services/hardware/sane_extra_backends/brscan5_etc_files.nixnew file+77
This diff is too big to show here.
nixos/modules/services/hardware/spacenavd.nix−2
This diff is too big to show here.
nixos/modules/services/hardware/tcsd.nix+29−18
This diff is too big to show here.
nixos/modules/services/hardware/thermald.nix+4−2
This diff is too big to show here.
nixos/modules/services/hardware/thinkfan.nix+2−2
This diff is too big to show here.
nixos/modules/services/hardware/triggerhappy.nix+2−2
This diff is too big to show here.
nixos/modules/services/hardware/udev.nix+127−24
This diff is too big to show here.
nixos/modules/services/hardware/udisks2.nix+41
This diff is too big to show here.
nixos/modules/services/hardware/undervolt.nix+2−4
This diff is too big to show here.
nixos/modules/services/hardware/upower.nix+7−8
This diff is too big to show here.
nixos/modules/services/hardware/usbrelayd.nixnew file+44
This diff is too big to show here.
nixos/modules/services/hardware/vdr.nix+2−2
This diff is too big to show here.
nixos/modules/services/home-automation/home-assistant.nixnew file+552
This diff is too big to show here.
nixos/modules/services/home-automation/zigbee2mqtt.nixnew file+142
This diff is too big to show here.
nixos/modules/services/logging/SystemdJournal2Gelf.nix+1
This diff is too big to show here.
nixos/modules/services/logging/awstats.nix+4−4
This diff is too big to show here.
nixos/modules/services/logging/filebeat.nixnew file+253
This diff is too big to show here.
nixos/modules/services/logging/fluentd.nix+1−1
This diff is too big to show here.
nixos/modules/services/logging/graylog.nix+7−8
This diff is too big to show here.
nixos/modules/services/logging/journalbeat.nix+4−17
This diff is too big to show here.
nixos/modules/services/logging/journalwatch.nix+1
This diff is too big to show here.
nixos/modules/services/logging/klogd.nix+6−34
This diff is too big to show here.
nixos/modules/services/logging/logcheck.nix+6−2
This diff is too big to show here.
nixos/modules/services/logging/logrotate.nix+267−33
This diff is too big to show here.
nixos/modules/services/logging/logstash.nix+24−11
This diff is too big to show here.
nixos/modules/services/logging/promtail.nix+6−1
This diff is too big to show here.
nixos/modules/services/logging/syslog-ng.nix+2−2
This diff is too big to show here.
nixos/modules/services/logging/vector.nix+23−20
This diff is too big to show here.
nixos/modules/services/mail/davmail.nix+1−1
This diff is too big to show here.
nixos/modules/services/mail/dovecot.nix+20−49
This diff is too big to show here.
nixos/modules/services/mail/exim.nix+16−4
This diff is too big to show here.
nixos/modules/services/mail/maddy.nixnew file+273
This diff is too big to show here.
nixos/modules/services/mail/mail.nix+2−1
This diff is too big to show here.
nixos/modules/services/mail/mailman.nix+22−12
This diff is too big to show here.
nixos/modules/services/mail/mailman.xml+3−3
This diff is too big to show here.
nixos/modules/services/mail/nullmailer.nix+2−1
This diff is too big to show here.
nixos/modules/services/mail/offlineimap.nix+2−2
This diff is too big to show here.
nixos/modules/services/mail/opendkim.nix+2−1
This diff is too big to show here.
nixos/modules/services/mail/opensmtpd.nix+5−2
This diff is too big to show here.
nixos/modules/services/mail/postfix.nix+47−23
This diff is too big to show here.
nixos/modules/services/mail/postfixadmin.nixnew file+199
This diff is too big to show here.
nixos/modules/services/mail/roundcube.nix+5−4
This diff is too big to show here.
nixos/modules/services/mail/rspamd.nix+10−12
This diff is too big to show here.
nixos/modules/services/mail/spamassassin.nix+36−29
This diff is too big to show here.
nixos/modules/services/mail/sympa.nix+4−4
This diff is too big to show here.
nixos/modules/services/misc/matrix-synapse-log_config.yaml → nixos/modules/services/matrix/matrix-synapse-log_config.yamlrenamed
The content is the same.
nixos/modules/services/matrix/matrix-synapse.nixnew file+773
This diff is too big to show here.
nixos/modules/services/misc/matrix-synapse.xml → nixos/modules/services/matrix/matrix-synapse.xmlrenamed+21−20
This diff is too big to show here.
nixos/modules/services/matrix/mjolnir.nixnew file+242
This diff is too big to show here.
nixos/modules/services/matrix/mjolnir.xmlnew file+134
This diff is too big to show here.
nixos/modules/services/matrix/pantalaimon-options.nixnew file+70
This diff is too big to show here.
nixos/modules/services/matrix/pantalaimon.nixnew file+70
This diff is too big to show here.
nixos/modules/services/misc/airsonic.nix+32−8
This diff is too big to show here.
nixos/modules/services/misc/ananicy.nixnew file+107
This diff is too big to show here.
nixos/modules/services/misc/ankisyncd.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/apache-kafka.nix+5−3
This diff is too big to show here.
nixos/modules/services/misc/autofs.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/autorandr.nix+309−2
This diff is too big to show here.
nixos/modules/services/misc/bazarr.nix+1
This diff is too big to show here.
nixos/modules/services/misc/bees.nix+44−35
This diff is too big to show here.
nixos/modules/services/misc/cfdyndns.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/cgminer.nix+7−3
This diff is too big to show here.
nixos/modules/services/misc/clipcat.nixnew file+31
This diff is too big to show here.
nixos/modules/services/misc/clipmenu.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/confd.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/couchpotato.nixdeleted−42
This diff is too big to show here.
nixos/modules/services/misc/dendrite.nixnew file+273
This diff is too big to show here.
nixos/modules/services/misc/dictd.nix+2−2
This diff is too big to show here.
nixos/modules/services/misc/disnix.nixnew file+98
This diff is too big to show here.
nixos/modules/services/misc/docker-registry.nix+3−1
This diff is too big to show here.
nixos/modules/services/misc/duckling.nixnew file+39
This diff is too big to show here.
nixos/modules/services/misc/dwm-status.nix+2−2
This diff is too big to show here.
nixos/modules/services/misc/dysnomia.nixnew file+265
This diff is too big to show here.
nixos/modules/services/misc/etcd.nix+14−4
This diff is too big to show here.
nixos/modules/services/misc/etebase-server.nix+98−77
This diff is too big to show here.
nixos/modules/services/misc/ethminer.nix+4−4
This diff is too big to show here.
nixos/modules/services/misc/exhibitor.nix+4−1
This diff is too big to show here.
nixos/modules/services/misc/felix.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/freeswitch.nix+4−5
This diff is too big to show here.
nixos/modules/services/misc/fstrim.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/gammu-smsd.nix+2−2
This diff is too big to show here.
nixos/modules/services/misc/geoip-updater.nixdeleted−306
This diff is too big to show here.
nixos/modules/services/misc/geoipupdate.nixnew file+187
This diff is too big to show here.
nixos/modules/services/misc/gitea.nix+79−61
This diff is too big to show here.
nixos/modules/services/misc/gitit.nix+27−27
This diff is too big to show here.
nixos/modules/services/misc/gitlab.nix+454−58
This diff is too big to show here.
nixos/modules/services/misc/gitlab.xml+38−19
This diff is too big to show here.
nixos/modules/services/misc/gitolite.nix+7−5
This diff is too big to show here.
nixos/modules/services/misc/gitweb.nix+2−1
This diff is too big to show here.
nixos/modules/services/misc/gogs.nix+4−1
This diff is too big to show here.
nixos/modules/services/misc/gollum.nix+1
This diff is too big to show here.
nixos/modules/services/misc/gpsd.nix+2−1
This diff is too big to show here.
nixos/modules/services/misc/greenclip.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/headphones.nix+3−1
This diff is too big to show here.
nixos/modules/services/misc/heisenbridge.nixnew file+222
This diff is too big to show here.
nixos/modules/services/misc/home-assistant.nixdeleted−286
This diff is too big to show here.
nixos/modules/services/misc/ihaskell.nix+4−3
This diff is too big to show here.
nixos/modules/services/misc/input-remapper.nixnew file+30
This diff is too big to show here.
nixos/modules/services/misc/jackett.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/jellyfin.nix+24−12
This diff is too big to show here.
nixos/modules/services/misc/klipper.nix+70−12
This diff is too big to show here.
nixos/modules/services/misc/leaps.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/libreddit.nixnew file+66
This diff is too big to show here.
nixos/modules/services/misc/lidarr.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/mame.nix+5−3
This diff is too big to show here.
nixos/modules/services/misc/matrix-appservice-discord.nix+7−2
This diff is too big to show here.
nixos/modules/services/misc/matrix-appservice-irc.nixnew file+232
This diff is too big to show here.
nixos/modules/services/misc/matrix-conduit.nixnew file+149
This diff is too big to show here.
nixos/modules/services/misc/matrix-synapse.nixdeleted−736
This diff is too big to show here.
nixos/modules/services/misc/mautrix-facebook.nixnew file+195
This diff is too big to show here.
nixos/modules/services/misc/mautrix-telegram.nix+6−3
This diff is too big to show here.
nixos/modules/services/misc/mbpfan.nix+59−61
This diff is too big to show here.
nixos/modules/services/misc/mediatomb.nix+10−7
This diff is too big to show here.
nixos/modules/services/misc/moonraker.nixnew file+178
This diff is too big to show here.
nixos/modules/services/misc/mwlib.nixdeleted−258
This diff is too big to show here.
nixos/modules/services/misc/mx-puppet-discord.nixnew file+122
This diff is too big to show here.
nixos/modules/services/misc/n8n.nix+2−1
This diff is too big to show here.
nixos/modules/services/misc/nitter.nixnew file+358
This diff is too big to show here.
nixos/modules/services/misc/nix-daemon.nix+510−283
This diff is too big to show here.
nixos/modules/services/misc/nix-gc.nix+9−3
This diff is too big to show here.
nixos/modules/services/misc/nix-optimise.nix+8−2
This diff is too big to show here.
nixos/modules/services/misc/nix-ssh-serve.nix+10−2
This diff is too big to show here.
nixos/modules/services/misc/nzbget.nix+36−18
This diff is too big to show here.
nixos/modules/services/misc/nzbhydra2.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/octoprint.nix+6−3
This diff is too big to show here.
nixos/modules/services/misc/ombi.nixnew file+81
This diff is too big to show here.
nixos/modules/services/misc/owncast.nixnew file+98
This diff is too big to show here.
nixos/modules/services/misc/packagekit.nix+51−42
This diff is too big to show here.
nixos/modules/services/misc/paperless.nix+204−67
This diff is too big to show here.
nixos/modules/services/misc/pinnwand.nix+47−22
This diff is too big to show here.
nixos/modules/services/misc/plex.nix+43−14
This diff is too big to show here.
nixos/modules/services/misc/podgrab.nixnew file+50
This diff is too big to show here.
nixos/modules/services/misc/prowlarr.nixnew file+41
This diff is too big to show here.
nixos/modules/services/misc/redmine.nix+10−9
This diff is too big to show here.
nixos/modules/services/misc/ripple-data-api.nix+3−1
This diff is too big to show here.
nixos/modules/services/misc/rippled.nix+11−5
This diff is too big to show here.
nixos/modules/services/misc/rmfakecloud.nixnew file+147
This diff is too big to show here.
nixos/modules/services/misc/safeeyes.nix+4
This diff is too big to show here.
nixos/modules/services/misc/sdrplay.nixnew file+35
This diff is too big to show here.
nixos/modules/services/misc/sickbeard.nix+6−3
This diff is too big to show here.
nixos/modules/services/misc/signald.nixnew file+105
This diff is too big to show here.
nixos/modules/services/misc/snapper.nix+42−19
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/builds.nixnew file+236
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/default.nixnew file+1386
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/dispatch.nixnew file+127
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/git.nixnew file+217
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/hg.nixnew file+175
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/hub.nixnew file+120
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/lists.nixnew file+187
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/man.nixnew file+124
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/meta.nixnew file+213
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/paste.nixnew file+135
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/service.nixnew file+375
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/sourcehut.xmlnew file+119
This diff is too big to show here.
nixos/modules/services/misc/sourcehut/todo.nixnew file+163
This diff is too big to show here.
nixos/modules/services/misc/ssm-agent.nix+11−4
This diff is too big to show here.
nixos/modules/services/misc/subsonic.nix+10−6
This diff is too big to show here.
nixos/modules/services/misc/synergy.nix+21−1
This diff is too big to show here.
nixos/modules/services/misc/taskserver/default.nix+15−10
This diff is too big to show here.
nixos/modules/services/misc/taskserver/doc.xml+1−1
This diff is too big to show here.
nixos/modules/services/misc/taskserver/helper-tool.py+5−5
This diff is too big to show here.
nixos/modules/services/misc/tautulli.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/tp-auto-kbbl.nixnew file+58
This diff is too big to show here.
nixos/modules/services/misc/uhub.nix+85−153
This diff is too big to show here.
nixos/modules/services/misc/weechat.nix+9−5
This diff is too big to show here.
nixos/modules/services/misc/xmr-stak.nix+1−1
This diff is too big to show here.
nixos/modules/services/misc/xmrig.nixnew file+76
This diff is too big to show here.
nixos/modules/services/misc/zigbee2mqtt.nixdeleted−99
This diff is too big to show here.
nixos/modules/services/misc/zoneminder.nix+4−4
This diff is too big to show here.
nixos/modules/services/misc/zookeeper.nix+12−3
This diff is too big to show here.
nixos/modules/services/monitoring/alerta.nix−4
This diff is too big to show here.
nixos/modules/services/monitoring/arbtt.nix+1−2
This diff is too big to show here.
nixos/modules/services/monitoring/bosun.nix+1−2
This diff is too big to show here.
nixos/modules/services/monitoring/cadvisor.nix+2
This diff is too big to show here.
nixos/modules/services/monitoring/collectd.nix+56−28
This diff is too big to show here.
nixos/modules/services/monitoring/datadog-agent.nix+11−9
This diff is too big to show here.
nixos/modules/services/monitoring/grafana-reporter.nix+3−2
This diff is too big to show here.
nixos/modules/services/monitoring/grafana.nix+111−24
This diff is too big to show here.
nixos/modules/services/monitoring/graphite.nix+16−4
This diff is too big to show here.
nixos/modules/services/monitoring/heapster.nix+4−2
This diff is too big to show here.
nixos/modules/services/monitoring/incron.nix+7−2
This diff is too big to show here.
nixos/modules/services/monitoring/kapacitor.nix+1−4
This diff is too big to show here.
nixos/modules/services/monitoring/loki.nix+2−2
This diff is too big to show here.
nixos/modules/services/monitoring/mackerel-agent.nix−1
This diff is too big to show here.
nixos/modules/services/monitoring/metricbeat.nixnew file+151
This diff is too big to show here.
nixos/modules/services/monitoring/mimir.nixnew file+63
This diff is too big to show here.
nixos/modules/services/monitoring/munin.nix+7−5
This diff is too big to show here.
nixos/modules/services/monitoring/nagios.nix+8−7
This diff is too big to show here.
nixos/modules/services/monitoring/netdata.nix+109−38
This diff is too big to show here.
nixos/modules/services/monitoring/parsedmarc.mdnew file+113
This diff is too big to show here.
nixos/modules/services/monitoring/parsedmarc.nixnew file+542
This diff is too big to show here.
nixos/modules/services/monitoring/parsedmarc.xmlnew file+125
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/alertmanager.nix+1−1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/default.nix+1266−385
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters.nix+40−4
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters.xml+21
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/bind.nix+6−6
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/bird.nix+5−1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/bitcoin.nixnew file+82
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nixnew file+64
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/collectd.nix+9−9
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/dmarc.nixnew file+117
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/domain.nixnew file+19
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/dovecot.nix+20−1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/fastly.nixnew file+41
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/flow.nix+1−1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/influxdb.nixnew file+34
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/kea.nixnew file+47
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/knot.nix+5−1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/mail.nix+19−1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix+2−2
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/modemmanager.nix+4
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/nginx.nix+5−5
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/node.nix+11−2
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/openldap.nixnew file+67
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/pihole.nixnew file+74
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/postfix.nix+3
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/postgres.nix+4
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/process.nixnew file+46
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/pve.nixnew file+118
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix+20−22
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/rtl_433.nix+5
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/script.nixnew file+64
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/smartctl.nixnew file+75
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/smokeping.nix+1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/snmp.nix+7−9
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/sql.nix+4
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/systemd.nix+5−1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/unbound.nixnew file+63
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/varnish.nix+3−2
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix+5
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/pushgateway.nix+1−1
This diff is too big to show here.
nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix+17−9
This diff is too big to show here.
nixos/modules/services/monitoring/scollector.nix+3−4
This diff is too big to show here.
nixos/modules/services/monitoring/smartd.nix+6−1
This diff is too big to show here.
nixos/modules/services/monitoring/teamviewer.nix+6−3
This diff is too big to show here.
nixos/modules/services/monitoring/telegraf.nix+9−6
This diff is too big to show here.
nixos/modules/services/monitoring/thanos.nix+8−5
This diff is too big to show here.
nixos/modules/services/monitoring/tuptime.nix+5−1
This diff is too big to show here.
nixos/modules/services/monitoring/unifi-poller.nix+80−4
This diff is too big to show here.
nixos/modules/services/monitoring/uptime.nix+7−3
This diff is too big to show here.
nixos/modules/services/monitoring/vnstat.nix+15−13
This diff is too big to show here.
nixos/modules/services/monitoring/zabbix-agent.nix+17−9
This diff is too big to show here.
nixos/modules/services/monitoring/zabbix-proxy.nix+18−7
This diff is too big to show here.
nixos/modules/services/monitoring/zabbix-server.nix+17−6
This diff is too big to show here.
nixos/modules/services/network-filesystems/ceph.nix+12−22
This diff is too big to show here.
nixos/modules/services/network-filesystems/davfs2.nix+18
This diff is too big to show here.
nixos/modules/services/network-filesystems/drbd.nix+5−7
This diff is too big to show here.
nixos/modules/services/network-filesystems/glusterfs.nix+1−4
This diff is too big to show here.
nixos/modules/services/network-filesystems/ipfs.nix+104−88
This diff is too big to show here.
nixos/modules/services/network-filesystems/litestream/default.nixnew file+100
This diff is too big to show here.
nixos/modules/services/network-filesystems/litestream/litestream.xmlnew file+65
This diff is too big to show here.
nixos/modules/services/network-filesystems/moosefs.nixnew file+249
This diff is too big to show here.
nixos/modules/services/network-filesystems/netatalk.nix+40−95
This diff is too big to show here.
nixos/modules/services/network-filesystems/openafs/client.nix+7−8
This diff is too big to show here.
nixos/modules/services/network-filesystems/openafs/server.nix+3−3
This diff is too big to show here.
nixos/modules/services/network-filesystems/orangefs/client.nix−1
This diff is too big to show here.
nixos/modules/services/network-filesystems/orangefs/server.nix+9−9
This diff is too big to show here.
nixos/modules/services/network-filesystems/rsyncd.nix+1−1
This diff is too big to show here.
nixos/modules/services/network-filesystems/samba-wsdd.nix+1−1
This diff is too big to show here.
nixos/modules/services/network-filesystems/samba.nix+17−7
This diff is too big to show here.
nixos/modules/services/network-filesystems/tahoe.nix+2−4
This diff is too big to show here.
nixos/modules/services/network-filesystems/webdav-server-rs.nixnew file+144
This diff is too big to show here.
nixos/modules/services/network-filesystems/webdav.nixnew file+107
This diff is too big to show here.
nixos/modules/services/network-filesystems/xtreemfs.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/3proxy.nix+3−16
This diff is too big to show here.
nixos/modules/services/networking/adguardhome.nixnew file+140
This diff is too big to show here.
nixos/modules/services/networking/amuled.nix+6−2
This diff is too big to show here.
nixos/modules/services/networking/antennas.nixnew file+80
This diff is too big to show here.
nixos/modules/services/networking/asterisk.nix+13−45
This diff is too big to show here.
nixos/modules/services/networking/atftpd.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/autossh.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/avahi-daemon.nix+5−5
This diff is too big to show here.
nixos/modules/services/networking/babeld.nix+24−4
This diff is too big to show here.
nixos/modules/services/networking/bee.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/biboumi.nix+1
This diff is too big to show here.
nixos/modules/services/networking/bind.nix+86−49
This diff is too big to show here.
nixos/modules/services/networking/bird.nix+91−67
This diff is too big to show here.
nixos/modules/services/networking/bitcoind.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/bitlbee.nix+8−16
This diff is too big to show here.
nixos/modules/services/networking/blockbook-frontend.nix+6−9
This diff is too big to show here.
nixos/modules/services/networking/blocky.nixnew file+40
This diff is too big to show here.
nixos/modules/services/networking/charybdis.nix+8−1
This diff is too big to show here.
nixos/modules/services/networking/cjdns.nix+16−6
This diff is too big to show here.
nixos/modules/services/networking/cloudflare-dyndns.nixnew file+93
This diff is too big to show here.
nixos/modules/services/networking/connman.nix+6−4
This diff is too big to show here.
nixos/modules/services/networking/consul.nix+41−11
This diff is too big to show here.
nixos/modules/services/networking/coredns.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/corerad.nix+4−4
This diff is too big to show here.
nixos/modules/services/networking/coturn.nix+68−37
This diff is too big to show here.
nixos/modules/services/networking/create_ap.nixnew file+50
This diff is too big to show here.
nixos/modules/services/networking/croc.nix+2−4
This diff is too big to show here.
nixos/modules/services/networking/ddclient.nix+54−24
This diff is too big to show here.
nixos/modules/services/networking/dhcpcd.nix+22−1
This diff is too big to show here.
nixos/modules/services/networking/dhcpd.nix+49−50
This diff is too big to show here.
nixos/modules/services/networking/dnscache.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/dnscrypt-proxy2.nix+6−3
This diff is too big to show here.
nixos/modules/services/networking/dnscrypt-wrapper.nix+2
This diff is too big to show here.
nixos/modules/services/networking/dnsdist.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/dnsmasq.nix+3−1
This diff is too big to show here.
nixos/modules/services/networking/doh-proxy-rust.nixnew file+60
This diff is too big to show here.
nixos/modules/services/networking/ejabberd.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/envoy.nixnew file+84
This diff is too big to show here.
nixos/modules/services/networking/epmd.nix+17−3
This diff is too big to show here.
nixos/modules/services/networking/ergo.nix+4−2
This diff is too big to show here.
nixos/modules/services/networking/ergochat.nixnew file+155
This diff is too big to show here.
nixos/modules/services/networking/eternal-terminal.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/ferm.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/firefox/sync-server.nixdeleted−183
This diff is too big to show here.
nixos/modules/services/networking/firewall.nix+8−9
This diff is too big to show here.
nixos/modules/services/networking/flannel.nix+5−2
This diff is too big to show here.
nixos/modules/services/networking/freeradius.nix+2
This diff is too big to show here.
nixos/modules/services/networking/frr.nixnew file+211
This diff is too big to show here.
nixos/modules/services/networking/gale.nixdeleted−181
This diff is too big to show here.
nixos/modules/services/networking/ghostunnel.nixnew file+242
This diff is too big to show here.
nixos/modules/services/networking/git-daemon.nix+2−1
This diff is too big to show here.
nixos/modules/services/networking/globalprotect-vpn.nixnew file+43
This diff is too big to show here.
nixos/modules/services/networking/gnunet.nix+15−11
This diff is too big to show here.
nixos/modules/services/networking/go-neb.nix+30−4
This diff is too big to show here.
nixos/modules/services/networking/gobgpd.nixnew file+64
This diff is too big to show here.
nixos/modules/services/networking/gogoclient.nixdeleted−87
This diff is too big to show here.
nixos/modules/services/networking/gvpe.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/hans.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/headscale.nixnew file+490
This diff is too big to show here.
nixos/modules/services/networking/https-dns-proxy.nixnew file+128
This diff is too big to show here.
nixos/modules/services/networking/hylafax/faxq-wait.sh+1−1
This diff is too big to show here.
nixos/modules/services/networking/hylafax/options.nix+17−20
This diff is too big to show here.
nixos/modules/services/networking/hylafax/spool.sh+3−3
This diff is too big to show here.
nixos/modules/services/networking/hylafax/systemd.nix+8−8
This diff is too big to show here.
nixos/modules/services/networking/i2pd.nix+19−12
This diff is too big to show here.
nixos/modules/services/networking/icecream/daemon.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/icecream/scheduler.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/inspircd.nixnew file+62
This diff is too big to show here.
nixos/modules/services/networking/iodine.nix+2−1
This diff is too big to show here.
nixos/modules/services/networking/ircd-hybrid/default.nix+3−3
This diff is too big to show here.
nixos/modules/services/networking/iscsi/initiator.nixnew file+84
This diff is too big to show here.
nixos/modules/services/networking/iscsi/root-initiator.nixnew file+190
This diff is too big to show here.
nixos/modules/services/networking/iscsi/target.nixnew file+53
This diff is too big to show here.
nixos/modules/services/networking/iwd.nix+43−6
This diff is too big to show here.
nixos/modules/services/networking/jibri/default.nixnew file+417
This diff is too big to show here.
nixos/modules/services/networking/jibri/logging.properties-journalnew file+32
This diff is too big to show here.
nixos/modules/services/networking/jicofo.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/jitsi-videobridge.nix+5−3
This diff is too big to show here.
nixos/modules/services/networking/kea.nixnew file+449
This diff is too big to show here.
nixos/modules/services/networking/keepalived/vrrp-instance-options.nix+1−3
This diff is too big to show here.
nixos/modules/services/networking/keepalived/vrrp-script-options.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/kippo.nixdeleted−117
This diff is too big to show here.
nixos/modules/services/networking/knot.nix+43−8
This diff is too big to show here.
nixos/modules/services/networking/kresd.nix+20−15
This diff is too big to show here.
nixos/modules/services/networking/lambdabot.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/libreswan.nix+89−58
This diff is too big to show here.
nixos/modules/services/networking/lxd-image-server.nixnew file+133
This diff is too big to show here.
nixos/modules/services/networking/mailpile.nixdeleted−74
This diff is too big to show here.
nixos/modules/services/networking/matterbridge.nix+3−3
This diff is too big to show here.
nixos/modules/services/networking/minidlna.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/miredo.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/monero.nix+15−9
This diff is too big to show here.
nixos/modules/services/networking/morty.nix+4−5
This diff is too big to show here.
nixos/modules/services/networking/mosquitto.mdnew file+102
This diff is too big to show here.
nixos/modules/services/networking/mosquitto.nix+574−174
This diff is too big to show here.
nixos/modules/services/networking/mosquitto.xmlnew file+147
This diff is too big to show here.
nixos/modules/services/networking/mozillavpn.nixnew file+19
This diff is too big to show here.
nixos/modules/services/networking/mtr-exporter.nixnew file+87
This diff is too big to show here.
nixos/modules/services/networking/mullvad-vpn.nix+6−2
This diff is too big to show here.
nixos/modules/services/networking/multipath.nixnew file+557
This diff is too big to show here.
nixos/modules/services/networking/murmur.nix+4−4
This diff is too big to show here.
nixos/modules/services/networking/mxisd.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/namecoind.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/nar-serve.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/nat.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/nats.nixnew file+158
This diff is too big to show here.
nixos/modules/services/networking/nbd.nixnew file+159
This diff is too big to show here.
nixos/modules/services/networking/ncdns.nix+10−5
This diff is too big to show here.
nixos/modules/services/networking/ndppd.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/nebula.nixnew file+217
This diff is too big to show here.
nixos/modules/services/networking/networkmanager.nix+165−89
This diff is too big to show here.
nixos/modules/services/networking/nftables.nix+7−12
This diff is too big to show here.
nixos/modules/services/networking/ngircd.nix+5−2
This diff is too big to show here.
nixos/modules/services/networking/nix-serve.nix+20−10
This diff is too big to show here.
nixos/modules/services/networking/nixops-dns.nix−1
This diff is too big to show here.
nixos/modules/services/networking/nntp-proxy.nix+18−18
This diff is too big to show here.
nixos/modules/services/networking/nomad.nix+21−8
This diff is too big to show here.
nixos/modules/services/networking/nsd.nix+30−19
This diff is too big to show here.
nixos/modules/services/networking/ntopng.nix+57−13
This diff is too big to show here.
nixos/modules/services/networking/ntp/chrony.nix+22−12
This diff is too big to show here.
nixos/modules/services/networking/ntp/ntpd.nix+8−7
This diff is too big to show here.
nixos/modules/services/networking/ntp/openntpd.nix+4−1
This diff is too big to show here.
nixos/modules/services/networking/nylon.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/ofono.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/onedrive.nix+1−2
This diff is too big to show here.
nixos/modules/services/networking/openconnect.nixnew file+137
This diff is too big to show here.
nixos/modules/services/networking/openfire.nixdeleted−56
This diff is too big to show here.
nixos/modules/services/networking/openvpn.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/ostinato.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/pdns-recursor.nix+13−8
This diff is too big to show here.
nixos/modules/services/networking/pixiecore.nix+1
This diff is too big to show here.
nixos/modules/services/networking/pleroma.nix+13−4
This diff is too big to show here.
nixos/modules/services/networking/pleroma.xml+177−121
This diff is too big to show here.
nixos/modules/services/networking/powerdns.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/pppd.nix+23−5
This diff is too big to show here.
nixos/modules/services/networking/privoxy.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/prosody.nix+3−2
This diff is too big to show here.
nixos/modules/services/networking/prosody.xml+1−1
This diff is too big to show here.
nixos/modules/services/networking/quagga.nixdeleted−185
This diff is too big to show here.
nixos/modules/services/networking/quassel.nix+6−3
This diff is too big to show here.
nixos/modules/services/networking/quicktun.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/quorum.nix+5−3
This diff is too big to show here.
nixos/modules/services/networking/racoon.nixdeleted−45
This diff is too big to show here.
nixos/modules/services/networking/radicale.nix+156−44
This diff is too big to show here.
nixos/modules/services/networking/radvd.nix+4−1
This diff is too big to show here.
nixos/modules/services/networking/rdnssd.nix+3−1
This diff is too big to show here.
nixos/modules/services/networking/resilio.nix+1
This diff is too big to show here.
nixos/modules/services/networking/rxe.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/sabnzbd.nix+8−1
This diff is too big to show here.
nixos/modules/services/networking/seafile.nixnew file+287
This diff is too big to show here.
nixos/modules/services/networking/searx.nix+11−10
This diff is too big to show here.
nixos/modules/services/networking/shadowsocks.nix+4−6
This diff is too big to show here.
nixos/modules/services/networking/shairport-sync.nix+29−2
This diff is too big to show here.
nixos/modules/services/networking/shellhub-agent.nix+26−17
This diff is too big to show here.
nixos/modules/services/networking/shorewall.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/shorewall6.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/shout.nix+4−2
This diff is too big to show here.
nixos/modules/services/networking/skydns.nix+2−1
This diff is too big to show here.
nixos/modules/services/networking/smartdns.nix+2−1
This diff is too big to show here.
nixos/modules/services/networking/smokeping.nix+61−21
This diff is too big to show here.
nixos/modules/services/networking/sniproxy.nix+6−17
This diff is too big to show here.
nixos/modules/services/networking/snowflake-proxy.nixnew file+81
This diff is too big to show here.
nixos/modules/services/networking/softether.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/soju.nixnew file+114
This diff is too big to show here.
nixos/modules/services/networking/solanum.nixnew file+109
This diff is too big to show here.
nixos/modules/services/networking/spacecookie.nix+147−14
This diff is too big to show here.
nixos/modules/services/networking/spiped.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/squid.nix+23−4
This diff is too big to show here.
nixos/modules/services/networking/ssh/sshd.nix+44−23
This diff is too big to show here.
nixos/modules/services/networking/sslh.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/strongswan-swanctl/module.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/strongswan-swanctl/swanctl-params.nix+10
This diff is too big to show here.
nixos/modules/services/networking/strongswan.nix+3−3
This diff is too big to show here.
nixos/modules/services/networking/stubby.nix+46−174
This diff is too big to show here.
nixos/modules/services/networking/stunnel.nix+3−2
This diff is too big to show here.
nixos/modules/services/networking/supplicant.nix+5−14
This diff is too big to show here.
nixos/modules/services/networking/supybot.nix+4−3
This diff is too big to show here.
nixos/modules/services/networking/syncplay.nix+19−3
This diff is too big to show here.
nixos/modules/services/networking/syncthing.nix+372−308
This diff is too big to show here.
nixos/modules/services/networking/tailscale.nix+20−2
This diff is too big to show here.
nixos/modules/services/networking/teamspeak3.nix+20−2
This diff is too big to show here.
nixos/modules/services/networking/tedicross.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/teleport.nixnew file+99
This diff is too big to show here.
nixos/modules/services/networking/tetrd.nixnew file+96
This diff is too big to show here.
nixos/modules/services/networking/thelounge.nix+39−8
This diff is too big to show here.
nixos/modules/services/networking/tinc.nix+11−8
This diff is too big to show here.
nixos/modules/services/networking/tinydns.nix+5−1
This diff is too big to show here.
nixos/modules/services/networking/tox-bootstrapd.nix+8−13
This diff is too big to show here.
nixos/modules/services/networking/tox-node.nix+1−6
This diff is too big to show here.
nixos/modules/services/networking/toxvpn.nix+4−2
This diff is too big to show here.
nixos/modules/services/networking/trickster.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/tvheadend.nix+3−1
This diff is too big to show here.
nixos/modules/services/networking/ucarp.nixnew file+183
This diff is too big to show here.
nixos/modules/services/networking/unbound.nix+176−81
This diff is too big to show here.
nixos/modules/services/networking/unifi.nix+80−60
This diff is too big to show here.
nixos/modules/services/networking/v2ray.nix+15−7
This diff is too big to show here.
nixos/modules/services/networking/vsftpd.nix+5−2
This diff is too big to show here.
nixos/modules/services/networking/wakeonlan.nixdeleted−56
This diff is too big to show here.
nixos/modules/services/networking/wasabibackend.nix+4−2
This diff is too big to show here.
nixos/modules/services/networking/websockify.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/wg-netmanager.nixnew file+42
This diff is too big to show here.
nixos/modules/services/networking/wg-quick.nix+12−13
This diff is too big to show here.
nixos/modules/services/networking/wicd.nixdeleted−40
This diff is too big to show here.
nixos/modules/services/networking/wireguard.nix+104−54
This diff is too big to show here.
nixos/modules/services/networking/wpa_supplicant.nix+355−83
This diff is too big to show here.
nixos/modules/programs/x2goserver.nix → nixos/modules/services/networking/x2goserver.nixrenamed+24−9
This diff is too big to show here.
nixos/modules/services/networking/xandikos.nix+2−2
This diff is too big to show here.
nixos/modules/services/networking/xrdp.nix+17−3
This diff is too big to show here.
nixos/modules/services/networking/yggdrasil.nix+3−4
This diff is too big to show here.
nixos/modules/services/networking/yggdrasil.xml−1
This diff is too big to show here.
nixos/modules/services/networking/zerobin.nix+1−1
This diff is too big to show here.
nixos/modules/services/networking/zeronet.nix+5−7
This diff is too big to show here.
nixos/modules/services/networking/zerotierone.nix+1−2
This diff is too big to show here.
nixos/modules/services/networking/znc/default.nix+36−9
This diff is too big to show here.
nixos/modules/services/networking/znc/options.nix+6−6
This diff is too big to show here.
nixos/modules/services/printing/cupsd.nix+1−1
This diff is too big to show here.
nixos/modules/services/scheduling/atd.nix+6−9
This diff is too big to show here.
nixos/modules/services/scheduling/cron.nix+7−2
This diff is too big to show here.
nixos/modules/services/scheduling/fcron.nix+3
This diff is too big to show here.
nixos/modules/services/search/elasticsearch.nix+43−12
This diff is too big to show here.
nixos/modules/services/search/hound.nix+13−11
This diff is too big to show here.
nixos/modules/services/search/kibana.nix+9−4
This diff is too big to show here.
nixos/modules/services/search/meilisearch.mdnew file+39
This diff is too big to show here.
nixos/modules/services/search/meilisearch.nixnew file+132
This diff is too big to show here.
nixos/modules/services/search/meilisearch.xmlnew file+85
This diff is too big to show here.
nixos/modules/services/search/solr.nix+1−1
This diff is too big to show here.
nixos/modules/services/security/aesmd.nixnew file+236
This diff is too big to show here.
nixos/modules/services/security/bitwarden_rs/default.nixdeleted−162
This diff is too big to show here.
nixos/modules/services/security/certmgr.nix+2−2
This diff is too big to show here.
nixos/modules/services/security/cfssl.nix+56−43
This diff is too big to show here.
nixos/modules/services/security/clamav.nix+4−5
This diff is too big to show here.
nixos/modules/services/security/fail2ban.nix+41−7
This diff is too big to show here.
nixos/modules/services/security/fprintd.nix+20−10
This diff is too big to show here.
nixos/modules/services/security/fprot.nixdeleted−82
This diff is too big to show here.
nixos/modules/services/security/haka.nix+1−1
This diff is too big to show here.
nixos/modules/services/security/haveged.nix+39−29
This diff is too big to show here.
nixos/modules/services/security/hockeypuck.nixnew file+106
This diff is too big to show here.
nixos/modules/services/security/hologram-agent.nix+1−1
This diff is too big to show here.
nixos/modules/services/security/nginx-sso.nix+2−2
This diff is too big to show here.
nixos/modules/services/security/oauth2_proxy.nix+12−7
This diff is too big to show here.
nixos/modules/services/security/oauth2_proxy_nginx.nix+4−2
This diff is too big to show here.
nixos/modules/services/security/opensnitch.nixnew file+125
This diff is too big to show here.
nixos/modules/services/security/physlock.nix+6−4
This diff is too big to show here.
nixos/modules/services/security/privacyidea.nix+40−9
This diff is too big to show here.
nixos/modules/services/security/shibboleth-sp.nix+1−1
This diff is too big to show here.
nixos/modules/services/security/sks.nix+2−2
This diff is too big to show here.
nixos/modules/services/security/sshguard.nix+20−16
This diff is too big to show here.
nixos/modules/services/security/sslmate-agent.nixnew file+32
This diff is too big to show here.
nixos/modules/services/security/step-ca.nixnew file+146
This diff is too big to show here.
nixos/modules/services/security/tor.nix+36−9
This diff is too big to show here.
nixos/modules/services/security/torsocks.nix+1
This diff is too big to show here.
nixos/modules/services/security/usbguard.nix+1−1
This diff is too big to show here.
nixos/modules/services/security/vault.nix+8−2
This diff is too big to show here.
nixos/modules/services/security/bitwarden_rs/backup.sh → nixos/modules/services/security/vaultwarden/backup.shrenamed+1−1
This diff is too big to show here.
nixos/modules/services/security/vaultwarden/default.nixnew file+185
This diff is too big to show here.
nixos/modules/services/security/yubikey-agent.nix+8−2
This diff is too big to show here.
nixos/modules/services/system/cachix-agent/default.nixnew file+57
This diff is too big to show here.
nixos/modules/services/system/cloud-init.nix+16−2
This diff is too big to show here.
nixos/modules/services/system/earlyoom.nix+134−97
This diff is too big to show here.
nixos/modules/services/system/kerberos/heimdal.nix+1−1
This diff is too big to show here.
nixos/modules/services/system/localtime.nix+2
This diff is too big to show here.
nixos/modules/services/system/nscd.nix+20−9
This diff is too big to show here.
nixos/modules/services/system/saslauthd.nix+1−1
This diff is too big to show here.
nixos/modules/services/system/self-deploy.nixnew file+173
This diff is too big to show here.
nixos/modules/services/system/systembus-notify.nixnew file+27
This diff is too big to show here.
nixos/modules/services/system/uptimed.nix+7−3
This diff is too big to show here.
nixos/modules/services/torrent/deluge.nix+9−2
This diff is too big to show here.
nixos/modules/services/torrent/flexget.nix+1−1
This diff is too big to show here.
nixos/modules/services/torrent/magnetico.nix+3−1
This diff is too big to show here.
nixos/modules/services/torrent/opentracker.nix+1−1
This diff is too big to show here.
nixos/modules/services/torrent/peerflix.nix+8−2
This diff is too big to show here.
nixos/modules/services/torrent/rtorrent.nix+4−2
This diff is too big to show here.
nixos/modules/services/torrent/transmission.nix+257−223
This diff is too big to show here.
nixos/modules/services/ttys/getty.nix+34−20
This diff is too big to show here.
nixos/modules/services/ttys/kmscon.nix+24−5
This diff is too big to show here.
nixos/modules/services/video/epgstation/default.nix+193−154
This diff is too big to show here.
nixos/modules/services/video/epgstation/streaming.json+129−108
This diff is too big to show here.
nixos/modules/services/video/mirakurun.nix+27−6
This diff is too big to show here.
nixos/modules/services/video/replay-sorcery.nixnew file+72
This diff is too big to show here.
nixos/modules/services/video/rtsp-simple-server.nixnew file+80
This diff is too big to show here.
nixos/modules/services/video/unifi-video.nixnew file+271
This diff is too big to show here.
nixos/modules/services/wayland/cage.nix+8−3
This diff is too big to show here.
nixos/modules/services/web-apps/atlassian/confluence.nix+2−2
This diff is too big to show here.
nixos/modules/services/web-apps/atlassian/crowd.nix+2−2
This diff is too big to show here.
nixos/modules/services/web-apps/atlassian/jira.nix+3−2
This diff is too big to show here.
nixos/modules/services/web-apps/baget.nixnew file+170
This diff is too big to show here.
nixos/modules/services/web-apps/bookstack.nix+156−72
This diff is too big to show here.
nixos/modules/services/web-apps/calibre-web.nixnew file+165
This diff is too big to show here.
nixos/modules/services/web-apps/code-server.nixnew file+139
This diff is too big to show here.
nixos/modules/services/web-apps/cryptpad.nix+2−2
This diff is too big to show here.
nixos/modules/services/web-apps/dex.nixnew file+118
This diff is too big to show here.
nixos/modules/services/web-apps/discourse.nixnew file+1093
This diff is too big to show here.
nixos/modules/services/web-apps/discourse.xmlnew file+355
This diff is too big to show here.
nixos/modules/services/web-apps/documize.nix+1
This diff is too big to show here.
nixos/modules/services/web-apps/dokuwiki.nix+325−274
This diff is too big to show here.
nixos/modules/services/web-apps/engelsystem.nix+3−3
This diff is too big to show here.
nixos/modules/services/web-apps/ethercalc.nixnew file+62
This diff is too big to show here.
nixos/modules/services/web-apps/fluidd.nixnew file+66
This diff is too big to show here.
nixos/modules/services/web-apps/galene.nix+36−2
This diff is too big to show here.
nixos/modules/services/web-apps/gerrit.nix+4−1
This diff is too big to show here.
nixos/modules/services/web-apps/hedgedoc.nix+72−8
This diff is too big to show here.
nixos/modules/services/web-apps/hledger-web.nix+89−24
This diff is too big to show here.
nixos/modules/services/web-apps/icingaweb2/icingaweb2.nix+19−1
This diff is too big to show here.
nixos/modules/services/web-apps/ihatemoney/default.nix+17−2
This diff is too big to show here.
nixos/modules/services/web-apps/invidious.nixnew file+264
This diff is too big to show here.
nixos/modules/services/web-apps/invoiceplane.nixnew file+305
This diff is too big to show here.
nixos/modules/services/web-apps/isso.nixnew file+69
This diff is too big to show here.
nixos/modules/services/web-apps/jirafeau.nix+10−6
This diff is too big to show here.
nixos/modules/services/web-apps/jitsi-meet.nix+130−12
This diff is too big to show here.
nixos/modules/services/web-apps/jitsi-meet.xml+2−2
This diff is too big to show here.
nixos/modules/services/web-apps/keycloak.nix+575−584
This diff is too big to show here.
nixos/modules/services/web-apps/keycloak.xml+82−85
This diff is too big to show here.
nixos/modules/services/web-apps/lemmy.mdnew file+34
This diff is too big to show here.
nixos/modules/services/web-apps/lemmy.nixnew file+236
This diff is too big to show here.
nixos/modules/services/web-apps/lemmy.xmlnew file+56
This diff is too big to show here.
nixos/modules/services/web-apps/limesurvey.nix+5−5
This diff is too big to show here.
nixos/modules/services/web-apps/mastodon.nix+82−8
This diff is too big to show here.
nixos/modules/services/web-apps/matomo.nix+44−15
This diff is too big to show here.
nixos/modules/services/web-apps/mattermost.nix+145−37
This diff is too big to show here.
nixos/modules/services/web-apps/mediawiki.nix+6−5
This diff is too big to show here.
nixos/modules/services/web-apps/miniflux.nix+49−29
This diff is too big to show here.
nixos/modules/services/web-apps/moinmoin.nixdeleted−304
This diff is too big to show here.
nixos/modules/services/web-apps/moodle.nix+7−7
This diff is too big to show here.
nixos/modules/services/web-apps/netbox.nixnew file+265
This diff is too big to show here.
nixos/modules/services/web-apps/nextcloud.nix+384−107
This diff is too big to show here.
nixos/modules/services/web-apps/nextcloud.xml+92−40
This diff is too big to show here.
nixos/modules/services/web-apps/nexus.nix+22
This diff is too big to show here.
nixos/modules/services/web-apps/nifi.nixnew file+318
This diff is too big to show here.
nixos/modules/services/web-apps/node-red.nixnew file+149
This diff is too big to show here.
nixos/modules/services/web-apps/openwebrx.nixnew file+34
This diff is too big to show here.
nixos/modules/services/web-apps/peertube.nixnew file+475
This diff is too big to show here.
nixos/modules/services/web-apps/pgpkeyserver-lite.nix+5−2
This diff is too big to show here.
nixos/modules/services/web-apps/pict-rs.mdnew file+88
This diff is too big to show here.
nixos/modules/services/web-apps/pict-rs.nixnew file+50
This diff is too big to show here.
nixos/modules/services/web-apps/pict-rs.xmlnew file+162
This diff is too big to show here.
nixos/modules/services/web-apps/plantuml-server.nix+21−4
This diff is too big to show here.
nixos/modules/services/web-apps/plausible.nixnew file+292
This diff is too big to show here.
nixos/modules/services/web-apps/plausible.xmlnew file+51
This diff is too big to show here.
nixos/modules/services/web-apps/powerdns-admin.nixnew file+152
This diff is too big to show here.
nixos/modules/services/web-apps/prosody-filer.nixnew file+86
This diff is too big to show here.
nixos/modules/services/web-apps/restya-board.nix+1−4
This diff is too big to show here.
nixos/modules/services/web-apps/rss-bridge.nix+2−4
This diff is too big to show here.
nixos/modules/services/web-apps/selfoss.nix−1
This diff is too big to show here.
nixos/modules/services/web-apps/shiori.nix+2−5
This diff is too big to show here.
nixos/modules/services/web-apps/timetagger.nixnew file+80
This diff is too big to show here.
nixos/modules/services/web-apps/trac.nixdeleted−79
This diff is too big to show here.
nixos/modules/services/web-apps/trilium.nix+11−2
This diff is too big to show here.
nixos/modules/services/web-apps/tt-rss.nix+97−88
This diff is too big to show here.
nixos/modules/services/web-apps/vikunja.nixnew file+145
This diff is too big to show here.
nixos/modules/services/web-apps/whitebophir.nix+1−1
This diff is too big to show here.
nixos/modules/services/web-apps/wiki-js.nixnew file+139
This diff is too big to show here.
nixos/modules/services/web-apps/wordpress.nix+175−61
This diff is too big to show here.
nixos/modules/services/web-apps/youtrack.nix+3−2
This diff is too big to show here.
nixos/modules/services/web-apps/zabbix.nix+12−5
This diff is too big to show here.
nixos/modules/services/web-servers/agate.nixnew file+148
This diff is too big to show here.
nixos/modules/services/web-servers/apache-httpd/default.nix+55−37
This diff is too big to show here.
nixos/modules/services/web-servers/apache-httpd/vhost-options.nix+26−6
This diff is too big to show here.
nixos/modules/services/web-servers/caddy.nixdeleted−154
This diff is too big to show here.
nixos/modules/services/web-servers/caddy/default.nixnew file+339
This diff is too big to show here.
nixos/modules/services/web-servers/caddy/vhost-options.nixnew file+79
This diff is too big to show here.
nixos/modules/services/web-servers/darkhttpd.nix+1−1
This diff is too big to show here.
nixos/modules/services/web-servers/hydron.nix+1−1
This diff is too big to show here.
nixos/modules/services/web-servers/lighttpd/cgit.nix+7−5
This diff is too big to show here.
nixos/modules/services/web-servers/lighttpd/collectd.nix+5−1
This diff is too big to show here.
nixos/modules/services/web-servers/lighttpd/default.nix+14−2
This diff is too big to show here.
nixos/modules/services/web-servers/minio.nix+34−12
This diff is too big to show here.
nixos/modules/services/web-servers/molly-brown.nix+1−2
This diff is too big to show here.
nixos/modules/services/web-servers/nginx/default.nix+174−33
This diff is too big to show here.
nixos/modules/services/web-servers/nginx/gitweb.nix+2−2
This diff is too big to show here.
nixos/modules/services/web-servers/nginx/location-options.nix+2−2
This diff is too big to show here.
nixos/modules/services/web-servers/nginx/vhost-options.nix+74−9
This diff is too big to show here.
nixos/modules/services/web-servers/phpfpm/default.nix+5−5
This diff is too big to show here.
nixos/modules/services/web-servers/pomerium.nixnew file+135
This diff is too big to show here.
nixos/modules/services/web-servers/shellinabox.nixdeleted−122
This diff is too big to show here.
nixos/modules/services/web-servers/tomcat.nix+6−5
This diff is too big to show here.
nixos/modules/services/web-servers/traefik.nix+3−3
This diff is too big to show here.
nixos/modules/services/web-servers/trafficserver/default.nixnew file+310
This diff is too big to show here.
nixos/modules/services/web-servers/trafficserver/ip_allow.jsonnew file+36
This diff is too big to show here.
nixos/modules/services/web-servers/trafficserver/logging.jsonnew file+37
This diff is too big to show here.
nixos/modules/services/web-servers/ttyd.nix+2−2
This diff is too big to show here.
nixos/modules/services/web-servers/unit/default.nix+2−2
This diff is too big to show here.
nixos/modules/services/web-servers/uwsgi.nix+10−12
This diff is too big to show here.
nixos/modules/services/web-servers/varnish/default.nix+9−7
This diff is too big to show here.
nixos/modules/services/web-servers/zope2.nix+6−2
This diff is too big to show here.
nixos/modules/services/x11/clight.nix+8
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/cde.nix+5−4
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/cinnamon.nix+24−12
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/default.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/enlightenment.nix+24−3
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/gnome.nixnew file+582
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/gnome.xmlnew file+253
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/gnome3.nixdeleted−499
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/kodi.nix+12−2
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/lumina.nix+4
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/lxqt.nix+13−4
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/mate.nix+12−40
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/none.nix+44−5
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/pantheon.nix+44−29
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/pantheon.xml+11−5
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/plasma5.nix+333−132
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/retroarch.nixnew file+40
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/surf-display.nix+2−1
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/xfce.nix+13−7
This diff is too big to show here.
nixos/modules/services/x11/desktop-managers/xterm.nix+2−2
This diff is too big to show here.
nixos/modules/services/x11/display-managers/account-service-util.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/display-managers/default.nix+16−12
This diff is too big to show here.
nixos/modules/services/x11/display-managers/gdm.nix+50−61
This diff is too big to show here.
nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix+4−4
This diff is too big to show here.
nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix+6−6
This diff is too big to show here.
nixos/modules/services/x11/display-managers/lightdm-greeters/pantheon.nix+2−2
This diff is too big to show here.
nixos/modules/services/x11/display-managers/lightdm.nix+8−6
This diff is too big to show here.
nixos/modules/services/x11/display-managers/sddm.nix+10−9
This diff is too big to show here.
nixos/modules/services/x11/display-managers/set-session.py+3
This diff is too big to show here.
nixos/modules/services/x11/display-managers/startx.nix−3
This diff is too big to show here.
nixos/modules/services/x11/display-managers/sx.nixnew file+34
This diff is too big to show here.
nixos/modules/services/x11/extra-layouts.nix+9−48
This diff is too big to show here.
nixos/modules/services/x11/hardware/libinput.nix+41−25
This diff is too big to show here.
nixos/modules/services/x11/hardware/synaptics.nix+6−1
This diff is too big to show here.
nixos/modules/services/x11/imwheel.nix+11−9
This diff is too big to show here.
nixos/modules/services/x11/picom.nix+13−3
This diff is too big to show here.
nixos/modules/services/x11/redshift.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/touchegg.nixnew file+38
This diff is too big to show here.
nixos/modules/services/x11/unclutter-xfixes.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/unclutter.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/urxvtd.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/window-managers/awesome.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/window-managers/bspwm.nix+6−6
This diff is too big to show here.
nixos/modules/services/x11/window-managers/clfswm.nix+13−3
This diff is too big to show here.
nixos/modules/services/x11/window-managers/default.nix+3
This diff is too big to show here.
nixos/modules/services/x11/window-managers/e16.nixnew file+26
This diff is too big to show here.
nixos/modules/services/x11/window-managers/exwm.nix+4−3
This diff is too big to show here.
nixos/modules/services/x11/window-managers/fvwm.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/window-managers/herbstluftwm.nix+1−1
This diff is too big to show here.
nixos/modules/services/x11/window-managers/i3.nix+3−3
This diff is too big to show here.
nixos/modules/services/x11/window-managers/metacity.nix+3−3
This diff is too big to show here.
nixos/modules/services/x11/window-managers/mlvwm.nixnew file+41
This diff is too big to show here.
nixos/modules/services/x11/window-managers/qtile.nix+11−4
This diff is too big to show here.
nixos/modules/services/x11/window-managers/wmderland.nixnew file+61
This diff is too big to show here.
nixos/modules/services/x11/window-managers/xmonad.nix+51−15
This diff is too big to show here.
nixos/modules/services/x11/xautolock.nix+4−3
This diff is too big to show here.
nixos/modules/services/x11/xserver.nix+78−40
This diff is too big to show here.
nixos/modules/system/activation/activation-script.nix+77−46
This diff is too big to show here.
nixos/modules/system/activation/switch-to-configuration.plmode 100644 → 100755+698−255
This diff is too big to show here.
nixos/modules/system/activation/top-level.nix+100−36
This diff is too big to show here.
nixos/modules/system/boot/binfmt.nix+52−10
This diff is too big to show here.
nixos/modules/system/boot/initrd-openvpn.nix+2−2
This diff is too big to show here.
nixos/modules/system/boot/initrd-ssh.nix+1−1
This diff is too big to show here.
nixos/modules/system/boot/kernel.nix+16−13
This diff is too big to show here.
nixos/modules/system/boot/kernel_config.nix+1−1
This diff is too big to show here.
nixos/modules/system/boot/kexec.nix+3−3
This diff is too big to show here.
nixos/modules/system/boot/loader/generic-extlinux-compatible/default.nix+18−1
This diff is too big to show here.
nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh+9−3
This diff is too big to show here.
nixos/modules/system/boot/loader/grub/grub.nix+42−9
This diff is too big to show here.
nixos/modules/system/boot/loader/grub/install-grub.pl+115−86
This diff is too big to show here.
nixos/modules/system/boot/loader/grub/ipxe.nix+1−1
This diff is too big to show here.
nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py+107−62
This diff is too big to show here.
nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix+152−3
This diff is too big to show here.
nixos/modules/system/boot/luksroot.nix+140−53
This diff is too big to show here.
nixos/modules/system/boot/modprobe.nix+2
This diff is too big to show here.
nixos/modules/system/boot/networkd.nix+338−14
This diff is too big to show here.
nixos/modules/system/boot/plymouth.nix+9−2
This diff is too big to show here.
nixos/modules/system/boot/resolved.nix+4−5
This diff is too big to show here.
nixos/modules/system/boot/stage-1-init.sh+41−40
This diff is too big to show here.
nixos/modules/system/boot/stage-1.nix+92−23
This diff is too big to show here.
nixos/modules/system/boot/stage-2-init.shmode 100644 → 100755+71−99
This diff is too big to show here.
nixos/modules/system/boot/stage-2.nix+9−33
This diff is too big to show here.
nixos/modules/system/boot/systemd-lib.nixdeleted−237
This diff is too big to show here.
nixos/modules/system/boot/systemd-nspawn.nixdeleted−133
This diff is too big to show here.
nixos/modules/system/boot/systemd-unit-options.nixdeleted−536
This diff is too big to show here.
nixos/modules/system/boot/systemd.nix+94−670
This diff is too big to show here.
nixos/modules/system/boot/systemd/coredump.nixnew file+57
This diff is too big to show here.
nixos/modules/system/boot/systemd/initrd-secrets.nixnew file+36
This diff is too big to show here.
nixos/modules/system/boot/systemd/initrd.nixnew file+502
This diff is too big to show here.
nixos/modules/system/boot/systemd/journald.nixnew file+131
This diff is too big to show here.
nixos/modules/system/boot/systemd/logind.nixnew file+114
This diff is too big to show here.
nixos/modules/system/boot/systemd/nspawn.nixnew file+131
This diff is too big to show here.
nixos/modules/system/boot/systemd/shutdown.nix+58
This diff is too big to show here.
nixos/modules/system/boot/systemd/tmpfiles.nix+120
This diff is too big to show here.
nixos/modules/system/boot/systemd/user.nix+153
This diff is too big to show here.
nixos/modules/system/boot/timesyncd.nix+19−5
This diff is too big to show here.
nixos/modules/system/boot/tmp.nix+20−2
This diff is too big to show here.
nixos/modules/system/build.nix+21
This diff is too big to show here.
nixos/modules/system/etc/etc-activation.nix+12
This diff is too big to show here.
nixos/modules/system/etc/etc.nix+61−22
This diff is too big to show here.
nixos/modules/system/etc/make-etc.sh−45
This diff is too big to show here.
nixos/modules/system/etc/setup-etc.pl+6
This diff is too big to show here.
nixos/modules/system/etc/test.nix+70
This diff is too big to show here.
nixos/modules/tasks/auto-upgrade.nix+105−20
This diff is too big to show here.
nixos/modules/tasks/bcache.nix+16−6
This diff is too big to show here.
nixos/modules/tasks/cpu-freq.nix+1−1
This diff is too big to show here.
nixos/modules/tasks/encrypted-devices.nix+1−1
This diff is too big to show here.
nixos/modules/tasks/filesystems.nix+93−11
This diff is too big to show here.
nixos/modules/tasks/filesystems/apfs.nix+22
This diff is too big to show here.
nixos/modules/tasks/filesystems/btrfs.nix+14−5
This diff is too big to show here.
nixos/modules/tasks/filesystems/cifs.nix+1−1
This diff is too big to show here.
nixos/modules/tasks/filesystems/ecryptfs.nix+12−2
This diff is too big to show here.
nixos/modules/tasks/filesystems/exfat.nix+5−3
This diff is too big to show here.
nixos/modules/tasks/filesystems/ext.nix+10−4
This diff is too big to show here.
nixos/modules/tasks/filesystems/f2fs.nix+1−1
This diff is too big to show here.
nixos/modules/tasks/filesystems/jfs.nix+1−1
This diff is too big to show here.
nixos/modules/tasks/filesystems/nfs.nix+1−1
This diff is too big to show here.
nixos/modules/tasks/filesystems/reiserfs.nix+1−1
This diff is too big to show here.
nixos/modules/tasks/filesystems/unionfs-fuse.nix+13−2
This diff is too big to show here.
nixos/modules/tasks/filesystems/vfat.nix+1−1
This diff is too big to show here.
nixos/modules/tasks/filesystems/xfs.nix+2−2
This diff is too big to show here.
nixos/modules/tasks/filesystems/zfs.nix+88−8
This diff is too big to show here.
nixos/modules/tasks/lvm.nix+73−14
This diff is too big to show here.
nixos/modules/tasks/network-interfaces-scripted.nix+80−9
This diff is too big to show here.
nixos/modules/tasks/network-interfaces-systemd.nix+116−6
This diff is too big to show here.
nixos/modules/tasks/network-interfaces.nix+329−69
This diff is too big to show here.
nixos/modules/tasks/snapraid.nix+230
This diff is too big to show here.
nixos/modules/tasks/swraid.nix+35−9
This diff is too big to show here.
nixos/modules/tasks/trackpoint.nix+5−4
This diff is too big to show here.
nixos/modules/testing/service-runner.nix+1−1
This diff is too big to show here.
nixos/modules/testing/test-instrumentation.nix+32−32
This diff is too big to show here.
nixos/modules/virtualisation/amazon-ec2-amis.nix+444
This diff is too big to show here.
nixos/modules/virtualisation/amazon-image.nix+33−10
This diff is too big to show here.
nixos/modules/virtualisation/amazon-init.nix+10
This diff is too big to show here.
nixos/modules/virtualisation/amazon-options.nix+54−1
This diff is too big to show here.
nixos/modules/virtualisation/anbox.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/azure-agent.nix+6−10
This diff is too big to show here.
nixos/modules/virtualisation/azure-common.nix+5−1
This diff is too big to show here.
nixos/modules/virtualisation/azure-image.nix+3−2
This diff is too big to show here.
nixos/modules/virtualisation/brightbox-image.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/build-vm.nix+58
This diff is too big to show here.
nixos/modules/virtualisation/container-config.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/containerd.nix+51−10
This diff is too big to show here.
nixos/modules/virtualisation/containers.nix+52−34
This diff is too big to show here.
nixos/modules/virtualisation/cri-o.nix+52−33
This diff is too big to show here.
nixos/modules/virtualisation/digital-ocean-image.nix+3−2
This diff is too big to show here.
nixos/modules/virtualisation/digital-ocean-init.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/docker-rootless.nix+102
This diff is too big to show here.
nixos/modules/virtualisation/docker.nix+37−8
This diff is too big to show here.
nixos/modules/virtualisation/ec2-amis.nix+9−352
This diff is too big to show here.
nixos/modules/virtualisation/ec2-data.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/ec2-metadata-fetcher.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/ecs-agent.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/fetch-instance-ssh-keys.bash−36
This diff is too big to show here.
nixos/modules/virtualisation/gce-images.nix+9−1
This diff is too big to show here.
nixos/modules/virtualisation/google-compute-config.nix+32−103
This diff is too big to show here.
nixos/modules/virtualisation/google-compute-image.nix+13−3
This diff is too big to show here.
nixos/modules/virtualisation/hyperv-guest.nix+3−1
This diff is too big to show here.
nixos/modules/virtualisation/hyperv-image.nix+3−2
This diff is too big to show here.
nixos/modules/virtualisation/kubevirt.nix+30
This diff is too big to show here.
nixos/modules/virtualisation/kvmgt.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/libvirtd.nix+183−67
This diff is too big to show here.
nixos/modules/virtualisation/lxc-container.nix+161−13
This diff is too big to show here.
nixos/modules/virtualisation/lxc.nix+8−4
This diff is too big to show here.
nixos/modules/virtualisation/lxd.nix+19−10
This diff is too big to show here.
nixos/modules/virtualisation/nixos-containers.nix+54−38
This diff is too big to show here.
nixos/modules/virtualisation/oci-containers.nix+60−19
This diff is too big to show here.
nixos/modules/virtualisation/openstack-config.nix+39−7
This diff is too big to show here.
nixos/modules/virtualisation/openstack-metadata-fetcher.nix+5−4
This diff is too big to show here.
nixos/modules/virtualisation/openstack-options.nix+71
This diff is too big to show here.
nixos/modules/virtualisation/openvswitch.nix+10−55
This diff is too big to show here.
nixos/modules/virtualisation/parallels-guest.nix+1−2
This diff is too big to show here.
nixos/modules/virtualisation/podman.nix−126
This diff is too big to show here.
nixos/modules/virtualisation/podman/default.nix+187
This diff is too big to show here.
nixos/modules/virtualisation/podman/dnsname.nix+36
This diff is too big to show here.
nixos/modules/virtualisation/podman/network-socket-ghostunnel.nix+34
This diff is too big to show here.
nixos/modules/virtualisation/podman/network-socket.nix+95
This diff is too big to show here.
nixos/modules/virtualisation/proxmox-image.nix+169
This diff is too big to show here.
nixos/modules/virtualisation/proxmox-lxc.nix+64
This diff is too big to show here.
nixos/modules/virtualisation/qemu-guest-agent.nix+6−2
This diff is too big to show here.
nixos/modules/virtualisation/qemu-vm.nix+366−89
This diff is too big to show here.
nixos/modules/virtualisation/railcar.nix+3−4
This diff is too big to show here.
nixos/modules/virtualisation/spice-usb-redirection.nix+4−2
This diff is too big to show here.
nixos/modules/virtualisation/virtualbox-guest.nix+2−2
This diff is too big to show here.
nixos/modules/virtualisation/virtualbox-host.nix+10−2
This diff is too big to show here.
nixos/modules/virtualisation/virtualbox-image.nix+25−4
This diff is too big to show here.
nixos/modules/virtualisation/vmware-guest.nix+27−1
This diff is too big to show here.
nixos/modules/virtualisation/vmware-host.nix+166
This diff is too big to show here.
nixos/modules/virtualisation/vmware-image.nix+3−2
This diff is too big to show here.
nixos/modules/virtualisation/waydroid.nix+75
This diff is too big to show here.
nixos/modules/virtualisation/xe-guest-utilities.nix+1−1
This diff is too big to show here.
nixos/modules/virtualisation/xen-dom0.nix+5−9
This diff is too big to show here.
nixos/release-combined.nix+8−5
This diff is too big to show here.
nixos/release-small.nix+4−2
This diff is too big to show here.
nixos/release.nix+69−10
This diff is too big to show here.
nixos/tests/acme.nix+403−206
This diff is too big to show here.
nixos/tests/adguardhome.nix+57
This diff is too big to show here.
nixos/tests/aesmd.nix+62
This diff is too big to show here.
nixos/tests/agda.nix+4−6
This diff is too big to show here.
nixos/tests/airsonic.nix+28
This diff is too big to show here.
nixos/tests/all-terminfo.nix+31
This diff is too big to show here.
nixos/tests/all-tests.nix+213−41
This diff is too big to show here.
nixos/tests/amazon-init-shell.nix+40
This diff is too big to show here.
nixos/tests/ammonite.nix−20
This diff is too big to show here.
nixos/tests/apfs.nix+54
This diff is too big to show here.
nixos/tests/apparmor.nix+82
This diff is too big to show here.
nixos/tests/atd.nix+1−1
This diff is too big to show here.
nixos/tests/atop.nix+226
This diff is too big to show here.
nixos/tests/avahi.nix+1−1
This diff is too big to show here.
nixos/tests/awscli.nix−17
This diff is too big to show here.
nixos/tests/babeld.nix−6
This diff is too big to show here.
nixos/tests/bat.nix−12
This diff is too big to show here.
nixos/tests/bazarr.nix+1−1
This diff is too big to show here.
nixos/tests/bcachefs.nix+8−9
This diff is too big to show here.
nixos/tests/beanstalkd.nix+1−1
This diff is too big to show here.
nixos/tests/bees.nix+1−1
This diff is too big to show here.
nixos/tests/bind.nix+1−1
This diff is too big to show here.
nixos/tests/bird.nix+129
This diff is too big to show here.
nixos/tests/bitcoind.nix+1−1
This diff is too big to show here.
nixos/tests/bittorrent.nix+1−1
This diff is too big to show here.
nixos/tests/bitwarden.nix−188
This diff is too big to show here.
nixos/tests/blockbook-frontend.nix+1−1
This diff is too big to show here.
nixos/tests/blocky.nix+34
This diff is too big to show here.
nixos/tests/boot-stage1.nix+3−1
This diff is too big to show here.
nixos/tests/boot.nix+61−18
This diff is too big to show here.
nixos/tests/borgbackup.nix+34−1
This diff is too big to show here.
nixos/tests/botamusique.nix+51
This diff is too big to show here.
nixos/tests/bpf.nix+29
This diff is too big to show here.
nixos/tests/breitbandmessung.nix+33
This diff is too big to show here.
nixos/tests/brscan5.nix+43
This diff is too big to show here.
nixos/tests/btrbk.nix+110
This diff is too big to show here.
nixos/tests/buildbot.nix+1−1
This diff is too big to show here.
nixos/tests/buildkite-agents.nix+1−1
This diff is too big to show here.
nixos/tests/caddy.nix+56−40
This diff is too big to show here.
nixos/tests/cage.nix+6−13
This diff is too big to show here.
nixos/tests/cagebreak.nix+25−54
This diff is too big to show here.
nixos/tests/calibre-web.nix+43
This diff is too big to show here.
nixos/tests/cassandra.nix−1
This diff is too big to show here.
nixos/tests/ceph-multi-node.nix+2−2
This diff is too big to show here.
nixos/tests/ceph-single-node-bluestore.nix+1−1
This diff is too big to show here.
nixos/tests/ceph-single-node.nix+1−1
This diff is too big to show here.
nixos/tests/cfssl.nix+1−1
This diff is too big to show here.
nixos/tests/chromium.nix+82−79
This diff is too big to show here.
nixos/tests/cifs-utils.nix−12
This diff is too big to show here.
nixos/tests/clickhouse.nix+2−1
This diff is too big to show here.
nixos/tests/cloud-init.nix+27−2
This diff is too big to show here.
nixos/tests/cntr.nix+75
This diff is too big to show here.
nixos/tests/collectd.nix+38
This diff is too big to show here.
nixos/tests/common/acme/client/default.nix+4−2
This diff is too big to show here.
nixos/tests/common/acme/server/default.nix+5
This diff is too big to show here.
nixos/tests/common/ec2.nix+1
This diff is too big to show here.
nixos/tests/common/lxd/config.yaml+24
This diff is too big to show here.
nixos/tests/common/wayland-cage.nix+13
This diff is too big to show here.
nixos/tests/containers-bridge.nix+2−3
This diff is too big to show here.
nixos/tests/containers-custom-pkgs.nix+2−2
This diff is too big to show here.
nixos/tests/containers-ephemeral.nix+4−5
This diff is too big to show here.
nixos/tests/containers-extra_veth.nix+2−3
This diff is too big to show here.
nixos/tests/containers-hosts.nix+1−2
This diff is too big to show here.
nixos/tests/containers-imperative.nix+30−11
This diff is too big to show here.
nixos/tests/containers-ip.nix+2−3
This diff is too big to show here.
nixos/tests/containers-macvlans.nix−2
This diff is too big to show here.
nixos/tests/containers-names.nix+1−1
This diff is too big to show here.
nixos/tests/containers-nested.nix+30
This diff is too big to show here.
nixos/tests/containers-physical_interfaces.nix−4
This diff is too big to show here.
nixos/tests/containers-portforward.nix+2−3
This diff is too big to show here.
nixos/tests/containers-tmpfs.nix+7−8
This diff is too big to show here.
nixos/tests/coturn.nix+29
This diff is too big to show here.
nixos/tests/couchdb.nix+3−38
This diff is too big to show here.
nixos/tests/cri-o.nix+1−1
This diff is too big to show here.
nixos/tests/croc.nix+2−2
This diff is too big to show here.
nixos/tests/cryptpad.nix+18
This diff is too big to show here.
nixos/tests/custom-ca.nix+112−80
This diff is too big to show here.
nixos/tests/deluge.nix+11−57
This diff is too big to show here.
nixos/tests/dendrite.nix+99
This diff is too big to show here.
nixos/tests/dex-oidc.nix+78
This diff is too big to show here.
nixos/tests/disable-installer-tools.nix+29
This diff is too big to show here.
nixos/tests/discourse.nix+201
This diff is too big to show here.
nixos/tests/dnsdist.nix+48
This diff is too big to show here.
nixos/tests/doas.nix+16−1
This diff is too big to show here.
nixos/tests/docker-rootless.nix+41
This diff is too big to show here.
nixos/tests/docker-tools-cross.nix+2−2
This diff is too big to show here.
nixos/tests/docker-tools-overlay.nix+1−1
This diff is too big to show here.
nixos/tests/docker-tools.nix+157−8
This diff is too big to show here.
nixos/tests/docker.nix+3
This diff is too big to show here.
nixos/tests/documize.nix+1−1
This diff is too big to show here.
nixos/tests/doh-proxy-rust.nix+43
This diff is too big to show here.
nixos/tests/dokuwiki.nix+60−25
This diff is too big to show here.
nixos/tests/domination.nix+26
This diff is too big to show here.
nixos/tests/dovecot.nix+3−1
This diff is too big to show here.
nixos/tests/drbd.nix+87
This diff is too big to show here.
nixos/tests/earlyoom.nix+16
This diff is too big to show here.
nixos/tests/ec2.nix+5
This diff is too big to show here.
nixos/tests/ecryptfs.nix+1−1
This diff is too big to show here.
nixos/tests/elk.nix+132−40
This diff is too big to show here.
nixos/tests/emacs-daemon.nix+2−2
This diff is too big to show here.
nixos/tests/empty-file
This diff is too big to show here.
nixos/tests/enlightenment.nix+4−5
This diff is too big to show here.
nixos/tests/env.nix+1−1
This diff is too big to show here.
nixos/tests/envoy.nix+33
This diff is too big to show here.
nixos/tests/ergochat.nix+97
This diff is too big to show here.
nixos/tests/etebase-server.nix+50
This diff is too big to show here.
nixos/tests/etesync-dav.nix+2−2
This diff is too big to show here.
nixos/tests/fancontrol.nix+23−17
This diff is too big to show here.
nixos/tests/fcitx/default.nix+1−2
This diff is too big to show here.
nixos/tests/fenics.nix+1−2
This diff is too big to show here.
nixos/tests/firefox.nix+9−11
This diff is too big to show here.
nixos/tests/fish.nix+1−1
This diff is too big to show here.
nixos/tests/fluentd.nix+1−1
This diff is too big to show here.
nixos/tests/fluidd.nix+21
This diff is too big to show here.
nixos/tests/fontconfig-default-fonts.nix+1−2
This diff is too big to show here.
nixos/tests/frr.nix+104
This diff is too big to show here.
nixos/tests/fsck.nix+1−1
This diff is too big to show here.
nixos/tests/ft2-clone.nix+2−2
This diff is too big to show here.
nixos/tests/gerrit.nix−1
This diff is too big to show here.
nixos/tests/geth.nix+2−2
This diff is too big to show here.
nixos/tests/ghostunnel.nix+103
This diff is too big to show here.
nixos/tests/gitdaemon.nix+5−1
This diff is too big to show here.
nixos/tests/gitea.nix+1−1
This diff is too big to show here.
nixos/tests/gitlab.nix+382−67
This diff is too big to show here.
nixos/tests/gitolite-fcgiwrap.nix+2−2
This diff is too big to show here.
nixos/tests/gnome-xorg.nix+96
This diff is too big to show here.
nixos/tests/gnome.nix+97
This diff is too big to show here.
nixos/tests/gnome3-xorg.nix−81
This diff is too big to show here.
nixos/tests/gnome3.nix−82
This diff is too big to show here.
nixos/tests/go-neb.nix+6−6
This diff is too big to show here.
nixos/tests/gobgpd.nix+71
This diff is too big to show here.
nixos/tests/gocd-agent.nix+1−1
This diff is too big to show here.
nixos/tests/google-oslogin/default.nix+2−2
This diff is too big to show here.
nixos/tests/google-oslogin/server.nix+2−4
This diff is too big to show here.
nixos/tests/google-oslogin/server.py
This diff is too big to show here.
nixos/tests/gotify-server.nix+1−1
This diff is too big to show here.
nixos/tests/grafana.nix+4−4
This diff is too big to show here.
nixos/tests/graphite.nix−1
This diff is too big to show here.
nixos/tests/graylog.nix+2−2
This diff is too big to show here.
nixos/tests/grocy.nix+2−2
This diff is too big to show here.
nixos/tests/grub.nix+1−1
This diff is too big to show here.
nixos/tests/hadoop/default.nix+7
This diff is too big to show here.
nixos/tests/hadoop/hadoop.nix+255
This diff is too big to show here.
nixos/tests/hadoop/hdfs.nix+57−27
This diff is too big to show here.
nixos/tests/hadoop/yarn.nix+22−23
This diff is too big to show here.
nixos/tests/handbrake.nix−31
This diff is too big to show here.
nixos/tests/haproxy.nix−1
This diff is too big to show here.
nixos/tests/hardened.nix+6−31
This diff is too big to show here.
nixos/tests/haste-server.nix+23
This diff is too big to show here.
nixos/tests/hbase.nix+30
This diff is too big to show here.
nixos/tests/herbstluftwm.nix+1−2
This diff is too big to show here.
nixos/tests/hibernate.nix+113−24
This diff is too big to show here.
nixos/tests/hitch/default.nix+1−1
This diff is too big to show here.
nixos/tests/hledger-web.nix+11−14
This diff is too big to show here.
nixos/tests/hocker-fetchdocker/default.nix+1−1
This diff is too big to show here.
nixos/tests/hockeypuck.nix+63
This diff is too big to show here.
nixos/tests/home-assistant.nix+95−38
This diff is too big to show here.
nixos/tests/hostname.nix+1−1
This diff is too big to show here.
nixos/tests/hound.nix+1−1
This diff is too big to show here.
nixos/tests/hydra/common.nix+1−1
This diff is too big to show here.
nixos/tests/hydra/default.nix+2−2
This diff is too big to show here.
nixos/tests/i3wm.nix+1−1
This diff is too big to show here.
nixos/tests/ihatemoney.nix−62
This diff is too big to show here.
nixos/tests/ihatemoney/default.nix+78
This diff is too big to show here.
nixos/tests/ihatemoney/rates.json+39
This diff is too big to show here.
nixos/tests/ihatemoney/server.crt+28
This diff is too big to show here.
nixos/tests/ihatemoney/server.key+52
This diff is too big to show here.
nixos/tests/incron.nix+1−1
This diff is too big to show here.
nixos/tests/initrd-network.nix+1−1
This diff is too big to show here.
nixos/tests/initrd-secrets.nix+9−3
This diff is too big to show here.
nixos/tests/input-remapper.nix+52
This diff is too big to show here.
nixos/tests/inspircd.nix+93
This diff is too big to show here.
nixos/tests/installed-tests/appstream-qt.nix+9
This diff is too big to show here.
nixos/tests/installed-tests/appstream.nix+9
This diff is too big to show here.
nixos/tests/installed-tests/default.nix+5−1
This diff is too big to show here.
nixos/tests/installed-tests/flatpak.nix+1
This diff is too big to show here.
nixos/tests/installed-tests/fwupd.nix−1
This diff is too big to show here.
nixos/tests/installed-tests/gjs.nix+6
This diff is too big to show here.
nixos/tests/installed-tests/gnome-photos.nix+1−1
This diff is too big to show here.
nixos/tests/installed-tests/libgdata.nix+1−1
This diff is too big to show here.
nixos/tests/installed-tests/librsvg.nix+9
This diff is too big to show here.
nixos/tests/installed-tests/pipewire.nix+10
This diff is too big to show here.
nixos/tests/installed-tests/power-profiles-daemon.nix+9
This diff is too big to show here.
nixos/tests/installer-systemd-stage-1.nix+33
This diff is too big to show here.
nixos/tests/installer.nix+52−44
This diff is too big to show here.
nixos/tests/invidious.nix+81
This diff is too big to show here.
nixos/tests/invoiceplane.nix+82
This diff is too big to show here.
nixos/tests/ipfs.nix+5
This diff is too big to show here.
nixos/tests/ipv6.nix+62−23
This diff is too big to show here.
nixos/tests/iscsi-multipath-root.nix+267
This diff is too big to show here.
nixos/tests/iscsi-root.nix+161
This diff is too big to show here.
nixos/tests/isso.nix+30
This diff is too big to show here.
nixos/tests/jellyfin.nix+155−16
This diff is too big to show here.
nixos/tests/jenkins-cli.nix+30
This diff is too big to show here.
nixos/tests/jenkins.nix+85−2
This diff is too big to show here.
nixos/tests/jibri.nix+69
This diff is too big to show here.
nixos/tests/jitsi-meet.nix+2−8
This diff is too big to show here.
nixos/tests/k3s-single-node-docker.nix+84
This diff is too big to show here.
nixos/tests/k3s-single-node.nix+82
This diff is too big to show here.
nixos/tests/k3s.nix−78
This diff is too big to show here.
nixos/tests/kafka.nix+2−4
This diff is too big to show here.
nixos/tests/kbd-setfont-decompress.nix+21
This diff is too big to show here.
nixos/tests/kbd-update-search-paths-patch.nix+19
This diff is too big to show here.
nixos/tests/kea.nix+73
This diff is too big to show here.
nixos/tests/keepassxc.nix+43−9
This diff is too big to show here.
nixos/tests/kerberos/heimdal.nix+2−2
This diff is too big to show here.
nixos/tests/kerberos/mit.nix+1−1
This diff is too big to show here.
nixos/tests/kernel-generic.nix+41
This diff is too big to show here.
nixos/tests/kernel-latest-ath-user-regd.nix+1−1
This diff is too big to show here.
nixos/tests/kernel-latest.nix−17
This diff is too big to show here.
nixos/tests/kernel-lts.nix−17
This diff is too big to show here.
nixos/tests/kernel-testing.nix−17
This diff is too big to show here.
nixos/tests/kexec.nix+44−19
This diff is too big to show here.
nixos/tests/keycloak.nix+46−10
This diff is too big to show here.
nixos/tests/keymap.nix+25−4
This diff is too big to show here.
nixos/tests/knot.nix+6
This diff is too big to show here.
nixos/tests/krb5/deprecated-config.nix+1−1
This diff is too big to show here.
nixos/tests/krb5/example-config.nix+1−1
This diff is too big to show here.
nixos/tests/ksm.nix+1−1
This diff is too big to show here.
nixos/tests/kubernetes/base.nix+3−4
This diff is too big to show here.
nixos/tests/kubernetes/default.nix+13−5
This diff is too big to show here.
nixos/tests/kubernetes/dns.nix+3−3
This diff is too big to show here.
nixos/tests/kubernetes/e2e.nix+1−1
This diff is too big to show here.
nixos/tests/kubernetes/rbac.nix+9−9
This diff is too big to show here.
nixos/tests/libinput.nix+38
This diff is too big to show here.
nixos/tests/libreddit.nix+19
This diff is too big to show here.
nixos/tests/libresprite.nix+30
This diff is too big to show here.
nixos/tests/libreswan.nix+134
This diff is too big to show here.
nixos/tests/lightdm.nix+2−2
This diff is too big to show here.
nixos/tests/limesurvey.nix+1−1
This diff is too big to show here.
nixos/tests/litestream.nix+93
This diff is too big to show here.
nixos/tests/login.nix+1−1
This diff is too big to show here.
nixos/tests/logrotate.nix+152
This diff is too big to show here.
nixos/tests/loki.nix+1−1
This diff is too big to show here.
nixos/tests/lorri/default.nix+1−1
This diff is too big to show here.
nixos/tests/lsd.nix−12
This diff is too big to show here.
nixos/tests/lvm2/default.nix+45
This diff is too big to show here.
nixos/tests/lvm2/systemd-stage-1.nix+104
This diff is too big to show here.
nixos/tests/lvm2/thinpool.nix+32
This diff is too big to show here.
nixos/tests/lvm2/vdo.nix+27
This diff is too big to show here.
nixos/tests/lxd-image-server.nix+94
This diff is too big to show here.
nixos/tests/lxd-nftables.nix+1−1
This diff is too big to show here.
nixos/tests/lxd.nix+41−64
This diff is too big to show here.
nixos/tests/maddy.nix+58
This diff is too big to show here.
nixos/tests/maestral.nix+72
This diff is too big to show here.
nixos/tests/magic-wormhole-mailbox-server.nix+1−1
This diff is too big to show here.
nixos/tests/magnetico.nix+1−1
This diff is too big to show here.
nixos/tests/mailcatcher.nix+8−3
This diff is too big to show here.
nixos/tests/mailhog.nix+1−1
This diff is too big to show here.
nixos/tests/make-test-python.nix+1−1
This diff is too big to show here.
nixos/tests/man.nix+100
This diff is too big to show here.
nixos/tests/matomo.nix+2−2
This diff is too big to show here.
nixos/tests/matrix-appservice-irc.nix+224
This diff is too big to show here.
nixos/tests/matrix-conduit.nix+95
This diff is too big to show here.
nixos/tests/matrix-synapse.nix+140−9
This diff is too big to show here.
nixos/tests/matrix/mjolnir.nix+170
This diff is too big to show here.
nixos/tests/matrix/pantalaimon.nix+88
This diff is too big to show here.
nixos/tests/mattermost.nix+124
This diff is too big to show here.
nixos/tests/mediawiki.nix+1−1
This diff is too big to show here.
nixos/tests/meilisearch.nix+60
This diff is too big to show here.
nixos/tests/memcached.nix+1−1
This diff is too big to show here.
nixos/tests/metabase.nix−1
This diff is too big to show here.
nixos/tests/minecraft-server.nix+1−1
This diff is too big to show here.
nixos/tests/minecraft.nix+1−1
This diff is too big to show here.
nixos/tests/minidlna.nix+4−2
This diff is too big to show here.
nixos/tests/miniflux.nix+25−13
This diff is too big to show here.
nixos/tests/minio.nix+4−1
This diff is too big to show here.
nixos/tests/misc.nix+7−6
This diff is too big to show here.
nixos/tests/mod_perl.nix+53
This diff is too big to show here.
nixos/tests/moinmoin.nix−28
This diff is too big to show here.
nixos/tests/mongodb.nix+4
This diff is too big to show here.
nixos/tests/moodle.nix+1−1
This diff is too big to show here.
nixos/tests/moonraker.nix+45
This diff is too big to show here.
nixos/tests/moosefs.nix+89
This diff is too big to show here.
nixos/tests/mosquitto.nix+167−49
This diff is too big to show here.
nixos/tests/mpd.nix+1−1
This diff is too big to show here.
nixos/tests/mpv.nix+28
This diff is too big to show here.
nixos/tests/mtp.nix+109
This diff is too big to show here.
nixos/tests/mumble.nix+2−2
This diff is too big to show here.
nixos/tests/musescore.nix+2−2
This diff is too big to show here.
nixos/tests/mutable-users.nix+28
This diff is too big to show here.
nixos/tests/mxisd.nix+4−13
This diff is too big to show here.
nixos/tests/mysql/common.nix+10
This diff is too big to show here.
nixos/tests/mysql/mariadb-galera-mariabackup.nix−223
This diff is too big to show here.
nixos/tests/mysql/mariadb-galera-rsync.nix−216
This diff is too big to show here.
nixos/tests/mysql/mariadb-galera.nix+250
This diff is too big to show here.
nixos/tests/mysql/mysql-autobackup.nix+48−33
This diff is too big to show here.
nixos/tests/mysql/mysql-backup.nix+60−44
This diff is too big to show here.
nixos/tests/mysql/mysql-replication.nix+84−74
This diff is too big to show here.
nixos/tests/mysql/mysql.nix+134−174
This diff is too big to show here.
nixos/tests/nagios.nix+1−1
This diff is too big to show here.
nixos/tests/nano.nix−44
This diff is too big to show here.
nixos/tests/nar-serve.nix+1−1
This diff is too big to show here.
nixos/tests/nats.nix+63
This diff is too big to show here.
nixos/tests/navidrome.nix+12
This diff is too big to show here.
nixos/tests/nbd.nix+103
This diff is too big to show here.
nixos/tests/ncdns.nix+6−9
This diff is too big to show here.
nixos/tests/nebula.nix+223
This diff is too big to show here.
nixos/tests/networking-proxy.nix−1
This diff is too big to show here.
nixos/tests/networking.nix+226−17
This diff is too big to show here.
nixos/tests/nextcloud/basic.nix+14−4
This diff is too big to show here.
nixos/tests/nextcloud/default.nix+20−8
This diff is too big to show here.
nixos/tests/nextcloud/with-mysql-and-memcached.nix+8−18
This diff is too big to show here.
nixos/tests/nextcloud/with-postgresql-and-redis.nix+5−2
This diff is too big to show here.
nixos/tests/nexus.nix+1−1
This diff is too big to show here.
nixos/tests/nfs/kerberos.nix+4−4
This diff is too big to show here.
nixos/tests/nfs/simple.nix+1−1
This diff is too big to show here.
nixos/tests/nginx-etag.nix+1−2
This diff is too big to show here.
nixos/tests/nginx-modsecurity.nix+39
This diff is too big to show here.
nixos/tests/nginx-pubhtml.nix+1−1
This diff is too big to show here.
nixos/tests/nginx-sandbox.nix+1−1
This diff is too big to show here.
nixos/tests/nginx-sso.nix+1−1
This diff is too big to show here.
nixos/tests/nginx-variants.nix+2−2
This diff is too big to show here.
nixos/tests/nginx.nix+2−2
This diff is too big to show here.
nixos/tests/nitter.nix+18
This diff is too big to show here.
nixos/tests/nix-ld.nix+20
This diff is too big to show here.
nixos/tests/nix-serve-ssh.nix+45
This diff is too big to show here.
nixos/tests/nix-serve.nix+22
This diff is too big to show here.
nixos/tests/nix-ssh-serve.nix−45
This diff is too big to show here.
nixos/tests/nixops/default.nix+114
This diff is too big to show here.
nixos/tests/nixops/legacy/base-configuration.nix+31
This diff is too big to show here.
nixos/tests/nixops/legacy/nixops.nix+15
This diff is too big to show here.
nixos/tests/nixos-generate-config.nix+3−3
This diff is too big to show here.
nixos/tests/node-red.nix+31
This diff is too big to show here.
nixos/tests/noto-fonts.nix+44
This diff is too big to show here.
nixos/tests/novacomd.nix+1−1
This diff is too big to show here.
nixos/tests/nsd.nix+10
This diff is too big to show here.
nixos/tests/nzbget.nix+17−1
This diff is too big to show here.
nixos/tests/oci-containers.nix+1−1
This diff is too big to show here.
nixos/tests/odoo.nix+27
This diff is too big to show here.
nixos/tests/oh-my-zsh.nix+1−1
This diff is too big to show here.
nixos/tests/ombi.nix+18
This diff is too big to show here.
nixos/tests/openarena.nix+2−2
This diff is too big to show here.
nixos/tests/openldap.nix+3−3
This diff is too big to show here.
nixos/tests/openresty-lua.nix+55
This diff is too big to show here.
nixos/tests/opensmtpd-rspamd.nix+141
This diff is too big to show here.
nixos/tests/openssh.nix+12−6
This diff is too big to show here.
nixos/tests/opentabletdriver.nix+1−1
This diff is too big to show here.
nixos/tests/os-prober.nix+13−15
This diff is too big to show here.
nixos/tests/osrm-backend.nix+1−1
This diff is too big to show here.
nixos/tests/overlayfs.nix+28−31
This diff is too big to show here.
nixos/tests/owncast.nix+42
This diff is too big to show here.
nixos/tests/pacemaker.nix+110
This diff is too big to show here.
nixos/tests/packagekit.nix+1−2
This diff is too big to show here.
nixos/tests/pam/pam-file-contents.nix+25
This diff is too big to show here.
nixos/tests/pam/pam-oath-login.nix+3−3
This diff is too big to show here.
nixos/tests/pam/pam-u2f.nix+2−2
This diff is too big to show here.
nixos/tests/pam/pam-ussh.nix+70
This diff is too big to show here.
nixos/tests/pam/test_chfn.py+27
This diff is too big to show here.
nixos/tests/pantheon.nix+7−8
This diff is too big to show here.
nixos/tests/paperless.nix+25−17
This diff is too big to show here.
nixos/tests/parsedmarc/default.nix+235
This diff is too big to show here.
nixos/tests/pdns-recursor.nix+4−1
This diff is too big to show here.
nixos/tests/pgadmin4-standalone.nix+43
This diff is too big to show here.
nixos/tests/pgadmin4.nix+132
This diff is too big to show here.
nixos/tests/php/default.nix+3−2
This diff is too big to show here.
nixos/tests/php/fpm.nix+18−16
This diff is too big to show here.
nixos/tests/php/httpd.nix+11−9
This diff is too big to show here.
nixos/tests/php/pcre.nix+12−10
This diff is too big to show here.
nixos/tests/pict-rs.nix+17
This diff is too big to show here.
nixos/tests/pinnwand.nix+9−1
This diff is too big to show here.
nixos/tests/plasma5-systemd-start.nix+42
This diff is too big to show here.
nixos/tests/plasma5.nix+5−6
This diff is too big to show here.
nixos/tests/plausible.nix+49
This diff is too big to show here.
nixos/tests/pleroma.nix+4−20
This diff is too big to show here.
nixos/tests/plikd.nix+1−1
This diff is too big to show here.
nixos/tests/plotinus.nix+3−3
This diff is too big to show here.
nixos/tests/podgrab.nix+34
This diff is too big to show here.
nixos/tests/podman.nix−101
This diff is too big to show here.
nixos/tests/podman/default.nix+144
This diff is too big to show here.
nixos/tests/podman/dnsname.nix+42
This diff is too big to show here.
nixos/tests/podman/tls-ghostunnel.nix+150
This diff is too big to show here.
nixos/tests/pomerium.nix+102
This diff is too big to show here.
nixos/tests/postfix-raise-smtpd-tls-security-level.nix+1−1
This diff is too big to show here.
nixos/tests/postfix.nix+1−1
This diff is too big to show here.
nixos/tests/postfixadmin.nix+31
This diff is too big to show here.
nixos/tests/postgresql-wal-receiver.nix+1−1
This diff is too big to show here.
nixos/tests/postgresql.nix+50−3
This diff is too big to show here.
nixos/tests/power-profiles-daemon.nix+1−1
This diff is too big to show here.
nixos/tests/powerdns-admin.nix+117
This diff is too big to show here.
nixos/tests/powerdns.nix+1
This diff is too big to show here.
nixos/tests/predictable-interface-names.nix+1−1
This diff is too big to show here.
nixos/tests/printing.nix+2−11
This diff is too big to show here.
nixos/tests/privacyidea.nix+11−4
This diff is too big to show here.
nixos/tests/privoxy.nix+1−1
This diff is too big to show here.
nixos/tests/prometheus-exporters.nix+565−211
This diff is too big to show here.
nixos/tests/prometheus.nix+91−1
This diff is too big to show here.
nixos/tests/prowlarr.nix+18
This diff is too big to show here.
nixos/tests/pt2-clone.nix+2−2
This diff is too big to show here.
nixos/tests/pulseaudio.nix+71
This diff is too big to show here.
nixos/tests/qboot.nix+1−1
This diff is too big to show here.
nixos/tests/quagga.nix−96
This diff is too big to show here.
nixos/tests/quorum.nix+32−9
This diff is too big to show here.
nixos/tests/rabbitmq.nix+8−2
This diff is too big to show here.
nixos/tests/radicale.nix+82−127
This diff is too big to show here.
nixos/tests/rasdaemon.nix+34
This diff is too big to show here.
nixos/tests/redis.nix+20−19
This diff is too big to show here.
nixos/tests/redmine.nix+1−1
This diff is too big to show here.
nixos/tests/restart-by-activation-script.nix+73
This diff is too big to show here.
nixos/tests/retroarch.nix+49
This diff is too big to show here.
nixos/tests/riak.nix+1−1
This diff is too big to show here.
nixos/tests/rspamd.nix+9−6
This diff is too big to show here.
nixos/tests/rss2email.nix+1−1
This diff is too big to show here.
nixos/tests/rstudio-server.nix+24
This diff is too big to show here.
nixos/tests/rsyslogd.nix+2−2
This diff is too big to show here.
nixos/tests/run-in-machine.nix−23
This diff is too big to show here.
nixos/tests/sabnzbd.nix+22
This diff is too big to show here.
nixos/tests/samba-wsdd.nix+1−1
This diff is too big to show here.
nixos/tests/samba.nix+1−2
This diff is too big to show here.
nixos/tests/sanoid.nix+37−16
This diff is too big to show here.
nixos/tests/sddm.nix+2−2
This diff is too big to show here.
nixos/tests/seafile.nix+121
This diff is too big to show here.
nixos/tests/searx.nix+1−1
This diff is too big to show here.
nixos/tests/service-runner.nix+1−1
This diff is too big to show here.
nixos/tests/sfxr-qt.nix+32
This diff is too big to show here.
nixos/tests/shadow.nix+15−12
This diff is too big to show here.
nixos/tests/shattered-pixel-dungeon.nix+3−2
This diff is too big to show here.
nixos/tests/shiori.nix+2−3
This diff is too big to show here.
nixos/tests/signal-desktop.nix+32−6
This diff is too big to show here.
nixos/tests/simple.nix+1−1
This diff is too big to show here.
nixos/tests/slurm.nix+1−1
This diff is too big to show here.
nixos/tests/snapcast.nix+15−2
This diff is too big to show here.
nixos/tests/snapper.nix+1−1
This diff is too big to show here.
nixos/tests/soapui.nix+24
This diff is too big to show here.
nixos/tests/sogo.nix+1−1
This diff is too big to show here.
nixos/tests/solanum.nix+97
This diff is too big to show here.
nixos/tests/solr.nix+1−1
This diff is too big to show here.
nixos/tests/sourcehut.nix+212
This diff is too big to show here.
nixos/tests/spacecookie.nix+19−14
This diff is too big to show here.
nixos/tests/spark/default.nix+27
This diff is too big to show here.
nixos/tests/spark/spark_sample.py+40
This diff is too big to show here.
nixos/tests/spike.nix−22
This diff is too big to show here.
nixos/tests/ssh-keys.nix+1−1
This diff is too big to show here.
nixos/tests/sssd-ldap.nix+79−81
This diff is too big to show here.
nixos/tests/sssd.nix+1−1
This diff is too big to show here.
nixos/tests/starship.nix+42
This diff is too big to show here.
nixos/tests/step-ca.nix+77
This diff is too big to show here.
nixos/tests/sudo.nix+25−2
This diff is too big to show here.
nixos/tests/sway.nix+138
This diff is too big to show here.
nixos/tests/switch-test.nix+1016−6
This diff is too big to show here.
nixos/tests/sympa.nix+1−2
This diff is too big to show here.
nixos/tests/syncthing-init.nix+9−9
This diff is too big to show here.
nixos/tests/syncthing-relay.nix+1−1
This diff is too big to show here.
nixos/tests/syncthing.nix+2−2
This diff is too big to show here.
nixos/tests/systemd-analyze.nix+1−1
This diff is too big to show here.
nixos/tests/systemd-binfmt.nix+86−20
This diff is too big to show here.
nixos/tests/systemd-boot.nix+169−5
This diff is too big to show here.
nixos/tests/systemd-confinement.nix+46−23
This diff is too big to show here.
nixos/tests/systemd-cryptenroll.nix+54
This diff is too big to show here.
nixos/tests/systemd-escaping.nix+45
This diff is too big to show here.
nixos/tests/systemd-initrd-btrfs-raid.nix+45
This diff is too big to show here.
nixos/tests/systemd-initrd-luks-keyfile.nix+53
This diff is too big to show here.
nixos/tests/systemd-initrd-luks-password.nix+48
This diff is too big to show here.
nixos/tests/systemd-initrd-simple.nix+44
This diff is too big to show here.
nixos/tests/systemd-initrd-swraid.nix+50
This diff is too big to show here.
nixos/tests/systemd-journal.nix+1−1
This diff is too big to show here.
nixos/tests/systemd-machinectl.nix+85
This diff is too big to show here.
nixos/tests/systemd-misc.nix+62
This diff is too big to show here.
nixos/tests/systemd-networkd-dhcpserver-static-leases.nix+81
This diff is too big to show here.
nixos/tests/systemd-networkd-ipv6-prefix-delegation.nix+5−12
This diff is too big to show here.
nixos/tests/systemd-networkd-vrf.nix+2
This diff is too big to show here.
nixos/tests/systemd-networkd.nix+10−1
This diff is too big to show here.
nixos/tests/systemd-shutdown.nix+26
This diff is too big to show here.
nixos/tests/systemd.nix+17−2
This diff is too big to show here.
nixos/tests/taskserver.nix+1
This diff is too big to show here.
nixos/tests/teeworlds.nix+2−2
This diff is too big to show here.
nixos/tests/telegraf.nix+1−1
This diff is too big to show here.
nixos/tests/teleport.nix+99
This diff is too big to show here.
nixos/tests/terminal-emulators.nix+207
This diff is too big to show here.
nixos/tests/thelounge.nix+29
This diff is too big to show here.
nixos/tests/tigervnc.nix+53
This diff is too big to show here.
nixos/tests/tinydns.nix+15−1
This diff is too big to show here.
nixos/tests/tinywl.nix+57
This diff is too big to show here.
nixos/tests/tomcat.nix+21
This diff is too big to show here.
nixos/tests/tor.nix+10−15
This diff is too big to show here.
nixos/tests/trac.nix−19
This diff is too big to show here.
nixos/tests/traefik.nix+2
This diff is too big to show here.
nixos/tests/trafficserver.nix+177
This diff is too big to show here.
nixos/tests/transmission.nix+1−1
This diff is too big to show here.
nixos/tests/tsm-client-gui.nix+57
This diff is too big to show here.
nixos/tests/tuptime.nix+1−1
This diff is too big to show here.
nixos/tests/turbovnc-headless-server.nix+5−4
This diff is too big to show here.
nixos/tests/tuxguitar.nix+24
This diff is too big to show here.
nixos/tests/txredisapi.nix+29
This diff is too big to show here.
nixos/tests/ucarp.nix+66
This diff is too big to show here.
nixos/tests/ucg.nix−18
This diff is too big to show here.
nixos/tests/udisks2.nix+2−2
This diff is too big to show here.
nixos/tests/unbound.nix+56−33
This diff is too big to show here.
nixos/tests/unifi.nix+36
This diff is too big to show here.
nixos/tests/usbguard.nix+2−2
This diff is too big to show here.
nixos/tests/user-activation-scripts.nix+33
This diff is too big to show here.
nixos/tests/uwsgi.nix+1−1
This diff is too big to show here.
nixos/tests/v2ray.nix+2−2
This diff is too big to show here.
nixos/tests/vault-postgresql.nix+2−3
This diff is too big to show here.
nixos/tests/vault.nix+4−3
This diff is too big to show here.
nixos/tests/vaultwarden.nix+187
This diff is too big to show here.
nixos/tests/vector.nix+1−1
This diff is too big to show here.
nixos/tests/vengi-tools.nix+29
This diff is too big to show here.
nixos/tests/vikunja.nix+65
This diff is too big to show here.
nixos/tests/virtualbox.nix+9−15
This diff is too big to show here.
nixos/tests/vscodium.nix+66−35
This diff is too big to show here.
nixos/tests/vsftpd.nix+42
This diff is too big to show here.
nixos/tests/wasabibackend.nix+1−1
This diff is too big to show here.
nixos/tests/web-apps/mastodon.nix+170
This diff is too big to show here.
nixos/tests/web-apps/netbox.nix+30
This diff is too big to show here.
nixos/tests/web-apps/nifi.nix+30
This diff is too big to show here.
nixos/tests/web-apps/peertube.nix+131
This diff is too big to show here.
nixos/tests/web-servers/agate.nix+29
This diff is too big to show here.
nixos/tests/web-servers/unit-php.nix+20−30
This diff is too big to show here.
nixos/tests/wiki-js.nix+152
This diff is too big to show here.
nixos/tests/wine.nix+48
This diff is too big to show here.
nixos/tests/wireguard/basic.nix+3−3
This diff is too big to show here.
nixos/tests/wireguard/wg-quick.nix+1−1
This diff is too big to show here.
nixos/tests/without-nix.nix+32
This diff is too big to show here.
nixos/tests/wmderland.nix+54
This diff is too big to show here.
nixos/tests/wordpress.nix+56−23
This diff is too big to show here.
nixos/tests/wpa_supplicant.nix+96
This diff is too big to show here.
nixos/tests/xandikos.nix+4−4
This diff is too big to show here.
nixos/tests/xautolock.nix+1−1
This diff is too big to show here.
nixos/tests/xfce.nix+2−3
This diff is too big to show here.
nixos/tests/xmonad-xdg-autostart.nix+35
This diff is too big to show here.
nixos/tests/xmonad.nix+84−17
This diff is too big to show here.
nixos/tests/xmpp/prosody-mysql.nix+65−33
This diff is too big to show here.
nixos/tests/xmpp/prosody.nix+3−2
This diff is too big to show here.
nixos/tests/xmpp/xmpp-sendmessage.nix+1−4
This diff is too big to show here.
nixos/tests/xrdp.nix+2−2
This diff is too big to show here.
nixos/tests/xss-lock.nix+1−1
This diff is too big to show here.
nixos/tests/xterm.nix+2−2
This diff is too big to show here.
nixos/tests/xxh.nix+67
This diff is too big to show here.
nixos/tests/yabar.nix+2−2
This diff is too big to show here.
nixos/tests/yggdrasil.nix+8−12
This diff is too big to show here.
nixos/tests/yq.nix−12
This diff is too big to show here.
nixos/tests/zammad.nix+60
This diff is too big to show here.
nixos/tests/zfs.nix+74−1
This diff is too big to show here.
nixos/tests/zigbee2mqtt.nix+6−2
This diff is too big to show here.
nixos/tests/zoneminder.nix+1−1
This diff is too big to show here.
nixos/tests/zrepl.nix+66
This diff is too big to show here.
nixos/tests/zsh-history.nix+1−1
This diff is too big to show here.
pkgs/applications/accessibility/contrast/default.nix+14−14
This diff is too big to show here.
pkgs/applications/accessibility/dasher/default.nix+33−18
This diff is too big to show here.
pkgs/applications/accessibility/espeakup/default.nix+46
This diff is too big to show here.
pkgs/applications/accessibility/mousetweaks/default.nix+2−2
This diff is too big to show here.
pkgs/applications/accessibility/squeekboard/default.nix+11−8
This diff is too big to show here.
pkgs/applications/accessibility/svkbd/default.nix+59
This diff is too big to show here.
pkgs/applications/accessibility/wvkbd/default.nix+36
This diff is too big to show here.
pkgs/applications/audio/CHOWTapeModel/default.nix+78
This diff is too big to show here.
pkgs/applications/audio/ChowCentaur/default.nix+53
This diff is too big to show here.
pkgs/applications/audio/ChowKick/default.nix+106
This diff is too big to show here.
pkgs/applications/audio/ChowPhaser/default.nix+76
This diff is too big to show here.
pkgs/applications/audio/LibreArp/default.nix+53
This diff is too big to show here.
pkgs/applications/audio/LibreArp/lv2.nix+53
This diff is too big to show here.
pkgs/applications/audio/MMA/default.nix+6−6
This diff is too big to show here.
pkgs/applications/audio/a2jmidid/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/aacgain/default.nix+7−2
This diff is too big to show here.
pkgs/applications/audio/adlplug/default.nix+76−14
This diff is too big to show here.
pkgs/applications/audio/aeolus/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/aether-lv2/default.nix+33
This diff is too big to show here.
pkgs/applications/audio/airwave/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/aj-snapshot/default.nix+4−5
This diff is too big to show here.
pkgs/applications/audio/amarok/default.nix+4−2
This diff is too big to show here.
pkgs/applications/audio/amberol/default.nix+75
This diff is too big to show here.
pkgs/applications/audio/ams/default.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/apple-music-electron/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/ardour/5.nix−161
This diff is too big to show here.
pkgs/applications/audio/ardour/default.nix+9−9
This diff is too big to show here.
pkgs/applications/audio/ashuffle/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/audacious/default.nix+10−8
This diff is too big to show here.
pkgs/applications/audio/audacity/default.nix+128−60
This diff is too big to show here.
pkgs/applications/audio/audio-recorder/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/aumix/default.nix+28−13
This diff is too big to show here.
pkgs/applications/audio/axoloti/libusb1.nix+7−6
This diff is too big to show here.
pkgs/applications/audio/bambootracker/default.nix+9−21
This diff is too big to show here.
pkgs/applications/audio/bchoppr/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/bespokesynth/default.nix+148
This diff is too big to show here.
pkgs/applications/audio/bitwig-studio/bitwig-studio1.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/bitwig-studio/bitwig-studio2.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/bitwig-studio/bitwig-studio3.nix+11−7
This diff is too big to show here.
pkgs/applications/audio/bitwig-studio/bitwig-studio4.nix+80
This diff is too big to show here.
pkgs/applications/audio/bjumblr/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/blanket/default.nix+69
This diff is too big to show here.
pkgs/applications/audio/boops/default.nix+28
This diff is too big to show here.
pkgs/applications/audio/bristol/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/bschaffl/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/bsequencer/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/bshapr/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/bslizr/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/bucklespring/default.nix+63
This diff is too big to show here.
pkgs/applications/audio/cadence/default.nix+49−39
This diff is too big to show here.
pkgs/applications/audio/callaudiod/default.nix+7−5
This diff is too big to show here.
pkgs/applications/audio/cantata/default.nix+73−58
This diff is too big to show here.
pkgs/applications/audio/cardinal/default.nix+67
This diff is too big to show here.
pkgs/applications/audio/carla/default.nix+13−5
This diff is too big to show here.
pkgs/applications/audio/caudec/default.nix+6−10
This diff is too big to show here.
pkgs/applications/audio/cava/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/cd-discid/default.nix−1
This diff is too big to show here.
pkgs/applications/audio/cdparanoia/default.nix+16−6
This diff is too big to show here.
pkgs/applications/audio/chuck/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/cider/default.nix+30
This diff is too big to show here.
pkgs/applications/audio/clementine/default.nix+70−15
This diff is too big to show here.
pkgs/applications/audio/clerk/default.nix+36−11
This diff is too big to show here.
pkgs/applications/audio/cmt/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/cmus/default.nix+6−6
This diff is too big to show here.
pkgs/applications/audio/cmusfm/default.nix+17−11
This diff is too big to show here.
pkgs/applications/audio/cozy-audiobooks/default.nix−87
This diff is too big to show here.
pkgs/applications/audio/cozy/default.nix+92
This diff is too big to show here.
pkgs/applications/audio/crip/default.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/csound/default.nix+6−9
This diff is too big to show here.
pkgs/applications/audio/cyanrip/default.nix+34
This diff is too big to show here.
pkgs/applications/audio/deadbeef/default.nix+6−7
This diff is too big to show here.
pkgs/applications/audio/deadbeef/plugins/statusnotifier.nix+39
This diff is too big to show here.
pkgs/applications/audio/denemo/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/dfasma/default.nix+1−3
This diff is too big to show here.
pkgs/applications/audio/diopser/default.nix+76
This diff is too big to show here.
pkgs/applications/audio/dirt/default.nix+2−1
This diff is too big to show here.
pkgs/applications/audio/distrho/default.nix+25−7
This diff is too big to show here.
pkgs/applications/audio/dr14_tmeter/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/dragonfly-reverb/default.nix+6−4
This diff is too big to show here.
pkgs/applications/audio/drumgizmo/default.nix+8−16
This diff is too big to show here.
pkgs/applications/audio/drumkv1/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/easyeffects/default.nix+113
This diff is too big to show here.
pkgs/applications/audio/easytag/default.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/ecasound/default.nix+14−2
This diff is too big to show here.
pkgs/applications/audio/eflite/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/ensemble-chorus/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/espeak-ng/default.nix+10
This diff is too big to show here.
pkgs/applications/audio/espeak/default.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/espeak/edit.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/eteroj.lv2/default.nix−23
This diff is too big to show here.
pkgs/applications/audio/exaile/default.nix+107
This diff is too big to show here.
pkgs/applications/audio/faust/faust2.nix+12−4
This diff is too big to show here.
pkgs/applications/audio/faust/faust2alqt.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/faust/faust2alsa.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/faust/faust2jack.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/faust/faust2jaqt.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/faust/faustlive.nix+14−14
This diff is too big to show here.
pkgs/applications/audio/faustPhysicalModeling/default.nix+39
This diff is too big to show here.
pkgs/applications/audio/faustStk/default.nix+39
This diff is too big to show here.
pkgs/applications/audio/fdkaac/default.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/flac/default.nix+5−4
This diff is too big to show here.
pkgs/applications/audio/flacon/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/fluidsynth/default.nix+9−25
This diff is too big to show here.
pkgs/applications/audio/fmit/default.nix+3−5
This diff is too big to show here.
pkgs/applications/audio/fomp/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/foo-yc20/default.nix−29
This diff is too big to show here.
pkgs/applications/audio/freac/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/freewheeling/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/freqtweak/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/friture/default.nix+21−8
This diff is too big to show here.
pkgs/applications/audio/friture/factorial.patch−13
This diff is too big to show here.
pkgs/applications/audio/friture/unlock_constraints.patch−34
This diff is too big to show here.
pkgs/applications/audio/ft2-clone/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/furnace/default.nix+100
This diff is too big to show here.
pkgs/applications/audio/game-music-emu/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/gbsplay/default.nix+17−13
This diff is too big to show here.
pkgs/applications/audio/geonkick/default.nix+4−5
This diff is too big to show here.
pkgs/applications/audio/giada/default.nix+40−26
This diff is too big to show here.
pkgs/applications/audio/gigedit/default.nix+20−3
This diff is too big to show here.
pkgs/applications/audio/gmu/default.nix+22−3
This diff is too big to show here.
pkgs/applications/audio/gnaural/default.nix+33
This diff is too big to show here.
pkgs/applications/audio/gnome-podcasts/default.nix+21−5
This diff is too big to show here.
pkgs/applications/audio/goattracker/default.nix+7−8
This diff is too big to show here.
pkgs/applications/audio/google-play-music-desktop-player/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/gpodder/default.nix+17−7
This diff is too big to show here.
pkgs/applications/audio/gpodder/disable-autoupdate.patch+8−29
This diff is too big to show here.
pkgs/applications/audio/gradio/default.nix−1
This diff is too big to show here.
pkgs/applications/audio/grandorgue/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/greg/default.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/gspeech/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/gtklick/default.nix−34
This diff is too big to show here.
pkgs/applications/audio/gtkpod/default.nix+6−5
This diff is too big to show here.
pkgs/applications/audio/guitarix/default.nix+18−6
This diff is too big to show here.
pkgs/applications/audio/gwc/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/gxplugins-lv2/default.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/helio-workstation/default.nix+8−8
This diff is too big to show here.
pkgs/applications/audio/helm/default.nix+7−12
This diff is too big to show here.
pkgs/applications/audio/helvum/default.nix+60
This diff is too big to show here.
pkgs/applications/audio/hivelytracker/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/hqplayer-desktop/default.nix+92
This diff is too big to show here.
pkgs/applications/audio/hushboard/default.nix+73
This diff is too big to show here.
pkgs/applications/audio/hybridreverb2/default.nix+45−10
This diff is too big to show here.
pkgs/applications/audio/hydrogen/0.nix+28−6
This diff is too big to show here.
pkgs/applications/audio/hydrogen/default.nix+5−5
This diff is too big to show here.
pkgs/applications/audio/iannix/default.nix+2−4
This diff is too big to show here.
pkgs/applications/audio/in-formant/default.nix+45
This diff is too big to show here.
pkgs/applications/audio/indicator-sound-switcher/default.nix+62
This diff is too big to show here.
pkgs/applications/audio/industrializer/default.nix+3−5
This diff is too big to show here.
pkgs/applications/audio/ingen/default.nix+10−13
This diff is too big to show here.
pkgs/applications/audio/jaaa/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/jack-rack/default.nix+5−4
This diff is too big to show here.
pkgs/applications/audio/jackmeter/default.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/jackmix/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/jacktrip/default.nix+61
This diff is too big to show here.
pkgs/applications/audio/jalv/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/jamesdsp/default.nix+95
This diff is too big to show here.
pkgs/applications/audio/jamin/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/jamulus/default.nix+5−5
This diff is too big to show here.
pkgs/applications/audio/japa/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/jconvolver/default.nix+114
This diff is too big to show here.
pkgs/applications/audio/jellycli/default.nix+33
This diff is too big to show here.
pkgs/applications/audio/jellycli/fix-test-dir.patch+13
This diff is too big to show here.
pkgs/applications/audio/jmusicbot/default.nix+31
This diff is too big to show here.
pkgs/applications/audio/kapitonov-plugins-pack/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/kid3/default.nix+56−14
This diff is too big to show here.
pkgs/applications/audio/kmetronome/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/ladspa-plugins/default.nix+17−7
This diff is too big to show here.
pkgs/applications/audio/lash/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/lastfmsubmitd/default.nix−21
This diff is too big to show here.
pkgs/applications/audio/librespot/cargo-lock.patch−137
This diff is too big to show here.
pkgs/applications/audio/librespot/default.nix+13−20
This diff is too big to show here.
pkgs/applications/audio/lingot/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/linuxband/default.nix−37
This diff is too big to show here.
pkgs/applications/audio/linuxsampler/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/lmms/default.nix+5−5
This diff is too big to show here.
pkgs/applications/audio/lollypop/default.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/losslessaudiochecker/default.nix+29
This diff is too big to show here.
pkgs/applications/audio/lsp-plugins/default.nix+12−5
This diff is too big to show here.
pkgs/applications/audio/lv2lint/default.nix+22
This diff is too big to show here.
pkgs/applications/audio/lyrebird/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/magnetophonDSP/faustCompressors/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/mamba/default.nix+6−5
This diff is too big to show here.
pkgs/applications/audio/mbrola/default.nix+3
This diff is too big to show here.
pkgs/applications/audio/meters_lv2/default.nix+43−36
This diff is too big to show here.
pkgs/applications/audio/mhwaveedit/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/mi2ly/default.nix+16−25
This diff is too big to show here.
pkgs/applications/audio/mi2ly/default.upstream−3
This diff is too big to show here.
pkgs/applications/audio/mid2key/default.nix+8−5
This diff is too big to show here.
pkgs/applications/audio/midas/generic.nix+6−7
This diff is too big to show here.
pkgs/applications/audio/midi-visualizer/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/midisheetmusic/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/mikmod/default.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/milkytracker/default.nix+10−4
This diff is too big to show here.
pkgs/applications/audio/mimic/default.nix+15−7
This diff is too big to show here.
pkgs/applications/audio/mimms/default.nix−31
This diff is too big to show here.
pkgs/applications/audio/miniaudicle/default.nix+59
This diff is too big to show here.
pkgs/applications/audio/mixxx/default.nix+118−34
This diff is too big to show here.
pkgs/applications/audio/mmtc/default.nix+6−7
This diff is too big to show here.
pkgs/applications/audio/moc/default.nix+9−9
This diff is too big to show here.
pkgs/applications/audio/mod-arpeggiator-lv2/default.nix+26
This diff is too big to show here.
pkgs/applications/audio/mod-distortion/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/molot-lite/default.nix+15−18
This diff is too big to show here.
pkgs/applications/audio/mopidy/default.nix+25−24
This diff is too big to show here.
pkgs/applications/audio/mopidy/iris.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/mopidy/jellyfin.nix+25
This diff is too big to show here.
pkgs/applications/audio/mopidy/mopidy.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/mopidy/mpd.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/mopidy/mpris.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/mopidy/muse.nix+29
This diff is too big to show here.
pkgs/applications/audio/mopidy/podcast.nix+31
This diff is too big to show here.
pkgs/applications/audio/mopidy/spotify.nix+9−7
This diff is too big to show here.
pkgs/applications/audio/mopidy/youtube.nix+43−15
This diff is too big to show here.
pkgs/applications/audio/mopidy/ytmusic.nix+35
This diff is too big to show here.
pkgs/applications/audio/mousai/default.nix+79
This diff is too big to show here.
pkgs/applications/audio/mousai/paths.patch+13
This diff is too big to show here.
pkgs/applications/audio/mp3blaster/default.nix+11−1
This diff is too big to show here.
pkgs/applications/audio/mp3gain/default.nix+4−3
This diff is too big to show here.
pkgs/applications/audio/mp3info/default.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/mpc/default.nix+41−13
This diff is too big to show here.
pkgs/applications/audio/mpdevil/default.nix+4−3
This diff is too big to show here.
pkgs/applications/audio/mpg123/default.nix+44−20
This diff is too big to show here.
pkgs/applications/audio/mpg321/default.nix+2−3
This diff is too big to show here.
pkgs/applications/audio/munt/default.nix−38
This diff is too big to show here.
pkgs/applications/audio/munt/libmt32emu.nix+38
This diff is too big to show here.
pkgs/applications/audio/munt/mt32emu-qt.nix+75
This diff is too big to show here.
pkgs/applications/audio/munt/mt32emu-smf2wav.nix+50
This diff is too big to show here.
pkgs/applications/audio/muse/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/musescore/darwin.nix−1
This diff is too big to show here.
pkgs/applications/audio/musescore/default.nix+8−7
This diff is too big to show here.
pkgs/applications/audio/musikcube/default.nix+23−8
This diff is too big to show here.
pkgs/applications/audio/muso/default.nix+4−3
This diff is too big to show here.
pkgs/applications/audio/mympd/default.nix+4−3
This diff is too big to show here.
pkgs/applications/audio/myxer/default.nix+38
This diff is too big to show here.
pkgs/applications/audio/ncmpc/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/ncmpcpp/default.nix+1
This diff is too big to show here.
pkgs/applications/audio/ncspot/bump-security-framework-crate.patch−19
This diff is too big to show here.
pkgs/applications/audio/ncspot/default.nix+15−19
This diff is too big to show here.
pkgs/applications/audio/netease-cloud-music-gtk/cargo-lock.patch+2007
This diff is too big to show here.
pkgs/applications/audio/netease-cloud-music-gtk/default.nix+60
This diff is too big to show here.
pkgs/applications/audio/netease-cloud-music-gtk/update-cargo-lock.sh+20
This diff is too big to show here.
pkgs/applications/audio/netease-music-tui/cargo-lock.patch+644−298
This diff is too big to show here.
pkgs/applications/audio/netease-music-tui/default.nix+6−6
This diff is too big to show here.
pkgs/applications/audio/netease-music-tui/update-cargo-lock.sh+20
This diff is too big to show here.
pkgs/applications/audio/new-session-manager/default.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/noise-repellent/default.nix+11−9
This diff is too big to show here.
pkgs/applications/audio/noisetorch/default.nix+11−15
This diff is too big to show here.
pkgs/applications/audio/noisetorch/version.patch−37
This diff is too big to show here.
pkgs/applications/audio/non/default.nix+7−7
This diff is too big to show here.
pkgs/applications/audio/nootka/default.nix+5−4
This diff is too big to show here.
pkgs/applications/audio/nootka/unstable.nix+25−7
This diff is too big to show here.
pkgs/applications/audio/nuclear/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/ocenaudio/default.nix+6−7
This diff is too big to show here.
pkgs/applications/audio/odin2/default.nix+79
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/eteroj.nix+10
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/generic.nix+37
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/jit.nix+12
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/mephisto.nix+17
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/midi_matrix.nix+10
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/moony.nix+13
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/orbit.nix+12
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/patchmatrix.nix+13
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/router.nix+11
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/sherlock.nix+12
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/synthpod.nix+13
This diff is too big to show here.
pkgs/applications/audio/open-music-kontrollers/vm.nix+10
This diff is too big to show here.
pkgs/applications/audio/openmpt123/default.nix−31
This diff is too big to show here.
pkgs/applications/audio/opus-tools/default.nix+4−2
This diff is too big to show here.
pkgs/applications/audio/opusfile/default.nix+9−5
This diff is too big to show here.
pkgs/applications/audio/opusfile/disable-cert-store.patch+35
This diff is too big to show here.
pkgs/applications/audio/orca-c/default.nix+17−10
This diff is too big to show here.
pkgs/applications/audio/osdlyrics/default.nix+87
This diff is too big to show here.
pkgs/applications/audio/osmid/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/oxefmsynth/default.nix+43
This diff is too big to show here.
pkgs/applications/audio/padthv1/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/pamix/default.nix+15−1
This diff is too big to show here.
pkgs/applications/audio/pamixer/default.nix+6−6
This diff is too big to show here.
pkgs/applications/audio/paprefs/default.nix+6−4
This diff is too big to show here.
pkgs/applications/audio/parlatype/default.nix−69
This diff is too big to show here.
pkgs/applications/audio/patchage/default.nix+33−11
This diff is too big to show here.
pkgs/applications/audio/pavucontrol/default.nix+24−15
This diff is too big to show here.
pkgs/applications/audio/pd-plugins/zexy/default.nix+2−1
This diff is too big to show here.
pkgs/applications/audio/petrifoo/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/pianobar/default.nix+6−5
This diff is too big to show here.
pkgs/applications/audio/pianobooster/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/pianoteq/default.nix+200
This diff is too big to show here.
pkgs/applications/audio/picard/default.nix+28−18
This diff is too big to show here.
pkgs/applications/audio/picoloop/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/pifi/Gemfile−2
This diff is too big to show here.
pkgs/applications/audio/pifi/Gemfile.lock−39
This diff is too big to show here.
pkgs/applications/audio/pifi/default.nix−18
This diff is too big to show here.
pkgs/applications/audio/pifi/gemset.nix−137
This diff is too big to show here.
pkgs/applications/audio/pipecontrol/default.nix+50
This diff is too big to show here.
pkgs/applications/audio/pithos/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/plexamp/default.nix+9−8
This diff is too big to show here.
pkgs/applications/audio/plexamp/update-plexamp.sh+54
This diff is too big to show here.
pkgs/applications/audio/plujain-ramp/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/pmidi/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/pocket-casts/default.nix+55
This diff is too big to show here.
pkgs/applications/audio/polyphone/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/praat/default.nix+17−13
This diff is too big to show here.
pkgs/applications/audio/psst/default.nix+39
This diff is too big to show here.
pkgs/applications/audio/pt2-clone/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/ptcollab/default.nix+26−7
This diff is too big to show here.
pkgs/applications/audio/puddletag/default.nix+46−9
This diff is too big to show here.
pkgs/applications/audio/pulseaudio-ctl/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/pulseaudio-dlna/0001-setup.py-remove-dbus-python-from-list.patch+25
This diff is too big to show here.
pkgs/applications/audio/pulseaudio-dlna/default.nix+54−33
This diff is too big to show here.
pkgs/applications/audio/pulseaudio-modules-bt/default.nix−91
This diff is too big to show here.
pkgs/applications/audio/pulseaudio-modules-bt/fix-install-path.patch−11
This diff is too big to show here.
pkgs/applications/audio/pulseeffects/default.nix−115
This diff is too big to show here.
pkgs/applications/audio/puredata/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/pyradio/default.nix+30
This diff is too big to show here.
pkgs/applications/audio/qjackctl/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/qmidiarp/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/qmidinet/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/qmidiroute/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/qmmp/default.nix+9−9
This diff is too big to show here.
pkgs/applications/audio/qpwgraph/default.nix+34
This diff is too big to show here.
pkgs/applications/audio/qsynth/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/qtractor/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/quadrafuzz/default.nix+43
This diff is too big to show here.
pkgs/applications/audio/quodlibet/default.nix+8−13
This diff is too big to show here.
pkgs/applications/audio/quodlibet/quodlibet-feedparser6.patch−12
This diff is too big to show here.
pkgs/applications/audio/r128gain/default.nix+7−15
This diff is too big to show here.
pkgs/applications/audio/radiotray-ng/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/rakarrack/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/reaper/default.nix+19−9
This diff is too big to show here.
pkgs/applications/audio/redux/default.nix+49
This diff is too big to show here.
pkgs/applications/audio/renoise/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/rhvoice/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/rhythmbox/default.nix+53−8
This diff is too big to show here.
pkgs/applications/audio/rofi-pulse-select/default.nix+40
This diff is too big to show here.
pkgs/applications/audio/roomeqwizard/default.nix+118
This diff is too big to show here.
pkgs/applications/audio/rosegarden/default.nix+28−10
This diff is too big to show here.
pkgs/applications/audio/rubyripper/default.nix+23−11
This diff is too big to show here.
pkgs/applications/audio/rymcast/default.nix+32
This diff is too big to show here.
pkgs/applications/audio/samplv1/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/sayonara/default.nix+17−3
This diff is too big to show here.
pkgs/applications/audio/sc68/default.nix+3−3
This diff is too big to show here.
pkgs/applications/audio/schismtracker/default.nix+17−9
This diff is too big to show here.
pkgs/applications/audio/scream/default.nix+46
This diff is too big to show here.
pkgs/applications/audio/seq24/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/seq66/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/setbfree/default.nix+8−6
This diff is too big to show here.
pkgs/applications/audio/sfizz/default.nix+40−8
This diff is too big to show here.
pkgs/applications/audio/sfxr-qt/default.nix+29−3
This diff is too big to show here.
pkgs/applications/audio/sfxr-qt/test-export-square-wave/default.nix+6
This diff is too big to show here.
pkgs/applications/audio/sfxr-qt/test-export-square-wave/input.sfxj+29
This diff is too big to show here.
pkgs/applications/audio/shortwave/default.nix+13−15
This diff is too big to show here.
pkgs/applications/audio/sidplayfp/default.nix+33−19
This diff is too big to show here.
pkgs/applications/audio/sisco.lv2/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/snapcast/default.nix+13−9
This diff is too big to show here.
pkgs/applications/audio/snd/default.nix+19−16
This diff is too big to show here.
pkgs/applications/audio/sndpeek/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/sonata/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/songrec/default.nix+40
This diff is too big to show here.
pkgs/applications/audio/sonic-lineup/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/sonic-pi/default.nix+63−40
This diff is too big to show here.
pkgs/applications/audio/sonic-visualiser/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/sonixd/default.nix+27
This diff is too big to show here.
pkgs/applications/audio/sony-headphones-client/default.nix+44
This diff is too big to show here.
pkgs/applications/audio/sooperlooper/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/sorcer/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/sound-juicer/default.nix+58−18
This diff is too big to show here.
pkgs/applications/audio/soundconverter/default.nix+85
This diff is too big to show here.
pkgs/applications/audio/soundkonverter/default.nix+1−1
This diff is too big to show here.
pkgs/applications/audio/soundscape-renderer/default.nix+13−11
This diff is too big to show here.
pkgs/applications/audio/soundtracker/default.nix+29−11
This diff is too big to show here.
pkgs/applications/audio/soundwireserver/default.nix+40
This diff is too big to show here.
pkgs/applications/audio/spectmorph/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/split2flac/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/spot/default.nix+84
This diff is too big to show here.
pkgs/applications/audio/spotify-qt/default.nix+36
This diff is too big to show here.
pkgs/applications/audio/spotify-tui/default.nix+4−3
This diff is too big to show here.
pkgs/applications/audio/spotify/default.nix+26−21
This diff is too big to show here.
pkgs/applications/audio/spotifyd/default.nix+12−11
This diff is too big to show here.
pkgs/applications/audio/sptlrx/default.nix+24
This diff is too big to show here.
pkgs/applications/audio/squeezelite/default.nix+49−31
This diff is too big to show here.
pkgs/applications/audio/squishyball/default.nix+21−11
This diff is too big to show here.
pkgs/applications/audio/stochas/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/strawberry/default.nix+33−25
This diff is too big to show here.
pkgs/applications/audio/sublime-music/default.nix+44−10
This diff is too big to show here.
pkgs/applications/audio/sunvox/default.nix+5−7
This diff is too big to show here.
pkgs/applications/audio/surge-XT/default.nix+93
This diff is too big to show here.
pkgs/applications/audio/surge/default.nix+23−18
This diff is too big to show here.
pkgs/applications/audio/swh-lv2/default.nix+6−4
This diff is too big to show here.
pkgs/applications/audio/synaesthesia/default.nix+33
This diff is too big to show here.
pkgs/applications/audio/synthv1/default.nix+4−4
This diff is too big to show here.
pkgs/applications/audio/tageditor/default.nix−2
This diff is too big to show here.
pkgs/applications/audio/tagutil/default.nix+45
This diff is too big to show here.
pkgs/applications/audio/tauon/default.nix+122
This diff is too big to show here.
pkgs/applications/audio/tenacity/default.nix+148
This diff is too big to show here.
pkgs/applications/audio/termusic/default.nix+28
This diff is too big to show here.
pkgs/applications/audio/tetraproc/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/timemachine/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/tonelib-gfx/default.nix+58
This diff is too big to show here.
pkgs/applications/audio/tonelib-jam/default.nix+61
This diff is too big to show here.
pkgs/applications/audio/tonelib-metal/default.nix+60
This diff is too big to show here.
pkgs/applications/audio/tonelib-zoom/default.nix+63
This diff is too big to show here.
pkgs/applications/audio/tony/default.nix+5−4
This diff is too big to show here.
pkgs/applications/audio/transcode/default.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/transcribe/default.nix+101
This diff is too big to show here.
pkgs/applications/audio/traverso/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/tunefish/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/uade123/default.nix+63−14
This diff is too big to show here.
pkgs/applications/audio/uhhyou.lv2/default.nix+5−5
This diff is too big to show here.
pkgs/applications/audio/vcv-rack/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/vgmstream/default.nix+42
This diff is too big to show here.
pkgs/applications/audio/vgmstream/update.sh+77
This diff is too big to show here.
pkgs/applications/audio/vimpc/default.nix+11
This diff is too big to show here.
pkgs/applications/audio/viper4linux-gui/default.nix+82
This diff is too big to show here.
pkgs/applications/audio/viper4linux/default.nix+61
This diff is too big to show here.
pkgs/applications/audio/virtual-ans/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/vkeybd/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/vmpk/default.nix+8−3
This diff is too big to show here.
pkgs/applications/audio/vocal/default.nix+22−4
This diff is too big to show here.
pkgs/applications/audio/wavegain/default.nix+15−2
This diff is too big to show here.
pkgs/applications/audio/whipper/default.nix+53−26
This diff is too big to show here.
pkgs/applications/audio/whipper/paths.patch−32
This diff is too big to show here.
pkgs/applications/audio/x42-avldrums/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/x42-plugins/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/xmp/default.nix+5−4
This diff is too big to show here.
pkgs/applications/audio/xsynth-dssi/default.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/yoshimi/default.nix+49−18
This diff is too big to show here.
pkgs/applications/audio/ytmdesktop/default.nix+36
This diff is too big to show here.
pkgs/applications/audio/zam-plugins/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/zita-ajbridge/default.nix+5−4
This diff is too big to show here.
pkgs/applications/audio/zita-at1/default.nix+3−2
This diff is too big to show here.
pkgs/applications/audio/zita-njbridge/default.nix+2−2
This diff is too big to show here.
pkgs/applications/audio/zrythm/default.nix+174
This diff is too big to show here.
pkgs/applications/audio/zynaddsubfx/default.nix+17−4
This diff is too big to show here.
pkgs/applications/audio/zynaddsubfx/mruby-zest/default.nix+1−1
This diff is too big to show here.
pkgs/applications/backup/areca/default.nix+6−3
This diff is too big to show here.
pkgs/applications/backup/deja-dup/default.nix+12−12
This diff is too big to show here.
pkgs/applications/backup/deja-dup/fix-paths.patch+3−3
This diff is too big to show here.
pkgs/applications/backup/pika-backup/default.nix+12−3
This diff is too big to show here.
pkgs/applications/backup/restique/default.nix+41
This diff is too big to show here.
pkgs/applications/backup/urbackup-client/default.nix+23
This diff is too big to show here.
pkgs/applications/backup/vorta/default.nix+64−14
This diff is too big to show here.
pkgs/applications/blockchains/aeon/default.nix+2−2
This diff is too big to show here.
pkgs/applications/blockchains/alfis/default.nix+56
This diff is too big to show here.
pkgs/applications/blockchains/besu/default.nix+29
This diff is too big to show here.
pkgs/applications/blockchains/bisq-desktop/default.nix+101
This diff is too big to show here.
pkgs/applications/blockchains/bisq-desktop/update.sh+22
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-abc.nix−50
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-abc/default.nix+76
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-abc/fix-bitcoin-qt-build.patch
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-classic.nix−56
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-classic/default.nix+76
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-gold.nix−70
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-gold/default.nix+72
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-knots.nix−41
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-knots/default.nix+83
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-unlimited.nix−66
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin-unlimited/default.nix+66
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin.nix−99
This diff is too big to show here.
pkgs/applications/blockchains/bitcoin/default.nix+108
This diff is too big to show here.
pkgs/applications/blockchains/btcpayserver/default.nix+14−38
This diff is too big to show here.
pkgs/applications/blockchains/btcpayserver/deps.nix+789−584
This diff is too big to show here.
pkgs/applications/blockchains/btcpayserver/update.sh+7−1
This diff is too big to show here.
pkgs/applications/blockchains/cgminer/default.nix+2−2
This diff is too big to show here.
pkgs/applications/blockchains/charge-lnd/default.nix+39
This diff is too big to show here.
pkgs/applications/blockchains/chia-plotter/default.nix+72
This diff is too big to show here.
pkgs/applications/blockchains/chia-plotter/dont_fetch_dependencies.patch+63
This diff is too big to show here.
pkgs/applications/blockchains/chia/default.nix+95
This diff is too big to show here.
pkgs/applications/blockchains/clightning.nix−63
This diff is too big to show here.
pkgs/applications/blockchains/clightning/default.nix+71
This diff is too big to show here.
pkgs/applications/blockchains/crypto-org-wallet/default.nix+33
This diff is too big to show here.
pkgs/applications/blockchains/cryptop/default.nix+2−2
This diff is too big to show here.
pkgs/applications/blockchains/dashpay.nix−44
This diff is too big to show here.
pkgs/applications/blockchains/dashpay/default.nix+44
This diff is too big to show here.
pkgs/applications/blockchains/dcrd/default.nix
This diff is too big to show here.
pkgs/applications/blockchains/dcrwallet/default.nix
This diff is too big to show here.
pkgs/applications/blockchains/dero.nix−25
This diff is too big to show here.
pkgs/applications/blockchains/digibyte/default.nix
This diff is too big to show here.
pkgs/applications/blockchains/dogecoin.nix−41
This diff is too big to show here.
pkgs/applications/blockchains/dogecoin/default.nix+41
This diff is too big to show here.
pkgs/applications/blockchains/eclair/default.nix+38
This diff is too big to show here.
pkgs/applications/blockchains/electrs.nix−30
This diff is too big to show here.
pkgs/applications/blockchains/electrs/default.nix+42
This diff is too big to show here.
pkgs/applications/blockchains/electrs/update.sh+40
This diff is too big to show here.
pkgs/applications/blockchains/elements/default.nix+84
This diff is too big to show here.
pkgs/applications/blockchains/ergo/default.nix+2−2
This diff is too big to show here.
pkgs/applications/blockchains/erigon.nix+34
This diff is too big to show here.
pkgs/applications/blockchains/ethabi.nix−23
This diff is too big to show here.
pkgs/applications/blockchains/ethabi/add-Cargo-lock.patch+683
This diff is too big to show here.
pkgs/applications/blockchains/ethabi/default.nix+26
This diff is too big to show here.
pkgs/applications/blockchains/exodus/default.nix+6−5
This diff is too big to show here.
pkgs/applications/blockchains/faraday/default.nix+27
This diff is too big to show here.
pkgs/applications/blockchains/fulcrum/default.nix+36
This diff is too big to show here.
pkgs/applications/blockchains/go-ethereum.nix−59
This diff is too big to show here.
pkgs/applications/blockchains/go-ethereum/default.nix+61
This diff is too big to show here.
pkgs/applications/blockchains/groestlcoin/default.nix+93
This diff is too big to show here.
pkgs/applications/blockchains/ledger-live-desktop/default.nix+18−5
This diff is too big to show here.
pkgs/applications/blockchains/ledger-live-desktop/systemd.patch+14
This diff is too big to show here.
pkgs/applications/blockchains/lightning-loop/default.nix+27
This diff is too big to show here.
pkgs/applications/blockchains/lightning-pool/default.nix+27
This diff is too big to show here.
pkgs/applications/blockchains/lightwalletd/default.nix+37
This diff is too big to show here.
pkgs/applications/blockchains/litecoin.nix−55
This diff is too big to show here.
pkgs/applications/blockchains/litecoin/default.nix+54
This diff is too big to show here.
pkgs/applications/blockchains/lnd.nix−40
This diff is too big to show here.
pkgs/applications/blockchains/lnd/default.nix+40
This diff is too big to show here.
pkgs/applications/blockchains/lndconnect/default.nix+1−1
This diff is too big to show here.
pkgs/applications/blockchains/lndmanage/default.nix+44
This diff is too big to show here.
pkgs/applications/blockchains/masari/default.nix
This diff is too big to show here.
pkgs/applications/blockchains/miniscript/default.nix+29
This diff is too big to show here.
pkgs/applications/blockchains/monero-cli/default.nix+60
This diff is too big to show here.
pkgs/applications/blockchains/monero-cli/use-system-libraries.patch+52
This diff is too big to show here.
pkgs/applications/blockchains/monero-gui/default.nix+22−33
This diff is too big to show here.
pkgs/applications/blockchains/monero-gui/use-system-libquirc.patch+37
This diff is too big to show here.
pkgs/applications/blockchains/monero/default.nix−68
This diff is too big to show here.
pkgs/applications/blockchains/monero/use-system-libraries.patch−69
This diff is too big to show here.
pkgs/applications/blockchains/mycrypto/default.nix+3−3
This diff is too big to show here.
pkgs/applications/blockchains/namecoin.nix−48
This diff is too big to show here.
pkgs/applications/blockchains/namecoin/default.nix+47
This diff is too big to show here.
pkgs/applications/blockchains/nano-wallet/default.nix+4−3
This diff is too big to show here.
pkgs/applications/blockchains/nbxplorer/default.nix+12−36
This diff is too big to show here.
pkgs/applications/blockchains/nbxplorer/deps.nix+265−240
This diff is too big to show here.
pkgs/applications/blockchains/nbxplorer/update.sh+1−1
This diff is too big to show here.
pkgs/applications/blockchains/nbxplorer/util/create-deps.sh+5−4
This diff is too big to show here.
pkgs/applications/blockchains/nbxplorer/util/update-common.sh+46−22
This diff is too big to show here.
pkgs/applications/blockchains/nearcore/default.nix+42
This diff is too big to show here.
pkgs/applications/blockchains/openethereum/default.nix+6−12
This diff is too big to show here.
pkgs/applications/blockchains/oxen/default.nix+68
This diff is too big to show here.
pkgs/applications/blockchains/parity-ui/default.nix−48
This diff is too big to show here.
pkgs/applications/blockchains/parity-ui/env.nix−19
This diff is too big to show here.
pkgs/applications/blockchains/particl-core/default.nix+56
This diff is too big to show here.
pkgs/applications/blockchains/particl/particl-core.nix−53
This diff is too big to show here.
pkgs/applications/blockchains/pivx.nix−59
This diff is too big to show here.
pkgs/applications/blockchains/pivx/default.nix+78
This diff is too big to show here.
pkgs/applications/blockchains/polkadot/default.nix+29−6
This diff is too big to show here.
pkgs/applications/blockchains/quorum/default.nix
This diff is too big to show here.
pkgs/applications/blockchains/snarkos/default.nix+61
This diff is too big to show here.
pkgs/applications/blockchains/solana/default.nix+61
This diff is too big to show here.
pkgs/applications/blockchains/solana/pin.json+5
This diff is too big to show here.
pkgs/applications/blockchains/solana/update.sh+33
This diff is too big to show here.
pkgs/applications/blockchains/stellar-core-dirty-version.patch−15
This diff is too big to show here.
pkgs/applications/blockchains/stellar-core.nix−47
This diff is too big to show here.
pkgs/applications/blockchains/stellar-core/default.nix+50
This diff is too big to show here.
pkgs/applications/blockchains/sumokoin/default.nix
This diff is too big to show here.
pkgs/applications/blockchains/tessera/default.nix
This diff is too big to show here.
pkgs/applications/blockchains/trezor-suite/default.nix+16−5
This diff is too big to show here.
pkgs/applications/blockchains/turbo-geth.nix−29
This diff is too big to show here.
pkgs/applications/blockchains/vertcoin/default.nix
This diff is too big to show here.
pkgs/applications/blockchains/wasabibackend/create_deps.sh−98
This diff is too big to show here.
pkgs/applications/blockchains/wasabibackend/default.nix+22−72
This diff is too big to show here.
pkgs/applications/blockchains/wasabibackend/deps.nix+202−955
This diff is too big to show here.
pkgs/applications/blockchains/wasabiwallet/default.nix+6−5
This diff is too big to show here.
pkgs/applications/blockchains/whirlpool-gui/default.nix−104
This diff is too big to show here.
pkgs/applications/blockchains/wownero.nix−60
This diff is too big to show here.