mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
Merge remote-tracking branch 'upstream/master' into allow-configuration-of-roles
This commit is contained in:
commit
7bfbf037d7
19957 changed files with 968084 additions and 497220 deletions
|
@ -55,6 +55,18 @@ trim_trailing_whitespace = unset
|
|||
[*.lock]
|
||||
indent_size = unset
|
||||
|
||||
# trailing whitespace is an actual syntax element of classic Markdown/
|
||||
# CommonMark to enforce a line break
|
||||
[*.md]
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
# binaries
|
||||
[*.nib]
|
||||
end_of_line = unset
|
||||
insert_final_newline = unset
|
||||
trim_trailing_whitespace = unset
|
||||
charset = unset
|
||||
|
||||
[eggs.nix]
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
|
|
|
@ -28,5 +28,14 @@
|
|||
# nixos/modules/rename: Sort alphabetically
|
||||
1f71224fe86605ef4cd23ed327b3da7882dad382
|
||||
|
||||
# manual: fix typos
|
||||
feddd5e7f8c6f8167b48a077fa2a5394dc008999
|
||||
|
||||
# nixos: fix module paths in rename.nix
|
||||
d08ede042b74b8199dc748323768227b88efcf7c
|
||||
|
||||
# fix indentation in mk-python-derivation.nix
|
||||
d1c1a0c656ccd8bd3b25d3c4287f2d075faf3cf3
|
||||
|
||||
# fix indentation in meteor default.nix
|
||||
a37a6de881ec4c6708e6b88fd16256bbc7f26bbd
|
||||
|
|
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1,4 +1,5 @@
|
|||
**/deps.nix linguist-generated
|
||||
**/deps.json linguist-generated
|
||||
**/node-packages.nix linguist-generated
|
||||
|
||||
pkgs/applications/editors/emacs-modes/*-generated.nix linguist-generated
|
||||
|
|
121
.github/CODEOWNERS
vendored
121
.github/CODEOWNERS
vendored
|
@ -10,9 +10,6 @@
|
|||
# IMPORTANT NOTE: in order to actually get pinged, commit access is required.
|
||||
# This also holds true for GitHub teams. Since almost none of our teams have write
|
||||
# permissions, you need to list all members of the team with commit access individually.
|
||||
# We still add the team to the list next to its members, this helps keeping things
|
||||
# in sync. (Put non team members before the team to distinguish them.)
|
||||
# See https://github.com/NixOS/nixpkgs/issues/124085 for more details
|
||||
|
||||
# This file
|
||||
/.github/CODEOWNERS @edolstra
|
||||
|
@ -39,12 +36,14 @@
|
|||
/pkgs/top-level/stage.nix @nbp @Ericson2314 @matthewbauer
|
||||
/pkgs/top-level/splice.nix @Ericson2314 @matthewbauer
|
||||
/pkgs/top-level/release-cross.nix @Ericson2314 @matthewbauer
|
||||
/pkgs/stdenv/generic @Ericson2314 @matthewbauer @cab404
|
||||
/pkgs/stdenv/generic @Ericson2314 @matthewbauer
|
||||
/pkgs/stdenv/generic/check-meta.nix @Ericson2314 @matthewbauer @piegamesde
|
||||
/pkgs/stdenv/cross @Ericson2314 @matthewbauer
|
||||
/pkgs/build-support/cc-wrapper @Ericson2314 @orivej
|
||||
/pkgs/build-support/bintools-wrapper @Ericson2314 @orivej
|
||||
/pkgs/build-support/cc-wrapper @Ericson2314
|
||||
/pkgs/build-support/bintools-wrapper @Ericson2314
|
||||
/pkgs/build-support/setup-hooks @Ericson2314
|
||||
/pkgs/build-support/setup-hooks/auto-patchelf.sh @aszlig
|
||||
/pkgs/build-support/setup-hooks/auto-patchelf.sh @layus
|
||||
/pkgs/build-support/setup-hooks/auto-patchelf.py @layus
|
||||
|
||||
# Nixpkgs build-support
|
||||
/pkgs/build-support/writers @lassulus @Profpatsch
|
||||
|
@ -52,8 +51,14 @@
|
|||
# Nixpkgs documentation
|
||||
/maintainers/scripts/db-to-md.sh @jtojnar @ryantm
|
||||
/maintainers/scripts/doc @jtojnar @ryantm
|
||||
|
||||
/doc/* @fricklerhandwerk
|
||||
/doc/build-aux/pandoc-filters @jtojnar
|
||||
/doc/contributing/contributing-to-documentation.chapter.md @jtojnar
|
||||
/doc/builders/trivial-builders.chapter.md @fricklerhandwerk
|
||||
/doc/contributing/ @fricklerhandwerk
|
||||
/doc/contributing/contributing-to-documentation.chapter.md @jtojnar @fricklerhandwerk
|
||||
/doc/stdenv @fricklerhandwerk
|
||||
/doc/using @fricklerhandwerk
|
||||
|
||||
# NixOS Internals
|
||||
/nixos/default.nix @nbp @infinisil
|
||||
|
@ -97,26 +102,25 @@
|
|||
/pkgs/development/python-modules @FRidh @jonringer
|
||||
/doc/languages-frameworks/python.section.md @FRidh
|
||||
/pkgs/development/tools/poetry2nix @adisbladis
|
||||
/pkgs/development/interpreters/python/hooks @FRidh @jonringer @DavHau
|
||||
/pkgs/development/interpreters/python/conda @DavHau
|
||||
/pkgs/development/interpreters/python/hooks @FRidh @jonringer
|
||||
|
||||
# Haskell
|
||||
/doc/languages-frameworks/haskell.section.md @cdepillabout @sternenseemann @maralorn @expipiplus1
|
||||
/maintainers/scripts/haskell @cdepillabout @sternenseemann @maralorn @expipiplus1
|
||||
/pkgs/development/compilers/ghc @cdepillabout @sternenseemann @maralorn @expipiplus1
|
||||
/pkgs/development/haskell-modules @cdepillabout @sternenseemann @maralorn @expipiplus1
|
||||
/pkgs/test/haskell @cdepillabout @sternenseemann @maralorn @expipiplus1
|
||||
/pkgs/top-level/release-haskell.nix @cdepillabout @sternenseemann @maralorn @expipiplus1
|
||||
/pkgs/top-level/haskell-packages.nix @cdepillabout @sternenseemann @maralorn @expipiplus1
|
||||
/doc/languages-frameworks/haskell.section.md @cdepillabout @sternenseemann @maralorn
|
||||
/maintainers/scripts/haskell @cdepillabout @sternenseemann @maralorn
|
||||
/pkgs/development/compilers/ghc @cdepillabout @sternenseemann @maralorn
|
||||
/pkgs/development/haskell-modules @cdepillabout @sternenseemann @maralorn
|
||||
/pkgs/test/haskell @cdepillabout @sternenseemann @maralorn
|
||||
/pkgs/top-level/release-haskell.nix @cdepillabout @sternenseemann @maralorn
|
||||
/pkgs/top-level/haskell-packages.nix @cdepillabout @sternenseemann @maralorn
|
||||
|
||||
# Perl
|
||||
/pkgs/development/interpreters/perl @stigtsp @zakame
|
||||
/pkgs/top-level/perl-packages.nix @stigtsp @zakame
|
||||
/pkgs/development/perl-modules @stigtsp @zakame
|
||||
/pkgs/development/interpreters/perl @stigtsp @zakame @dasJ
|
||||
/pkgs/top-level/perl-packages.nix @stigtsp @zakame @dasJ
|
||||
/pkgs/development/perl-modules @stigtsp @zakame @dasJ
|
||||
|
||||
# R
|
||||
/pkgs/applications/science/math/R @jbedo @bcdarwin
|
||||
/pkgs/development/r-modules @jbedo @bcdarwin
|
||||
/pkgs/applications/science/math/R @jbedo
|
||||
/pkgs/development/r-modules @jbedo
|
||||
|
||||
# Ruby
|
||||
/pkgs/development/interpreters/ruby @marsam
|
||||
|
@ -124,12 +128,6 @@
|
|||
|
||||
# Rust
|
||||
/pkgs/development/compilers/rust @Mic92 @LnL7 @zowoq
|
||||
/pkgs/build-support/rust @zowoq
|
||||
/doc/languages-frameworks/rust.section.md @zowoq
|
||||
|
||||
# Darwin-related
|
||||
/pkgs/stdenv/darwin @NixOS/darwin-maintainers
|
||||
/pkgs/os-specific/darwin @NixOS/darwin-maintainers
|
||||
|
||||
# C compilers
|
||||
/pkgs/development/compilers/gcc @matthewbauer
|
||||
|
@ -139,15 +137,6 @@
|
|||
/pkgs/top-level/unix-tools.nix @matthewbauer
|
||||
/pkgs/development/tools/xcbuild @matthewbauer
|
||||
|
||||
# Beam-related (Erlang, Elixir, LFE, etc)
|
||||
/pkgs/development/beam-modules @gleber
|
||||
/pkgs/development/interpreters/erlang @gleber
|
||||
/pkgs/development/interpreters/lfe @gleber
|
||||
/pkgs/development/interpreters/elixir @gleber
|
||||
/pkgs/development/tools/build-managers/rebar @gleber
|
||||
/pkgs/development/tools/build-managers/rebar3 @gleber
|
||||
/pkgs/development/tools/erlang @gleber
|
||||
|
||||
# Audio
|
||||
/nixos/modules/services/audio/botamusique.nix @mweinelt
|
||||
/nixos/modules/services/audio/snapserver.nix @mweinelt
|
||||
|
@ -203,19 +192,20 @@
|
|||
/nixos/modules/services/networking/babeld.nix @mweinelt
|
||||
/nixos/modules/services/networking/kea.nix @mweinelt
|
||||
/nixos/modules/services/networking/knot.nix @mweinelt
|
||||
/nixos/modules/services/monitoring/prometheus/exporters/kea.nix @mweinelt
|
||||
/nixos/tests/babeld.nix @mweinelt
|
||||
/nixos/tests/kea.nix @mweinelt
|
||||
/nixos/tests/knot.nix @mweinelt
|
||||
|
||||
# Dhall
|
||||
/pkgs/development/dhall-modules @Gabriel439 @Profpatsch @ehmry
|
||||
/pkgs/development/interpreters/dhall @Gabriel439 @Profpatsch @ehmry
|
||||
/pkgs/development/dhall-modules @Gabriella439 @Profpatsch @ehmry
|
||||
/pkgs/development/interpreters/dhall @Gabriella439 @Profpatsch @ehmry
|
||||
|
||||
# Idris
|
||||
/pkgs/development/idris-modules @Infinisil
|
||||
|
||||
# Bazel
|
||||
/pkgs/development/tools/build-managers/bazel @mboes @Profpatsch
|
||||
/pkgs/development/tools/build-managers/bazel @Profpatsch
|
||||
|
||||
# NixOS modules for e-mail and dns services
|
||||
/nixos/modules/services/mail/mailman.nix @peti
|
||||
|
@ -243,38 +233,36 @@
|
|||
/nixos/tests/prometheus-exporters.nix @WilliButz
|
||||
|
||||
# PHP interpreter, packages, extensions, tests and documentation
|
||||
/doc/languages-frameworks/php.section.md @NixOS/php @aanderse @etu @globin @ma27 @talyz
|
||||
/nixos/tests/php @NixOS/php @aanderse @etu @globin @ma27 @talyz
|
||||
/pkgs/build-support/build-pecl.nix @NixOS/php @aanderse @etu @globin @ma27 @talyz
|
||||
/pkgs/development/interpreters/php @jtojnar @NixOS/php @aanderse @etu @globin @ma27 @talyz
|
||||
/pkgs/development/php-packages @NixOS/php @aanderse @etu @globin @ma27 @talyz
|
||||
/pkgs/top-level/php-packages.nix @jtojnar @NixOS/php @aanderse @etu @globin @ma27 @talyz
|
||||
/doc/languages-frameworks/php.section.md @aanderse @etu @globin @ma27 @talyz
|
||||
/nixos/tests/php @aanderse @etu @globin @ma27 @talyz
|
||||
/pkgs/build-support/build-pecl.nix @aanderse @etu @globin @ma27 @talyz
|
||||
/pkgs/development/interpreters/php @jtojnar @aanderse @etu @globin @ma27 @talyz
|
||||
/pkgs/development/php-packages @aanderse @etu @globin @ma27 @talyz
|
||||
/pkgs/top-level/php-packages.nix @jtojnar @aanderse @etu @globin @ma27 @talyz
|
||||
|
||||
# Podman, CRI-O modules and related
|
||||
/nixos/modules/virtualisation/containers.nix @NixOS/podman @zowoq @adisbladis
|
||||
/nixos/modules/virtualisation/cri-o.nix @NixOS/podman @zowoq @adisbladis
|
||||
/nixos/modules/virtualisation/podman @NixOS/podman @zowoq @adisbladis
|
||||
/nixos/tests/cri-o.nix @NixOS/podman @zowoq @adisbladis
|
||||
/nixos/tests/podman @NixOS/podman @zowoq @adisbladis
|
||||
/nixos/modules/virtualisation/containers.nix @zowoq @adisbladis
|
||||
/nixos/modules/virtualisation/cri-o.nix @zowoq @adisbladis
|
||||
/nixos/modules/virtualisation/podman @zowoq @adisbladis
|
||||
/nixos/tests/cri-o.nix @zowoq @adisbladis
|
||||
/nixos/tests/podman @zowoq @adisbladis
|
||||
|
||||
# Docker tools
|
||||
/pkgs/build-support/docker @roberth @utdemir
|
||||
/nixos/tests/docker-tools-overlay.nix @roberth
|
||||
/nixos/tests/docker-tools.nix @roberth
|
||||
/doc/builders/images/dockertools.xml @roberth
|
||||
/pkgs/build-support/docker @roberth
|
||||
/nixos/tests/docker-tools* @roberth
|
||||
/doc/builders/images/dockertools.section.md @roberth
|
||||
|
||||
# Blockchains
|
||||
/pkgs/applications/blockchains @mmahut @RaghavSood
|
||||
|
||||
# Go
|
||||
/doc/languages-frameworks/go.section.md @kalbasit @Mic92 @zowoq
|
||||
/pkgs/build-support/go @kalbasit @Mic92 @zowoq
|
||||
/pkgs/development/compilers/go @kalbasit @Mic92 @zowoq
|
||||
/pkgs/development/go-modules @kalbasit @Mic92 @zowoq
|
||||
/pkgs/development/go-packages @kalbasit @Mic92 @zowoq
|
||||
|
||||
# GNOME
|
||||
/pkgs/desktops/gnome @NixOS/GNOME @jtojnar @hedning
|
||||
/pkgs/desktops/gnome/extensions @piegamesde @NixOS/GNOME @jtojnar @hedning
|
||||
/pkgs/desktops/gnome @jtojnar
|
||||
/pkgs/desktops/gnome/extensions @piegamesde @jtojnar
|
||||
|
||||
# Cinnamon
|
||||
/pkgs/desktops/cinnamon @mkg20001
|
||||
|
@ -295,10 +283,19 @@
|
|||
|
||||
# Matrix
|
||||
/pkgs/servers/heisenbridge @piegamesde
|
||||
/pkgs/servers/matrix-conduit @piegamesde @pstn
|
||||
/pkgs/servers/matrix-conduit @piegamesde
|
||||
/pkgs/servers/matrix-synapse/matrix-appservice-irc @piegamesde
|
||||
/nixos/modules/services/misc/heisenbridge.nix @piegamesde
|
||||
/nixos/modules/services/misc/matrix-appservice-irc.nix @piegamesde
|
||||
/nixos/modules/services/misc/matrix-conduit.nix @piegamesde @pstn
|
||||
/nixos/modules/services/misc/matrix-conduit.nix @piegamesde
|
||||
/nixos/tests/matrix-appservice-irc.nix @piegamesde
|
||||
/nixos/tests/matrix-conduit.nix @piegamesde @pstn
|
||||
/nixos/tests/matrix-conduit.nix @piegamesde
|
||||
|
||||
# Dotnet
|
||||
/pkgs/build-support/dotnet @IvarWithoutBones
|
||||
/pkgs/development/compilers/dotnet @IvarWithoutBones
|
||||
|
||||
# Node.js
|
||||
/pkgs/build-support/node/build-npm-package @winterqt
|
||||
/pkgs/build-support/node/fetch-npm-deps @winterqt
|
||||
/doc/languages-frameworks/javascript.section.md @winterqt
|
||||
|
|
34
.github/ISSUE_TEMPLATE/build_failure.md
vendored
Normal file
34
.github/ISSUE_TEMPLATE/build_failure.md
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
name: Build failure
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: '0.kind: build failure'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
### Steps To Reproduce
|
||||
Steps to reproduce the behavior:
|
||||
1. build *X*
|
||||
|
||||
### Build log
|
||||
```
|
||||
log here if short otherwise a link to a gist
|
||||
```
|
||||
|
||||
### Additional context
|
||||
Add any other context about the problem here.
|
||||
|
||||
### Notify maintainers
|
||||
<!--
|
||||
Please @ people who are in the `meta.maintainers` list of the offending package or module.
|
||||
If in doubt, check `git blame` for whoever last touched something.
|
||||
-->
|
||||
|
||||
### Metadata
|
||||
Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result.
|
||||
|
||||
```console
|
||||
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
|
||||
output here
|
||||
```
|
32
.github/ISSUE_TEMPLATE/missing_documentation.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE/missing_documentation.md
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
name: Missing or incorrect documentation
|
||||
about: Help us improve the Nixpkgs and NixOS reference manuals
|
||||
title: ''
|
||||
labels: '9.needs: documentation'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Problem
|
||||
|
||||
<!-- describe your problem -->
|
||||
|
||||
## Checklist
|
||||
|
||||
<!-- make sure this issue is not redundant or obsolete -->
|
||||
|
||||
- [ ] checked [latest Nixpkgs manual] \([source][nixpkgs-source]) and [latest NixOS manual] \([source][nixos-source])
|
||||
- [ ] checked [open documentation issues] for possible duplicates
|
||||
- [ ] checked [open documentation pull requests] for possible solutions
|
||||
|
||||
[latest Nixpkgs manual]: https://nixos.org/manual/nixpkgs/unstable/
|
||||
[latest NixOS manual]: https://nixos.org/manual/nixos/unstable/
|
||||
[nixpkgs-source]: https://github.com/NixOS/nixpkgs/tree/master/doc
|
||||
[nixos-source]: https://github.com/NixOS/nixpkgs/tree/master/nixos/doc/manual
|
||||
[open documentation issues]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+label%3A%229.needs%3A+documentation%22
|
||||
[open documentation pull requests]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+is%3Apr+label%3A%228.has%3A+documentation%22%2C%226.topic%3A+documentation%22
|
||||
|
||||
## Proposal
|
||||
|
||||
<!-- propose a solution -->
|
||||
|
31
.github/ISSUE_TEMPLATE/unreproducible_package.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/unreproducible_package.md
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
name: Unreproducible package
|
||||
about: A package that does not produce a bit-by-bit reproducible result each time it is built
|
||||
title: ''
|
||||
labels: '0.kind: enhancement', '6.topic: reproducible builds'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Building this package twice does not produce the bit-by-bit identical result each time, making it harder to detect CI breaches. You can read more about this at https://reproducible-builds.org/ .
|
||||
|
||||
Fixing bit-by-bit reproducibility also has additional advantages, such as avoiding hard-to-reproduce bugs, making content-addressed storage more effective and reducing rebuilds in such systems.
|
||||
|
||||
### Steps To Reproduce
|
||||
|
||||
```
|
||||
nix-build '<nixpkgs>' -A ... --check --keep-failed
|
||||
```
|
||||
|
||||
You can use `diffoscope` to analyze the differences in the output of the two builds.
|
||||
|
||||
To view the build log of the build that produced the artifact in the binary cache:
|
||||
|
||||
```
|
||||
nix-store --read-log $(nix-instantiate '<nixpkgs>' -A ...)
|
||||
```
|
||||
|
||||
### Additional context
|
||||
|
||||
(please share the relevant fragment of the diffoscope output here,
|
||||
and any additional analysis you may have done)
|
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -22,7 +22,7 @@ For new packages please briefly describe the package or provide a link to its ho
|
|||
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
|
||||
- [ ] 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)
|
||||
- [ ] Tested basic functionality of all binary files (usually in `./result/bin/`)
|
||||
- [22.05 Release Notes (or backporting 21.11 Release notes)](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#generating-2205-release-notes)
|
||||
- [23.05 Release Notes (or backporting 22.11 Release notes)](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#generating-2305-release-notes)
|
||||
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
|
||||
- [ ] (Module updates) Added a release notes entry if the change is significant
|
||||
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
|
||||
|
|
1
.github/STALE-BOT.md
vendored
1
.github/STALE-BOT.md
vendored
|
@ -1,6 +1,7 @@
|
|||
# Stale bot information
|
||||
|
||||
- Thanks for your contribution!
|
||||
- Our stale bot will never close an issue or PR.
|
||||
- To remove the stale label, just leave a new comment.
|
||||
- _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.)
|
||||
- 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).
|
||||
|
|
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
8
.github/labeler.yml
vendored
8
.github/labeler.yml
vendored
|
@ -7,6 +7,8 @@
|
|||
|
||||
"6.topic: cinnamon":
|
||||
- pkgs/desktops/cinnamon/**/*
|
||||
- nixos/modules/services/x11/desktop-managers/cinnamon.nix
|
||||
- nixos/tests/cinnamon.nix
|
||||
|
||||
"6.topic: emacs":
|
||||
- nixos/modules/services/editors/emacs.nix
|
||||
|
@ -40,9 +42,8 @@
|
|||
|
||||
"6.topic: golang":
|
||||
- doc/languages-frameworks/go.section.md
|
||||
- pkgs/build-support/go/**/*
|
||||
- pkgs/development/compilers/go/**/*
|
||||
- pkgs/development/go-modules/**/*
|
||||
- pkgs/development/go-packages/**/*
|
||||
|
||||
"6.topic: haskell":
|
||||
- doc/languages-frameworks/haskell.section.md
|
||||
|
@ -142,6 +143,9 @@
|
|||
- nixos/modules/programs/neovim.nix
|
||||
- pkgs/applications/editors/neovim/**/*
|
||||
|
||||
"6.topic: vscode":
|
||||
- pkgs/applications/editors/vscode/**/*
|
||||
|
||||
"6.topic: xfce":
|
||||
- nixos/doc/manual/configuration/xfce.xml
|
||||
- nixos/modules/services/x11/desktop-managers/xfce.nix
|
||||
|
|
3
.github/stale.yml
vendored
3
.github/stale.yml
vendored
|
@ -5,6 +5,5 @@ exemptLabels:
|
|||
- "1.severity: security"
|
||||
- "2.status: never-stale"
|
||||
staleLabel: "2.status: stale"
|
||||
markComment: |
|
||||
I marked this as stale due to inactivity. → [More info](https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md)
|
||||
markComment: false
|
||||
closeComment: false
|
||||
|
|
11
.github/workflows/backport.yml
vendored
11
.github/workflows/backport.yml
vendored
|
@ -8,8 +8,14 @@ on:
|
|||
# the GitHub repository. This means that it should not evaluate user input in a
|
||||
# way that allows code injection.
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
backport:
|
||||
permissions:
|
||||
contents: write # for zeebe-io/backport-action to create branch
|
||||
pull-requests: write # for zeebe-io/backport-action to create PR to backport
|
||||
name: Backport Pull Request
|
||||
if: github.repository_owner == 'NixOS' && github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith('backport', github.event.label.name))
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -20,14 +26,11 @@ jobs:
|
|||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Create backport PRs
|
||||
# should be kept in sync with `version`
|
||||
uses: zeebe-io/backport-action@v0.0.5
|
||||
uses: zeebe-io/backport-action@v0.0.9
|
||||
with:
|
||||
# Config README: https://github.com/zeebe-io/backport-action#backport-action
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_workspace: ${{ github.workspace }}
|
||||
# should be kept in sync with `uses`
|
||||
version: v0.0.5
|
||||
pull_description: |-
|
||||
Bot-based backport to `${target_branch}`, triggered by a label in #${pull_number}.
|
||||
|
||||
|
|
24
.github/workflows/basic-eval.yml
vendored
24
.github/workflows/basic-eval.yml
vendored
|
@ -1,22 +1,26 @@
|
|||
name: Basic evaluation checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-**
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-**
|
||||
workflow_dispatch
|
||||
# pull_request:
|
||||
# branches:
|
||||
# - master
|
||||
# - release-**
|
||||
# push:
|
||||
# branches:
|
||||
# - master
|
||||
# - release-**
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
# we don't limit this action to only NixOS repo since the checks are cheap and useful developer feedback
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v16
|
||||
- uses: cachix/cachix-action@v10
|
||||
- uses: cachix/install-nix-action@v18
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
|
||||
name: nixpkgs-ci
|
||||
|
|
21
.github/workflows/compare-manuals.sh
vendored
Executable file
21
.github/workflows/compare-manuals.sh
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p html-tidy
|
||||
|
||||
set -euo pipefail
|
||||
shopt -s inherit_errexit
|
||||
|
||||
normalize() {
|
||||
tidy \
|
||||
--anchor-as-name no \
|
||||
--coerce-endtags no \
|
||||
--escape-scripts no \
|
||||
--fix-backslash no \
|
||||
--fix-style-tags no \
|
||||
--fix-uri no \
|
||||
--indent yes \
|
||||
--wrap 0 \
|
||||
< "$1" \
|
||||
2> /dev/null
|
||||
}
|
||||
|
||||
diff -U3 <(normalize "$1") <(normalize "$2")
|
7
.github/workflows/direct-push.yml
vendored
7
.github/workflows/direct-push.yml
vendored
|
@ -4,8 +4,13 @@ on:
|
|||
branches:
|
||||
- master
|
||||
- release-**
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
contents: write # for peter-evans/commit-comment to comment on commit
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'NixOS'
|
||||
env:
|
||||
|
@ -16,7 +21,7 @@ jobs:
|
|||
id: ismerge
|
||||
run: |
|
||||
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')
|
||||
echo "::set-output name=ismerge::$ISMERGE"
|
||||
echo "ismerge=$ISMERGE" >> $GITHUB_OUTPUT
|
||||
# github events are eventually consistent, so wait until changes propagate to thier DB
|
||||
- run: sleep 60
|
||||
if: steps.ismerge.outputs.ismerge != 'true'
|
||||
|
|
2
.github/workflows/editorconfig.yml
vendored
2
.github/workflows/editorconfig.yml
vendored
|
@ -28,7 +28,7 @@ jobs:
|
|||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
- uses: cachix/install-nix-action@v16
|
||||
- uses: cachix/install-nix-action@v18
|
||||
with:
|
||||
# nixpkgs commit is pinned so that it doesn't break
|
||||
# editorconfig-checker 2.4.0
|
||||
|
|
14
.github/workflows/manual-nixos.yml
vendored
14
.github/workflows/manual-nixos.yml
vendored
|
@ -18,14 +18,22 @@ jobs:
|
|||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
- uses: cachix/install-nix-action@v16
|
||||
- uses: cachix/install-nix-action@v18
|
||||
with:
|
||||
# explicitly enable sandbox
|
||||
extra_nix_config: sandbox = true
|
||||
- uses: cachix/cachix-action@v10
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
|
||||
name: nixpkgs-ci
|
||||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||
- name: Building NixOS manual
|
||||
- name: Building NixOS manual with DocBook options
|
||||
run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true nixos/release.nix -A manual.x86_64-linux
|
||||
- name: Building NixOS manual with Markdown options
|
||||
run: |
|
||||
export NIX_PATH=nixpkgs=$(pwd)
|
||||
nix-build \
|
||||
--option restrict-eval true \
|
||||
--arg configuration '{ documentation.nixos.options.allowDocBook = false; }' \
|
||||
nixos/release.nix \
|
||||
-A manual.x86_64-linux
|
||||
|
|
4
.github/workflows/manual-nixpkgs.yml
vendored
4
.github/workflows/manual-nixpkgs.yml
vendored
|
@ -18,11 +18,11 @@ jobs:
|
|||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
- uses: cachix/install-nix-action@v16
|
||||
- uses: cachix/install-nix-action@v18
|
||||
with:
|
||||
# explicitly enable sandbox
|
||||
extra_nix_config: sandbox = true
|
||||
- uses: cachix/cachix-action@v10
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
|
||||
name: nixpkgs-ci
|
||||
|
|
64
.github/workflows/manual-rendering.yml
vendored
Normal file
64
.github/workflows/manual-rendering.yml
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
name: "Check NixOS Manual DocBook rendering against MD rendering"
|
||||
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# * is a special character in YAML so you have to quote this string
|
||||
# Check every 24 hours
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-rendering-equivalence:
|
||||
permissions:
|
||||
pull-requests: write # for peter-evans/create-or-update-comment to create or update comment
|
||||
if: github.repository_owner == 'NixOS'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v18
|
||||
with:
|
||||
# explicitly enable sandbox
|
||||
extra_nix_config: sandbox = true
|
||||
- uses: cachix/cachix-action@v12
|
||||
with:
|
||||
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
|
||||
name: nixpkgs-ci
|
||||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||
|
||||
- name: Build DocBook and MD manuals
|
||||
run: |
|
||||
export NIX_PATH=nixpkgs=$(pwd)
|
||||
nix-build \
|
||||
--option restrict-eval true \
|
||||
-o docbook nixos/release.nix \
|
||||
-A manual.x86_64-linux
|
||||
nix-build \
|
||||
--option restrict-eval true \
|
||||
--arg configuration '{ documentation.nixos.options.allowDocBook = false; }' \
|
||||
-o md nixos/release.nix \
|
||||
-A manual.x86_64-linux
|
||||
|
||||
- name: Compare DocBook and MD manuals
|
||||
id: check
|
||||
run: |
|
||||
export NIX_PATH=nixpkgs=$(pwd)
|
||||
.github/workflows/compare-manuals.sh \
|
||||
docbook/share/doc/nixos/options.html \
|
||||
md/share/doc/nixos/options.html
|
||||
|
||||
# if the manual can't be built we don't want to notify anyone.
|
||||
# while this may temporarily hide rendering failures it will be a lot
|
||||
# less noisy until all nixpkgs pull requests have stopped using
|
||||
# docbook for option docs.
|
||||
- name: Comment on failure
|
||||
uses: peter-evans/create-or-update-comment@v2
|
||||
if: ${{ failure() && steps.check.conclusion == 'failure' }}
|
||||
with:
|
||||
issue-number: 189318
|
||||
body: |
|
||||
Markdown and DocBook manuals do not agree.
|
||||
|
||||
Check https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }} for details.
|
12
.github/workflows/nixos-manual.yml
vendored
12
.github/workflows/nixos-manual.yml
vendored
|
@ -19,8 +19,16 @@ jobs:
|
|||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
- uses: cachix/install-nix-action@v16
|
||||
- uses: cachix/install-nix-action@v18
|
||||
- name: Check DocBook files generated from Markdown are consistent
|
||||
run: |
|
||||
nixos/doc/manual/md-to-db.sh
|
||||
git diff --exit-code
|
||||
git diff --exit-code || {
|
||||
echo
|
||||
echo 'Generated manual files are out of date.'
|
||||
echo 'Please run'
|
||||
echo
|
||||
echo ' nixos/doc/manual/md-to-db.sh'
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
|
5
.github/workflows/no-channel.yml
vendored
5
.github/workflows/no-channel.yml
vendored
|
@ -6,8 +6,13 @@ on:
|
|||
- 'nixos-**'
|
||||
- 'nixpkgs-**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
fail:
|
||||
permissions:
|
||||
contents: none
|
||||
name: "This PR is is targeting a channel branch"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
33
.github/workflows/ofborg-pending.yml
vendored
Normal file
33
.github/workflows/ofborg-pending.yml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
name: "Set pending OfBorg status"
|
||||
on:
|
||||
pull_request_target:
|
||||
|
||||
# Sets the ofborg-eval status to "pending" to signal that we are waiting for
|
||||
# OfBorg even if it is running late. The status will be overwritten by OfBorg
|
||||
# once it starts evaluation.
|
||||
|
||||
# WARNING:
|
||||
# When extending this action, be aware that $GITHUB_TOKEN allows (restricted) write access to
|
||||
# the GitHub repository. This means that it should not evaluate user input in a
|
||||
# way that allows code injection.
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
action:
|
||||
if: github.repository_owner == 'NixOS'
|
||||
permissions:
|
||||
statuses: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Set pending OfBorg status"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||
-d '{"context": "ofborg-eval", "state": "pending", "description": "Waiting for OfBorg..."}' \
|
||||
"https://api.github.com/repos/NixOS/nixpkgs/commits/${{ github.event.pull_request.head.sha }}/statuses"
|
21
.github/workflows/pending-clear.yml
vendored
21
.github/workflows/pending-clear.yml
vendored
|
@ -1,21 +0,0 @@
|
|||
name: "clear pending status"
|
||||
|
||||
on:
|
||||
check_suite:
|
||||
types: [ completed ]
|
||||
|
||||
jobs:
|
||||
action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: clear pending status
|
||||
if: github.repository_owner == 'NixOS' && github.event.check_suite.app.name == 'OfBorg'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-d '{"state": "success", "target_url": " ", "description": " ", "context": "Wait for ofborg"}' \
|
||||
"https://api.github.com/repos/NixOS/nixpkgs/statuses/${{ github.event.check_suite.head_sha }}"
|
25
.github/workflows/pending-set.yml
vendored
25
.github/workflows/pending-set.yml
vendored
|
@ -1,25 +0,0 @@
|
|||
name: "set pending status"
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
|
||||
# WARNING:
|
||||
# When extending this action, be aware that $GITHUB_TOKEN allows write access to
|
||||
# the GitHub repository. This means that it should not evaluate user input in a
|
||||
# way that allows code injection.
|
||||
|
||||
jobs:
|
||||
action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: set pending status
|
||||
if: github.repository_owner == 'NixOS'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-d '{"state": "pending", "target_url": " ", "description": "This pending status will be cleared when ofborg starts eval.", "context": "Wait for ofborg"}' \
|
||||
"https://api.github.com/repos/NixOS/nixpkgs/statuses/${{ github.event.pull_request.head.sha }}"
|
22
.github/workflows/periodic-merge-24h.yml
vendored
22
.github/workflows/periodic-merge-24h.yml
vendored
|
@ -14,8 +14,14 @@ on:
|
|||
# Merge every 24 hours
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
periodic-merge:
|
||||
permissions:
|
||||
contents: write # for devmasx/merge-branch to merge branches
|
||||
pull-requests: write # for peter-evans/create-or-update-comment to create or update comment
|
||||
if: github.repository_owner == 'NixOS'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
@ -28,14 +34,14 @@ jobs:
|
|||
pairs:
|
||||
- from: master
|
||||
into: haskell-updates
|
||||
- from: release-21.05
|
||||
into: staging-next-21.05
|
||||
- from: staging-next-21.05
|
||||
into: staging-21.05
|
||||
- from: release-21.11
|
||||
into: staging-next-21.11
|
||||
- from: staging-next-21.11
|
||||
into: staging-21.11
|
||||
- from: release-22.11
|
||||
into: staging-next-22.11
|
||||
- from: staging-next-22.11
|
||||
into: staging-22.11
|
||||
- from: release-22.05
|
||||
into: staging-next-22.05
|
||||
- from: staging-next-22.05
|
||||
into: staging-22.05
|
||||
name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
6
.github/workflows/periodic-merge-6h.yml
vendored
6
.github/workflows/periodic-merge-6h.yml
vendored
|
@ -14,8 +14,14 @@ on:
|
|||
# Merge every 6 hours
|
||||
- cron: '0 */6 * * *'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
periodic-merge:
|
||||
permissions:
|
||||
contents: write # for devmasx/merge-branch to merge branches
|
||||
pull-requests: write # for peter-evans/create-or-update-comment to create or update comment
|
||||
if: github.repository_owner == 'NixOS'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
|
46
.github/workflows/update-terraform-providers.yml
vendored
46
.github/workflows/update-terraform-providers.yml
vendored
|
@ -2,46 +2,54 @@ name: "Update terraform-providers"
|
|||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "14 3 * * 1"
|
||||
- cron: "0 3 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
tf-providers:
|
||||
permissions:
|
||||
contents: write # for peter-evans/create-pull-request to create branch
|
||||
pull-requests: write # for peter-evans/create-pull-request to create a PR, for peter-evans/create-or-update-comment to create or update comment
|
||||
if: github.repository_owner == 'NixOS' && github.ref == 'refs/heads/master' # ensure workflow_dispatch only runs on master
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v16
|
||||
- uses: cachix/install-nix-action@v18
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixpkgs-unstable
|
||||
- name: setup
|
||||
id: setup
|
||||
run: |
|
||||
echo ::set-output name=title::"terraform-providers: update $(date -u +"%Y-%m-%d")"
|
||||
echo "title=terraform-providers: update $(date -u +"%Y-%m-%d")" >> $GITHUB_OUTPUT
|
||||
- name: update terraform-providers
|
||||
run: |
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "github-actions[bot]"
|
||||
pushd pkgs/applications/networking/cluster/terraform-providers
|
||||
./update-all-providers --no-build
|
||||
git commit -m "${{ steps.setup.outputs.title }}" providers.json
|
||||
popd
|
||||
echo | nix-shell \
|
||||
maintainers/scripts/update.nix \
|
||||
--argstr commit true \
|
||||
--argstr keep-going true \
|
||||
--argstr max-workers 2 \
|
||||
--argstr path terraform-providers
|
||||
- name: clean repo
|
||||
run: |
|
||||
git clean -f
|
||||
- name: create PR
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
body: |
|
||||
Automatic update of terraform providers.
|
||||
Automatic update by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action.
|
||||
|
||||
Created by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action.
|
||||
https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}
|
||||
|
||||
Check that all providers build with `@ofborg build terraform-full`
|
||||
Check that all providers build with:
|
||||
```
|
||||
@ofborg build terraform.full
|
||||
```
|
||||
branch: terraform-providers-update
|
||||
delete-branch: false
|
||||
labels: "2.status: work-in-progress"
|
||||
title: ${{ steps.setup.outputs.title }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: comment on failure
|
||||
uses: peter-evans/create-or-update-comment@v2
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
issue-number: 153416
|
||||
body: |
|
||||
Automatic update of terraform providers [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).
|
||||
|
|
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -5,13 +5,15 @@
|
|||
.idea/
|
||||
.vscode/
|
||||
outputs/
|
||||
result
|
||||
result-*
|
||||
source/
|
||||
result
|
||||
!pkgs/development/python-modules/result
|
||||
/doc/NEWS.html
|
||||
/doc/NEWS.txt
|
||||
/doc/manual.html
|
||||
/doc/manual.pdf
|
||||
/result
|
||||
/source/
|
||||
.version-suffix
|
||||
|
||||
.DS_Store
|
||||
|
|
3
.mailmap
Normal file
3
.mailmap
Normal file
|
@ -0,0 +1,3 @@
|
|||
Daniel Løvbrøtte Olsen <me@dandellion.xyz> <daniel.olsen99@gmail.com>
|
||||
R. RyanTM <ryantm-bot@ryantm.com>
|
||||
Sandro <sandro.jaeckel@gmail.com>
|
2
.version
2
.version
|
@ -1 +1 @@
|
|||
22.05
|
||||
23.05
|
||||
|
|
|
@ -20,7 +20,7 @@ Below is a short excerpt of some points in there:
|
|||
```
|
||||
(pkg-name | nixos/<module>): (from -> to | init at version | refactor | etc)
|
||||
|
||||
(Motivation for change. Additional information.)
|
||||
(Motivation for change. Link to release notes. Additional information.)
|
||||
```
|
||||
|
||||
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).
|
||||
|
@ -29,6 +29,7 @@ Below is a short excerpt of some points in there:
|
|||
|
||||
* nginx: init at 2.0.1
|
||||
* firefox: 54.0.1 -> 55.0
|
||||
https://www.mozilla.org/en-US/firefox/55.0/releasenotes/
|
||||
* nixos/hydra: add bazBaz option
|
||||
|
||||
Dual baz behavior is needed to do foo.
|
||||
|
@ -50,17 +51,68 @@ See the nixpkgs manual for more details on [standard meta-attributes](https://ni
|
|||
|
||||
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.
|
||||
|
||||
For package version upgrades and such a one-line commit message is usually sufficient.
|
||||
Package version upgrades usually allow for simpler commit messages, including attribute name, old and new version, as well as a reference to the relevant release notes/changelog. Every once in a while a package upgrade requires more extensive changes, and that subsequently warrants a more verbose message.
|
||||
|
||||
We prefer not to use the "squash merge" feature in nixpkgs: in order to keep as much information as possible in the commit history, we expect pull requests to consist of self-contained commits as described above.
|
||||
This means that, after addressing review comments and before the PR is merged, you will sometimes need to rewrite your branch's history and then force-push it with `git push --force-with-lease`.
|
||||
Useful commands to be comfortable with are `git commit --amend`, `git commit --fixup` and `git rebase -i` (and don't forget that git lets you define aliases!).
|
||||
|
||||
## Rebasing between branches (i.e. from master to staging)
|
||||
|
||||
From time to time, changes between branches must be rebased, for example, if the
|
||||
number of new rebuilds they would cause is too large for the target branch. When
|
||||
rebasing, care must be taken to include only the intended changes, otherwise
|
||||
many CODEOWNERS will be inadvertently requested for review. To achieve this,
|
||||
rebasing should not be performed directly on the target branch, but on the merge
|
||||
base between the current and target branch.
|
||||
|
||||
In the following example, we assume that the current branch, called `feature`,
|
||||
is based on `master`, and we rebase it onto the merge base between
|
||||
`master` and `staging` so that the PR can eventually be retargeted to
|
||||
`staging` without causing a mess. The example uses `upstream` as the remote for `NixOS/nixpkgs.git`
|
||||
while `origin` is the remote you are pushing to.
|
||||
|
||||
|
||||
```console
|
||||
# Rebase your commits onto the common merge base
|
||||
git rebase --onto upstream/staging... upstream/master
|
||||
# Force push your changes
|
||||
git push origin feature --force-with-lease
|
||||
```
|
||||
|
||||
The syntax `upstream/staging...` is equivalent to `upstream/staging...HEAD` and
|
||||
stands for the merge base between `upstream/staging` and `HEAD` (hence between
|
||||
`upstream/staging` and `upstream/master`).
|
||||
|
||||
Then change the base branch in the GitHub PR using the *Edit* button in the upper
|
||||
right corner, and switch from `master` to `staging`. *After* the PR has been
|
||||
retargeted it might be necessary to do a final rebase onto the target branch, to
|
||||
resolve any outstanding merge conflicts.
|
||||
|
||||
```console
|
||||
# Rebase onto target branch
|
||||
git rebase upstream/staging
|
||||
# Review and fixup possible conflicts
|
||||
git status
|
||||
# Force push your changes
|
||||
git push origin feature --force-with-lease
|
||||
```
|
||||
|
||||
## Backporting changes
|
||||
|
||||
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).
|
||||
|
||||
You can add a label such as `backport release-22.11` to a PR, so that merging it will
|
||||
automatically create a backport (via [a GitHub Action](.github/workflows/backport.yml)).
|
||||
This also works for PR's that have already been merged, and might take a couple of minutes to trigger.
|
||||
|
||||
You can also create the backport manually:
|
||||
|
||||
1. Take note of the commits in which the change was introduced into `master` branch.
|
||||
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`.
|
||||
2. Check out the target _release branch_, e.g. `release-22.11`. Do not use a _channel branch_ like `nixos-22.11` or `nixpkgs-22.11-darwin`.
|
||||
3. Create a branch for your change, e.g. `git checkout -b backport`.
|
||||
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.
|
||||
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]`.
|
||||
5. Push to GitHub and open a backport pull request. Make sure to select the release branch (e.g. `release-22.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. `[22.11]`.
|
||||
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.
|
||||
|
||||
## Criteria for Backporting changes
|
||||
|
@ -72,17 +124,15 @@ Anything that does not cause user or downstream dependency regressions can be ba
|
|||
- Services which require a client to be up-to-date regardless. (E.g. `spotify`, `steam`, or `discord`)
|
||||
- Security critical applications (E.g. `firefox`)
|
||||
|
||||
## Generating 22.05 Release Notes
|
||||
|
||||
(This section also applies to backporting 21.11 release notes: substitute "rl-2205" for "rl-2111".)
|
||||
## Generating 23.05 Release Notes
|
||||
|
||||
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.
|
||||
|
||||
Steps for updating 22.05 Release notes:
|
||||
Steps for updating 23.05 Release notes:
|
||||
|
||||
1. Edit `nixos/doc/manual/release-notes/rl-2205.section.md` with the desired changes
|
||||
2. Run `./nixos/doc/manual/md-to-db.sh` to render `nixos/doc/manual/from_md/release-notes/rl-2205.section.xml`
|
||||
3. Include changes to `rl-2205.section.md` and `rl-2205.section.xml` in the same commit.
|
||||
1. Edit `nixos/doc/manual/release-notes/rl-2305.section.md` with the desired changes
|
||||
2. Run `./nixos/doc/manual/md-to-db.sh` to render `nixos/doc/manual/from_md/release-notes/rl-2305.section.xml`
|
||||
3. Include changes to `rl-2305.section.md` and `rl-2305.section.xml` in the same commit.
|
||||
|
||||
## Reviewing contributions
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ Nixpkgs and NixOS are built and tested by our continuous integration
|
|||
system, [Hydra](https://hydra.nixos.org/).
|
||||
|
||||
* [Continuous package builds for unstable/master](https://hydra.nixos.org/jobset/nixos/trunk-combined)
|
||||
* [Continuous package builds for the NixOS 21.11 release](https://hydra.nixos.org/jobset/nixos/release-21.11)
|
||||
* [Continuous package builds for the NixOS 22.11 release](https://hydra.nixos.org/jobset/nixos/release-22.11)
|
||||
* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
|
||||
* [Tests for the NixOS 21.11 release](https://hydra.nixos.org/job/nixos/release-21.11/tested#tabs-constituents)
|
||||
* [Tests for the NixOS 22.11 release](https://hydra.nixos.org/job/nixos/release-22.11/tested#tabs-constituents)
|
||||
|
||||
Artifacts successfully built with Hydra are published to cache at
|
||||
https://cache.nixos.org/. When successful build and test criteria are
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--[[
|
||||
Converts some HTML elements commonly used in Markdown to corresponding DocBook elements.
|
||||
]]
|
||||
|
||||
function RawInline(elem)
|
||||
if elem.format == 'html' and elem.text == '<kbd>' then
|
||||
return pandoc.RawInline('docbook', '<keycap>')
|
||||
elseif elem.format == 'html' and elem.text == '</kbd>' then
|
||||
return pandoc.RawInline('docbook', '</keycap>')
|
||||
end
|
||||
end
|
|
@ -27,6 +27,14 @@ function Code(elem)
|
|||
content = '<refentrytitle>' .. title .. '</refentrytitle>' .. (volnum ~= nil and ('<manvolnum>' .. volnum .. '</manvolnum>') or '')
|
||||
elseif elem.attributes['role'] == 'file' then
|
||||
tag = 'filename'
|
||||
elseif elem.attributes['role'] == 'command' then
|
||||
tag = 'command'
|
||||
elseif elem.attributes['role'] == 'option' then
|
||||
tag = 'option'
|
||||
elseif elem.attributes['role'] == 'var' then
|
||||
tag = 'varname'
|
||||
elseif elem.attributes['role'] == 'env' then
|
||||
tag = 'envar'
|
||||
end
|
||||
|
||||
if tag ~= nil then
|
||||
|
|
|
@ -1,16 +1,55 @@
|
|||
# Fetchers {#chap-pkgs-fetchers}
|
||||
|
||||
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.
|
||||
Building software with Nix often requires downloading source code and other files from the internet.
|
||||
`nixpkgs` provides *fetchers* for different protocols and services. Fetchers are functions that simplify downloading files.
|
||||
|
||||
## Caveats
|
||||
|
||||
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.
|
||||
Fetchers create [fixed output derivations](https://nixos.org/manual/nix/stable/#fixed-output-drvs) from downloaded files.
|
||||
Nix can reuse the downloaded files via the hash of the resulting derivation.
|
||||
|
||||
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`](#sec-pkgs-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.
|
||||
The fact that the hash belongs to the Nix derivation output and not the file itself can lead to confusion.
|
||||
For example, consider the following fetcher:
|
||||
|
||||
```nix
|
||||
fetchurl {
|
||||
url = "http://www.example.org/hello-1.0.tar.gz";
|
||||
sha256 = "0v6r3wwnsk5pdjr188nip3pjgn1jrn5pc5ajpcfy6had6b3v4dwm";
|
||||
};
|
||||
```
|
||||
|
||||
A common mistake is to update a fetcher’s URL, or a version parameter, without updating the hash.
|
||||
|
||||
```nix
|
||||
fetchurl {
|
||||
url = "http://www.example.org/hello-1.1.tar.gz";
|
||||
sha256 = "0v6r3wwnsk5pdjr188nip3pjgn1jrn5pc5ajpcfy6had6b3v4dwm";
|
||||
};
|
||||
```
|
||||
|
||||
**This will reuse the old contents**.
|
||||
Remember to invalidate the hash argument, in this case by setting the `sha256` attribute to an empty string.
|
||||
|
||||
```nix
|
||||
fetchurl {
|
||||
url = "http://www.example.org/hello-1.1.tar.gz";
|
||||
sha256 = "";
|
||||
};
|
||||
```
|
||||
|
||||
Use the resulting error message to determine the correct hash.
|
||||
|
||||
```
|
||||
error: hash mismatch in fixed-output derivation '/path/to/my.drv':
|
||||
specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
got: sha256-RApQUm78dswhBLC/rfU9y0u6pSAzHceIJqgmetRD24E=
|
||||
```
|
||||
|
||||
A similar problem arises while testing changes to a fetcher's implementation. If the output of the derivation already exists in the Nix store, test failures can go undetected. The [`invalidateFetcherByDrvHash`](#tester-invalidateFetcherByDrvHash) function helps prevent reusing cached derivations.
|
||||
|
||||
## `fetchurl` and `fetchzip` {#fetchurl}
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
```nix
|
||||
{ stdenv, fetchurl }:
|
||||
|
@ -24,9 +63,21 @@ stdenv.mkDerivation {
|
|||
}
|
||||
```
|
||||
|
||||
The main difference between `fetchurl` and `fetchzip` is in how they store the contents. `fetchurl` will store the unaltered contents of the URL within the Nix store. `fetchzip` on the other hand will decompress the archive for you, making files and directories directly accessible in the future. `fetchzip` can only be used with archives. Despite the name, `fetchzip` is not limited to .zip files and can also be used with any tarball.
|
||||
The main difference between `fetchurl` and `fetchzip` is in how they store the contents. `fetchurl` will store the unaltered contents of the URL within the Nix store. `fetchzip` on the other hand, will decompress the archive for you, making files and directories directly accessible in the future. `fetchzip` can only be used with archives. Despite the name, `fetchzip` is not limited to .zip files and can also be used with any tarball.
|
||||
|
||||
## `fetchpatch` {#fetchpatch}
|
||||
|
||||
`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.
|
||||
|
||||
- `relative`: Similar to using `git-diff`'s `--relative` flag, only keep changes inside the specified directory, making paths relative to it.
|
||||
- `stripLen`: Remove the first `stripLen` components of pathnames in the patch.
|
||||
- `extraPrefix`: Prefix pathnames by this string.
|
||||
- `excludes`: Exclude files matching these patterns (applies after the above arguments).
|
||||
- `includes`: Include only files matching these patterns (applies after the above arguments).
|
||||
- `revert`: Revert the patch.
|
||||
|
||||
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.
|
||||
|
||||
`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.
|
||||
|
||||
Most other fetchers return a directory rather than a single file.
|
||||
|
||||
|
@ -38,9 +89,9 @@ Used with Subversion. Expects `url` to a Subversion directory, `rev`, and `sha25
|
|||
|
||||
Used with Git. Expects `url` to a Git repo, `rev`, and `sha256`. `rev` in this case can be full the git commit id (SHA1 hash) or a tag name like `refs/tags/v1.0`.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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 infomation:
|
||||
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) for more information:
|
||||
|
||||
```nix
|
||||
{ stdenv, fetchgit }:
|
||||
|
@ -49,10 +100,10 @@ stdenv.mkDerivation {
|
|||
name = "hello";
|
||||
src = fetchgit {
|
||||
url = "https://...";
|
||||
sparseCheckout = ''
|
||||
path/to/be/included
|
||||
another/path
|
||||
'';
|
||||
sparseCheckout = [
|
||||
"directory/to/be/included"
|
||||
"another/directory"
|
||||
];
|
||||
sha256 = "0000000000000000000000000000000000000000000000000000";
|
||||
};
|
||||
}
|
||||
|
@ -78,17 +129,17 @@ A number of fetcher functions wrap part of `fetchurl` and `fetchzip`. They are m
|
|||
|
||||
## `fetchFromGitHub` {#fetchfromgithub}
|
||||
|
||||
`fetchFromGitHub` expects four arguments. `owner` is a string corresponding to the GitHub user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. Finally, `sha256` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available but `sha256` is currently preferred.
|
||||
`fetchFromGitHub` expects four arguments. `owner` is a string corresponding to the GitHub user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. Finally, `sha256` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available, but `sha256` is currently preferred.
|
||||
|
||||
`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.
|
||||
|
||||
## `fetchFromGitLab` {#fetchfromgitlab}
|
||||
|
||||
This is used with GitLab repositories. The arguments expected are very similar to fetchFromGitHub above.
|
||||
This is used with GitLab repositories. The arguments expected are very similar to `fetchFromGitHub` above.
|
||||
|
||||
## `fetchFromGitiles` {#fetchfromgitiles}
|
||||
|
||||
This is used with Gitiles repositories. The arguments expected are similar to fetchgit.
|
||||
This is used with Gitiles repositories. The arguments expected are similar to `fetchgit`.
|
||||
|
||||
## `fetchFromBitbucket` {#fetchfrombitbucket}
|
||||
|
||||
|
@ -96,11 +147,11 @@ This is used with BitBucket repositories. The arguments expected are very simila
|
|||
|
||||
## `fetchFromSavannah` {#fetchfromsavannah}
|
||||
|
||||
This is used with Savannah repositories. The arguments expected are very similar to fetchFromGitHub above.
|
||||
This is used with Savannah repositories. The arguments expected are very similar to `fetchFromGitHub` above.
|
||||
|
||||
## `fetchFromRepoOrCz` {#fetchfromrepoorcz}
|
||||
|
||||
This is used with repo.or.cz repositories. The arguments expected are very similar to fetchFromGitHub above.
|
||||
This is used with repo.or.cz repositories. The arguments expected are very similar to `fetchFromGitHub` above.
|
||||
|
||||
## `fetchFromSourcehut` {#fetchfromsourcehut}
|
||||
|
||||
|
@ -111,4 +162,4 @@ or "hg"), `domain` and `fetchSubmodules`.
|
|||
|
||||
If `fetchSubmodules` is `true`, `fetchFromSourcehut` uses `fetchgit`
|
||||
or `fetchhg` with `fetchSubmodules` or `fetchSubrepos` set to `true`,
|
||||
respectively. Otherwise the fetcher uses `fetchzip`.
|
||||
respectively. Otherwise, the fetcher uses `fetchzip`.
|
||||
|
|
|
@ -9,4 +9,5 @@
|
|||
<xi:include href="images/dockertools.section.xml" />
|
||||
<xi:include href="images/ocitools.section.xml" />
|
||||
<xi:include href="images/snaptools.section.xml" />
|
||||
<xi:include href="images/portableservice.section.xml" />
|
||||
</chapter>
|
||||
|
|
|
@ -20,7 +20,12 @@ buildImage {
|
|||
fromImageName = null;
|
||||
fromImageTag = "latest";
|
||||
|
||||
contents = pkgs.redis;
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "image-root";
|
||||
paths = [ pkgs.redis ];
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
|
||||
runAsRoot = ''
|
||||
#!${pkgs.runtimeShell}
|
||||
mkdir -p /data
|
||||
|
@ -31,6 +36,9 @@ buildImage {
|
|||
WorkingDir = "/data";
|
||||
Volumes = { "/data" = { }; };
|
||||
};
|
||||
|
||||
diskSize = 1024;
|
||||
buildVMMemorySize = 512;
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -46,7 +54,7 @@ The above example will build a Docker image `redis/latest` from the given base i
|
|||
|
||||
- `fromImageTag` can be used to further specify the tag of the base image within the repository, in case an image contains multiple tags. By default it's `null`, in which case `buildImage` will peek the first tag available for the base image.
|
||||
|
||||
- `contents` is a derivation that will be copied in the new layer of the resulting image. This can be similarly seen as `ADD contents/ /` in a `Dockerfile`. By default it's `null`.
|
||||
- `copyToRoot` is a derivation that will be copied in the new layer of the resulting image. This can be similarly seen as `ADD contents/ /` in a `Dockerfile`. By default it's `null`.
|
||||
|
||||
- `runAsRoot` is a bash script that will run as root in an environment that overlays the existing layers of the base image with the new resulting layer, including the previously copied `contents` derivation. This can be similarly seen as `RUN ...` in a `Dockerfile`.
|
||||
|
||||
|
@ -54,11 +62,15 @@ The above example will build a Docker image `redis/latest` from the given base i
|
|||
|
||||
- `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).
|
||||
|
||||
- `diskSize` is used to specify the disk size of the VM used to build the image in megabytes. By default it's 1024 MiB.
|
||||
|
||||
- `buildVMMemorySize` is used to specify the memory size of the VM to build the image in megabytes. By default it's 512 MiB.
|
||||
|
||||
After the new layer has been created, its closure (to which `contents`, `config` and `runAsRoot` contribute) will be copied in the layer itself. Only new dependencies that are not already in the existing layers will be copied.
|
||||
|
||||
At the end of the process, only one new single layer will be produced and added to the resulting image.
|
||||
|
||||
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`.
|
||||
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`.
|
||||
|
||||
It is possible to inspect the arguments with which an image was built using its `buildArgs` attribute.
|
||||
|
||||
|
@ -81,13 +93,17 @@ pkgs.dockerTools.buildImage {
|
|||
name = "hello";
|
||||
tag = "latest";
|
||||
created = "now";
|
||||
contents = pkgs.hello;
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "image-root";
|
||||
paths = [ pkgs.hello ];
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
|
||||
config.Cmd = [ "/bin/hello" ];
|
||||
}
|
||||
```
|
||||
|
||||
and now the Docker CLI will display a reasonable date and sort the images as expected:
|
||||
Now the Docker CLI will display a reasonable date and sort the images as expected:
|
||||
|
||||
```ShellSession
|
||||
$ docker images
|
||||
|
@ -95,7 +111,7 @@ REPOSITORY TAG IMAGE ID CREATED SIZE
|
|||
hello latest de2bf4786de6 About a minute ago 25.2MB
|
||||
```
|
||||
|
||||
however, the produced images will not be binary reproducible.
|
||||
However, the produced images will not be binary reproducible.
|
||||
|
||||
## buildLayeredImage {#ssec-pkgs-dockerTools-buildLayeredImage}
|
||||
|
||||
|
@ -119,13 +135,13 @@ Create a Docker image with many of the store paths being on their own layer to i
|
|||
|
||||
`contents` _optional_
|
||||
|
||||
: Top level paths in the container. Either a single derivation, or a list of derivations.
|
||||
: Top-level paths in the container. Either a single derivation, or a list of derivations.
|
||||
|
||||
*Default:* `[]`
|
||||
|
||||
`config` _optional_
|
||||
|
||||
: 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).
|
||||
: 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).
|
||||
|
||||
*Default:* `{}`
|
||||
|
||||
|
@ -195,9 +211,9 @@ pkgs.dockerTools.buildLayeredImage {
|
|||
|
||||
Increasing the `maxLayers` increases the number of layers which have a chance to be shared between different images.
|
||||
|
||||
Modern Docker installations support up to 128 layers, however older versions support as few as 42.
|
||||
Modern Docker installations support up to 128 layers, but older versions support as few as 42.
|
||||
|
||||
If the produced image will not be extended by other Docker builds, it is safe to set `maxLayers` to `128`. However it will be impossible to extend the image further.
|
||||
If the produced image will not be extended by other Docker builds, it is safe to set `maxLayers` to `128`. However, it will be impossible to extend the image further.
|
||||
|
||||
The first (`maxLayers-2`) most "popular" paths will have their own individual layers, then layer \#`maxLayers-1` will contain all the remaining "unpopular" paths, and finally layer \#`maxLayers` will contain the Image configuration.
|
||||
|
||||
|
@ -213,7 +229,7 @@ The image produced by running the output script can be piped directly into `dock
|
|||
$(nix-build) | docker load
|
||||
```
|
||||
|
||||
Alternatively, the image be piped via `gzip` into `skopeo`, e.g. to copy it into a registry:
|
||||
Alternatively, the image be piped via `gzip` into `skopeo`, e.g., to copy it into a registry:
|
||||
|
||||
```ShellSession
|
||||
$(nix-build) | gzip --fast | skopeo copy docker-archive:/dev/stdin docker://some_docker_registry/myimage:tag
|
||||
|
@ -292,7 +308,44 @@ The parameters relative to the base image have the same synopsis as described in
|
|||
|
||||
The `name` argument is the name of the derivation output, which defaults to `fromImage.name`.
|
||||
|
||||
## shadowSetup {#ssec-pkgs-dockerTools-shadowSetup}
|
||||
## Environment Helpers {#ssec-pkgs-dockerTools-helpers}
|
||||
|
||||
Some packages expect certain files to be available globally.
|
||||
When building an image from scratch (i.e. without `fromImage`), these files are missing.
|
||||
`pkgs.dockerTools` provides some helpers to set up an environment with the necessary files.
|
||||
You can include them in `copyToRoot` like this:
|
||||
|
||||
```nix
|
||||
buildImage {
|
||||
name = "environment-example";
|
||||
copyToRoot = with pkgs.dockerTools; [
|
||||
usrBinEnv
|
||||
binSh
|
||||
caCertificates
|
||||
fakeNss
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### usrBinEnv {#sssec-pkgs-dockerTools-helpers-usrBinEnv}
|
||||
|
||||
This provides the `env` utility at `/usr/bin/env`.
|
||||
|
||||
### binSh {#sssec-pkgs-dockerTools-helpers-binSh}
|
||||
|
||||
This provides `bashInteractive` at `/bin/sh`.
|
||||
|
||||
### caCertificates {#sssec-pkgs-dockerTools-helpers-caCertificates}
|
||||
|
||||
This sets up `/etc/ssl/certs/ca-certificates.crt`.
|
||||
|
||||
### fakeNss {#sssec-pkgs-dockerTools-helpers-fakeNss}
|
||||
|
||||
Provides `/etc/passwd` and `/etc/group` that contain root and nobody.
|
||||
Useful when packaging binaries that insist on using nss to look up
|
||||
username/groups (like nginx).
|
||||
|
||||
### shadowSetup {#ssec-pkgs-dockerTools-shadowSetup}
|
||||
|
||||
This constant string is a helper for setting up the base files for managing users and groups, only if such files don't exist already. It is suitable for being used in a [`buildImage` `runAsRoot`](#ex-dockerTools-buildImage-runAsRoot) script for cases like in the example below:
|
||||
|
||||
|
@ -302,7 +355,7 @@ buildImage {
|
|||
|
||||
runAsRoot = ''
|
||||
#!${pkgs.runtimeShell}
|
||||
${shadowSetup}
|
||||
${pkgs.dockerTools.shadowSetup}
|
||||
groupadd -r redis
|
||||
useradd -r -g redis redis
|
||||
mkdir /data
|
||||
|
@ -312,3 +365,171 @@ buildImage {
|
|||
```
|
||||
|
||||
Creating base files like `/etc/passwd` or `/etc/login.defs` is necessary for shadow-utils to manipulate users and groups.
|
||||
|
||||
## fakeNss {#ssec-pkgs-dockerTools-fakeNss}
|
||||
|
||||
If your primary goal is providing a basic skeleton for user lookups to work,
|
||||
and/or a lesser privileged user, adding `pkgs.fakeNss` to
|
||||
the container image root might be the better choice than a custom script
|
||||
running `useradd` and friends.
|
||||
|
||||
It provides a `/etc/passwd` and `/etc/group`, containing `root` and `nobody`
|
||||
users and groups.
|
||||
|
||||
It also provides a `/etc/nsswitch.conf`, configuring NSS host resolution to
|
||||
first check `/etc/hosts`, before checking DNS, as the default in the absence of
|
||||
a config file (`dns [!UNAVAIL=return] files`) is quite unexpected.
|
||||
|
||||
You can pair it with `binSh`, which provides `bin/sh` as a symlink
|
||||
to `bashInteractive` (as `/bin/sh` is configured as a shell).
|
||||
|
||||
```nix
|
||||
buildImage {
|
||||
name = "shadow-basic";
|
||||
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "image-root";
|
||||
paths = [ binSh pkgs.fakeNss ];
|
||||
pathsToLink = [ "/bin" "/etc" "/var" ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## buildNixShellImage {#ssec-pkgs-dockerTools-buildNixShellImage}
|
||||
|
||||
Create a Docker image that sets up an environment similar to that of running `nix-shell` on a derivation.
|
||||
When run in Docker, this environment somewhat resembles the Nix sandbox typically used by `nix-build`, with a major difference being that access to the internet is allowed.
|
||||
It additionally also behaves like an interactive `nix-shell`, running things like `shellHook` and setting an interactive prompt.
|
||||
If the derivation is fully buildable (i.e. `nix-build` can be used on it), running `buildDerivation` inside such a Docker image will build the derivation, with all its outputs being available in the correct `/nix/store` paths, pointed to by the respective environment variables like `$out`, etc.
|
||||
|
||||
::: {.warning}
|
||||
The behavior doesn't match `nix-shell` or `nix-build` exactly and this function is known not to work correctly for e.g. fixed-output derivations, content-addressed derivations, impure derivations and other special types of derivations.
|
||||
:::
|
||||
|
||||
### Arguments
|
||||
|
||||
`drv`
|
||||
|
||||
: The derivation on which to base the Docker image.
|
||||
|
||||
Adding packages to the Docker image is possible by e.g. extending the list of `nativeBuildInputs` of this derivation like
|
||||
|
||||
```nix
|
||||
buildNixShellImage {
|
||||
drv = someDrv.overrideAttrs (old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs or [] ++ [
|
||||
somethingExtra
|
||||
];
|
||||
});
|
||||
# ...
|
||||
}
|
||||
```
|
||||
|
||||
Similarly, you can extend the image initialization script by extending `shellHook`
|
||||
|
||||
`name` _optional_
|
||||
|
||||
: The name of the resulting image.
|
||||
|
||||
*Default:* `drv.name + "-env"`
|
||||
|
||||
`tag` _optional_
|
||||
|
||||
: Tag of the generated image.
|
||||
|
||||
*Default:* the resulting image derivation output path's hash
|
||||
|
||||
`uid`/`gid` _optional_
|
||||
|
||||
: The user/group ID to run the container as. This is like a `nixbld` build user.
|
||||
|
||||
*Default:* 1000/1000
|
||||
|
||||
`homeDirectory` _optional_
|
||||
|
||||
: The home directory of the user the container is running as
|
||||
|
||||
*Default:* `/build`
|
||||
|
||||
`shell` _optional_
|
||||
|
||||
: The path to the `bash` binary to use as the shell. This shell is started when running the image.
|
||||
|
||||
*Default:* `pkgs.bashInteractive + "/bin/bash"`
|
||||
|
||||
`command` _optional_
|
||||
|
||||
: Run this command in the environment of the derivation, in an interactive shell. See the `--command` option in the [`nix-shell` documentation](https://nixos.org/manual/nix/stable/command-ref/nix-shell.html?highlight=nix-shell#options).
|
||||
|
||||
*Default:* (none)
|
||||
|
||||
`run` _optional_
|
||||
|
||||
: Same as `command`, but runs the command in a non-interactive shell instead. See the `--run` option in the [`nix-shell` documentation](https://nixos.org/manual/nix/stable/command-ref/nix-shell.html?highlight=nix-shell#options).
|
||||
|
||||
*Default:* (none)
|
||||
|
||||
### Example
|
||||
|
||||
The following shows how to build the `pkgs.hello` package inside a Docker container built with `buildNixShellImage`.
|
||||
|
||||
```nix
|
||||
with import <nixpkgs> {};
|
||||
dockerTools.buildNixShellImage {
|
||||
drv = hello;
|
||||
}
|
||||
```
|
||||
|
||||
Build the derivation:
|
||||
|
||||
```console
|
||||
nix-build hello.nix
|
||||
```
|
||||
|
||||
these 8 derivations will be built:
|
||||
/nix/store/xmw3a5ln29rdalavcxk1w3m4zb2n7kk6-nix-shell-rc.drv
|
||||
...
|
||||
Creating layer 56 from paths: ['/nix/store/crpnj8ssz0va2q0p5ibv9i6k6n52gcya-stdenv-linux']
|
||||
Creating layer 57 with customisation...
|
||||
Adding manifests...
|
||||
Done.
|
||||
/nix/store/cpyn1lc897ghx0rhr2xy49jvyn52bazv-hello-2.12-env.tar.gz
|
||||
|
||||
Load the image:
|
||||
|
||||
```console
|
||||
docker load -i result
|
||||
```
|
||||
|
||||
0d9f4c4cd109: Loading layer [==================================================>] 2.56MB/2.56MB
|
||||
...
|
||||
ab1d897c0697: Loading layer [==================================================>] 10.24kB/10.24kB
|
||||
Loaded image: hello-2.12-env:pgj9h98nal555415faa43vsydg161bdz
|
||||
|
||||
Run the container:
|
||||
|
||||
```console
|
||||
docker run -it hello-2.12-env:pgj9h98nal555415faa43vsydg161bdz
|
||||
```
|
||||
|
||||
[nix-shell:/build]$
|
||||
|
||||
In the running container, run the build:
|
||||
|
||||
```console
|
||||
buildDerivation
|
||||
```
|
||||
|
||||
unpacking sources
|
||||
unpacking source archive /nix/store/8nqv6kshb3vs5q5bs2k600xpj5bkavkc-hello-2.12.tar.gz
|
||||
...
|
||||
patching script interpreter paths in /nix/store/z5wwy5nagzy15gag42vv61c2agdpz2f2-hello-2.12
|
||||
checking for references to /build/ in /nix/store/z5wwy5nagzy15gag42vv61c2agdpz2f2-hello-2.12...
|
||||
|
||||
Check the build result:
|
||||
|
||||
```console
|
||||
$out/bin/hello
|
||||
```
|
||||
|
||||
Hello, world!
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# pkgs.ociTools {#sec-pkgs-ociTools}
|
||||
|
||||
`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.
|
||||
`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.
|
||||
|
||||
## buildContainer {#ssec-pkgs-ociTools-buildContainer}
|
||||
|
||||
This function creates a simple OCI container that runs a single command inside of it. An OCI container consists of a `config.json` and a rootfs directory.The nix store of the container will contain all referenced dependencies of the given command.
|
||||
This function creates a simple OCI container that runs a single command inside of it. An OCI container consists of a `config.json` and a rootfs directory. The nix store of the container will contain all referenced dependencies of the given command.
|
||||
|
||||
The parameters of `buildContainer` with an example value are described below:
|
||||
|
||||
|
@ -30,7 +30,7 @@ buildContainer {
|
|||
}
|
||||
```
|
||||
|
||||
- `args` specifies a set of arguments to run inside the container. This is the only required argument for `buildContainer`. All referenced packages inside the derivation will be made available inside the container
|
||||
- `args` specifies a set of arguments to run inside the container. This is the only required argument for `buildContainer`. All referenced packages inside the derivation will be made available inside the container.
|
||||
|
||||
- `mounts` specifies additional mount points chosen by the user. By default only a minimal set of necessary filesystems are mounted into the container (e.g procfs, cgroupfs)
|
||||
|
||||
|
|
81
doc/builders/images/portableservice.section.md
Normal file
81
doc/builders/images/portableservice.section.md
Normal file
|
@ -0,0 +1,81 @@
|
|||
# pkgs.portableService {#sec-pkgs-portableService}
|
||||
|
||||
`pkgs.portableService` is a function to create _portable service images_,
|
||||
as read-only, immutable, `squashfs` archives.
|
||||
|
||||
systemd supports a concept of [Portable Services](https://systemd.io/PORTABLE_SERVICES/).
|
||||
Portable Services are a delivery method for system services that uses two specific features of container management:
|
||||
|
||||
* Applications are bundled. I.e. multiple services, their binaries and
|
||||
all their dependencies are packaged in an image, and are run directly from it.
|
||||
* Stricter default security policies, i.e. sandboxing of applications.
|
||||
|
||||
This allows using Nix to build images which can be run on many recent Linux distributions.
|
||||
|
||||
The primary tool for interacting with Portable Services is `portablectl`,
|
||||
and they are managed by the `systemd-portabled` system service.
|
||||
|
||||
::: {.note}
|
||||
Portable services are supported starting with systemd 239 (released on 2018-06-22).
|
||||
:::
|
||||
|
||||
A very simple example of using `portableService` is described below:
|
||||
|
||||
[]{#ex-pkgs-portableService}
|
||||
|
||||
```nix
|
||||
pkgs.portableService {
|
||||
pname = "demo";
|
||||
version = "1.0";
|
||||
units = [ demo-service demo-socket ];
|
||||
}
|
||||
```
|
||||
|
||||
The above example will build an squashfs archive image in `result/$pname_$version.raw`. The image will contain the
|
||||
file system structure as required by the portable service specification, and a subset of the Nix store with all the
|
||||
dependencies of the two derivations in the `units` list.
|
||||
`units` must be a list of derivations, and their names must be prefixed with the service name (`"demo"` in this case).
|
||||
Otherwise `systemd-portabled` will ignore them.
|
||||
|
||||
::: {.note}
|
||||
The `.raw` file extension of the image is required by the portable services specification.
|
||||
:::
|
||||
|
||||
Some other options available are:
|
||||
- `description`, `homepage`
|
||||
|
||||
Are added to the `/etc/os-release` in the image and are shown by the portable services tooling.
|
||||
Default to empty values, not added to os-release.
|
||||
- `symlinks`
|
||||
|
||||
A list of attribute sets {object, symlink}. Symlinks will be created in the root filesystem of the image to
|
||||
objects in the Nix store. Defaults to an empty list.
|
||||
- `contents`
|
||||
|
||||
A list of additional derivations to be included in the image Nix store, as-is. Defaults to an empty list.
|
||||
- `squashfsTools`
|
||||
|
||||
Defaults to `pkgs.squashfsTools`, allows you to override the package that provides `mksquashfs`.
|
||||
- `squash-compression`, `squash-block-size`
|
||||
|
||||
Options to `mksquashfs`. Default to `"xz -Xdict-size 100%"` and `"1M"` respectively.
|
||||
|
||||
A typical usage of `symlinks` would be:
|
||||
```nix
|
||||
symlinks = [
|
||||
{ object = "${pkgs.cacert}/etc/ssl"; symlink = "/etc/ssl"; }
|
||||
{ object = "${pkgs.bash}/bin/bash"; symlink = "/bin/sh"; }
|
||||
{ object = "${pkgs.php}/bin/php"; symlink = "/usr/bin/php"; }
|
||||
];
|
||||
```
|
||||
to create these symlinks for legacy applications that assume them existing globally.
|
||||
|
||||
Once the image is created, and deployed on a host in `/var/lib/portables/`, you can attach the image and run the service. As root run:
|
||||
```console
|
||||
portablectl attach demo_1.0.raw
|
||||
systemctl enable --now demo.socket
|
||||
systemctl enable --now demo.service
|
||||
```
|
||||
::: {.note}
|
||||
See the [man page](https://www.freedesktop.org/software/systemd/man/portablectl.html) of `portablectl` for more info on its usage.
|
||||
:::
|
|
@ -33,7 +33,7 @@ in snapTools.makeSnap {
|
|||
|
||||
## Build a Graphical Snap {#ssec-pkgs-snapTools-build-a-snap-firefox}
|
||||
|
||||
Graphical programs require many more integrations with the host. This example uses Firefox as an example, because it is one of the most complicated programs we could package.
|
||||
Graphical programs require many more integrations with the host. This example uses Firefox as an example because it is one of the most complicated programs we could package.
|
||||
|
||||
``` {#ex-snapTools-buildSnap-firefox .nix}
|
||||
let
|
||||
|
|
|
@ -4,13 +4,13 @@ The [Citrix Workspace App](https://www.citrix.com/products/workspace-app/) is a
|
|||
|
||||
## Basic usage {#sec-citrix-base}
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Citrix Selfservice {#sec-citrix-selfservice}
|
||||
## Citrix Self-service {#sec-citrix-selfservice}
|
||||
|
||||
The [selfservice](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.
|
||||
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.
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
```ShellSession
|
||||
$ storebrowse -C ~/Downloads/receiverconfig.cr
|
||||
|
@ -19,7 +19,7 @@ $ selfservice
|
|||
|
||||
## Custom certificates {#sec-citrix-custom-certs}
|
||||
|
||||
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`:
|
||||
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`:
|
||||
|
||||
```nix
|
||||
with import <nixpkgs> { config.allowUnfree = true; };
|
||||
|
|
|
@ -8,9 +8,9 @@ Nixpkgs provides a number of packages that will install Eclipse in its various f
|
|||
$ nix-env -f '<nixpkgs>' -qaP -A eclipses --description
|
||||
```
|
||||
|
||||
Once an Eclipse variant is installed it can be run using the `eclipse` command, as expected. From within Eclipse it is then possible to install plugins in the usual manner by either manually specifying an Eclipse update site or by installing the Marketplace Client plugin and using it to discover and install other plugins. This installation method provides an Eclipse installation that closely resemble a manually installed Eclipse.
|
||||
Once an Eclipse variant is installed, it can be run using the `eclipse` command, as expected. From within Eclipse, it is then possible to install plugins in the usual manner by either manually specifying an Eclipse update site or by installing the Marketplace Client plugin and using it to discover and install other plugins. This installation method provides an Eclipse installation that closely resemble a manually installed Eclipse.
|
||||
|
||||
If you prefer to install plugins in a more declarative manner then Nixpkgs also offer a number of Eclipse plugins that can be installed in an _Eclipse environment_. This type of environment is created using the function `eclipseWithPlugins` found inside the `nixpkgs.eclipses` attribute set. This function takes as argument `{ eclipse, plugins ? [], jvmArgs ? [] }` where `eclipse` is a one of the Eclipse packages described above, `plugins` is a list of plugin derivations, and `jvmArgs` is a list of arguments given to the JVM running the Eclipse. For example, say you wish to install the latest Eclipse Platform with the popular Eclipse Color Theme plugin and also allow Eclipse to use more RAM. You could then add
|
||||
If you prefer to install plugins in a more declarative manner, then Nixpkgs also offer a number of Eclipse plugins that can be installed in an _Eclipse environment_. This type of environment is created using the function `eclipseWithPlugins` found inside the `nixpkgs.eclipses` attribute set. This function takes as argument `{ eclipse, plugins ? [], jvmArgs ? [] }` where `eclipse` is a one of the Eclipse packages described above, `plugins` is a list of plugin derivations, and `jvmArgs` is a list of arguments given to the JVM running the Eclipse. For example, say you wish to install the latest Eclipse Platform with the popular Eclipse Color Theme plugin and also allow Eclipse to use more RAM. You could then add:
|
||||
|
||||
```nix
|
||||
packageOverrides = pkgs: {
|
||||
|
@ -22,15 +22,15 @@ packageOverrides = pkgs: {
|
|||
}
|
||||
```
|
||||
|
||||
to your Nixpkgs configuration (`~/.config/nixpkgs/config.nix`) and install it by running `nix-env -f '<nixpkgs>' -iA myEclipse` and afterward run Eclipse as usual. It is possible to find out which plugins are available for installation using `eclipseWithPlugins` by running
|
||||
to your Nixpkgs configuration (`~/.config/nixpkgs/config.nix`) and install it by running `nix-env -f '<nixpkgs>' -iA myEclipse` and afterward run Eclipse as usual. It is possible to find out which plugins are available for installation using `eclipseWithPlugins` by running:
|
||||
|
||||
```ShellSession
|
||||
$ nix-env -f '<nixpkgs>' -qaP -A eclipses.plugins --description
|
||||
```
|
||||
|
||||
If there is a need to install plugins that are not available in Nixpkgs then it may be possible to define these plugins outside Nixpkgs using the `buildEclipseUpdateSite` and `buildEclipsePlugin` functions found in the `nixpkgs.eclipses.plugins` attribute set. Use the `buildEclipseUpdateSite` function to install a plugin distributed as an Eclipse update site. This function takes `{ name, src }` as argument where `src` indicates the Eclipse update site archive. All Eclipse features and plugins within the downloaded update site will be installed. When an update site archive is not available then the `buildEclipsePlugin` function can be used to install a plugin that consists of a pair of feature and plugin JARs. This function takes an argument `{ name, srcFeature, srcPlugin }` where `srcFeature` and `srcPlugin` are the feature and plugin JARs, respectively.
|
||||
If there is a need to install plugins that are not available in Nixpkgs then it may be possible to define these plugins outside Nixpkgs using the `buildEclipseUpdateSite` and `buildEclipsePlugin` functions found in the `nixpkgs.eclipses.plugins` attribute set. Use the `buildEclipseUpdateSite` function to install a plugin distributed as an Eclipse update site. This function takes `{ name, src }` as argument, where `src` indicates the Eclipse update site archive. All Eclipse features and plugins within the downloaded update site will be installed. When an update site archive is not available, then the `buildEclipsePlugin` function can be used to install a plugin that consists of a pair of feature and plugin JARs. This function takes an argument `{ name, srcFeature, srcPlugin }` where `srcFeature` and `srcPlugin` are the feature and plugin JARs, respectively.
|
||||
|
||||
Expanding the previous example with two plugins using the above functions we have
|
||||
Expanding the previous example with two plugins using the above functions, we have:
|
||||
|
||||
```nix
|
||||
packageOverrides = pkgs: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Elm {#sec-elm}
|
||||
|
||||
To start a development environment do
|
||||
To start a development environment, run:
|
||||
|
||||
```ShellSession
|
||||
nix-shell -p elmPackages.elm elmPackages.elm-format
|
||||
|
|
|
@ -20,7 +20,7 @@ The Emacs package comes with some extra helpers to make it easier to configure.
|
|||
}
|
||||
```
|
||||
|
||||
You can install it like any other packages via `nix-env -iA myEmacs`. However, this will only install those packages. It will not `configure` them for us. To do this, we need to provide a configuration file. Luckily, it is possible to do this from within Nix! By modifying the above example, we can make Emacs load a custom config file. The key is to create a package that provide a `default.el` file in `/share/emacs/site-start/`. Emacs knows to load this file automatically when it starts.
|
||||
You can install it like any other packages via `nix-env -iA myEmacs`. However, this will only install those packages. It will not `configure` them for us. To do this, we need to provide a configuration file. Luckily, it is possible to do this from within Nix! By modifying the above example, we can make Emacs load a custom config file. The key is to create a package that provides a `default.el` file in `/share/emacs/site-start/`. Emacs knows to load this file automatically when it starts.
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -101,9 +101,9 @@ You can install it like any other packages via `nix-env -iA myEmacs`. However, t
|
|||
}
|
||||
```
|
||||
|
||||
This provides a fairly full Emacs start file. It will load in addition to the user's presonal config. You can always disable it by passing `-q` to the Emacs command.
|
||||
This provides a fairly full Emacs start file. It will load in addition to the user's personal config. You can always disable it by passing `-q` to the Emacs command.
|
||||
|
||||
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'`.
|
||||
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'`.
|
||||
|
||||
```nix
|
||||
overrides = self: super: rec {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# /etc files {#etc}
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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 varaibles `NIX_ETC_PROTOCOLS` and `NIX_ETC_SERVICES` to the corresponding files in the package through a _setup-hook_.
|
||||
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.
|
||||
|
||||
|
||||
```bash
|
||||
|
@ -15,4 +15,4 @@ NIX_ETC_SERVICES=/nix/store/aj866hr8fad8flnggwdhrldm0g799ccz-iana-etc-20210225/e
|
|||
NIX_ETC_PROTOCOLS=/nix/store/aj866hr8fad8flnggwdhrldm0g799ccz-iana-etc-20210225/etc/protocols
|
||||
```
|
||||
|
||||
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 variable are *not set*, then it will attempt to find the files at the default location within _/etc_.
|
||||
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`.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Build wrapped Firefox with extensions and policies {#build-wrapped-firefox-with-extensions-and-policies}
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -30,6 +30,10 @@ The `wrapFirefox` function allows to pass policies, preferences and extension th
|
|||
ExtensionRecommendations = false;
|
||||
SkipOnboarding = true;
|
||||
};
|
||||
SecurityDevices = {
|
||||
# Use a proxy module rather than `nixpkgs.config.firefox.smartcardSupport = true`
|
||||
"PKCS#11 Proxy Module" = "${pkgs.p11-kit}/lib/p11-kit-proxy.so";
|
||||
};
|
||||
};
|
||||
|
||||
extraPrefs = ''
|
||||
|
@ -40,13 +44,12 @@ The `wrapFirefox` function allows to pass policies, preferences and extension th
|
|||
}
|
||||
```
|
||||
|
||||
If `nixExtensions != null` then all manually installed addons will be uninstalled from your browser profile.
|
||||
To view available enterprise policies visit [enterprise policies](https://github.com/mozilla/policy-templates#enterprisepoliciesenabled)
|
||||
or type into the Firefox url bar: `about:policies#documentation`.
|
||||
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.
|
||||
If `nixExtensions != null`, then all manually installed add-ons will be uninstalled from your browser profile.
|
||||
To view available enterprise policies, visit [enterprise policies](https://github.com/mozilla/policy-templates#enterprisepoliciesenabled)
|
||||
or type into the Firefox URL bar: `about:policies#documentation`.
|
||||
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.
|
||||
|
||||
## Troubleshooting {#sec-firefox-troubleshooting}
|
||||
If addons 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 addons thus nix addons get disabled by the normal Firefox binary.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
|
|
@ -36,7 +36,7 @@ using `buildFishPlugin` and running unit tests with the `fishtape` test runner.
|
|||
## Fish wrapper {#sec-fish-wrapper}
|
||||
|
||||
The `wrapFish` package is a wrapper around Fish which can be used to create
|
||||
Fish shells initialised with some plugins as well as completions, configuration
|
||||
Fish shells initialized with some plugins as well as completions, configuration
|
||||
snippets and functions sourced from the given paths. This provides a convenient
|
||||
way to test Fish plugins and scripts without having to alter the environment.
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ packages on macOS:
|
|||
checking for fuse.h... no
|
||||
configure: error: No fuse.h found.
|
||||
|
||||
This happens on autoconf based projects that uses `AC_CHECK_HEADERS` or
|
||||
This happens on autoconf based projects that use `AC_CHECK_HEADERS` or
|
||||
`AC_CHECK_LIBS` to detect libfuse, and will occur even when the `fuse` package
|
||||
is included in `buildInputs`. It happens because libfuse headers throw an error
|
||||
on macOS if the `FUSE_USE_VERSION` macro is undefined. Many proejcts do define
|
||||
on macOS if the `FUSE_USE_VERSION` macro is undefined. Many projects do define
|
||||
`FUSE_USE_VERSION`, but only inside C source files. This results in the above
|
||||
error at configure time because the configure script would attempt to compile
|
||||
sample FUSE programs without defining `FUSE_USE_VERSION`.
|
||||
|
|
|
@ -6,7 +6,7 @@ This package is an ibus-based completion method to speed up typing.
|
|||
|
||||
IBus needs to be configured accordingly to activate `typing-booster`. The configuration depends on the desktop manager in use. For detailed instructions, please refer to the [upstream docs](https://mike-fabian.github.io/ibus-typing-booster/documentation.html).
|
||||
|
||||
On NixOS you need to explicitly enable `ibus` with given engines before customizing your desktop to use `typing-booster`. This can be achieved using the `ibus` module:
|
||||
On NixOS, you need to explicitly enable `ibus` with given engines before customizing your desktop to use `typing-booster`. This can be achieved using the `ibus` module:
|
||||
|
||||
```nix
|
||||
{ pkgs, ... }: {
|
||||
|
@ -19,7 +19,7 @@ On NixOS you need to explicitly enable `ibus` with given engines before customiz
|
|||
|
||||
## Using custom hunspell dictionaries {#sec-ibus-typing-booster-customize-hunspell}
|
||||
|
||||
The IBus engine is based on `hunspell` to support completion in many languages. By default the dictionaries `de-de`, `en-us`, `fr-moderne` `es-es`, `it-it`, `sv-se` and `sv-fi` are in use. To add another dictionary, the package can be overridden like this:
|
||||
The IBus engine is based on `hunspell` to support completion in many languages. By default, the dictionaries `de-de`, `en-us`, `fr-moderne` `es-es`, `it-it`, `sv-se` and `sv-fi` are in use. To add another dictionary, the package can be overridden like this:
|
||||
|
||||
```nix
|
||||
ibus-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
|
|||
|
||||
The `ibus-engines.typing-booster` package contains a program named `emoji-picker`. To display all emojis correctly, a special font such as `noto-fonts-emoji` is needed:
|
||||
|
||||
On NixOS it can be installed using the following expression:
|
||||
On NixOS, it can be installed using the following expression:
|
||||
|
||||
```nix
|
||||
{ pkgs, ... }: { fonts.fonts = with pkgs; [ noto-fonts-emoji ]; }
|
||||
|
|
|
@ -4,7 +4,7 @@ The Nix expressions to build the Linux kernel are in [`pkgs/os-specific/linux/ke
|
|||
|
||||
The function that builds the kernel has an argument `kernelPatches` which should be a list of `{name, patch, extraConfig}` attribute sets, where `name` is the name of the patch (which is included in the kernel’s `meta.description` attribute), `patch` is the patch itself (possibly compressed), and `extraConfig` (optional) is a string specifying extra options to be concatenated to the kernel configuration file (`.config`).
|
||||
|
||||
The kernel derivation exports an attribute `features` specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the `iwlwifi` feature (i.e. has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external `iwlwifi` package:
|
||||
The kernel derivation exports an attribute `features` specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the `iwlwifi` feature (i.e., has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external `iwlwifi` package:
|
||||
|
||||
```nix
|
||||
modulesTree = [kernel]
|
||||
|
@ -14,19 +14,19 @@ modulesTree = [kernel]
|
|||
|
||||
How to add a new (major) version of the Linux kernel to Nixpkgs:
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
2. Add the new kernel to the `kernels` attribute set in `linux-kernels.nix` (e.g., create an attribute `kernel_2_6_22`).
|
||||
|
||||
3. 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:
|
||||
|
||||
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`).
|
||||
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`).
|
||||
|
||||
2. Copy the config file for this platform (e.g. `config-2.6.22-i686-smp`) to `.config` in the kernel source tree.
|
||||
2. Copy the config file for this platform (e.g., `config-2.6.22-i686-smp`) to `.config` in the kernel source tree.
|
||||
|
||||
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`).
|
||||
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`).
|
||||
|
||||
4. If needed you can also run `make menuconfig`:
|
||||
4. If needed, you can also run `make menuconfig`:
|
||||
|
||||
```ShellSession
|
||||
$ nix-env -f "<nixpkgs>" -iA ncurses
|
||||
|
@ -34,7 +34,7 @@ How to add a new (major) version of the Linux kernel to Nixpkgs:
|
|||
$ make menuconfig ARCH=arch
|
||||
```
|
||||
|
||||
5. Copy `.config` over the new config file (e.g. `config-2.6.22-i686-smp`).
|
||||
5. Copy `.config` over the new config file (e.g., `config-2.6.22-i686-smp`).
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Locales {#locales}
|
||||
|
||||
To allow simultaneous use of packages linked against different versions of `glibc` with different locale archive formats Nixpkgs patches `glibc` to rely on `LOCALE_ARCHIVE` environment variable.
|
||||
To allow simultaneous use of packages linked against different versions of `glibc` with different locale archive formats, Nixpkgs patches `glibc` to rely on `LOCALE_ARCHIVE` environment variable.
|
||||
|
||||
On non-NixOS distributions this variable is obviously not set. This can cause regressions in language support or even crashes in some Nixpkgs-provided programs. The simplest way to mitigate this problem is exporting the `LOCALE_ARCHIVE` variable pointing to `${glibcLocales}/lib/locale/locale-archive`. The drawback (and the reason this is not the default) is the relatively large (a hundred MiB) size of the full set of locales. It is possible to build a custom set of locales by overriding parameters `allLocales` and `locales` of the package.
|
||||
On non-NixOS distributions, this variable is obviously not set. This can cause regressions in language support or even crashes in some Nixpkgs-provided programs. The simplest way to mitigate this problem is exporting the `LOCALE_ARCHIVE` variable pointing to `${glibcLocales}/lib/locale/locale-archive`. The drawback (and the reason this is not the default) is the relatively large (a hundred MiB) size of the full set of locales. It is possible to build a custom set of locales by overriding parameters `allLocales` and `locales` of the package.
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
## ETags on static files served from the Nix store {#sec-nginx-etag}
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
As of NixOS 19.09, the nginx package in Nixpkgs is patched such that when nginx serves a file out of `/nix/store`, the hash in the store path is used as the `ETag` header in the HTTP response, thus providing proper caching functionality. This happens automatically; you do not need to do modify any configuration to get this behavior.
|
||||
|
|
|
@ -12,4 +12,4 @@ The NixOS desktop or other non-headless configurations are the primary target fo
|
|||
|
||||
If you are using a non-NixOS GNU/Linux/X11 desktop with free software video drivers, consider launching OpenGL-dependent programs from Nixpkgs with Nixpkgs versions of `libglvnd` and `mesa.drivers` in `LD_LIBRARY_PATH`. For Mesa drivers, the Linux kernel version doesn't have to match nixpkgs.
|
||||
|
||||
For proprietary video drivers you might have luck with also adding the corresponding video driver package.
|
||||
For proprietary video drivers, you might have luck with also adding the corresponding video driver package.
|
||||
|
|
|
@ -4,7 +4,7 @@ Some packages provide the shell integration to be more useful. But unlike other
|
|||
|
||||
- `fzf` : `fzf-share`
|
||||
|
||||
E.g. `fzf` can then used in the `.bashrc` like this:
|
||||
E.g. `fzf` can then be used in the `.bashrc` like this:
|
||||
|
||||
```bash
|
||||
source "$(fzf-share)/completion.bash"
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
|
||||
## Steam in Nix {#sec-steam-nix}
|
||||
|
||||
Steam is distributed as a `.deb` file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called `steam` that in Ubuntu (their target distro) would go to `/usr/bin`. When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in \$HOME.
|
||||
Steam is distributed as a `.deb` file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called `steam` that in Ubuntu (their target distro) would go to `/usr/bin`. When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in `$HOME`.
|
||||
|
||||
Nix problems and constraints:
|
||||
|
||||
- We don't have `/bin/bash` and many scripts point there. Similarly for `/usr/bin/python`.
|
||||
- We don't have `/bin/bash` and many scripts point there. Same thing for `/usr/bin/python`.
|
||||
- We don't have the dynamic loader in `/lib`.
|
||||
- The `steam.sh` script in \$HOME can not be patched, as it is checked and rewritten by steam.
|
||||
- The `steam.sh` script in `$HOME` cannot be patched, as it is checked and rewritten by steam.
|
||||
- The steam binary cannot be patched, it's also checked.
|
||||
|
||||
The 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.
|
||||
|
||||
## How to play {#sec-steam-play}
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Troubleshooting {#sec-steam-troub}
|
||||
|
||||
|
@ -32,7 +32,7 @@ Use `programs.steam.enable = true;` if you want to add steam to systemPackages a
|
|||
- **Using the FOSS Radeon or nouveau (nvidia) drivers**
|
||||
|
||||
- The `newStdcpp` parameter was removed since NixOS 17.09 and should not be needed anymore.
|
||||
- Steam ships statically linked with a version of libcrypto that conflics with the one dynamically loaded by radeonsi_dri.so. If you get the error
|
||||
- Steam ships statically linked with a version of `libcrypto` that conflicts with the one dynamically loaded by radeonsi_dri.so. If you get the error:
|
||||
|
||||
```
|
||||
steam.sh: line 713: 7842 Segmentation fault (core dumped)
|
||||
|
@ -42,13 +42,13 @@ Use `programs.steam.enable = true;` if you want to add steam to systemPackages a
|
|||
|
||||
- **Java**
|
||||
|
||||
1. There is no java in steam chrootenv by default. If you get a message like
|
||||
1. There is no java in steam chrootenv by default. If you get a message like:
|
||||
|
||||
```
|
||||
/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found
|
||||
```
|
||||
|
||||
you need to add
|
||||
you need to add:
|
||||
|
||||
```nix
|
||||
steam.override { withJava = true; };
|
||||
|
@ -56,7 +56,7 @@ Use `programs.steam.enable = true;` if you want to add steam to systemPackages a
|
|||
|
||||
## steam-run {#sec-steam-run}
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
```
|
||||
steam-run ./foo
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<section xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="unfree-software">
|
||||
<title>Unfree software</title>
|
||||
|
||||
<para>
|
||||
All users of Nixpkgs are free software users, and many users (and developers) of Nixpkgs want to limit and tightly control their exposure to unfree software. At the same time, many users need (or want) to run some specific pieces of proprietary software. Nixpkgs includes some expressions for unfree software packages. By default unfree software cannot be installed and doesn’t show up in searches. To allow installing unfree software in a single Nix invocation one can export <literal>NIXPKGS_ALLOW_UNFREE=1</literal>. For a persistent solution, users can set <literal>allowUnfree</literal> in the Nixpkgs configuration.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Fine-grained control is possible by defining <literal>allowUnfreePredicate</literal> function in config; it takes the <literal>mkDerivation</literal> parameter attrset and returns <literal>true</literal> for unfree packages that should be allowed.
|
||||
</para>
|
||||
</section>
|
|
@ -4,7 +4,7 @@ Urxvt, also known as rxvt-unicode, is a highly customizable terminal emulator.
|
|||
|
||||
## Configuring urxvt {#sec-urxvt-conf}
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
```nix
|
||||
rxvt-unicode.override {
|
||||
|
@ -58,14 +58,14 @@ rxvt-unicode.override {
|
|||
|
||||
## Packaging urxvt plugins {#sec-urxvt-pkg}
|
||||
|
||||
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`.
|
||||
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`.
|
||||
|
||||
A 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.
|
||||
|
||||
If the plugin is itself a perl package that needs to be imported from other plugins or scripts, add the following passthrough:
|
||||
If the plugin is itself a Perl package that needs to be imported from other plugins or scripts, add the following passthrough:
|
||||
|
||||
```nix
|
||||
passthru.perlPackages = [ "self" ];
|
||||
```
|
||||
|
||||
This will make the urxvt wrapper pick up the dependency and set up the perl path accordingly.
|
||||
This will make the urxvt wrapper pick up the dependency and set up the Perl path accordingly.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Weechat {#sec-weechat}
|
||||
# WeeChat {#sec-weechat}
|
||||
|
||||
Weechat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration such as
|
||||
WeeChat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration, such as:
|
||||
|
||||
```nix
|
||||
weechat.override {configure = {availablePlugins, ...}: {
|
||||
|
@ -13,7 +13,7 @@ If the `configure` function returns an attrset without the `plugins` attribute,
|
|||
|
||||
The plugins currently available are `python`, `perl`, `ruby`, `guile`, `tcl` and `lua`.
|
||||
|
||||
The python and perl plugins allows the addition of extra libraries. For instance, the `inotify.py` script in `weechat-scripts` requires D-Bus or libnotify, and the `fish.py` script requires `pycrypto`. To use these scripts, use the plugin's `withPackages` attribute:
|
||||
The Python and Perl plugins allows the addition of extra libraries. For instance, the `inotify.py` script in `weechat-scripts` requires D-Bus or libnotify, and the `fish.py` script requires `pycrypto`. To use these scripts, use the plugin's `withPackages` attribute:
|
||||
|
||||
```nix
|
||||
weechat.override { configure = {availablePlugins, ...}: {
|
||||
|
@ -49,7 +49,7 @@ weechat.override {
|
|||
|
||||
Further values can be added to the list of commands when running `weechat --run-command "your-commands"`.
|
||||
|
||||
Additionally it's possible to specify scripts to be loaded when starting `weechat`. These will be loaded before the commands from `init`:
|
||||
Additionally, it's possible to specify scripts to be loaded when starting `weechat`. These will be loaded before the commands from `init`:
|
||||
|
||||
```nix
|
||||
weechat.override {
|
||||
|
@ -64,7 +64,7 @@ weechat.override {
|
|||
}
|
||||
```
|
||||
|
||||
In `nixpkgs` there's a subpackage which contains derivations for WeeChat scripts. Such derivations expect a `passthru.scripts` attribute which contains a list of all scripts inside the store path. Furthermore all scripts have to live in `$out/share`. An exemplary derivation looks like this:
|
||||
In `nixpkgs` there's a subpackage which contains derivations for WeeChat scripts. Such derivations expect a `passthru.scripts` attribute, which contains a list of all scripts inside the store path. Furthermore, all scripts have to live in `$out/share`. An exemplary derivation looks like this:
|
||||
|
||||
```nix
|
||||
{ stdenv, fetchurl }:
|
||||
|
|
|
@ -7,5 +7,4 @@
|
|||
</para>
|
||||
<xi:include href="special/fhs-environments.section.xml" />
|
||||
<xi:include href="special/mkshell.section.xml" />
|
||||
<xi:include href="special/invalidateFetcherByDrvHash.section.xml" />
|
||||
</chapter>
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
## `invalidateFetcherByDrvHash` {#sec-pkgs-invalidateFetcherByDrvHash}
|
||||
|
||||
Use the derivation hash to invalidate the output via name, for testing.
|
||||
|
||||
Type: `(a@{ name, ... } -> Derivation) -> a -> Derivation`
|
||||
|
||||
Normally, fixed output derivations can and should be cached by their output
|
||||
hash only, but for testing we want to re-fetch everytime the fetcher changes.
|
||||
|
||||
Changes to the fetcher become apparent in the drvPath, which is a hash of
|
||||
how to fetch, rather than a fixed store path.
|
||||
By inserting this hash into the name, we can make sure to re-run the fetcher
|
||||
every time the fetcher changes.
|
||||
|
||||
This relies on the assumption that Nix isn't clever enough to reuse its
|
||||
database of local store contents to optimize fetching.
|
||||
|
||||
You might notice that the "salted" name derives from the normal invocation,
|
||||
not the final derivation. `invalidateFetcherByDrvHash` has to invoke the fetcher
|
||||
function twice: once to get a derivation hash, and again to produce the final
|
||||
fixed output derivation.
|
||||
|
||||
Example:
|
||||
|
||||
tests.fetchgit = invalidateFetcherByDrvHash fetchgit {
|
||||
name = "nix-source";
|
||||
url = "https://github.com/NixOS/nix";
|
||||
rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
|
||||
sha256 = "sha256-7DszvbCNTjpzGRmpIVAWXk20P0/XTrWZ79KSOGLrUWY=";
|
||||
};
|
198
doc/builders/testers.chapter.md
Normal file
198
doc/builders/testers.chapter.md
Normal file
|
@ -0,0 +1,198 @@
|
|||
# Testers {#chap-testers}
|
||||
This chapter describes several testing builders which are available in the <literal>testers</literal> namespace.
|
||||
|
||||
## `testVersion` {#tester-testVersion}
|
||||
|
||||
Checks the command output contains the specified version
|
||||
|
||||
Although simplistic, this test assures that the main program
|
||||
can run. While there's no substitute for a real test case,
|
||||
it does catch dynamic linking errors and such. It also provides
|
||||
some protection against accidentally building the wrong version,
|
||||
for example when using an 'old' hash in a fixed-output derivation.
|
||||
|
||||
Examples:
|
||||
|
||||
```nix
|
||||
passthru.tests.version = testers.testVersion { package = hello; };
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = seaweedfs;
|
||||
command = "weed version";
|
||||
};
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = key;
|
||||
command = "KeY --help";
|
||||
# Wrong '2.5' version in the code. Drop on next version.
|
||||
version = "2.5";
|
||||
};
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = ghr;
|
||||
# The output needs to contain the 'version' string without any prefix or suffix.
|
||||
version = "v${version}";
|
||||
};
|
||||
```
|
||||
|
||||
## `testBuildFailure` {#tester-testBuildFailure}
|
||||
|
||||
Make sure that a build does not succeed. This is useful for testing testers.
|
||||
|
||||
This returns a derivation with an override on the builder, with the following effects:
|
||||
|
||||
- Fail the build when the original builder succeeds
|
||||
- Move `$out` to `$out/result`, if it exists (assuming `out` is the default output)
|
||||
- Save the build log to `$out/testBuildFailure.log` (same)
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
runCommand "example" {
|
||||
failed = testers.testBuildFailure (runCommand "fail" {} ''
|
||||
echo ok-ish >$out
|
||||
echo failing though
|
||||
exit 3
|
||||
'');
|
||||
} ''
|
||||
grep -F 'ok-ish' $failed/result
|
||||
grep -F 'failing though' $failed/testBuildFailure.log
|
||||
[[ 3 = $(cat $failed/testBuildFailure.exit) ]]
|
||||
touch $out
|
||||
'';
|
||||
```
|
||||
|
||||
While `testBuildFailure` is designed to keep changes to the original builder's
|
||||
environment to a minimum, some small changes are inevitable.
|
||||
|
||||
- The file `$TMPDIR/testBuildFailure.log` is present. It should not be deleted.
|
||||
- `stdout` and `stderr` are a pipe instead of a tty. This could be improved.
|
||||
- One or two extra processes are present in the sandbox during the original
|
||||
builder's execution.
|
||||
- The derivation and output hashes are different, but not unusual.
|
||||
- The derivation includes a dependency on `buildPackages.bash` and
|
||||
`expect-failure.sh`, which is built to include a transitive dependency on
|
||||
`buildPackages.coreutils` and possibly more. These are not added to `PATH`
|
||||
or any other environment variable, so they should be hard to observe.
|
||||
|
||||
## `testEqualContents` {#tester-equalContents}
|
||||
|
||||
Check that two paths have the same contents.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
testers.testEqualContents {
|
||||
assertion = "sed -e performs replacement";
|
||||
expected = writeText "expected" ''
|
||||
foo baz baz
|
||||
'';
|
||||
actual = runCommand "actual" {
|
||||
# not really necessary for a package that's in stdenv
|
||||
nativeBuildInputs = [ gnused ];
|
||||
base = writeText "base" ''
|
||||
foo bar baz
|
||||
'';
|
||||
} ''
|
||||
sed -e 's/bar/baz/g' $base >$out
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
## `testEqualDerivation` {#tester-testEqualDerivation}
|
||||
|
||||
Checks that two packages produce the exact same build instructions.
|
||||
|
||||
This can be used to make sure that a certain difference of configuration,
|
||||
such as the presence of an overlay does not cause a cache miss.
|
||||
|
||||
When the derivations are equal, the return value is an empty file.
|
||||
Otherwise, the build log explains the difference via `nix-diff`.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
testers.testEqualDerivation
|
||||
"The hello package must stay the same when enabling checks."
|
||||
hello
|
||||
(hello.overrideAttrs(o: { doCheck = true; }))
|
||||
```
|
||||
|
||||
## `invalidateFetcherByDrvHash` {#tester-invalidateFetcherByDrvHash}
|
||||
|
||||
Use the derivation hash to invalidate the output via name, for testing.
|
||||
|
||||
Type: `(a@{ name, ... } -> Derivation) -> a -> Derivation`
|
||||
|
||||
Normally, fixed output derivations can and should be cached by their output
|
||||
hash only, but for testing we want to re-fetch everytime the fetcher changes.
|
||||
|
||||
Changes to the fetcher become apparent in the drvPath, which is a hash of
|
||||
how to fetch, rather than a fixed store path.
|
||||
By inserting this hash into the name, we can make sure to re-run the fetcher
|
||||
every time the fetcher changes.
|
||||
|
||||
This relies on the assumption that Nix isn't clever enough to reuse its
|
||||
database of local store contents to optimize fetching.
|
||||
|
||||
You might notice that the "salted" name derives from the normal invocation,
|
||||
not the final derivation. `invalidateFetcherByDrvHash` has to invoke the fetcher
|
||||
function twice: once to get a derivation hash, and again to produce the final
|
||||
fixed output derivation.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
tests.fetchgit = testers.invalidateFetcherByDrvHash fetchgit {
|
||||
name = "nix-source";
|
||||
url = "https://github.com/NixOS/nix";
|
||||
rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
|
||||
sha256 = "sha256-7DszvbCNTjpzGRmpIVAWXk20P0/XTrWZ79KSOGLrUWY=";
|
||||
};
|
||||
```
|
||||
|
||||
## `nixosTest` {#tester-nixosTest}
|
||||
|
||||
Run a NixOS VM network test using this evaluation of Nixpkgs.
|
||||
|
||||
NOTE: This function is primarily for external use. NixOS itself uses `make-test-python.nix` directly. Packages defined in Nixpkgs [reuse NixOS tests via `nixosTests`, plural](#ssec-nixos-tests-linking).
|
||||
|
||||
It is mostly equivalent to the function `import ./make-test-python.nix` from the
|
||||
[NixOS manual](https://nixos.org/nixos/manual/index.html#sec-nixos-tests),
|
||||
except that the current application of Nixpkgs (`pkgs`) will be used, instead of
|
||||
letting NixOS invoke Nixpkgs anew.
|
||||
|
||||
If a test machine needs to set NixOS options under `nixpkgs`, it must set only the
|
||||
`nixpkgs.pkgs` option.
|
||||
|
||||
### Parameter
|
||||
|
||||
A [NixOS VM test network](https://nixos.org/nixos/manual/index.html#sec-nixos-tests), or path to it. Example:
|
||||
|
||||
```nix
|
||||
{
|
||||
name = "my-test";
|
||||
nodes = {
|
||||
machine1 = { lib, pkgs, nodes, ... }: {
|
||||
environment.systemPackages = [ pkgs.hello ];
|
||||
services.foo.enable = true;
|
||||
};
|
||||
# machine2 = ...;
|
||||
};
|
||||
testScript = ''
|
||||
start_all()
|
||||
machine1.wait_for_unit("foo.service")
|
||||
machine1.succeed("hello | foo-send")
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
### Result
|
||||
|
||||
A derivation that runs the VM test.
|
||||
|
||||
Notable attributes:
|
||||
|
||||
* `nodes`: the evaluated NixOS configurations. Useful for debugging and exploring the configuration.
|
||||
|
||||
* `driverInteractive`: a script that launches an interactive Python session in the context of the `testScript`.
|
|
@ -35,10 +35,10 @@ This works just like `runCommand`. The only difference is that it also provides
|
|||
|
||||
## `runCommandLocal` {#trivial-builder-runCommandLocal}
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
::: {.note}
|
||||
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`.
|
||||
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`.
|
||||
:::
|
||||
|
||||
## `writeTextFile`, `writeText`, `writeTextDir`, `writeScript`, `writeScriptBin` {#trivial-builder-writeText}
|
||||
|
@ -219,5 +219,5 @@ produces an output path `/nix/store/<hash>-runtime-references` containing
|
|||
/nix/store/<hash>-hello-2.10
|
||||
```
|
||||
|
||||
but none of `hello`'s dependencies, because those are not referenced directly
|
||||
but none of `hello`'s dependencies because those are not referenced directly
|
||||
by `hi`'s output.
|
||||
|
|
|
@ -214,15 +214,15 @@ Most of the time, these are the same. For instance, the package `e2fsprogs` has
|
|||
|
||||
There are a few naming guidelines:
|
||||
|
||||
- The `name` attribute _should_ be identical to the upstream package name.
|
||||
- The `pname` attribute _should_ be identical to the upstream package name.
|
||||
|
||||
- The `name` attribute _must not_ contain uppercase letters — e.g., `"mplayer-1.0rc2"` instead of `"MPlayer-1.0rc2"`.
|
||||
- The `pname` and the `version` attribute _must not_ contain uppercase letters — e.g., `"mplayer" instead of `"MPlayer"`.
|
||||
|
||||
- The version part of the `name` attribute _must_ start with a digit (following a dash) — e.g., `"hello-0.3.1rc2"`.
|
||||
- The `version` attribute _must_ start with a digit e.g`"0.3.1rc2".
|
||||
|
||||
- If a package is not a release but a commit from a repository, then the version part of the name _must_ be the date of that (fetched) commit. The date _must_ be in `"YYYY-MM-DD"` format. Also append `"unstable"` to the name - e.g., `"pkgname-unstable-2014-09-23"`.
|
||||
- If a package is not a release but a commit from a repository, then the `version` attribute _must_ be the date of that (fetched) commit. The date _must_ be in `"unstable-YYYY-MM-DD"` format.
|
||||
|
||||
- Dashes in the package name _should_ be preserved in new variable names, rather than converted to underscores or camel cased — e.g., `http-parser` instead of `http_parser` or `httpParser`. The hyphenated style is preferred in all three package names.
|
||||
- Dashes in the package `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.
|
||||
|
||||
- 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)
|
||||
|
||||
|
@ -338,6 +338,10 @@ A (typically large) program with a distinct user interface, primarily used inter
|
|||
|
||||
- `applications/terminal-emulators` (e.g. `alacritty` or `rxvt` or `termite`)
|
||||
|
||||
- **If it’s a _file manager_:**
|
||||
|
||||
- `applications/file-managers` (e.g. `mc` or `ranger` or `pcmanfm`)
|
||||
|
||||
- **If it’s for _video playback / editing_:**
|
||||
|
||||
- `applications/video` (e.g. `vlc`)
|
||||
|
@ -449,7 +453,10 @@ In the file `pkgs/top-level/all-packages.nix` you can find fetch helpers, these
|
|||
}
|
||||
```
|
||||
|
||||
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`.
|
||||
When fetching from GitHub, commits must always be referenced by their full commit hash. This is because GitHub shares commit hashes among all forks and returns `404 Not Found` when a short commit hash is ambiguous. It already happens for some short, 6-character commit hashes in `nixpkgs`.
|
||||
It is a practical vector for a denial-of-service attack by pushing large amounts of auto generated commits into forks and was already [demonstrated against GitHub Actions Beta](https://blog.teddykatz.com/2019/11/12/github-actions-dos.html).
|
||||
|
||||
Find the value to put as `sha256` by running `nix-shell -p nix-prefetch-github --run "nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS nix"`.
|
||||
|
||||
## Obtaining source hash {#sec-source-hashes}
|
||||
|
||||
|
@ -473,15 +480,23 @@ Preferred source hash type is sha256. There are several ways to get it.
|
|||
|
||||
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.
|
||||
|
||||
5. Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints.
|
||||
5. Fake hash: set the hash to one of
|
||||
|
||||
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.
|
||||
- `""`
|
||||
- `lib.fakeHash`
|
||||
- `lib.fakeSha256`
|
||||
- `lib.fakeSha512`
|
||||
|
||||
in the package expression, attempt build and extract correct hash from error messages.
|
||||
|
||||
::: {.warning}
|
||||
You must use one of these four fake hashes and not some arbitrarily-chosen hash.
|
||||
|
||||
See [](#sec-source-hashes-security).
|
||||
:::
|
||||
|
||||
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.
|
||||
|
||||
::: {.warning}
|
||||
This method has security problems. Check below for details.
|
||||
:::
|
||||
|
||||
### Obtaining hashes securely {#sec-source-hashes-security}
|
||||
|
||||
|
@ -493,7 +508,7 @@ Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead of f
|
|||
|
||||
- `https://` URLs are secure in methods 1, 2, 3;
|
||||
|
||||
- `https://` URLs are not secure in method 5. When obtaining hashes with fake hash method, TLS checks are disabled. So refetch source hash from several different networks to exclude MITM scenario. Alternatively, use fake hash method to make Nix error, but instead of extracting hash from error, extract `https://` URL and prefetch it with method 1.
|
||||
- `https://` URLs are secure in method 5 *only if* you use one of the listed fake hashes. If you use any other hash, `fetchurl` will pass `--insecure` to `curl` and may then degrade to HTTP in case of TLS certificate expiration.
|
||||
|
||||
## Patches {#sec-patches}
|
||||
|
||||
|
@ -511,6 +526,8 @@ patches = [
|
|||
|
||||
Otherwise, you can add a `.patch` file to the `nixpkgs` repository. In the interest of keeping our maintenance burden to a minimum, only patches that are unique to `nixpkgs` should be added in this way.
|
||||
|
||||
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`. Check [](#fetchpatch) for details.
|
||||
|
||||
```nix
|
||||
patches = [ ./0001-changes.patch ];
|
||||
```
|
||||
|
@ -538,17 +555,6 @@ If you do need to do create this sort of patch file, one way to do so is with gi
|
|||
$ git diff -a > nixpkgs/pkgs/the/package/0001-changes.patch
|
||||
```
|
||||
|
||||
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`:
|
||||
|
||||
- `relative`: Similar to using `git-diff`'s `--relative` flag, only keep changes inside the specified directory, making paths relative to it.
|
||||
- `stripLen`: Remove the first `stripLen` components of pathnames in the patch.
|
||||
- `extraPrefix`: Prefix pathnames by this string.
|
||||
- `excludes`: Exclude files matching these patterns (applies after the above arguments).
|
||||
- `includes`: Include only files matching these patterns (applies after the above arguments).
|
||||
- `revert`: Revert the patch.
|
||||
|
||||
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.
|
||||
|
||||
## Package tests {#sec-package-tests}
|
||||
|
||||
Tests are important to ensure quality and make reviews and automatic updates easy.
|
||||
|
|
|
@ -27,7 +27,7 @@ If the build succeeds, the manual will be in `./result/share/doc/nixpkgs/manual.
|
|||
|
||||
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.
|
||||
|
||||
Additionally, the following syntax extensions are currently used:
|
||||
Additional syntax extensions are available, though not all extensions can be used in NixOS option documentation. The following extensions are currently used:
|
||||
|
||||
- []{#ssec-contributing-markup-anchors}
|
||||
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).
|
||||
|
@ -53,12 +53,24 @@ Additionally, the following syntax extensions are currently used:
|
|||
This syntax is taken from [MyST](https://myst-parser.readthedocs.io/en/latest/using/syntax.html#targets-and-cross-referencing).
|
||||
|
||||
- []{#ssec-contributing-markup-inline-roles}
|
||||
If you want to link to a man page, you can use `` {manpage}`nix.conf(5)` ``, which will turn into {manpage}`nix.conf(5)`.
|
||||
If you want to link to a man page, you can use `` {manpage}`nix.conf(5)` ``, which will turn into {manpage}`nix.conf(5)`. The references will turn into links when a mapping exists in {file}`doc/build-aux/pandoc-filters/link-unix-man-references.lua`.
|
||||
|
||||
The references will turn into links when a mapping exists in {file}`doc/build-aux/pandoc-filters/link-unix-man-references.lua`.
|
||||
A few markups for other kinds of literals are also available:
|
||||
|
||||
- `` {command}`rm -rfi` `` turns into {command}`rm -rfi`
|
||||
- `` {env}`XDG_DATA_DIRS` `` turns into {env}`XDG_DATA_DIRS`
|
||||
- `` {file}`/etc/passwd` `` turns into {file}`/etc/passwd`
|
||||
- `` {option}`networking.useDHCP` `` turns into {option}`networking.useDHCP`
|
||||
- `` {var}`/etc/passwd` `` turns into {var}`/etc/passwd`
|
||||
|
||||
These literal kinds are used mostly in NixOS option documentation.
|
||||
|
||||
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.
|
||||
|
||||
::: {.note}
|
||||
Inline roles are available for option documentation.
|
||||
:::
|
||||
|
||||
- []{#ssec-contributing-markup-admonitions}
|
||||
**Admonitions**, set off from the text to bring attention to something.
|
||||
|
||||
|
@ -84,6 +96,10 @@ Additionally, the following syntax extensions are currently used:
|
|||
- [`tip`](https://tdg.docbook.org/tdg/5.0/tip.html)
|
||||
- [`warning`](https://tdg.docbook.org/tdg/5.0/warning.html)
|
||||
|
||||
::: {.note}
|
||||
Admonitions are available for option documentation.
|
||||
:::
|
||||
|
||||
- []{#ssec-contributing-markup-definition-lists}
|
||||
[**Definition lists**](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/definition_lists.md), for defining a group of terms:
|
||||
|
||||
|
|
|
@ -185,6 +185,111 @@ Sample template for a new module review is provided below.
|
|||
##### Comments
|
||||
```
|
||||
|
||||
## Individual maintainer list {#reviewing-contributions-indvidual-maintainer-list}
|
||||
|
||||
When adding users to `maintainers/maintainer-list.nix`, the following
|
||||
checks should be performed:
|
||||
|
||||
- If the user has specified a GPG key, verify that the commit is
|
||||
signed by their key.
|
||||
|
||||
First, validate that the commit adding the maintainer is signed by
|
||||
the key the maintainer listed. Check out the pull request and
|
||||
compare its signing key with the listed key in the commit.
|
||||
|
||||
If the commit is not signed or it is signed by a different user, ask
|
||||
them to either recommit using that key or to remove their key
|
||||
information.
|
||||
|
||||
Given a maintainter entry like this:
|
||||
|
||||
``` nix
|
||||
{
|
||||
example = {
|
||||
email = "user@example.com";
|
||||
name = "Example User";
|
||||
keys = [{
|
||||
fingerprint = "0000 0000 2A70 6423 0AED 3C11 F04F 7A19 AAA6 3AFE";
|
||||
}];
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
First receive their key from a keyserver:
|
||||
|
||||
$ gpg --recv-keys 0xF04F7A19AAA63AFE
|
||||
gpg: key 0xF04F7A19AAA63AFE: public key "Example <user@example.com>" imported
|
||||
gpg: Total number processed: 1
|
||||
gpg: imported: 1
|
||||
|
||||
Then check the commit is signed by that key:
|
||||
|
||||
$ git log --show-signature
|
||||
commit b87862a4f7d32319b1de428adb6cdbdd3a960153
|
||||
gpg: Signature made Wed Mar 12 13:32:24 2003 +0000
|
||||
gpg: using RSA key 000000002A7064230AED3C11F04F7A19AAA63AFE
|
||||
gpg: Good signature from "Example User <user@example.com>
|
||||
Author: Example User <user@example.com>
|
||||
Date: Wed Mar 12 13:32:24 2003 +0000
|
||||
|
||||
maintainers: adding example
|
||||
|
||||
and validate that there is a `Good signature` and the printed key
|
||||
matches the user's submitted key.
|
||||
|
||||
Note: GitHub's "Verified" label does not display the user's full key
|
||||
fingerprint, and should not be used for validating the key matches.
|
||||
|
||||
- If the user has specified a `github` account name, ensure they have
|
||||
also specified a `githubId` and verify the two match.
|
||||
|
||||
Maintainer entries that include a `github` field must also include
|
||||
their `githubId`. People can and do change their GitHub name
|
||||
frequently, and the ID is used as the official and stable identity
|
||||
of the maintainer.
|
||||
|
||||
Given a maintainer entry like this:
|
||||
|
||||
``` nix
|
||||
{
|
||||
example = {
|
||||
email = "user@example.com";
|
||||
name = "Example User";
|
||||
github = "ghost";
|
||||
githubId = 10137;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
First, make sure that the listed GitHub handle matches the author of
|
||||
the commit.
|
||||
|
||||
Then, visit the URL `https://api.github.com/users/ghost` and
|
||||
validate that the `id` field matches the provided `githubId`.
|
||||
|
||||
## Maintainer teams {#reviewing-contributions-maintainer-teams}
|
||||
|
||||
Feel free to create a new maintainer team in `maintainers/team-list.nix`
|
||||
when a group is collectively responsible for a collection of packages.
|
||||
Use taste and personal judgement when deciding if a team is warranted.
|
||||
|
||||
Teams are allowed to define their own rules about membership.
|
||||
|
||||
For example, some teams will represent a business or other group which
|
||||
wants to carefully track its members. Other teams may be very open about
|
||||
who can join, and allow anybody to participate.
|
||||
|
||||
When reviewing changes to a team, read the team's scope and the context
|
||||
around the member list for indications about the team's membership
|
||||
policy.
|
||||
|
||||
In any case, request reviews from the existing team members. If the team
|
||||
lists no specific membership policy, feel free to merge changes to the
|
||||
team after giving the existing members a few days to respond.
|
||||
|
||||
*Important:* If a team says it is a closed group, do not merge additions
|
||||
to the team without an approval by at least one existing member.
|
||||
|
||||
## Other submissions {#reviewing-contributions-other-submissions}
|
||||
|
||||
Other type of submissions requires different reviewing steps.
|
||||
|
@ -197,6 +302,12 @@ Container system, boot system and library changes are some examples of the pull
|
|||
|
||||
It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
|
||||
|
||||
In case the PR is stuck waiting for the original author to apply a trivial
|
||||
change (a typo, capitalisation change, etc.) and the author allowed the members
|
||||
to modify the PR, consider applying it yourself. (or commit the existing review
|
||||
suggestion) You should pay extra attention to make sure the addition doesn't go
|
||||
against the idea of the original PR and would not be opposed by the author.
|
||||
|
||||
<!--
|
||||
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.
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ We use jbidwatcher as an example for a discontinued project here.
|
|||
|
||||
1. Have Nixpkgs checked out locally and up to date.
|
||||
1. Create a new branch for your change, e.g. `git checkout -b jbidwatcher`
|
||||
1. Remove the actual package including its directory, e.g. `rm -rf pkgs/applications/misc/jbidwatcher`
|
||||
1. Remove the actual package including its directory, e.g. `git rm -rf pkgs/applications/misc/jbidwatcher`
|
||||
1. Remove the package from the list of all packages (`pkgs/top-level/all-packages.nix`).
|
||||
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.)
|
||||
|
||||
|
@ -167,24 +167,30 @@ Packages with automated tests are much more likely to be merged in a timely fash
|
|||
|
||||
### Tested compilation of all pkgs that depend on this change using `nixpkgs-review` {#submitting-changes-tested-compilation}
|
||||
|
||||
If you are updating a package’s version, you can use nixpkgs-review to make sure all packages that depend on the updated package still compile correctly. The `nixpkgs-review` utility can look for and build all dependencies either based on uncommited changes with the `wip` option or specifying a github pull request number.
|
||||
If you are updating a package’s version, you can use `nixpkgs-review` to make sure all packages that depend on the updated package still compile correctly. The `nixpkgs-review` utility can look for and build all dependencies either based on uncommitted changes with the `wip` option or specifying a GitHub pull request number.
|
||||
|
||||
review changes from pull request number 12345:
|
||||
Review changes from pull request number 12345:
|
||||
|
||||
```ShellSession
|
||||
nix run nixpkgs.nixpkgs-review -c nixpkgs-review pr 12345
|
||||
nix-shell -p nixpkgs-review --run "nixpkgs-review pr 12345"
|
||||
```
|
||||
|
||||
review uncommitted changes:
|
||||
Alternatively, with flakes (and analogously for the other commands below):
|
||||
|
||||
```ShellSession
|
||||
nix run nixpkgs.nixpkgs-review -c nixpkgs-review wip
|
||||
nix run nixpkgs#nixpkgs-review -- pr 12345
|
||||
```
|
||||
|
||||
review changes from last commit:
|
||||
Review uncommitted changes:
|
||||
|
||||
```ShellSession
|
||||
nix run nixpkgs.nixpkgs-review -c nixpkgs-review rev HEAD
|
||||
nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
|
||||
```
|
||||
|
||||
Review changes from last commit:
|
||||
|
||||
```ShellSession
|
||||
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
|
||||
```
|
||||
|
||||
### Tested execution of all binary files (usually in `./result/bin/`) {#submitting-changes-tested-execution}
|
||||
|
@ -227,7 +233,7 @@ digraph {
|
|||
}
|
||||
```
|
||||
|
||||
[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.
|
||||
[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; these are the blue arrows in the diagram above. The purple arrows in the diagram above are done manually and much less frequently. You can get an idea of how often these merges occur by looking at the git history.
|
||||
|
||||
|
||||
### Master branch {#submitting-changes-master-branch}
|
||||
|
@ -236,14 +242,18 @@ The `master` branch is the main development branch. It should only see non-break
|
|||
|
||||
### Staging branch {#submitting-changes-staging-branch}
|
||||
|
||||
The `staging` branch is a development branch where mass-rebuilds go. It should only see non-breaking mass-rebuild commits. That means it is not to be used for testing, and changes must have been well tested already. If the branch is already in a broken state, please refrain from adding extra new breakages.
|
||||
The `staging` branch is a development branch where mass-rebuilds go. Mass rebuilds are commits that cause rebuilds for many packages, like more than 500 (or perhaps, if it's 'light' packages, 1000). It should only see non-breaking mass-rebuild commits. That means it is not to be used for testing, and changes must have been well tested already. If the branch is already in a broken state, please refrain from adding extra new breakages.
|
||||
|
||||
During the process of a releasing a new NixOS version, this branch or the release-critical packages can be restricted to non-breaking changes.
|
||||
|
||||
### Staging-next branch {#submitting-changes-staging-next-branch}
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
If 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.
|
||||
|
||||
During the process of a releasing a new NixOS version, this branch or the release-critical packages can be restricted to non-breaking changes.
|
||||
|
||||
### Stable release branches {#submitting-changes-stable-release-branches}
|
||||
|
||||
The same staging workflow applies to stable release branches, but the main branch is called `release-*` instead of `master`.
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{ pkgs ? (import ../.. {}), nixpkgs ? { }}:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
inherit (lib) hasPrefix removePrefix;
|
||||
|
||||
locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; };
|
||||
functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; };
|
||||
version = pkgs.lib.version;
|
||||
|
@ -23,6 +26,26 @@ let
|
|||
<xsl:import href="${./parameters.xml}"/>
|
||||
</xsl:stylesheet>
|
||||
'';
|
||||
|
||||
# NB: This file describes the Nixpkgs manual, which happens to use module
|
||||
# docs infra originally developed for NixOS.
|
||||
optionsDoc = pkgs.nixosOptionsDoc {
|
||||
inherit (pkgs.lib.evalModules { modules = [ ../../pkgs/top-level/config.nix ]; }) options;
|
||||
documentType = "none";
|
||||
transformOptions = opt:
|
||||
opt // {
|
||||
declarations =
|
||||
map
|
||||
(decl:
|
||||
if hasPrefix (toString ../..) (toString decl)
|
||||
then
|
||||
let subpath = removePrefix "/" (removePrefix (toString ../..) (toString decl));
|
||||
in { url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}"; name = subpath; }
|
||||
else decl)
|
||||
opt.declarations;
|
||||
};
|
||||
};
|
||||
|
||||
in pkgs.runCommand "doc-support" {}
|
||||
''
|
||||
mkdir result
|
||||
|
@ -30,6 +53,7 @@ in pkgs.runCommand "doc-support" {}
|
|||
cd result
|
||||
ln -s ${locationsXml} ./function-locations.xml
|
||||
ln -s ${functionDocs} ./function-docs
|
||||
ln -s ${optionsDoc.optionsDocBook} ./config-options.docbook.xml
|
||||
|
||||
ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng
|
||||
ln -s ${pkgs.docbook_xsl_ns}/xml/xsl ./xsl
|
||||
|
|
|
@ -22,6 +22,7 @@ with pkgs; stdenv.mkDerivation {
|
|||
docgen lists 'List manipulation functions'
|
||||
docgen debug 'Debugging functions'
|
||||
docgen options 'NixOS / nixpkgs option handling'
|
||||
docgen filesystem 'Filesystem functions'
|
||||
docgen sources 'Source filtering functions'
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -11,4 +11,5 @@
|
|||
<xsl:param name="toc.section.depth" select="0" />
|
||||
<xsl:param name="admon.style" select="''" />
|
||||
<xsl:param name="callout.graphics.extension" select="'.svg'" />
|
||||
<xsl:param name="generate.consistent.ids" select="1" />
|
||||
</xsl:stylesheet>
|
||||
|
|
|
@ -26,5 +26,7 @@
|
|||
|
||||
<xi:include href="./library/generated/options.xml" />
|
||||
|
||||
<xi:include href="./library/generated/filesystem.xml" />
|
||||
|
||||
<xi:include href="./library/generated/sources.xml" />
|
||||
</section>
|
||||
|
|
4
doc/hooks/autoconf.section.md
Normal file
4
doc/hooks/autoconf.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### Autoconf {#setup-hook-autoconf}
|
||||
|
||||
The `autoreconfHook` derivation adds `autoreconfPhase`, which runs autoreconf, libtoolize and automake, essentially preparing the configure script in autotools-based builds. Most autotools-based packages come with the configure script pre-generated, but this hook is necessary for a few packages and when you need to patch the package’s configure scripts.
|
4
doc/hooks/automake.section.md
Normal file
4
doc/hooks/automake.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### Automake {#setup-hook-automake}
|
||||
|
||||
Adds the `share/aclocal` subdirectory of each build input to the `ACLOCAL_PATH` environment variable.
|
12
doc/hooks/autopatchelf.section.md
Normal file
12
doc/hooks/autopatchelf.section.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
### autoPatchelfHook {#setup-hook-autopatchelfhook}
|
||||
|
||||
This is a special setup hook which helps in packaging proprietary software in that it automatically tries to find missing shared library dependencies of ELF files based on the given `buildInputs` and `nativeBuildInputs`.
|
||||
|
||||
You can also specify a `runtimeDependencies` variable which lists dependencies to be unconditionally added to rpath of all executables. This is useful for programs that use dlopen 3 to load libraries at runtime.
|
||||
|
||||
In certain situations you may want to run the main command (`autoPatchelf`) of the setup hook on a file or a set of directories instead of unconditionally patching all outputs. This can be done by setting the `dontAutoPatchelf` environment variable to a non-empty value.
|
||||
|
||||
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.
|
||||
|
||||
The `autoPatchelf` command also recognizes a `--no-recurse` command line flag, which prevents it from recursing into subdirectories.
|
18
doc/hooks/breakpoint.section.md
Normal file
18
doc/hooks/breakpoint.section.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
### breakpointHook {#breakpointhook}
|
||||
|
||||
This hook will make a build pause instead of stopping when a failure happens. It prevents nix from cleaning up the build environment immediately and allows the user to attach to a build environment using the `cntr` command. Upon build error it will print instructions on how to use `cntr`, which can be used to enter the environment for debugging. Installing cntr and running the command will provide shell access to the build sandbox of failed build. At `/var/lib/cntr` the sandboxed filesystem is mounted. All commands and files of the system are still accessible within the shell. To execute commands from the sandbox use the cntr exec subcommand. `cntr` is only supported on Linux-based platforms. To use it first add `cntr` to your `environment.systemPackages` on NixOS or alternatively to the root user on non-NixOS systems. Then in the package that is supposed to be inspected, add `breakpointHook` to `nativeBuildInputs`.
|
||||
|
||||
```nix
|
||||
nativeBuildInputs = [ breakpointHook ];
|
||||
```
|
||||
|
||||
When a build failure happens there will be an instruction printed that shows how to attach with `cntr` to the build sandbox.
|
||||
|
||||
::: {.note}
|
||||
::: {.title}
|
||||
Caution with remote builds
|
||||
:::
|
||||
|
||||
This won’t work with remote builds as the build environment is on a different machine and can’t be accessed by `cntr`. Remote builds can be turned off by setting `--option builders ''` for `nix-build` or `--builders ''` for `nix build`.
|
||||
:::
|
4
doc/hooks/cmake.section.md
Normal file
4
doc/hooks/cmake.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### cmake {#cmake}
|
||||
|
||||
Overrides the default configure phase to run the CMake command. By default, we use the Make generator of CMake. In addition, dependencies are added automatically to `CMAKE_PREFIX_PATH` so that packages are correctly detected by CMake. Some additional flags are passed in to give similar behavior to configure-based packages. You can disable this hook’s behavior by setting `configurePhase` to a custom value, or by setting `dontUseCmakeConfigure`. `cmakeFlags` controls flags passed only to CMake. By default, parallel building is enabled as CMake supports parallel building almost everywhere. When Ninja is also in use, CMake will detect that and use the ninja generator.
|
4
doc/hooks/gdk-pixbuf.section.md
Normal file
4
doc/hooks/gdk-pixbuf.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### gdk-pixbuf {#setup-hook-gdk-pixbuf}
|
||||
|
||||
Exports `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).
|
4
doc/hooks/ghc.section.md
Normal file
4
doc/hooks/ghc.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### GHC {#ghc}
|
||||
|
||||
Creates a temporary package database and registers every Haskell build input in it (TODO: how?).
|
4
doc/hooks/gnome.section.md
Normal file
4
doc/hooks/gnome.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### GNOME platform {#gnome-platform}
|
||||
|
||||
Hooks related to GNOME platform and related libraries like GLib, GTK and GStreamer are described in [](#sec-language-gnome).
|
37
doc/hooks/index.xml
Normal file
37
doc/hooks/index.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xml:id="chap-hooks">
|
||||
<title>Hooks reference</title>
|
||||
<para>
|
||||
Nixpkgs has several hook packages that augment the stdenv phases.
|
||||
</para>
|
||||
<para>
|
||||
The stdenv built-in hooks are documented in <xref linkend="ssec-setup-hooks"/>.
|
||||
</para>
|
||||
<xi:include href="./autoconf.section.xml" />
|
||||
<xi:include href="./automake.section.xml" />
|
||||
<xi:include href="./autopatchelf.section.xml" />
|
||||
<xi:include href="./breakpoint.section.xml" />
|
||||
<xi:include href="./cmake.section.xml" />
|
||||
<xi:include href="./gdk-pixbuf.section.xml" />
|
||||
<xi:include href="./ghc.section.xml" />
|
||||
<xi:include href="./gnome.section.xml" />
|
||||
<xi:include href="./installShellFiles.section.xml" />
|
||||
<xi:include href="./libiconv.section.xml" />
|
||||
<xi:include href="./libxml2.section.xml" />
|
||||
<xi:include href="./meson.section.xml" />
|
||||
<xi:include href="./ninja.section.xml" />
|
||||
<xi:include href="./patch-rc-path-hooks.section.xml" />
|
||||
<xi:include href="./perl.section.xml" />
|
||||
<xi:include href="./pkg-config.section.xml" />
|
||||
<xi:include href="./postgresql-test-hook.section.xml" />
|
||||
<xi:include href="./python.section.xml" />
|
||||
<xi:include href="./qt-4.section.xml" />
|
||||
<xi:include href="./scons.section.xml" />
|
||||
<xi:include href="./tetex-tex-live.section.xml" />
|
||||
<xi:include href="./unzip.section.xml" />
|
||||
<xi:include href="./validatePkgConfig.section.xml" />
|
||||
<xi:include href="./waf.section.xml" />
|
||||
<xi:include href="./xcbuild.section.xml" />
|
||||
</chapter>
|
26
doc/hooks/installShellFiles.section.md
Normal file
26
doc/hooks/installShellFiles.section.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
### `installShellFiles` {#installshellfiles}
|
||||
|
||||
This hook helps with installing manpages and shell completion files. It exposes 2 shell functions `installManPage` and `installShellCompletion` that can be used from your `postInstall` hook.
|
||||
|
||||
The `installManPage` function takes one or more paths to manpages to install. The manpages must have a section suffix, and may optionally be compressed (with `.gz` suffix). This function will place them into the correct directory.
|
||||
|
||||
The `installShellCompletion` function takes one or more paths to shell completion files. By default it will autodetect the shell type from the completion file extension, but you may also specify it by passing one of `--bash`, `--fish`, or `--zsh`. These flags apply to all paths listed after them (up until another shell flag is given). Each path may also have a custom installation name provided by providing a flag `--name NAME` before the path. If this flag is not provided, zsh completions will be renamed automatically such that `foobar.zsh` becomes `_foobar`. A root name may be provided for all paths using the flag `--cmd NAME`; this synthesizes the appropriate name depending on the shell (e.g. `--cmd foo` will synthesize the name `foo.bash` for bash and `_foo` for zsh). The path may also be a fifo or named fd (such as produced by `<(cmd)`), in which case the shell and name must be provided.
|
||||
|
||||
```nix
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
postInstall = ''
|
||||
installManPage doc/foobar.1 doc/barfoo.3
|
||||
# explicit behavior
|
||||
installShellCompletion --bash --name foobar.bash share/completions.bash
|
||||
installShellCompletion --fish --name foobar.fish share/completions.fish
|
||||
installShellCompletion --zsh --name _foobar share/completions.zsh
|
||||
# implicit behavior
|
||||
installShellCompletion share/completions/foobar.{bash,fish,zsh}
|
||||
# using named fd
|
||||
installShellCompletion --cmd foobar \
|
||||
--bash <($out/bin/foobar --bash-completion) \
|
||||
--fish <($out/bin/foobar --fish-completion) \
|
||||
--zsh <($out/bin/foobar --zsh-completion)
|
||||
'';
|
||||
```
|
4
doc/hooks/libiconv.section.md
Normal file
4
doc/hooks/libiconv.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### libiconv, libintl {#libiconv-libintl}
|
||||
|
||||
A few libraries automatically add to `NIX_LDFLAGS` their library, making their symbols automatically available to the linker. This includes libiconv and libintl (gettext). This is done to provide compatibility between GNU Linux, where libiconv and libintl are bundled in, and other systems where that might not be the case. Sometimes, this behavior is not desired. To disable this behavior, set `dontAddExtraLibs`.
|
4
doc/hooks/libxml2.section.md
Normal file
4
doc/hooks/libxml2.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### libxml2 {#setup-hook-libxml2}
|
||||
|
||||
Adds every file named `catalog.xml` found under the `xml/dtd` and `xml/xsl` subdirectories of each build input to the `XML_CATALOG_FILES` environment variable.
|
26
doc/hooks/meson.section.md
Normal file
26
doc/hooks/meson.section.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
### Meson {#meson}
|
||||
|
||||
Overrides the configure phase to run meson to generate Ninja files. To run these files, you should accompany Meson with ninja. By default, `enableParallelBuilding` is enabled as Meson supports parallel building almost everywhere.
|
||||
|
||||
#### Variables controlling Meson {#variables-controlling-meson}
|
||||
|
||||
##### `mesonFlags` {#mesonflags}
|
||||
|
||||
Controls the flags passed to meson.
|
||||
|
||||
##### `mesonBuildType` {#mesonbuildtype}
|
||||
|
||||
Which [`--buildtype`](https://mesonbuild.com/Builtin-options.html#core-options) to pass to Meson. We default to `plain`.
|
||||
|
||||
##### `mesonAutoFeatures` {#mesonautofeatures}
|
||||
|
||||
What value to set [`-Dauto_features=`](https://mesonbuild.com/Builtin-options.html#core-options) to. We default to `enabled`.
|
||||
|
||||
##### `mesonWrapMode` {#mesonwrapmode}
|
||||
|
||||
What value to set [`-Dwrap_mode=`](https://mesonbuild.com/Builtin-options.html#core-options) to. We default to `nodownload` as we disallow network access.
|
||||
|
||||
##### `dontUseMesonConfigure` {#dontusemesonconfigure}
|
||||
|
||||
Disables using Meson’s `configurePhase`.
|
4
doc/hooks/ninja.section.md
Normal file
4
doc/hooks/ninja.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### ninja {#ninja}
|
||||
|
||||
Overrides the build, install, and check phase to run ninja instead of make. You can disable this behavior with the `dontUseNinjaBuild`, `dontUseNinjaInstall`, and `dontUseNinjaCheck`, respectively. Parallel building is enabled by default in Ninja.
|
50
doc/hooks/patch-rc-path-hooks.section.md
Normal file
50
doc/hooks/patch-rc-path-hooks.section.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
|
||||
# `patchRcPath` hooks {#sec-patchRcPathHooks}
|
||||
|
||||
These hooks provide shell-specific utilities (with the same name as the hook) to patch shell scripts meant to be sourced by software users.
|
||||
|
||||
The typical usage is to patch initialisation or [rc](https://unix.stackexchange.com/questions/3467/what-does-rc-in-bashrc-stand-for) scripts inside `$out/bin` or `$out/etc`.
|
||||
Such scripts, when being sourced, would insert the binary locations of certain commands into `PATH`, modify other environment variables or run a series of start-up commands.
|
||||
When shipped from the upstream, they sometimes use commands that might not be available in the environment they are getting sourced in.
|
||||
|
||||
The compatible shells for each hook are:
|
||||
|
||||
- `patchRcPathBash`: [Bash](https://www.gnu.org/software/bash/), [ksh](http://www.kornshell.org/), [zsh](https://www.zsh.org/) and other shells supporting the Bash-like parameter expansions.
|
||||
- `patchRcPathCsh`: Csh scripts, such as those targeting [tcsh](https://www.tcsh.org/).
|
||||
- `patchRcPathFish`: [Fish](https://fishshell.com/) scripts.
|
||||
- `patchRcPathPosix`: POSIX-conformant shells supporting the limited parameter expansions specified by the POSIX standard. Current implementation uses the parameter expansion `${foo-}` only.
|
||||
|
||||
For each supported shell, it modifies the script with a `PATH` prefix that is later removed when the script ends.
|
||||
It allows nested patching, which guarantees that a patched script may source another patched script.
|
||||
|
||||
Syntax to apply the utility to a script:
|
||||
|
||||
```sh
|
||||
patchRcPath<shell> <file> <PATH-prefix>
|
||||
```
|
||||
|
||||
Example usage:
|
||||
|
||||
Given a package `foo` containing an init script `this-foo.fish` that depends on `coreutils`, `man` and `which`,
|
||||
patch the init script for users to source without having the above dependencies in their `PATH`:
|
||||
|
||||
```nix
|
||||
{ lib, stdenv, patchRcPathFish}:
|
||||
stdenv.mkDerivation {
|
||||
|
||||
# ...
|
||||
|
||||
nativeBuildInputs = [
|
||||
patchRcPathFish
|
||||
];
|
||||
|
||||
postFixup = ''
|
||||
patchRcPathFish $out/bin/this-foo.fish ${lib.makeBinPath [ coreutils man which ]}
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
::: {.note}
|
||||
`patchRcPathCsh` and `patchRcPathPosix` implementation depends on `sed` to do the string processing.
|
||||
The others are in vanilla shell and have no third-party dependencies.
|
||||
:::
|
4
doc/hooks/perl.section.md
Normal file
4
doc/hooks/perl.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### Perl {#setup-hook-perl}
|
||||
|
||||
Adds the `lib/site_perl` subdirectory of each build input to the `PERL5LIB` environment variable. For instance, if `buildInputs` contains Perl, then the `lib/site_perl` subdirectory of each input is added to the `PERL5LIB` environment variable.
|
4
doc/hooks/pkg-config.section.md
Normal file
4
doc/hooks/pkg-config.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### pkg-config {#setup-hook-pkg-config}
|
||||
|
||||
Adds the `lib/pkgconfig` and `share/pkgconfig` subdirectories of each build input to the `PKG_CONFIG_PATH` environment variable.
|
59
doc/hooks/postgresql-test-hook.section.md
Normal file
59
doc/hooks/postgresql-test-hook.section.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
|
||||
# `postgresqlTestHook` {#sec-postgresqlTestHook}
|
||||
|
||||
This hook starts a PostgreSQL server during the `checkPhase`. Example:
|
||||
|
||||
```nix
|
||||
{ stdenv, postgresql, postgresqlTestHook }:
|
||||
stdenv.mkDerivation {
|
||||
|
||||
# ...
|
||||
|
||||
checkInputs = [
|
||||
postgresql
|
||||
postgresqlTestHook
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
If you use a custom `checkPhase`, remember to add the `runHook` calls:
|
||||
```nix
|
||||
checkPhase ''
|
||||
runHook preCheck
|
||||
|
||||
# ... your tests
|
||||
|
||||
runHook postCheck
|
||||
''
|
||||
```
|
||||
|
||||
## Variables {#sec-postgresqlTestHook-variables}
|
||||
|
||||
The hook logic will read a number of variables and set them to a default value if unset or empty.
|
||||
|
||||
Exported variables:
|
||||
|
||||
- `PGDATA`: location of server files.
|
||||
- `PGHOST`: location of UNIX domain socket directory; the default `host` in a connection string.
|
||||
- `PGUSER`: user to create / log in with, default: `test_user`.
|
||||
- `PGDATABASE`: database name, default: `test_db`.
|
||||
|
||||
Bash-only variables:
|
||||
|
||||
- `postgresqlTestUserOptions`: SQL options to use when creating the `$PGUSER` role, default: `"LOGIN"`. Example: `"LOGIN SUPERUSER"`
|
||||
- `postgresqlTestSetupSQL`: SQL commands to run as database administrator after startup, default: statements that create `$PGUSER` and `$PGDATABASE`.
|
||||
- `postgresqlTestSetupCommands`: bash commands to run after database start, defaults to running `$postgresqlTestSetupSQL` as database administrator.
|
||||
- `postgresqlEnableTCP`: set to `1` to enable TCP listening. Flaky; not recommended.
|
||||
- `postgresqlStartCommands`: defaults to `pg_ctl start`.
|
||||
|
||||
## TCP and the Nix sandbox {#sec-postgresqlTestHook-tcp}
|
||||
|
||||
`postgresqlEnableTCP` relies on network sandboxing, which is not available on macOS and some custom Nix installations, resulting in flaky tests.
|
||||
For this reason, it is disabled by default.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
::: {.note}
|
||||
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.
|
||||
:::
|
4
doc/hooks/python.section.md
Normal file
4
doc/hooks/python.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### Python {#setup-hook-python}
|
||||
|
||||
Adds the `lib/${python.libPrefix}/site-packages` subdirectory of each build input to the `PYTHONPATH` environment variable.
|
4
doc/hooks/qt-4.section.md
Normal file
4
doc/hooks/qt-4.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### Qt 4 {#qt-4}
|
||||
|
||||
Sets the `QTDIR` environment variable to Qt’s path.
|
4
doc/hooks/scons.section.md
Normal file
4
doc/hooks/scons.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### scons {#scons}
|
||||
|
||||
Overrides the build, install, and check phases. This uses the scons build system as a replacement for make. scons does not provide a configure phase, so everything is managed at build and install time.
|
4
doc/hooks/tetex-tex-live.section.md
Normal file
4
doc/hooks/tetex-tex-live.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### teTeX / TeX Live {#tetex-tex-live}
|
||||
|
||||
Adds the `share/texmf-nix` subdirectory of each build input to the `TEXINPUTS` environment variable.
|
4
doc/hooks/unzip.section.md
Normal file
4
doc/hooks/unzip.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### unzip {#unzip}
|
||||
|
||||
This setup hook will allow you to unzip .zip files specified in `$src`. There are many similar packages like `unrar`, `undmg`, etc.
|
4
doc/hooks/validatePkgConfig.section.md
Normal file
4
doc/hooks/validatePkgConfig.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### validatePkgConfig {#validatepkgconfig}
|
||||
|
||||
The `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.
|
4
doc/hooks/waf.section.md
Normal file
4
doc/hooks/waf.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### wafHook {#wafhook}
|
||||
|
||||
Overrides the configure, build, and install phases. This will run the “waf” script used by many projects. If `wafPath` (default `./waf`) doesn’t exist, it will copy the version of waf available in Nixpkgs. `wafFlags` can be used to pass flags to the waf script.
|
4
doc/hooks/xcbuild.section.md
Normal file
4
doc/hooks/xcbuild.section.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
### xcbuildHook {#xcbuildhook}
|
||||
|
||||
Overrides the build and install phases to run the "xcbuild" command. This hook is needed when a project only comes with build files for the XCode build system. You can disable this behavior by setting buildPhase and configurePhase to a custom value. xcbuildFlags controls flags passed only to xcbuild.
|
49
doc/languages-frameworks/chicken.section.md
Normal file
49
doc/languages-frameworks/chicken.section.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
# CHICKEN {#sec-chicken}
|
||||
|
||||
[CHICKEN](https://call-cc.org/) is a
|
||||
[R⁵RS](https://schemers.org/Documents/Standards/R5RS/HTML/)-compliant Scheme
|
||||
compiler. It includes an interactive mode and a custom package format, "eggs".
|
||||
|
||||
## Using Eggs
|
||||
|
||||
Eggs described in nixpkgs are available inside the
|
||||
`chickenPackages.chickenEggs` attrset. Including an egg as a build input is
|
||||
done in the typical Nix fashion. For example, to include support for [SRFI
|
||||
189](https://srfi.schemers.org/srfi-189/srfi-189.html) in a derivation, one
|
||||
might write:
|
||||
|
||||
```nix
|
||||
buildInputs = [
|
||||
chicken
|
||||
chickenPackages.chickenEggs.srfi-189
|
||||
];
|
||||
```
|
||||
|
||||
Both `chicken` and its eggs have a setup hook which configures the environment
|
||||
variables `CHICKEN_INCLUDE_PATH` and `CHICKEN_REPOSITORY_PATH`.
|
||||
|
||||
## Updating Eggs
|
||||
|
||||
nixpkgs only knows about a subset of all published eggs. It uses
|
||||
[egg2nix](https://github.com/the-kenny/egg2nix) to generate a
|
||||
package set from a list of eggs to include.
|
||||
|
||||
The package set is regenerated by running the following shell commands:
|
||||
|
||||
```
|
||||
$ nix-shell -p chickenPackages.egg2nix
|
||||
$ cd pkgs/development/compilers/chicken/5/
|
||||
$ egg2nix eggs.scm > eggs.nix
|
||||
```
|
||||
|
||||
## Adding Eggs
|
||||
|
||||
When we run `egg2nix`, we obtain one collection of eggs with
|
||||
mutually-compatible versions. This means that when we add new eggs, we may
|
||||
need to update existing eggs. To keep those separate, follow the procedure for
|
||||
updating eggs before including more eggs.
|
||||
|
||||
To include more eggs, edit `pkgs/development/compilers/chicken/5/eggs.scm`.
|
||||
The first section of this file lists eggs which are required by `egg2nix`
|
||||
itself; all other eggs go into the second section. After editing, follow the
|
||||
procedure for updating eggs.
|
|
@ -5,9 +5,11 @@
|
|||
The 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
|
||||
|
||||
* `version` (optional, defaults to the latest version of Coq selected for nixpkgs, see `pkgs/top-level/coq-packages` to witness this choice), which follows the conventions explained in the `coqPackages` section below,
|
||||
* `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).
|
||||
* `customOCamlPackages` (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).
|
||||
* `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"; }`.
|
||||
|
||||
The associated package set can be optained using `mkCoqPackages coq`, where `coq` is the derivation to use.
|
||||
|
||||
## Coq packages attribute sets: `coqPackages` {#coq-packages-attribute-sets-coqpackages}
|
||||
|
||||
The 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:
|
||||
|
@ -29,11 +31,16 @@ The recommended way of defining a derivation for a Coq library, is to use the `c
|
|||
* `releaseRev` (optional, defaults to `(v: v)`), provides a default mapping from release names to revision hashes/branch names/tags,
|
||||
* `displayVersion` (optional), provides a way to alter the computation of `name` from `pname`, by explaining how to display version numbers,
|
||||
* `namePrefix` (optional, defaults to `[ "coq" ]`), provides a way to alter the computation of `name` from `pname`, by explaining which dependencies must occur in `name`,
|
||||
* `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,
|
||||
* `extraBuildInputs` (optional), this allows to add more build inputs,
|
||||
* `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.
|
||||
* `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"`,
|
||||
* `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.
|
||||
* `nativeBuildInputs` (optional), is a list of executables that are required to build the current derivation, in addition to the default ones (namely `which`, `dune` and `ocaml` depending on whether `useDune`, `useDuneifVersion` and `mlPlugin` are set).
|
||||
* `extraNativeBuildInputs` (optional, deprecated), an additional list of derivation to add to `nativeBuildInputs`,
|
||||
* `overrideNativeBuildInputs` (optional) replaces the default list of derivation to which `nativeBuildInputs` and `extraNativeBuildInputs` adds extra elements,
|
||||
* `buildInputs` (optional), is a list of libraries and dependencies that are required to build and run the current derivation, in addition to the default one `[ coq ]`,
|
||||
* `extraBuildInputs` (optional, deprecated), an additional list of derivation to add to `buildInputs`,
|
||||
* `overrideBuildInputs` (optional) replaces the default list of derivation to which `buildInputs` and `extraBuildInputs` adds extras elements,
|
||||
* `propagatedBuildInputs` (optional) is passed as is to `mkDerivation`, we recommend to use this for Coq libraries and Coq plugin dependencies, as this makes sure the paths of the compiled libraries and plugins will always be added to the build environements of subsequent derivation, which is necessary for Coq packages to work correctly,
|
||||
* `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 `nativeBuildInputs`, `buildInputs`, and `propagatedBuildInputs` to depend on the same package set Coq was built against.
|
||||
* `useDuneifVersion` (optional, default to `(x: false)` uses Dune to build the package if the provided predicate evaluates to true on the version, e.g. `useDuneifVersion = versions.isGe "1.1"` will use dune if the version of the package is greater or equal to `"1.1"`,
|
||||
* `useDune` (optional, defaults to `false`) uses Dune to build the package if set to true, the presence of this attribute overrides the behavior of the previous one.
|
||||
* `opam-name` (optional, defaults to concatenating with a dash separator the components of `namePrefix` and `pname`), name of the Dune package to build.
|
||||
* `enableParallelBuilding` (optional, defaults to `true`), since it is activated by default, we provide a way to disable it.
|
||||
* `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.
|
||||
|
@ -81,3 +88,58 @@ with lib; mkCoqDerivation {
|
|||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Three ways of overriding Coq packages {#coq-overriding-packages}
|
||||
|
||||
There are three distinct ways of changing a Coq package by overriding one of its values: `.override`, `overrideCoqDerivation`, and `.overrideAttrs`. This section explains what sort of values can be overridden with each of these methods.
|
||||
|
||||
### `.override` {#coq-override}
|
||||
|
||||
`.override` lets you change arguments to a Coq derivation. In the case of the `multinomials` package above, `.override` would let you override arguments like `mkCoqDerivation`, `version`, `coq`, `mathcomp`, `mathcom-finmap`, etc.
|
||||
|
||||
For example, assuming you have a special `mathcomp` dependency you want to use, here is how you could override the `mathcomp` dependency:
|
||||
|
||||
```nix
|
||||
multinomials.override {
|
||||
mathcomp = my-special-mathcomp;
|
||||
}
|
||||
```
|
||||
|
||||
In Nixpkgs, all Coq derivations take a `version` argument. This can be overridden in order to easily use a different version:
|
||||
|
||||
```nix
|
||||
coqPackages.multinomials.override {
|
||||
version = "1.5.1";
|
||||
}
|
||||
```
|
||||
|
||||
Refer to [](#coq-packages-attribute-sets-coqpackages) for all the different formats that you can potentially pass to `version`, as well as the restrictions.
|
||||
|
||||
### `overrideCoqDerivation` {#coq-overrideCoqDerivation}
|
||||
|
||||
The `overrideCoqDerivation` function lets you easily change arguments to `mkCoqDerivation`. These arguments are described in [](#coq-packages-attribute-sets-coqpackages).
|
||||
|
||||
For example, here is how you could locally add a new release of the `multinomials` library, and set the `defaultVersion` to use this release:
|
||||
|
||||
```nix
|
||||
coqPackages.lib.overrideCoqDerivation
|
||||
{
|
||||
defaultVersion = "2.0";
|
||||
release."2.0".sha256 = "1lq8x86vd3vqqh2yq6hvyagpnhfq5wmk5pg2z0xq7b7dbbbhyfkk";
|
||||
}
|
||||
coqPackages.multinomials
|
||||
```
|
||||
|
||||
### `.overrideAttrs` {#coq-overrideAttrs}
|
||||
|
||||
`.overrideAttrs` lets you override arguments to the underlying `stdenv.mkDerivation` call. Internally, `mkCoqDerivation` uses `stdenv.mkDerivation` to create derivations for Coq libraries. You can override arguments to `stdenv.mkDerivation` with `.overrideAttrs`.
|
||||
|
||||
For instance, here is how you could add some code to be performed in the derivation after installation is complete:
|
||||
|
||||
```nix
|
||||
coqPackages.multinomials.overrideAttrs (oldAttrs: {
|
||||
postInstall = oldAttrs.postInstall or "" + ''
|
||||
echo "you can do anything you want here"
|
||||
'';
|
||||
})
|
||||
```
|
||||
|
|
34
doc/languages-frameworks/cuda.section.md
Normal file
34
doc/languages-frameworks/cuda.section.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
# CUDA {#cuda}
|
||||
|
||||
CUDA-only packages are stored in the `cudaPackages` packages set. This set
|
||||
includes the `cudatoolkit`, portions of the toolkit in separate derivations,
|
||||
`cudnn`, `cutensor` and `nccl`.
|
||||
|
||||
A package set is available for each CUDA version, so for example
|
||||
`cudaPackages_11_6`. Within each set is a matching version of the above listed
|
||||
packages. Additionally, other versions of the packages that are packaged and
|
||||
compatible are available as well. For example, there can be a
|
||||
`cudaPackages.cudnn_8_3_2` package.
|
||||
|
||||
To use one or more CUDA packages in an expression, give the expression a `cudaPackages` parameter, and in case CUDA is optional
|
||||
```nix
|
||||
cudaSupport ? false
|
||||
cudaPackages ? {}
|
||||
```
|
||||
|
||||
When using `callPackage`, you can choose to pass in a different variant, e.g.
|
||||
when a different version of the toolkit suffices
|
||||
```nix
|
||||
mypkg = callPackage { cudaPackages = cudaPackages_11_5; }
|
||||
```
|
||||
|
||||
If another version of say `cudnn` or `cutensor` is needed, you can override the
|
||||
package set to make it the default. This guarantees you get a consistent package
|
||||
set.
|
||||
```nix
|
||||
mypkg = let
|
||||
cudaPackages = cudaPackages_11_5.overrideScope' (final: prev {
|
||||
cudnn = prev.cudnn_8_3_2;
|
||||
}});
|
||||
in callPackage { inherit cudaPackages; };
|
||||
```
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue