Merge commit '57725ef3ec0b51fea97137fca7cb8f14c98b4525' as 'third_party/nixpkgs'
This commit is contained in:
commit
8a1c371b63
44126 changed files with 5655249 additions and 0 deletions
122
third_party/nixpkgs/.editorconfig
vendored
Normal file
122
third_party/nixpkgs/.editorconfig
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
# EditorConfig configuration for nixpkgs
|
||||
# https://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file, utf-8 charset
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
# Ignore diffs/patches
|
||||
[*.{diff,patch}]
|
||||
end_of_line = unset
|
||||
insert_final_newline = unset
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
# We want readFile .version to return the version without a newline.
|
||||
[.version]
|
||||
insert_final_newline = false
|
||||
|
||||
# see https://nixos.org/nixpkgs/manual/#chap-conventions
|
||||
|
||||
# Match json/lockfiles/markdown/nix/perl/python/ruby/shell/docbook files, set indent to spaces
|
||||
[*.{json,lock,md,nix,pl,pm,py,rb,sh,xml}]
|
||||
indent_style = space
|
||||
|
||||
# Match docbook files, set indent width of one
|
||||
[*.xml]
|
||||
indent_size = 1
|
||||
|
||||
# Match json/lockfiles/markdown/nix/ruby files, set indent width of two
|
||||
[*.{json,lock,md,nix,rb}]
|
||||
indent_size = 2
|
||||
|
||||
# Match perl/python/shell scripts, set indent width of four
|
||||
[*.{pl,pm,py,sh}]
|
||||
indent_size = 4
|
||||
|
||||
# Match gemfiles, set indent to spaces with width of two
|
||||
[Gemfile]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
# Match package.json, which are generally pulled from upstream and accept them as they are
|
||||
[package.json]
|
||||
indent_style = unset
|
||||
|
||||
# Disable file types or individual files
|
||||
# some of these files may be auto-generated and/or require significant changes
|
||||
|
||||
[*.{c,h}]
|
||||
insert_final_newline = unset
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[*.{asc,key,ovpn}]
|
||||
insert_final_newline = unset
|
||||
end_of_line = unset
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[*.lock]
|
||||
indent_size = unset
|
||||
|
||||
# Although Markdown/CommonMark allows using two trailing spaces to denote
|
||||
# a hard line break, we do not use that feature in nixpkgs since
|
||||
# it forces the surrounding paragraph to become a <literallayout> which
|
||||
# does not wrap reasonably.
|
||||
# Instead of a hard line break, start a new paragraph by inserting a blank line.
|
||||
[*.md]
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# binaries
|
||||
[*.nib]
|
||||
end_of_line = unset
|
||||
insert_final_newline = unset
|
||||
trim_trailing_whitespace = unset
|
||||
charset = unset
|
||||
|
||||
[eggs.nix]
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[nixos/modules/services/networking/ircd-hybrid/*.{conf,in}]
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[pkgs/build-support/dotnetenv/Wrapper/**]
|
||||
end_of_line = unset
|
||||
indent_style = unset
|
||||
insert_final_newline = unset
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[pkgs/development/compilers/elm/registry.dat]
|
||||
end_of_line = unset
|
||||
insert_final_newline = unset
|
||||
|
||||
[pkgs/development/haskell-modules/hackage-packages.nix]
|
||||
indent_style = unset
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[pkgs/misc/documentation-highlighter/**]
|
||||
insert_final_newline = unset
|
||||
|
||||
[pkgs/servers/dict/wordnet_structures.py]
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[pkgs/tools/misc/timidity/timidity.cfg]
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[pkgs/tools/virtualization/ovftool/*.ova]
|
||||
end_of_line = unset
|
||||
insert_final_newline = unset
|
||||
trim_trailing_whitespace = unset
|
||||
charset = unset
|
||||
|
||||
[lib/tests/*.plist]
|
||||
indent_style = tab
|
||||
insert_final_newline = unset
|
||||
|
||||
[pkgs/kde/generated/**]
|
||||
insert_final_newline = unset
|
||||
end_of_line = unset
|
205
third_party/nixpkgs/.git-blame-ignore-revs
vendored
Normal file
205
third_party/nixpkgs/.git-blame-ignore-revs
vendored
Normal file
|
@ -0,0 +1,205 @@
|
|||
# This file contains a list of commits that are not likely what you
|
||||
# are looking for in a blame, such as mass reformatting or renaming.
|
||||
# You can set this file as a default ignore file for blame by running
|
||||
# the following command.
|
||||
#
|
||||
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||
#
|
||||
# To temporarily not use this file add
|
||||
# --ignore-revs-file=""
|
||||
# to your blame command.
|
||||
#
|
||||
# The ignoreRevsFile can't be set globally due to blame failing if the file isn't present.
|
||||
# To not have to set the option in every repository it is needed in,
|
||||
# save the following script in your path with the name "git-bblame"
|
||||
# now you can run
|
||||
# $ git bblame $FILE
|
||||
# to use the .git-blame-ignore-revs file if it is present.
|
||||
#
|
||||
# #!/usr/bin/env bash
|
||||
# repo_root=$(git rev-parse --show-toplevel)
|
||||
# if [[ -e $repo_root/.git-blame-ignore-revs ]]; then
|
||||
# git blame --ignore-revs-file="$repo_root/.git-blame-ignore-revs" $@
|
||||
# else
|
||||
# git blame $@
|
||||
# fi
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# pkgs/stdenv/make-derivation: Reindent
|
||||
b4cc2a2479a7ab0f6440b2e1319221920ef72699
|
||||
|
||||
# treewide: automatically md-convert option descriptions
|
||||
2e751c0772b9d48ff6923569adfa661b030ab6a2
|
||||
|
||||
# nixos/*: automatically convert option docs
|
||||
087472b1e5230ffc8ba642b1e4f9218adf4634a2
|
||||
|
||||
# nixos/*: automatically convert option descriptions
|
||||
ef176dcf7e76c3639571d7c6051246c8fbadf12a
|
||||
|
||||
# nixos/*: automatically convert option docs to MD
|
||||
61e93df1891972bae3e0c97a477bd44e8a477aa0
|
||||
|
||||
# nixos/*: convert options with admonitions to MD
|
||||
722b99bc0eb57711c0498a86a3f55e6c69cdb05f
|
||||
|
||||
# nixos/*: automatically convert option docs
|
||||
6039648c50c7c0858b5e506c6298773a98e0f066
|
||||
|
||||
# nixos/*: md-convert options with unordered lists
|
||||
c915b915b5e466a0b0b2af2906cd4d2380b8a1de
|
||||
|
||||
# nixos/*: convert options with listings
|
||||
f2ea09ecbe1fa1da32eaa6e036d64ac324a2986f
|
||||
|
||||
# nixos/*: convert straggler options to MD
|
||||
1d41cff3dc4c8f37bb5841f51fcbff705e169178
|
||||
|
||||
# nixos/*: normalize manpage references to single-line form
|
||||
423545fe4865d126e86721ba30da116e29c65004
|
||||
|
||||
# nixos/documentation: split options doc build
|
||||
fc614c37c653637e5475a0b0a987489b4d1f351d
|
||||
|
||||
# nixos/*: convert options with admonitions to MD
|
||||
722b99bc0eb57711c0498a86a3f55e6c69cdb05f
|
||||
|
||||
# nixos/*: convert internal option descriptions to MD
|
||||
9547123258f69efd92b54763051d6dc7f3bfcaca
|
||||
|
||||
# nixos/*: replace </para><para> with double linebreaks
|
||||
694d5b19d30bf66687b42fb77f43ea7cd1002a62
|
||||
|
||||
# treewide: add defaultText for options with simple interpolation defaults
|
||||
fb0e5be84331188a69b3edd31679ca6576edb75a
|
||||
|
||||
# nixos/*: mark pre-existing markdown descriptions as mdDoc
|
||||
7e7d68a250f75678451cd44f8c3d585bf750461e
|
||||
|
||||
# nixos/*: normalize link format
|
||||
3aebb4a2be8821a6d8a695f0908d8567dc00de31
|
||||
|
||||
# nixos/*: replace <code> in option docs with <literal>
|
||||
16102dce2fbad670bd47dd75c860a8daa5fe47ad
|
||||
|
||||
# nixos/*: add trivial defaultText for options with simple defaults
|
||||
25124556397ba17bfd70297000270de1e6523b0a
|
||||
|
||||
# systemd: rewrite comments
|
||||
92dfeb7b3dab820ae307c56c216d175c69ee93cd
|
||||
|
||||
# systemd: break too long lines of Nix code
|
||||
67643f8ec84bef1482204709073e417c9f07eb87
|
||||
|
||||
# {pkgs/development/cuda-modules,pkgs/test/cuda,pkgs/top-level/cuda-packages.nix}: reformat all CUDA files with nixfmt-rfc-style 2023-03-01
|
||||
802a1b4d3338f24cbc4efd704616654456d75a94
|
||||
|
||||
# postgresql: move packages.nix to ext/default.nix
|
||||
719034f6f6749d624faa28dff259309fc0e3e730
|
||||
|
||||
# php ecosystem: reformat with nixfmt-rfc-style
|
||||
75ae7621330ff8db944ce4dff4374e182d5d151f
|
||||
c759efa5e7f825913f9a69ef20f025f50f56dc4d
|
||||
|
||||
# pkgs/os-specific/bsd: Reformat with nixfmt-rfc-style 2024-03-01
|
||||
3fe3b055adfc020e6a923c466b6bcd978a13069a
|
||||
|
||||
# k3s: format with nixfmt-rfc-style
|
||||
6cfcd3c75428ede517bc6b15a353d704837a2830
|
||||
|
||||
# python3Packages: format with nixfmt
|
||||
59b1aef59071cae6e87859dc65de973d2cc595c0
|
||||
|
||||
# treewide description changes (#317959)
|
||||
bf995e3641950f4183c1dd9010349263dfa0123b
|
||||
755b915a158c9d588f08e9b08da9f7f3422070cc
|
||||
f8c4a98e8e138e21353a2c33b90db3359f539b37
|
||||
|
||||
# vscode-extensions.*: format with nixfmt (RFC 166)
|
||||
7bf9febfa6271012b1ef86647a3a06f06875fdcf
|
||||
|
||||
# remove uses of mdDoc (#303841)
|
||||
1a24330f792c8625746d07d842290e6fd95ae6f9
|
||||
acd0e3898feb321cb9a71a0fd376f1157d0f4553
|
||||
1b28414d2886c57343864326dbb745a634d3e37d
|
||||
6afb255d976f85f3359e4929abd6f5149c323a02
|
||||
|
||||
# azure-cli: move to by-name, nixfmt #325950
|
||||
96cd538b68bd1d0a0a37979356d669abbba32ebc
|
||||
|
||||
# poptracker: format with nixfmt-rfc-style (#326697)
|
||||
ff5c8f6cc3d1f2e017e86d50965c14b71f00567b
|
||||
|
||||
# mangal: format with nixfmt-rfc-style #328284
|
||||
3bb5e993cac3a6e1c3056d2bc9bf43eb2c7a5951
|
||||
|
||||
# pico-sdk: switch to finalAttrs (#329438)
|
||||
8946018b0391ae594d167f1e58497b18de068968
|
||||
|
||||
# ollama: format with nixfmt-rfc-style (#329353)
|
||||
bdfde18037f8d9f9b641a4016c8ada4dc4cbf856
|
||||
|
||||
# nixos/ollama: format with nixfmt-rfc-style (#329561)
|
||||
246d1ee533810ac1946d863bbd9de9b525818d56
|
||||
|
||||
# steam: cleanup (#216972)
|
||||
ad815aebfbfe1415ff6436521d545029c803c3fb
|
||||
|
||||
# nixos/nvidia: apply nixfmt-rfc-style (#313440)
|
||||
fbdcdde04a7caa007e825a8b822c75fab9adb2d6
|
||||
|
||||
# treewide: reformat files which need reformatting after (#341407)
|
||||
e0464e47880a69896f0fb1810f00e0de469f770a
|
||||
|
||||
# step-cli: format package.nix with nixfmt (#331629)
|
||||
fc7a83f8b62e90de5679e993d4d49ca014ea013d
|
||||
|
||||
# ndn-cxx: format with nixfmt-rfc-style
|
||||
160b2b769c3b8a6d1ae9947afa77520fa2887db7
|
||||
|
||||
# ndn-tools: format with nixfmt-rfc-style
|
||||
4882ef721ce3d7bb3b5e48ff80125255db515013
|
||||
|
||||
# nfd: format with nixfmt-rfc-style
|
||||
548c2377fa81e2abfc192fbf4f521e601251c468
|
||||
|
||||
# darwin.stdenv: format with nixfmt-rfc-style (#333962)
|
||||
93c10ac9e561c6594d3baaeaff2341907390d9b8
|
||||
|
||||
# nrr: format with nixfmt-rfc-style (#334578)
|
||||
cffc27daf06c77c0d76bc35d24b929cb9d68c3c9
|
||||
|
||||
# nixos/kanidm: inherit lib, nixfmt
|
||||
8f18393d380079904d072007fb19dc64baef0a3a
|
||||
|
||||
# fetchurl: nixfmt-rfc-style
|
||||
ce21e97a1f20dee15da85c084f9d1148d84f853b
|
||||
|
||||
# percona: apply nixfmt
|
||||
8d14fa2886fec877690c6d28cfcdba4503dbbcea
|
||||
|
||||
# nixos/virtualisation: format image-related files
|
||||
# Original formatting commit that was reverted
|
||||
04fadac429ca7d6b92025188652376c230205730
|
||||
# Revert commit
|
||||
4cec81a9959ce612b653860dcca53101a36f328a
|
||||
# Final commit that does the formatting
|
||||
88b285c01d84de82c0b2b052fd28eaf6709c2d26
|
||||
|
||||
# sqlc: format with nixfmt
|
||||
2bdec131b2bb2c8563f4556d741d34ccb77409e2
|
20
third_party/nixpkgs/.gitattributes
vendored
Normal file
20
third_party/nixpkgs/.gitattributes
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
**/deps.nix linguist-generated
|
||||
**/deps.json linguist-generated
|
||||
**/deps.toml linguist-generated
|
||||
**/node-packages.nix linguist-generated
|
||||
|
||||
pkgs/applications/editors/emacs-modes/*-generated.nix linguist-generated
|
||||
pkgs/development/r-modules/*-packages.nix linguist-generated
|
||||
pkgs/development/haskell-modules/hackage-packages.nix linguist-generated
|
||||
pkgs/development/beam-modules/hex-packages.nix linguist-generated
|
||||
|
||||
doc/** linguist-documentation
|
||||
doc/default.nix linguist-documentation=false
|
||||
|
||||
nixos/doc/** linguist-documentation
|
||||
nixos/doc/default.nix linguist-documentation=false
|
||||
|
||||
nixos/modules/module-list.nix merge=union
|
||||
# pkgs/top-level/all-packages.nix merge=union
|
||||
|
||||
ci/OWNERS linguist-language=CODEOWNERS
|
11
third_party/nixpkgs/.github/ISSUE_TEMPLATE.md
vendored
Normal file
11
third_party/nixpkgs/.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
## Issue description
|
||||
|
||||
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
|
||||
|
||||
## Technical details
|
||||
|
||||
<!-- Please insert the output of running `nix-shell -p nix-info --run "nix-info -m"` below this line -->
|
44
third_party/nixpkgs/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
44
third_party/nixpkgs/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: '0.kind: bug'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
### Describe the bug
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
### Steps To Reproduce
|
||||
Steps to reproduce the behavior:
|
||||
1. ...
|
||||
2. ...
|
||||
3. ...
|
||||
|
||||
### Expected behavior
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
### Screenshots
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
### 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 insert the output of running `nix-shell -p nix-info --run "nix-info -m"` below this line -->
|
||||
|
||||
---
|
||||
|
||||
Add a :+1: [reaction] to [issues you find important].
|
||||
|
||||
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
|
41
third_party/nixpkgs/.github/ISSUE_TEMPLATE/build_failure.md
vendored
Normal file
41
third_party/nixpkgs/.github/ISSUE_TEMPLATE/build_failure.md
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
name: Build failure
|
||||
about: Create a report to help us improve
|
||||
title: 'Build failure: PACKAGENAME'
|
||||
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 insert the output of running `nix-shell -p nix-info --run "nix-info -m"` below this line -->
|
||||
|
||||
---
|
||||
|
||||
Add a :+1: [reaction] to [issues you find important].
|
||||
|
||||
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
|
38
third_party/nixpkgs/.github/ISSUE_TEMPLATE/missing_documentation.md
vendored
Normal file
38
third_party/nixpkgs/.github/ISSUE_TEMPLATE/missing_documentation.md
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
name: Missing or incorrect documentation
|
||||
about: Help us improve the Nixpkgs and NixOS reference manuals
|
||||
title: 'Documentation: '
|
||||
labels: '9.needs: documentation'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Problem
|
||||
|
||||
<!-- describe your problem -->
|
||||
|
||||
## Proposal
|
||||
|
||||
<!-- propose a solution (optional) -->
|
||||
|
||||
## 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
|
||||
|
||||
---
|
||||
|
||||
Add a :+1: [reaction] to [issues you find important].
|
||||
|
||||
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
|
35
third_party/nixpkgs/.github/ISSUE_TEMPLATE/out_of_date_package_report.md
vendored
Normal file
35
third_party/nixpkgs/.github/ISSUE_TEMPLATE/out_of_date_package_report.md
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
name: Out-of-date package reports
|
||||
about: For packages that are out-of-date
|
||||
title: 'Update request: PACKAGENAME OLDVERSION → NEWVERSION'
|
||||
labels: '9.needs: package (update)'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
- Package name:
|
||||
- Latest released version:
|
||||
<!-- Search your package here: https://search.nixos.org/packages?channel=unstable -->
|
||||
- Current version on the unstable channel:
|
||||
- Current version on the stable/release channel:
|
||||
<!--
|
||||
Type the name of your package and try to find an open pull request for the package
|
||||
If you find an open pull request, you can review it!
|
||||
There's a high chance that you'll have the new version right away while helping the community!
|
||||
-->
|
||||
- [ ] Checked the [nixpkgs pull requests](https://github.com/NixOS/nixpkgs/pulls)
|
||||
|
||||
**Notify maintainers**
|
||||
|
||||
<!-- If the search.nixos.org result shows no maintainers, tag the person that last updated the package. -->
|
||||
|
||||
-----
|
||||
|
||||
Note for maintainers: Please tag this issue in your PR.
|
||||
|
||||
---
|
||||
|
||||
Add a :+1: [reaction] to [issues you find important].
|
||||
|
||||
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
|
26
third_party/nixpkgs/.github/ISSUE_TEMPLATE/packaging_request.md
vendored
Normal file
26
third_party/nixpkgs/.github/ISSUE_TEMPLATE/packaging_request.md
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
name: Packaging requests
|
||||
about: For packages that are missing
|
||||
title: 'Package request: PACKAGENAME'
|
||||
labels: '0.kind: packaging request'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Project description**
|
||||
|
||||
<!-- Describe the project a little: -->
|
||||
|
||||
**Metadata**
|
||||
|
||||
* homepage URL:
|
||||
* source URL:
|
||||
* license: mit, bsd, gpl2+ , ...
|
||||
* platforms: unix, linux, darwin, ...
|
||||
|
||||
---
|
||||
|
||||
Add a :+1: [reaction] to [issues you find important].
|
||||
|
||||
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
|
94
third_party/nixpkgs/.github/ISSUE_TEMPLATE/unreproducible_package.md
vendored
Normal file
94
third_party/nixpkgs/.github/ISSUE_TEMPLATE/unreproducible_package.md
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
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: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Hello dear reporter,
|
||||
|
||||
Thank you for bringing attention to this issue. Your insights are valuable to
|
||||
us, and we appreciate the time you took to document the problem.
|
||||
|
||||
I wanted to kindly point out that in this issue template, it would be beneficial
|
||||
to replace the placeholder `<package>` with the actual, canonical name of the
|
||||
package you're reporting the issue for. Doing so will provide better context and
|
||||
facilitate quicker troubleshooting for anyone who reads this issue in the
|
||||
future.
|
||||
|
||||
Best regards
|
||||
-->
|
||||
|
||||
Building this package multiple times does not yield bit-by-bit identical
|
||||
results, complicating the detection of Continuous Integration (CI) breaches. For
|
||||
more information on this issue, visit
|
||||
[reproducible-builds.org](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
|
||||
|
||||
In the following steps, replace `<package>` with the canonical name of the
|
||||
package.
|
||||
|
||||
#### 1. Build the package
|
||||
|
||||
This step will build the package. Specific arguments are passed to the command
|
||||
to keep the build artifacts so we can compare them in case of differences.
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```
|
||||
nix-build '<nixpkgs>' -A <package> && nix-build '<nixpkgs>' -A <package> --check --keep-failed
|
||||
```
|
||||
|
||||
Or using the new command line style:
|
||||
|
||||
```
|
||||
nix build nixpkgs#<package> && nix build nixpkgs#<package> --rebuild --keep-failed
|
||||
```
|
||||
|
||||
#### 2. Compare the build artifacts
|
||||
|
||||
If the previous command completes successfully, no differences were found and
|
||||
there's nothing to do, builds are reproducible.
|
||||
If it terminates with the error message `error: derivation '<X>' may not be
|
||||
deterministic: output '<Y>' differs from '<Z>'`, use `diffoscope` to investigate
|
||||
the discrepancies between the two build outputs. You may need to add the
|
||||
`--exclude-directory-metadata recursive` option to ignore files and directories
|
||||
metadata (*e.g. timestamp*) differences.
|
||||
|
||||
```
|
||||
nix run nixpkgs#diffoscopeMinimal -- --exclude-directory-metadata recursive <Y> <Z>
|
||||
```
|
||||
|
||||
#### 3. Examine the build log
|
||||
|
||||
To examine the build log, use:
|
||||
|
||||
```
|
||||
nix-store --read-log $(nix-instantiate '<nixpkgs>' -A <package>)
|
||||
```
|
||||
|
||||
Or with the new command line style:
|
||||
|
||||
```
|
||||
nix log $(nix path-info --derivation nixpkgs#<package>)
|
||||
```
|
||||
|
||||
### Additional context
|
||||
|
||||
(please share the relevant fragment of the diffoscope output here, and any
|
||||
additional analysis you may have done)
|
||||
|
||||
---
|
||||
|
||||
Add a :+1: [reaction] to [issues you find important].
|
||||
|
||||
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
|
50
third_party/nixpkgs/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
50
third_party/nixpkgs/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
|
||||
<!--
|
||||
^ Please summarise the changes you have done and explain why they are necessary here ^
|
||||
|
||||
For package updates please link to a changelog or describe changes, this helps your fellow maintainers discover breaking updates.
|
||||
For new packages please briefly describe the package or provide a link to its homepage.
|
||||
-->
|
||||
|
||||
## Things done
|
||||
|
||||
<!-- Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers. -->
|
||||
|
||||
- Built on platform(s)
|
||||
- [ ] x86_64-linux
|
||||
- [ ] aarch64-linux
|
||||
- [ ] x86_64-darwin
|
||||
- [ ] aarch64-darwin
|
||||
- For non-Linux: Is sandboxing enabled in `nix.conf`? (See [Nix manual](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
|
||||
- [ ] `sandbox = relaxed`
|
||||
- [ ] `sandbox = true`
|
||||
- [ ] Tested, as applicable:
|
||||
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
|
||||
- and/or [package tests](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests)
|
||||
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
|
||||
- made sure NixOS tests are [linked](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#linking-nixos-module-tests-to-a-package) 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/`)
|
||||
- [24.11 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2411.section.md) (or backporting [23.11](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) and [24.05](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2405.section.md) 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
|
||||
- [ ] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
<!--
|
||||
To help with the large amounts of pull requests, we would appreciate your
|
||||
reviews of other pull requests, especially simple package updates. Just leave a
|
||||
comment describing what you have tested in the relevant package/service.
|
||||
Reviewing helps to reduce the average time-to-merge for everyone.
|
||||
Thanks a lot if you do!
|
||||
|
||||
List of open PRs: https://github.com/NixOS/nixpkgs/pulls
|
||||
Reviewing guidelines: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#reviewing-contributions
|
||||
-->
|
||||
|
||||
---
|
||||
|
||||
Add a :+1: [reaction] to [pull requests you find important].
|
||||
|
||||
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
|
36
third_party/nixpkgs/.github/STALE-BOT.md
vendored
Normal file
36
third_party/nixpkgs/.github/STALE-BOT.md
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
# 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).
|
||||
|
||||
## Suggestions for PRs
|
||||
|
||||
1. GitHub sometimes doesn't notify people who commented / reviewed a PR previously, when you (force) push commits. If you have addressed the reviews you can [officially ask for a review](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/requesting-a-pull-request-review) from those who commented to you or anyone else.
|
||||
2. If it is unfinished but you plan to finish it, please mark it as a draft.
|
||||
3. If you don't expect to work on it any time soon, closing it with a short comment may encourage someone else to pick up your work.
|
||||
4. To get things rolling again, rebase the PR against the target branch and address valid comments.
|
||||
5. If you need a review to move forward, ask in [the Discourse thread for PRs that need help](https://discourse.nixos.org/t/prs-in-distress/3604).
|
||||
6. If all you need is a merge, check the git history to find and [request reviews](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/requesting-a-pull-request-review) from people who usually merge related contributions.
|
||||
|
||||
## Suggestions for issues
|
||||
|
||||
1. If it is resolved (either for you personally, or in general), please consider closing it.
|
||||
2. If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
|
||||
3. If you still have interest in resolving it, try to ping somebody who you believe might have an interest in the topic. Consider discussing the problem in [our Discourse Forum](https://discourse.nixos.org/).
|
||||
4. As with all open source projects, your best option is to submit a Pull Request that addresses this issue. We :heart: this attitude!
|
||||
|
||||
**Memorandum on closing issues**
|
||||
|
||||
Don't be afraid to close an issue that holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
|
||||
|
||||
## Useful GitHub search queries
|
||||
|
||||
- [Open PRs with any stale-bot interaction](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+commenter%3Aapp%2Fstale+)
|
||||
- [Open PRs with any stale-bot interaction and `2.status: stale`](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+commenter%3Aapp%2Fstale+label%3A%222.status%3A+stale%22)
|
||||
- [Open PRs with any stale-bot interaction and NOT `2.status: stale`](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+commenter%3Aapp%2Fstale+-label%3A%222.status%3A+stale%22+)
|
||||
- [Open Issues with any stale-bot interaction](https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+commenter%3Aapp%2Fstale+)
|
||||
- [Open Issues with any stale-bot interaction and `2.status: stale`](https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+commenter%3Aapp%2Fstale+label%3A%222.status%3A+stale%22+)
|
||||
- [Open Issues with any stale-bot interaction and NOT `2.status: stale`](https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+commenter%3Aapp%2Fstale+-label%3A%222.status%3A+stale%22+)
|
6
third_party/nixpkgs/.github/dependabot.yml
vendored
Normal file
6
third_party/nixpkgs/.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
567
third_party/nixpkgs/.github/labeler.yml
vendored
Normal file
567
third_party/nixpkgs/.github/labeler.yml
vendored
Normal file
|
@ -0,0 +1,567 @@
|
|||
# NOTE: bsd, darwin and cross-compilation labels are handled by ofborg
|
||||
"6.topic: agda":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/agda.section.md
|
||||
- nixos/tests/agda.nix
|
||||
- pkgs/build-support/agda/**/*
|
||||
- pkgs/development/libraries/agda/**/*
|
||||
- pkgs/top-level/agda-packages.nix
|
||||
|
||||
"6.topic: cinnamon":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/x11/desktop-managers/cinnamon.nix
|
||||
- nixos/tests/cinnamon.nix
|
||||
- nixos/tests/cinnamon-wayland.nix
|
||||
- pkgs/by-name/ci/cinnamon-*/**/*
|
||||
- pkgs/by-name/cj/cjs/**/*
|
||||
- pkgs/by-name/mu/muffin/**/*
|
||||
- pkgs/by-name/ne/nemo/**/*
|
||||
- pkgs/by-name/ne/nemo-*/**/*
|
||||
|
||||
"6.topic: continuous integration":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- .github/**/*
|
||||
- ci/**/*
|
||||
|
||||
"6.topic: coq":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/applications/science/logic/coq/**/*
|
||||
- pkgs/development/coq-modules/**/*
|
||||
- pkgs/top-level/coq-packages.nix
|
||||
|
||||
"6.topic: crystal":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/development/compilers/crystal/**/*
|
||||
|
||||
"6.topic: cuda":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/development/cuda-modules/**/*
|
||||
- pkgs/top-level/cuda-packages.nix
|
||||
|
||||
"6.topic: deepin":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/desktops/deepin/**/*
|
||||
- pkgs/desktops/deepin/**/*
|
||||
|
||||
"6.topic: docker tools":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/applications/virtualization/docker/**/*
|
||||
|
||||
"6.topic: dotnet":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/dotnet.section.md
|
||||
- maintainers/scripts/update-dotnet-lockfiles.nix
|
||||
- pkgs/build-support/dotnet/**/*
|
||||
- pkgs/development/compilers/dotnet/**/*
|
||||
- pkgs/test/dotnet/**/*
|
||||
- pkgs/top-level/dotnet-packages.nix
|
||||
|
||||
"6.topic: emacs":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/editors/emacs.nix
|
||||
- nixos/modules/services/editors/emacs.xml
|
||||
- nixos/tests/emacs-daemon.nix
|
||||
- pkgs/applications/editors/emacs/build-support/**/*
|
||||
- pkgs/applications/editors/emacs/elisp-packages/**/*
|
||||
- pkgs/applications/editors/emacs/**/*
|
||||
- pkgs/top-level/emacs-packages.nix
|
||||
|
||||
"6.topic: Enlightenment DE":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/x11/desktop-managers/enlightenment.nix
|
||||
- pkgs/desktops/enlightenment/**/*
|
||||
- pkgs/development/python-modules/python-efl/*
|
||||
|
||||
"6.topic: erlang":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/beam.section.md
|
||||
- pkgs/development/beam-modules/**/*
|
||||
- pkgs/development/interpreters/elixir/**/*
|
||||
- pkgs/development/interpreters/erlang/**/*
|
||||
- pkgs/development/tools/build-managers/rebar/**/*
|
||||
- pkgs/development/tools/build-managers/rebar3/**/*
|
||||
- pkgs/development/tools/erlang/**/*
|
||||
- pkgs/top-level/beam-packages.nix
|
||||
|
||||
"6.topic: fetch":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/build-support/fetch*/**/*
|
||||
|
||||
"6.topic: flakes":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- '**/flake.nix'
|
||||
- lib/systems/flake-systems.nix
|
||||
- nixos/modules/config/nix-flakes.nix
|
||||
|
||||
"6.topic: flutter":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/build-support/flutter/*.nix
|
||||
- pkgs/development/compilers/flutter/**/*.nix
|
||||
|
||||
"6.topic: games":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/games/**/*
|
||||
|
||||
"6.topic: GNOME":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/gnome.section.md
|
||||
- nixos/modules/services/desktops/gnome/**/*
|
||||
- nixos/modules/services/x11/desktop-managers/gnome.nix
|
||||
- nixos/tests/gnome-xorg.nix
|
||||
- nixos/tests/gnome.nix
|
||||
- pkgs/desktops/gnome/**/*
|
||||
|
||||
"6.topic: golang":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/go.section.md
|
||||
- pkgs/build-support/go/**/*
|
||||
- pkgs/development/compilers/go/**/*
|
||||
|
||||
"6.topic: hardware":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/hardware/**/*
|
||||
|
||||
"6.topic: haskell":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/haskell.section.md
|
||||
- maintainers/scripts/haskell/**/*
|
||||
- pkgs/development/compilers/ghc/**/*
|
||||
- pkgs/development/haskell-modules/**/*
|
||||
- pkgs/development/tools/haskell/**/*
|
||||
- pkgs/test/haskell/**/*
|
||||
- pkgs/top-level/haskell-packages.nix
|
||||
- pkgs/top-level/release-haskell.nix
|
||||
|
||||
"6.topic: java":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/programs/java.nix
|
||||
- pkgs/development/compilers/graalvm/**/*
|
||||
- pkgs/development/compilers/openjdk/**/*
|
||||
- pkgs/development/compilers/temurin-bin/**/*
|
||||
- pkgs/development/compilers/zulu/**/*
|
||||
- pkgs/development/java-modules/**/*
|
||||
- pkgs/top-level/java-packages.nix
|
||||
|
||||
"6.topic: jitsi":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/networking/jitsi-videobridge.nix
|
||||
- nixos/modules/services/web-apps/jitsi-meet.nix
|
||||
- pkgs/servers/web-apps/jitsi-meet/**/*
|
||||
- pkgs/servers/jitsi-videobridge/**/*
|
||||
- pkgs/applications/networking/instant-messengers/jitsi/**/*
|
||||
|
||||
"6.topic: julia":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/julia.section.md
|
||||
- pkgs/development/compilers/julia/**/*
|
||||
- pkgs/development/julia-modules/**/*
|
||||
|
||||
"6.topic: jupyter":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/development/python-modules/jupyter*/**/*
|
||||
- pkgs/development/python-modules/mkdocs-jupyter/*
|
||||
- nixos/modules/services/development/jupyter/**/*
|
||||
- pkgs/applications/editors/jupyter-kernels/**/*
|
||||
- pkgs/applications/editors/jupyter/**/*
|
||||
|
||||
"6.topic: k3s":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/cluster/k3s/**/*
|
||||
- nixos/tests/k3s/**/*
|
||||
- pkgs/applications/networking/cluster/k3s/**/*
|
||||
|
||||
"6.topic: kernel":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/build-support/kernel/**/*
|
||||
- pkgs/os-specific/linux/kernel/**/*
|
||||
|
||||
"6.topic: lib":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- lib/**
|
||||
|
||||
"6.topic: llvm/clang":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/development/compilers/llvm/**/*
|
||||
|
||||
"6.topic: lua":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/development/tools/misc/luarocks/*
|
||||
- pkgs/development/interpreters/lua-5/**/*
|
||||
- pkgs/development/interpreters/luajit/**/*
|
||||
- pkgs/development/lua-modules/**/*
|
||||
- pkgs/top-level/lua-packages.nix
|
||||
|
||||
"6.topic: Lumina DE":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/x11/desktop-managers/lumina.nix
|
||||
- pkgs/desktops/lumina/**/*
|
||||
|
||||
"6.topic: LXQt":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/x11/desktop-managers/lxqt.nix
|
||||
- pkgs/desktops/lxqt/**/*
|
||||
|
||||
"6.topic: mate":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/x11/desktop-managers/mate.nix
|
||||
- nixos/tests/mate.nix
|
||||
- pkgs/desktops/mate/**/*
|
||||
|
||||
"6.topic: module system":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- lib/modules.nix
|
||||
- lib/types.nix
|
||||
- lib/options.nix
|
||||
- lib/tests/modules.sh
|
||||
- lib/tests/modules/**
|
||||
|
||||
"6.topic: musl":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/os-specific/linux/musl/**/*
|
||||
|
||||
"6.topic: nixos":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/**/*
|
||||
- pkgs/by-name/sw/switch-to-configuration-ng/**/*
|
||||
- pkgs/os-specific/linux/nixos-rebuild/**/*
|
||||
|
||||
"6.topic: nixos-container":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/virtualisation/nixos-containers.nix
|
||||
- pkgs/tools/virtualization/nixos-container/**/*
|
||||
|
||||
"6.topic: nim":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/nim.section.md
|
||||
- pkgs/build-support/build-nim-package.nix
|
||||
- pkgs/by-name/ni/nim*
|
||||
- pkgs/top-level/nim-overrides.nix
|
||||
|
||||
"6.topic: nodejs":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/javascript.section.md
|
||||
- pkgs/build-support/node/**/*
|
||||
- pkgs/development/node-packages/**/*
|
||||
- pkgs/development/tools/yarn/*
|
||||
- pkgs/development/tools/yarn2nix-moretea/**/*
|
||||
- pkgs/development/tools/pnpm/**/*
|
||||
- pkgs/development/web/nodejs/*
|
||||
|
||||
"6.topic: nvidia":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/hardware/video/nvidia.nix
|
||||
- nixos/modules/services/hardware/nvidia-container-toolkit/**/*
|
||||
- nixos/modules/services/hardware/nvidia-optimus.nix
|
||||
- pkgs/os-specific/linux/nvidia-x11/**/*
|
||||
|
||||
"6.topic: ocaml":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/ocaml.section.md
|
||||
- pkgs/development/compilers/ocaml/**/*
|
||||
- pkgs/development/compilers/reason/**/*
|
||||
- pkgs/development/ocaml-modules/**/*
|
||||
- pkgs/development/tools/ocaml/**/*
|
||||
- pkgs/top-level/ocaml-packages.nix
|
||||
|
||||
"6.topic: pantheon":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/desktops/pantheon/**/*
|
||||
- nixos/modules/services/x11/desktop-managers/pantheon.nix
|
||||
- nixos/modules/services/x11/display-managers/lightdm-greeters/pantheon.nix
|
||||
- nixos/tests/pantheon.nix
|
||||
- pkgs/desktops/pantheon/**/*
|
||||
|
||||
"6.topic: php":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/php.section.md
|
||||
- pkgs/build-support/php/**/*
|
||||
- pkgs/development/interpreters/php/*
|
||||
- pkgs/development/php-packages/**/*
|
||||
- pkgs/test/php/default.nix
|
||||
- pkgs/top-level/php-packages.nix
|
||||
|
||||
"6.topic: policy discussion":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- .github/**/*
|
||||
- CONTRIBUTING.md
|
||||
- pkgs/README.md
|
||||
- nixos/README.md
|
||||
- maintainers/README.md
|
||||
- lib/README.md
|
||||
- doc/README.md
|
||||
|
||||
"6.topic: printing":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/services/printing/cupsd.nix
|
||||
- pkgs/misc/cups/**/*
|
||||
|
||||
"6.topic: python":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/python.section.md
|
||||
- pkgs/development/interpreters/python/**/*
|
||||
- pkgs/development/python-modules/**/*
|
||||
- pkgs/top-level/python-packages.nix
|
||||
|
||||
"6.topic: qt/kde":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/qt.section.md
|
||||
- nixos/modules/services/x11/desktop-managers/plasma5.nix
|
||||
- nixos/tests/plasma5.nix
|
||||
- pkgs/applications/kde/**/*
|
||||
- pkgs/desktops/plasma-5/**/*
|
||||
- pkgs/development/libraries/kde-frameworks/**/*
|
||||
- pkgs/development/libraries/qt-5/**/*
|
||||
|
||||
"6.topic: R":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/applications/science/math/R/**/*
|
||||
- pkgs/development/r-modules/**/*
|
||||
|
||||
"6.topic: rocm":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/development/rocm-modules/**/*
|
||||
|
||||
"6.topic: ruby":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/ruby.section.md
|
||||
- pkgs/development/interpreters/ruby/**/*
|
||||
- pkgs/development/ruby-modules/**/*
|
||||
|
||||
"6.topic: rust":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/rust.section.md
|
||||
- pkgs/build-support/rust/**/*
|
||||
- pkgs/development/compilers/rust/**/*
|
||||
|
||||
"6.topic: stdenv":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/stdenv/**/*
|
||||
|
||||
"6.topic: steam":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/games/steam/**/*
|
||||
|
||||
"6.topic: systemd":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/os-specific/linux/systemd/**/*
|
||||
- nixos/modules/system/boot/systemd*/**/*
|
||||
|
||||
"6.topic: tcl":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/tcl.section.md
|
||||
- pkgs/development/interpreters/tcl/*
|
||||
- pkgs/development/tcl-modules/**/*
|
||||
- pkgs/top-level/tcl-packages.nix
|
||||
|
||||
"6.topic: TeX":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/texlive.section.md
|
||||
- pkgs/test/texlive/**
|
||||
- pkgs/tools/typesetting/tex/**/*
|
||||
|
||||
"6.topic: testing":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
# NOTE: Let's keep the scope limited to test frameworks that are
|
||||
# *developed in this repo*;
|
||||
# - not individual tests
|
||||
# - not packages for test frameworks
|
||||
- pkgs/build-support/testers/**
|
||||
- nixos/lib/testing/**
|
||||
- nixos/lib/test-driver/**
|
||||
- nixos/tests/nixos-test-driver/**
|
||||
- nixos/lib/testing-python.nix # legacy
|
||||
- nixos/tests/make-test-python.nix # legacy
|
||||
# lib/debug.nix has a test framework (runTests) but it's not the main focus
|
||||
|
||||
"6.topic: updaters":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/common-updater/**/*
|
||||
|
||||
"6.topic: vim":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/languages-frameworks/vim.section.md
|
||||
- pkgs/applications/editors/vim/**/*
|
||||
- pkgs/applications/editors/vim/plugins/**/*
|
||||
- nixos/modules/programs/neovim.nix
|
||||
- pkgs/applications/editors/neovim/**/*
|
||||
|
||||
"6.topic: vscode":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/applications/editors/vscode/**/*
|
||||
|
||||
"6.topic: windows":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/os-specific/windows/**/*
|
||||
|
||||
"6.topic: xen-project":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/virtualisation/xen*
|
||||
- pkgs/by-name/xe/xen/*
|
||||
- pkgs/by-name/qe/qemu_xen/*
|
||||
- pkgs/by-name/xe/xen-guest-agent/*
|
||||
- pkgs/by-name/xt/xtf/*
|
||||
- pkgs/build-support/xen/*
|
||||
- pkgs/development/ocaml-modules/xen*/*
|
||||
- pkgs/development/ocaml-modules/vchan/*
|
||||
|
||||
"6.topic: xfce":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/doc/manual/configuration/xfce.xml
|
||||
- nixos/modules/services/x11/desktop-managers/xfce.nix
|
||||
- nixos/tests/xfce.nix
|
||||
- pkgs/desktops/xfce/**/*
|
||||
|
||||
"6.topic: zig":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- pkgs/development/compilers/zig/**/*
|
||||
- doc/hooks/zig.section.md
|
||||
|
||||
"8.has: changelog":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/doc/manual/release-notes/**/*
|
||||
|
||||
"8.has: documentation":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/**/*
|
||||
- nixos/doc/**/*
|
||||
|
||||
"8.has: module (update)":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- nixos/modules/**/*
|
||||
"8.has: maintainer-list (update)":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- maintainers/maintainer-list.nix
|
9
third_party/nixpkgs/.github/stale.yml
vendored
Normal file
9
third_party/nixpkgs/.github/stale.yml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
daysUntilStale: 180
|
||||
daysUntilClose: false
|
||||
exemptLabels:
|
||||
- "1.severity: security"
|
||||
- "2.status: never-stale"
|
||||
staleLabel: "2.status: stale"
|
||||
markComment: false
|
||||
closeComment: false
|
35
third_party/nixpkgs/.github/workflows/backport.yml
vendored
Normal file
35
third_party/nixpkgs/.github/workflows/backport.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: Backport
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [closed, labeled]
|
||||
|
||||
# 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.
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
backport:
|
||||
permissions:
|
||||
contents: write # for korthout/backport-action to create branch
|
||||
pull-requests: write # for korthout/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
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Create backport PRs
|
||||
uses: korthout/backport-action@bd410d37cdcae80be6d969823ff5a225fe5c833f # v3.0.2
|
||||
with:
|
||||
# Config README: https://github.com/korthout/backport-action#backport-action
|
||||
copy_labels_pattern: 'severity:\ssecurity'
|
||||
pull_description: |-
|
||||
Bot-based backport to `${target_branch}`, triggered by a label in #${pull_number}.
|
||||
|
||||
* [ ] Before merging, ensure that this backport is [acceptable for the release](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#changes-acceptable-for-releases).
|
||||
* Even as a non-commiter, if you find that it is not acceptable, leave a comment.
|
31
third_party/nixpkgs/.github/workflows/basic-eval.yml
vendored
Normal file
31
third_party/nixpkgs/.github/workflows/basic-eval.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: Basic evaluation checks
|
||||
|
||||
on:
|
||||
workflow_dispatch
|
||||
# pull_request:
|
||||
# branches:
|
||||
# - master
|
||||
# - release-**
|
||||
# push:
|
||||
# branches:
|
||||
# - master
|
||||
# - release-**
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: basic-eval-checks
|
||||
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
- uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
|
||||
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 }}'
|
||||
- run: nix --experimental-features 'nix-command flakes' flake check --all-systems --no-build
|
||||
# explicit list of supportedSystems is needed until aarch64-darwin becomes part of the trunk jobset
|
||||
- run: nix-build pkgs/top-level/release.nix -A release-checks --arg supportedSystems '[ "aarch64-darwin" "aarch64-linux" "x86_64-linux" "x86_64-darwin" ]'
|
26
third_party/nixpkgs/.github/workflows/check-cherry-picks.yml
vendored
Normal file
26
third_party/nixpkgs/.github/workflows/check-cherry-picks.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
name: "Check cherry-picks"
|
||||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- 'release-**'
|
||||
- 'staging-**'
|
||||
- '!staging-next'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: cherry-pick-check
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'NixOS'
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
- name: Check cherry-picks
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
./maintainers/scripts/check-cherry-picks.sh "$BASE_SHA" "$HEAD_SHA"
|
29
third_party/nixpkgs/.github/workflows/check-maintainers-sorted.yaml
vendored
Normal file
29
third_party/nixpkgs/.github/workflows/check-maintainers-sorted.yaml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
name: "Check that maintainer list is sorted"
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
paths:
|
||||
- 'maintainers/maintainer-list.nix'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
nixos:
|
||||
name: maintainer-list-check
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'NixOS'
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
# Only these directories to perform the check
|
||||
sparse-checkout: |
|
||||
lib
|
||||
maintainers
|
||||
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
with:
|
||||
# explicitly enable sandbox
|
||||
extra_nix_config: sandbox = true
|
||||
- name: Check that maintainer-list.nix is sorted
|
||||
run: nix-instantiate --eval maintainers/scripts/check-maintainers-sorted.nix
|
90
third_party/nixpkgs/.github/workflows/check-nix-format.yml
vendored
Normal file
90
third_party/nixpkgs/.github/workflows/check-nix-format.yml
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
# This file was copied mostly from check-maintainers-sorted.yaml.
|
||||
# NOTE: Formatting with the RFC-style nixfmt command is not yet stable. See
|
||||
# https://github.com/NixOS/rfcs/pull/166.
|
||||
# Because of this, this action is not yet enabled for all files -- only for
|
||||
# those who have opted in.
|
||||
name: Check that Nix files are formatted
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
# See the comment at the same location in ./nixpkgs-vet.yml
|
||||
types: [opened, synchronize, reopened, edited]
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
nixos:
|
||||
name: nixfmt-check
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip treewide]')"
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
# Fetches the merge commit and its parents
|
||||
fetch-depth: 2
|
||||
- name: Checking out base branch
|
||||
run: |
|
||||
base=$(mktemp -d)
|
||||
baseRev=$(git rev-parse HEAD^1)
|
||||
git worktree add "$base" "$baseRev"
|
||||
echo "baseRev=$baseRev" >> "$GITHUB_ENV"
|
||||
echo "base=$base" >> "$GITHUB_ENV"
|
||||
- name: Get Nixpkgs revision for nixfmt
|
||||
run: |
|
||||
# pin to a commit from nixpkgs-unstable to avoid e.g. building nixfmt
|
||||
# from staging
|
||||
# This should not be a URL, because it would allow PRs to run arbitrary code in CI!
|
||||
rev=$(jq -r .rev ci/pinned-nixpkgs.json)
|
||||
echo "url=https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz" >> "$GITHUB_ENV"
|
||||
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
with:
|
||||
# explicitly enable sandbox
|
||||
extra_nix_config: sandbox = true
|
||||
nix_path: nixpkgs=${{ env.url }}
|
||||
- name: Install nixfmt
|
||||
run: "nix-env -f '<nixpkgs>' -iAP nixfmt-rfc-style"
|
||||
- name: Check that Nix files are formatted according to the RFC style
|
||||
run: |
|
||||
unformattedFiles=()
|
||||
|
||||
# TODO: Make this more parallel
|
||||
|
||||
# Loop through all Nix files touched by the PR
|
||||
while readarray -d '' -n 2 entry && (( ${#entry[@]} != 0 )); do
|
||||
type=${entry[0]}
|
||||
file=${entry[1]}
|
||||
case $type in
|
||||
A*)
|
||||
source=""
|
||||
dest=$file
|
||||
;;
|
||||
M*)
|
||||
source=$file
|
||||
dest=$file
|
||||
;;
|
||||
C*|R*)
|
||||
source=$file
|
||||
read -r -d '' dest
|
||||
;;
|
||||
*)
|
||||
echo "Ignoring file $file with type $type"
|
||||
continue
|
||||
esac
|
||||
|
||||
# Ignore files that weren't already formatted
|
||||
if [[ -n "$source" ]] && ! nixfmt --check ${{ env.base }}/"$source" 2>/dev/null; then
|
||||
echo "Ignoring file $file because it's not formatted in the base commit"
|
||||
elif ! nixfmt --check "$dest"; then
|
||||
unformattedFiles+=("$dest")
|
||||
fi
|
||||
done < <(git diff -z --name-status ${{ env.baseRev }} -- '*.nix')
|
||||
|
||||
if (( "${#unformattedFiles[@]}" > 0 )); then
|
||||
echo "Some new/changed Nix files are not properly formatted"
|
||||
echo "Please go to the Nixpkgs root directory, run \`nix-shell\`, then:"
|
||||
echo "nixfmt ${unformattedFiles[*]@Q}"
|
||||
echo "If you're having trouble, please ping @NixOS/nix-formatting"
|
||||
exit 1
|
||||
fi
|
129
third_party/nixpkgs/.github/workflows/check-nixf-tidy.yml
vendored
Normal file
129
third_party/nixpkgs/.github/workflows/check-nixf-tidy.yml
vendored
Normal file
|
@ -0,0 +1,129 @@
|
|||
name: Check changed Nix files with nixf-tidy (experimental)
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened, edited]
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
nixos:
|
||||
name: exp-nixf-tidy-check
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip treewide]')"
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
# Fetches the merge commit and its parents
|
||||
fetch-depth: 2
|
||||
- name: Checking out base branch
|
||||
run: |
|
||||
base=$(mktemp -d)
|
||||
baseRev=$(git rev-parse HEAD^1)
|
||||
git worktree add "$base" "$baseRev"
|
||||
echo "baseRev=$baseRev" >> "$GITHUB_ENV"
|
||||
echo "base=$base" >> "$GITHUB_ENV"
|
||||
- name: Get Nixpkgs revision for nixf
|
||||
run: |
|
||||
# pin to a commit from nixpkgs-unstable to avoid e.g. building nixf
|
||||
# from staging
|
||||
# This should not be a URL, because it would allow PRs to run arbitrary code in CI!
|
||||
rev=$(jq -r .rev ci/pinned-nixpkgs.json)
|
||||
echo "url=https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz" >> "$GITHUB_ENV"
|
||||
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
with:
|
||||
# explicitly enable sandbox
|
||||
extra_nix_config: sandbox = true
|
||||
nix_path: nixpkgs=${{ env.url }}
|
||||
- name: Install nixf and jq
|
||||
# provided jq is incompatible with our expression
|
||||
run: "nix-env -f '<nixpkgs>' -iAP nixf jq"
|
||||
- name: Check that Nix files pass nixf-tidy
|
||||
run: |
|
||||
# Filtering error messages we don't like
|
||||
nixf_wrapper(){
|
||||
nixf-tidy --variable-lookup < "$1" | jq -r '
|
||||
[
|
||||
"sema-escaping-with"
|
||||
]
|
||||
as $ignored_errors|[.[]|select(.sname as $s|$ignored_errors|index($s)|not)]
|
||||
'
|
||||
}
|
||||
|
||||
failedFiles=()
|
||||
|
||||
# Don't report errors to file overview
|
||||
# to avoid duplicates when editing title and description
|
||||
if [[ "${{ github.event.action }}" == 'edited' ]] && [[ -z "${{ github.event.edited.changes.base }}" ]]; then
|
||||
DONT_REPORT_ERROR=1
|
||||
else
|
||||
DONT_REPORT_ERROR=
|
||||
fi
|
||||
# TODO: Make this more parallel
|
||||
|
||||
# Loop through all Nix files touched by the PR
|
||||
while readarray -d '' -n 2 entry && (( ${#entry[@]} != 0 )); do
|
||||
type=${entry[0]}
|
||||
file=${entry[1]}
|
||||
case $type in
|
||||
A*)
|
||||
source=""
|
||||
dest=$file
|
||||
;;
|
||||
M*)
|
||||
source=$file
|
||||
dest=$file
|
||||
;;
|
||||
C*|R*)
|
||||
source=$file
|
||||
read -r -d '' dest
|
||||
;;
|
||||
*)
|
||||
echo "Ignoring file $file with type $type"
|
||||
continue
|
||||
esac
|
||||
|
||||
if [[ -n "$source" ]] && [[ "$(nixf_wrapper ${{ env.base }}/"$source")" != '[]' ]] 2>/dev/null; then
|
||||
echo "Ignoring file $file because it doesn't pass nixf-tidy in the base commit"
|
||||
echo # insert blank line
|
||||
else
|
||||
nixf_report="$(nixf_wrapper "$dest")"
|
||||
if [[ "$nixf_report" != '[]' ]]; then
|
||||
echo "$dest doesn't pass nixf-tidy. Reported by nixf-tidy:"
|
||||
errors=$(echo "$nixf_report" | jq -r --arg dest "$dest" '
|
||||
def getLCur: "line=" + (.line+1|tostring) + ",col=" + (.column|tostring);
|
||||
def getRCur: "endLine=" + (.line+1|tostring) + ",endColumn=" + (.column|tostring);
|
||||
def getRange: "file=\($dest)," + (.lCur|getLCur) + "," + (.rCur|getRCur);
|
||||
def getBody: . as $top|(.range|getRange) + ",title="+ .sname + "::" +
|
||||
(.message|sub("{}" ; ($top.args.[]|tostring)));
|
||||
def getNote: "\n::notice " + (.|getBody);
|
||||
def getMessage: "::error " + (.|getBody) + (if (.notes|length)>0 then
|
||||
([.notes.[]|getNote]|add) else "" end);
|
||||
.[]|getMessage
|
||||
')
|
||||
if [[ -z "$DONT_REPORT_ERROR" ]]; then
|
||||
echo "$errors"
|
||||
else
|
||||
# just print in plain text
|
||||
echo "$errors" | sed 's/^:://'
|
||||
echo # add one empty line
|
||||
fi
|
||||
failedFiles+=("$dest")
|
||||
fi
|
||||
fi
|
||||
done < <(git diff -z --name-status ${{ env.baseRev }} -- '*.nix')
|
||||
|
||||
if [[ -n "$DONT_REPORT_ERROR" ]]; then
|
||||
echo "Edited the PR but didn't change the base branch, only the description/title."
|
||||
echo "Not reporting errors again to avoid duplication."
|
||||
echo # add one empty line
|
||||
fi
|
||||
|
||||
if (( "${#failedFiles[@]}" > 0 )); then
|
||||
echo "Some new/changed Nix files don't pass nixf-tidy."
|
||||
echo "See ${{ github.event.pull_request.html_url }}/files for reported errors."
|
||||
echo "If you believe this is a false positive, ping @Aleksanaa and @inclyc in this PR."
|
||||
exit 1
|
||||
fi
|
31
third_party/nixpkgs/.github/workflows/check-shell.yml
vendored
Normal file
31
third_party/nixpkgs/.github/workflows/check-shell.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: "Check shell"
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
x86_64-linux:
|
||||
name: shell-check-x86_64-linux
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
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@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
- name: Build shell
|
||||
run: nix-build shell.nix
|
||||
|
||||
aarch64-darwin:
|
||||
name: shell-check-aarch64-darwin
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
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@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
- name: Build shell
|
||||
run: nix-build shell.nix
|
104
third_party/nixpkgs/.github/workflows/codeowners-v2.yml
vendored
Normal file
104
third_party/nixpkgs/.github/workflows/codeowners-v2.yml
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
name: Codeowners v2
|
||||
|
||||
# This workflow depends on two GitHub Apps with the following permissions:
|
||||
# - For checking code owners:
|
||||
# - Permissions:
|
||||
# - Repository > Administration: read-only
|
||||
# - Organization > Members: read-only
|
||||
# - Install App on this repository, setting these variables:
|
||||
# - OWNER_RO_APP_ID (variable)
|
||||
# - OWNER_RO_APP_PRIVATE_KEY (secret)
|
||||
# - For requesting code owners:
|
||||
# - Permissions:
|
||||
# - Repository > Administration: read-only
|
||||
# - Organization > Members: read-only
|
||||
# - Repository > Pull Requests: read-write
|
||||
# - Install App on this repository, setting these variables:
|
||||
# - OWNER_APP_ID (variable)
|
||||
# - OWNER_APP_PRIVATE_KEY (secret)
|
||||
#
|
||||
# This split is done because checking code owners requires handling untrusted PR input,
|
||||
# while requesting code owners requires PR write access, and those shouldn't be mixed.
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, ready_for_review, synchronize, reopened, edited]
|
||||
|
||||
# We don't need any default GitHub token
|
||||
permissions: {}
|
||||
|
||||
env:
|
||||
OWNERS_FILE: ci/OWNERS
|
||||
# Don't do anything on draft PRs
|
||||
DRY_MODE: ${{ github.event.pull_request.draft && '1' || '' }}
|
||||
|
||||
jobs:
|
||||
# Check that code owners is valid
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
|
||||
- uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
|
||||
if: github.repository_owner == 'NixOS'
|
||||
with:
|
||||
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
|
||||
name: nixpkgs-ci
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
||||
# Important: Because we use pull_request_target, this checks out the base branch of the PR, not the PR itself.
|
||||
# We later build and run code from the base branch with access to secrets,
|
||||
# so it's important this is not the PRs code.
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
path: base
|
||||
|
||||
- name: Build codeowners validator
|
||||
run: nix-build base/ci -A codeownersValidator
|
||||
|
||||
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ vars.OWNER_RO_APP_ID }}
|
||||
private-key: ${{ secrets.OWNER_RO_APP_PRIVATE_KEY }}
|
||||
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.number }}/merge
|
||||
path: pr
|
||||
|
||||
- name: Validate codeowners
|
||||
run: result/bin/codeowners-validator
|
||||
env:
|
||||
OWNERS_FILE: pr/${{ env.OWNERS_FILE }}
|
||||
GITHUB_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
REPOSITORY_PATH: pr
|
||||
OWNER_CHECKER_REPOSITORY: ${{ github.repository }}
|
||||
# Set this to "notowned,avoid-shadowing" to check that all files are owned by somebody
|
||||
EXPERIMENTAL_CHECKS: "avoid-shadowing"
|
||||
|
||||
# Request reviews from code owners
|
||||
request:
|
||||
name: Request
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
|
||||
# Important: Because we use pull_request_target, this checks out the base branch of the PR, not the PR head.
|
||||
# This is intentional, because we need to request the review of owners as declared in the base branch.
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ vars.OWNER_APP_ID }}
|
||||
private-key: ${{ secrets.OWNER_APP_PRIVATE_KEY }}
|
||||
|
||||
- name: Build review request package
|
||||
run: nix-build ci -A requestReviews
|
||||
|
||||
- name: Request reviews
|
||||
run: result/bin/request-reviews.sh ${{ github.repository }} ${{ github.event.number }} "$OWNERS_FILE"
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
44
third_party/nixpkgs/.github/workflows/editorconfig-v2.yml
vendored
Normal file
44
third_party/nixpkgs/.github/workflows/editorconfig-v2.yml
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
name: "Checking EditorConfig v2"
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
|
||||
on:
|
||||
# avoids approving first time contributors
|
||||
pull_request_target:
|
||||
branches-ignore:
|
||||
- 'release-**'
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: editorconfig-check
|
||||
runs-on: ubuntu-latest
|
||||
if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
|
||||
steps:
|
||||
- name: Get list of changed files from PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh api \
|
||||
repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \
|
||||
| jq '.[] | select(.status != "removed") | .filename' \
|
||||
> "$HOME/changed_files"
|
||||
- name: print list of changed files
|
||||
run: |
|
||||
cat "$HOME/changed_files"
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
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@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
with:
|
||||
# nixpkgs commit is pinned so that it doesn't break
|
||||
# editorconfig-checker 2.4.0
|
||||
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz
|
||||
- name: Checking EditorConfig
|
||||
run: |
|
||||
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size'
|
||||
- if: ${{ failure() }}
|
||||
run: |
|
||||
echo "::error :: Hey! It looks like your changes don't follow our editorconfig settings. Read https://editorconfig.org/#download to configure your editor so you never see this error again."
|
25
third_party/nixpkgs/.github/workflows/labels.yml
vendored
Normal file
25
third_party/nixpkgs/.github/workflows/labels.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
name: "Label PR"
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [edited, opened, synchronize, reopened]
|
||||
|
||||
# WARNING:
|
||||
# When extending this action, be aware that $GITHUB_TOKEN allows some write
|
||||
# access to the GitHub API. This means that it should not evaluate user input in
|
||||
# a way that allows code injection.
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
labels:
|
||||
name: label-pr
|
||||
runs-on: ubuntu-latest
|
||||
if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
|
||||
steps:
|
||||
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
sync-labels: true
|
33
third_party/nixpkgs/.github/workflows/manual-nixos-v2.yml
vendored
Normal file
33
third_party/nixpkgs/.github/workflows/manual-nixos-v2.yml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
name: "Build NixOS manual v2"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'nixos/**'
|
||||
|
||||
jobs:
|
||||
nixos:
|
||||
name: nixos-manual-build
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'NixOS'
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
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@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
with:
|
||||
# explicitly enable sandbox
|
||||
extra_nix_config: sandbox = true
|
||||
- uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
|
||||
with:
|
||||
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
|
||||
name: nixpkgs-ci
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
- name: Building NixOS manual
|
||||
run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true nixos/release.nix -A manual.x86_64-linux
|
35
third_party/nixpkgs/.github/workflows/manual-nixpkgs-v2.yml
vendored
Normal file
35
third_party/nixpkgs/.github/workflows/manual-nixpkgs-v2.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: "Build Nixpkgs manual v2"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'doc/**'
|
||||
- 'lib/**'
|
||||
- 'pkgs/tools/nix/nixdoc/**'
|
||||
|
||||
jobs:
|
||||
nixpkgs:
|
||||
name: nixpkgs-manual-build
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'NixOS'
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
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@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
with:
|
||||
# explicitly enable sandbox
|
||||
extra_nix_config: sandbox = true
|
||||
- uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
|
||||
with:
|
||||
# This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere.
|
||||
name: nixpkgs-ci
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
- name: Building Nixpkgs manual
|
||||
run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true pkgs/top-level/release.nix -A manual -A manual.tests
|
45
third_party/nixpkgs/.github/workflows/nix-parse-v2.yml
vendored
Normal file
45
third_party/nixpkgs/.github/workflows/nix-parse-v2.yml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
name: "Check whether nix files are parseable v2"
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
|
||||
on:
|
||||
# avoids approving first time contributors
|
||||
pull_request_target:
|
||||
branches-ignore:
|
||||
- 'release-**'
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: nix-files-parseable-check
|
||||
runs-on: ubuntu-latest
|
||||
if: "github.repository_owner == 'NixOS' && !contains(github.event.pull_request.title, '[skip treewide]')"
|
||||
steps:
|
||||
- name: Get list of changed files from PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh api \
|
||||
repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \
|
||||
| jq --raw-output '.[] | select(.status != "removed" and (.filename | endswith(".nix"))) | .filename' \
|
||||
> "$HOME/changed_files"
|
||||
if [[ -s "$HOME/changed_files" ]]; then
|
||||
echo "CHANGED_FILES=$HOME/changed_files" > "$GITHUB_ENV"
|
||||
fi
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
if: ${{ env.CHANGED_FILES && env.CHANGED_FILES != '' }}
|
||||
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixpkgs-unstable
|
||||
- name: Parse all changed or added nix files
|
||||
run: |
|
||||
ret=0
|
||||
while IFS= read -r file; do
|
||||
out="$(nix-instantiate --parse "$file")" || { echo "$out" && ret=1; }
|
||||
done < "$HOME/changed_files"
|
||||
exit "$ret"
|
||||
if: ${{ env.CHANGED_FILES && env.CHANGED_FILES != '' }}
|
86
third_party/nixpkgs/.github/workflows/nixpkgs-vet.yml
vendored
Normal file
86
third_party/nixpkgs/.github/workflows/nixpkgs-vet.yml
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
# `nixpkgs-vet` is a tool to vet Nixpkgs: its architecture, package structure, and more.
|
||||
# Among other checks, it makes sure that `pkgs/by-name` (see `../../pkgs/by-name/README.md`) follows the validity rules outlined in [RFC 140](https://github.com/NixOS/rfcs/pull/140).
|
||||
# When you make changes to this workflow, please also update `ci/nixpkgs-vet.sh` to reflect the impact of your work to the CI.
|
||||
# See https://github.com/NixOS/nixpkgs-vet for details on the tool and its checks.
|
||||
name: Vet nixpkgs
|
||||
|
||||
on:
|
||||
# Using pull_request_target instead of pull_request avoids having to approve first time contributors.
|
||||
pull_request_target:
|
||||
# This workflow depends on the base branch of the PR, but changing the base branch is not included in the default trigger events, which would be `opened`, `synchronize` or `reopened`.
|
||||
# Instead it causes an `edited` event, so we need to add it explicitly here.
|
||||
# While `edited` is also triggered when the PR title/body is changed, this PR action is fairly quick, and PRs don't get edited **that** often, so it shouldn't be a problem.
|
||||
# There is a feature request for adding a `base_changed` event: https://github.com/orgs/community/discussions/35058
|
||||
types: [opened, synchronize, reopened, edited]
|
||||
|
||||
permissions: {}
|
||||
|
||||
# We don't use a concurrency group here, because the action is triggered quite often (due to the PR edit trigger), and contributors would get notified on any canceled run.
|
||||
# There is a feature request for suppressing notifications on concurrency-canceled runs: https://github.com/orgs/community/discussions/13015
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: nixpkgs-vet
|
||||
# This needs to be x86_64-linux, because we depend on the tooling being pre-built in the GitHub releases.
|
||||
runs-on: ubuntu-latest
|
||||
# This should take 1 minute at most, but let's be generous. The default of 6 hours is definitely too long.
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
# This checks out the base branch because of pull_request_target
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
path: base
|
||||
sparse-checkout: ci
|
||||
- name: Resolving the merge commit
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
if mergedSha=$(base/ci/get-merge-commit.sh ${{ github.repository }} ${{ github.event.number }}); then
|
||||
echo "Checking the merge commit $mergedSha"
|
||||
echo "mergedSha=$mergedSha" >> "$GITHUB_ENV"
|
||||
else
|
||||
echo "Skipping the rest..."
|
||||
fi
|
||||
rm -rf base
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
if: env.mergedSha
|
||||
with:
|
||||
# pull_request_target checks out the base branch by default
|
||||
ref: ${{ env.mergedSha }}
|
||||
# Fetches the merge commit and its parents
|
||||
fetch-depth: 2
|
||||
- name: Checking out base branch
|
||||
if: env.mergedSha
|
||||
run: |
|
||||
base=$(mktemp -d)
|
||||
git worktree add "$base" "$(git rev-parse HEAD^1)"
|
||||
echo "base=$base" >> "$GITHUB_ENV"
|
||||
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
|
||||
if: env.mergedSha
|
||||
- name: Fetching the pinned tool
|
||||
if: env.mergedSha
|
||||
# Update the pinned version using ci/nixpkgs-vet/update-pinned-tool.sh
|
||||
run: |
|
||||
# The pinned version of the tooling to use.
|
||||
toolVersion=$(<ci/nixpkgs-vet/pinned-version.txt)
|
||||
|
||||
# Fetch the x86_64-linux-specific release artifact containing the gzipped NAR of the pre-built tool.
|
||||
toolPath=$(curl -sSfL https://github.com/NixOS/nixpkgs-vet/releases/download/"$toolVersion"/x86_64-linux.nar.gz \
|
||||
| gzip -cd | nix-store --import | tail -1)
|
||||
|
||||
# Adds a result symlink as a GC root.
|
||||
nix-store --realise "$toolPath" --add-root result
|
||||
- name: Running nixpkgs-vet
|
||||
if: env.mergedSha
|
||||
env:
|
||||
# Force terminal colors to be enabled. The library that `nixpkgs-vet` uses respects https://bixense.com/clicolors/
|
||||
CLICOLOR_FORCE: 1
|
||||
run: |
|
||||
if result/bin/nixpkgs-vet --base "$base" .; then
|
||||
exit 0
|
||||
else
|
||||
exitCode=$?
|
||||
echo "To run locally: ./ci/nixpkgs-vet.sh $GITHUB_BASE_REF https://github.com/$GITHUB_REPOSITORY.git"
|
||||
echo "If you're having trouble, ping @NixOS/nixpkgs-vet"
|
||||
exit "$exitCode"
|
||||
fi
|
26
third_party/nixpkgs/.github/workflows/no-channel.yml
vendored
Normal file
26
third_party/nixpkgs/.github/workflows/no-channel.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
name: "No channel PR"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'nixos-**'
|
||||
- 'nixpkgs-**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
fail:
|
||||
permissions:
|
||||
contents: none
|
||||
name: "This PR is is targeting a channel branch"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
cat <<EOF
|
||||
The nixos-* and nixpkgs-* branches are pushed to by the channel
|
||||
release script and should not be merged into directly.
|
||||
|
||||
Please target the equivalent release-* branch or master instead.
|
||||
EOF
|
||||
exit 1
|
34
third_party/nixpkgs/.github/workflows/ofborg-pending.yml
vendored
Normal file
34
third_party/nixpkgs/.github/workflows/ofborg-pending.yml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
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:
|
||||
name: set-ofborg-pending
|
||||
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"
|
60
third_party/nixpkgs/.github/workflows/periodic-merge-24h.yml
vendored
Normal file
60
third_party/nixpkgs/.github/workflows/periodic-merge-24h.yml
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
# This action periodically merges base branches into staging branches.
|
||||
# This is done to
|
||||
# * prevent conflicts or rather resolve them early
|
||||
# * make all potential breakage happen on the staging branch
|
||||
# * and make sure that all major rebuilds happen before the staging
|
||||
# branch get’s merged back into its base branch.
|
||||
|
||||
name: "Periodic Merges (24h)"
|
||||
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# * is a special character in YAML so you have to quote this string
|
||||
# Merge every 24 hours
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
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:
|
||||
# don't fail fast, so that all pairs are tried
|
||||
fail-fast: false
|
||||
# certain branches need to be merged in order, like master->staging-next->staging
|
||||
# and disabling parallelism ensures the order of the pairs below.
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
pairs:
|
||||
- from: master
|
||||
into: haskell-updates
|
||||
- from: release-24.05
|
||||
into: staging-next-24.05
|
||||
- from: staging-next-24.05
|
||||
into: staging-24.05
|
||||
name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
|
||||
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f # 1.4.0
|
||||
with:
|
||||
type: now
|
||||
from_branch: ${{ matrix.pairs.from }}
|
||||
target_branch: ${{ matrix.pairs.into }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Comment on failure
|
||||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
issue-number: 105153
|
||||
body: |
|
||||
Periodic merge from `${{ matrix.pairs.from }}` into `${{ matrix.pairs.into }}` has [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).
|
58
third_party/nixpkgs/.github/workflows/periodic-merge-6h.yml
vendored
Normal file
58
third_party/nixpkgs/.github/workflows/periodic-merge-6h.yml
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
# This action periodically merges base branches into staging branches.
|
||||
# This is done to
|
||||
# * prevent conflicts or rather resolve them early
|
||||
# * make all potential breakage happen on the staging branch
|
||||
# * and make sure that all major rebuilds happen before the staging
|
||||
# branch get’s merged back into its base branch.
|
||||
|
||||
name: "Periodic Merges (6h)"
|
||||
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# * is a special character in YAML so you have to quote this string
|
||||
# Merge every 6 hours
|
||||
- cron: '0 */6 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
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:
|
||||
# don't fail fast, so that all pairs are tried
|
||||
fail-fast: false
|
||||
# certain branches need to be merged in order, like master->staging-next->staging
|
||||
# and disabling parallelism ensures the order of the pairs below.
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
pairs:
|
||||
- from: master
|
||||
into: staging-next
|
||||
- from: staging-next
|
||||
into: staging
|
||||
name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: ${{ matrix.pairs.from }} → ${{ matrix.pairs.into }}
|
||||
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f # 1.4.0
|
||||
with:
|
||||
type: now
|
||||
from_branch: ${{ matrix.pairs.from }}
|
||||
target_branch: ${{ matrix.pairs.into }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Comment on failure
|
||||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
issue-number: 105153
|
||||
body: |
|
||||
Periodic merge from `${{ matrix.pairs.from }}` into `${{ matrix.pairs.into }}` has [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).
|
38
third_party/nixpkgs/.gitignore
vendored
Normal file
38
third_party/nixpkgs/.gitignore
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
*~
|
||||
,*
|
||||
.*.swp
|
||||
.*.swo
|
||||
.\#*
|
||||
\#*\#
|
||||
.idea/
|
||||
.nixos-test-history
|
||||
.vscode/
|
||||
.helix/
|
||||
outputs/
|
||||
result-*
|
||||
result
|
||||
repl-result-*
|
||||
tags
|
||||
!pkgs/development/python-modules/result
|
||||
/doc/NEWS.html
|
||||
/doc/NEWS.txt
|
||||
/doc/manual.html
|
||||
/doc/manual.pdf
|
||||
/source/
|
||||
.version-suffix
|
||||
.direnv
|
||||
.envrc
|
||||
|
||||
.DS_Store
|
||||
.mypy_cache
|
||||
__pycache__
|
||||
|
||||
/pkgs/development/libraries/qt-5/*/tmp/
|
||||
/pkgs/desktops/kde-5/*/tmp/
|
||||
/pkgs/development/mobile/androidenv/xml/*
|
||||
|
||||
# generated by pkgs/common-updater/update-script.nix
|
||||
update-git-commits.txt
|
||||
|
||||
# JetBrains IDEA module declaration file
|
||||
/nixpkgs.iml
|
26
third_party/nixpkgs/.mailmap
vendored
Normal file
26
third_party/nixpkgs/.mailmap
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
ajs124 <git@ajs124.de> <ajs124@users.noreply.github.com>
|
||||
Anderson Torres <torres.anderson.85@protonmail.com>
|
||||
Atemu <git@atemu.net> <atemu.main@gmail.com>
|
||||
Christina Sørensen <christina@cafkafk.com>
|
||||
Christina Sørensen <christina@cafkafk.com> <christinaafk@gmail.com>
|
||||
Christina Sørensen <christina@cafkafk.com> <89321978+cafkafk@users.noreply.github.com>
|
||||
Daniel Løvbrøtte Olsen <me@dandellion.xyz> <daniel.olsen99@gmail.com>
|
||||
Fabian Affolter <mail@fabian-affolter.ch> <fabian@affolter-engineering.ch>
|
||||
Fiona Behrens <me@kloenk.dev>
|
||||
Fiona Behrens <me@kloenk.dev> <me@kloenk.de>
|
||||
goatastronaut0212 <goatastronaut0212@outlook.com> <goatastronaut0212@proton.me>
|
||||
Janne Heß <janne@hess.ooo> <dasJ@users.noreply.github.com>
|
||||
Jörg Thalheim <joerg@thalheim.io> <Mic92@users.noreply.github.com>
|
||||
Lin Jian <me@linj.tech> <linj.dev@outlook.com>
|
||||
Lin Jian <me@linj.tech> <75130626+jian-lin@users.noreply.github.com>
|
||||
Martin Weinelt <hexa@darmstadt.ccc.de> <mweinelt@users.noreply.github.com>
|
||||
R. RyanTM <ryantm-bot@ryantm.com>
|
||||
Robert Hensing <robert@roberthensing.nl> <roberth@users.noreply.github.com>
|
||||
Sandro Jäckel <sandro.jaeckel@gmail.com>
|
||||
Sandro Jäckel <sandro.jaeckel@gmail.com> <sandro.jaeckel@sap.com>
|
||||
superherointj <5861043+superherointj@users.noreply.github.com>
|
||||
Tomodachi94 <tomodachi94@protonmail.com> Tomo <68489118+Tomodachi94@users.noreply.github.com>
|
||||
Vladimír Čunát <v@cunat.cz> <vcunat@gmail.com>
|
||||
Vladimír Čunát <v@cunat.cz> <vladimir.cunat@nic.cz>
|
||||
Yifei Sun <ysun@hey.com> StepBroBD <Hi@StepBroBD.com>
|
||||
Yifei Sun <ysun@hey.com> <ysun+git@stepbrobd.com>
|
1
third_party/nixpkgs/.version
vendored
Symbolic link
1
third_party/nixpkgs/.version
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
lib/.version
|
802
third_party/nixpkgs/CONTRIBUTING.md
vendored
Normal file
802
third_party/nixpkgs/CONTRIBUTING.md
vendored
Normal file
|
@ -0,0 +1,802 @@
|
|||
# Contributing to Nixpkgs
|
||||
|
||||
This document is for people wanting to contribute to the implementation of Nixpkgs.
|
||||
This involves interacting with implementation changes that are proposed using [GitHub](https://github.com/) [pull requests](https://docs.github.com/pull-requests) to the [Nixpkgs](https://github.com/nixos/nixpkgs/) repository (which you're in right now).
|
||||
|
||||
As such, a GitHub account is recommended, which you can sign up for [here](https://github.com/signup).
|
||||
See [here](https://discourse.nixos.org/t/about-the-patches-category/477) for how to contribute without a GitHub account.
|
||||
|
||||
Additionally this document assumes that you already know how to use GitHub and Git.
|
||||
If that's not the case, we recommend learning about it first [here](https://docs.github.com/en/get-started/quickstart/hello-world).
|
||||
|
||||
## Overview
|
||||
[overview]: #overview
|
||||
|
||||
This file contains general contributing information, but individual parts also have more specific information to them in their respective `README.md` files, linked here:
|
||||
- [`lib`](./lib/README.md): Sources and documentation of the [library functions](https://nixos.org/manual/nixpkgs/stable/#chap-functions)
|
||||
- [`maintainers`](./maintainers/README.md): Nixpkgs maintainer and team listings, maintainer scripts
|
||||
- [`pkgs`](./pkgs/README.md): Package and [builder](https://nixos.org/manual/nixpkgs/stable/#part-builders) definitions
|
||||
- [`doc`](./doc/README.md): Sources and infrastructure for the [Nixpkgs manual](https://nixos.org/manual/nixpkgs/stable/)
|
||||
- [`nixos`](./nixos/README.md): Implementation of [NixOS](https://nixos.org/manual/nixos/stable/)
|
||||
|
||||
# How to's
|
||||
|
||||
## How to create pull requests
|
||||
[pr-create]: #how-to-create-pull-requests
|
||||
|
||||
This section describes in some detail how changes can be made and proposed with pull requests.
|
||||
|
||||
> [!Note]
|
||||
> Be aware that contributing implies licensing those contributions under the terms of [COPYING](./COPYING), an MIT-like license.
|
||||
|
||||
0. Set up a local version of Nixpkgs to work with using GitHub and Git
|
||||
1. [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) the [Nixpkgs repository](https://github.com/nixos/nixpkgs/).
|
||||
1. [Clone the forked repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) into a local `nixpkgs` directory.
|
||||
1. [Configure the upstream Nixpkgs repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#configuring-git-to-sync-your-fork-with-the-upstream-repository).
|
||||
|
||||
1. Figure out the branch that should be used for this change by going through [this section][branch].
|
||||
If in doubt use `master`, that's where most changes should go.
|
||||
This can be changed later by [rebasing][rebase].
|
||||
|
||||
2. Create and switch to a new Git branch, ideally such that:
|
||||
- The name of the branch hints at the change you'd like to implement, e.g. `update-hello`.
|
||||
- The base of the branch includes the most recent changes on the base branch from step 1, we'll assume `master` here.
|
||||
|
||||
```bash
|
||||
# Make sure you have the latest changes from upstream Nixpkgs
|
||||
git fetch upstream
|
||||
|
||||
# Create and switch to a new branch based off the master branch in Nixpkgs
|
||||
git switch --create update-hello upstream/master
|
||||
```
|
||||
|
||||
To avoid having to download and build potentially many derivations, at the expense of using a potentially outdated version, you can base the branch off a specific [Git commit](https://www.git-scm.com/docs/gitglossary#def_commit) instead:
|
||||
- The commit of the latest `nixpkgs-unstable` channel, available [here](https://channels.nixos.org/nixpkgs-unstable/git-revision).
|
||||
- The commit of a local Nixpkgs downloaded using [nix-channel](https://nixos.org/manual/nix/stable/command-ref/nix-channel), available using `nix-instantiate --eval --expr '(import <nixpkgs/lib>).trivial.revisionWithDefault null'`
|
||||
- If you're using NixOS, the commit of your NixOS installation, available with `nixos-version --revision`.
|
||||
|
||||
Once you have an appropriate commit you can use it instead of `upstream/master` in the above command:
|
||||
```bash
|
||||
git switch --create update-hello <the desired base commit>
|
||||
```
|
||||
|
||||
3. Make the desired changes in the local Nixpkgs repository using an editor of your choice.
|
||||
Make sure to:
|
||||
- Adhere to both the [general code conventions][code-conventions], and the code conventions specific to the part you're making changes to.
|
||||
See the [overview section][overview] for more specific information.
|
||||
- Test the changes.
|
||||
See the [overview section][overview] for more specific information.
|
||||
- If necessary, document the change.
|
||||
See the [overview section][overview] for more specific information.
|
||||
|
||||
4. Commit your changes using `git commit`.
|
||||
Make sure to adhere to the [commit conventions](#commit-conventions).
|
||||
|
||||
Repeat the steps 3-4 as many times as necessary.
|
||||
Advance to the next step if all the commits (viewable with `git log`) make sense together.
|
||||
|
||||
5. Push your commits to your fork of Nixpkgs.
|
||||
```
|
||||
git push --set-upstream origin HEAD
|
||||
```
|
||||
|
||||
The above command will output a link that allows you to directly quickly do the next step:
|
||||
```
|
||||
remote: Create a pull request for 'update-hello' on GitHub by visiting:
|
||||
remote: https://github.com/myUser/nixpkgs/pull/new/update-hello
|
||||
```
|
||||
|
||||
6. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request#creating-the-pull-request) from the new branch in your Nixpkgs fork to the upstream Nixpkgs repository.
|
||||
Use the branch from step 2 as the pull requests base branch.
|
||||
Go through the [pull request template](#pull-request-template) in the pre-filled default description.
|
||||
|
||||
7. Respond to review comments, potential CI failures and potential merge conflicts by updating the pull request.
|
||||
Always keep the pull request in a mergeable state.
|
||||
|
||||
This process is covered in more detail from the non-technical side in [I opened a PR, how do I get it merged?](#i-opened-a-pr-how-do-i-get-it-merged).
|
||||
|
||||
The custom [OfBorg](https://github.com/NixOS/ofborg) CI system will perform various checks to help ensure code quality, whose results you can see at the bottom of the pull request.
|
||||
See [the OfBorg Readme](https://github.com/NixOS/ofborg#readme) for more details.
|
||||
|
||||
- To add new commits, repeat steps 3-4 and push the result using
|
||||
```
|
||||
git push
|
||||
```
|
||||
|
||||
- To change existing commits you will have to [rewrite Git history](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History).
|
||||
Useful Git commands that can help a lot with this are `git commit --patch --amend` and `git rebase --interactive`.
|
||||
With a rewritten history you need to force-push the commits using
|
||||
```
|
||||
git push --force-with-lease
|
||||
```
|
||||
|
||||
- In case of merge conflicts you will also have to [rebase the branch](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) on top of current `master`.
|
||||
Sometimes this can be done [on GitHub directly](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch), but if not you will have to rebase locally using
|
||||
```
|
||||
git fetch upstream
|
||||
git rebase upstream/master
|
||||
git push --force-with-lease
|
||||
```
|
||||
|
||||
- If you need to change the base branch of the pull request, you can do so by [rebasing][rebase].
|
||||
|
||||
8. If your pull request is merged and [acceptable for releases][release-acceptable] you may [backport][pr-backport] the pull request.
|
||||
|
||||
### Pull request template
|
||||
[pr-template]: #pull-request-template
|
||||
|
||||
The pull request template helps determine what steps have been made for a contribution so far, and will help guide maintainers on the status of a change. The motivation section of the PR should include any extra details the title does not address and link any existing issues related to the pull request.
|
||||
|
||||
When a PR is created, it will be pre-populated with some checkboxes detailed below:
|
||||
|
||||
#### Tested using sandboxing
|
||||
|
||||
When sandbox builds are enabled, Nix will set up an isolated environment for each build process.
|
||||
It is used to remove further hidden dependencies set by the build environment to improve reproducibility.
|
||||
This includes access to the network during the build outside of `fetch*` functions and files outside the Nix store.
|
||||
Depending on the operating system, access to other resources is blocked as well (e.g., inter-process communication is isolated on Linux); see [sandbox](https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-sandbox) in the Nix manual for details.
|
||||
|
||||
In pull requests for [nixpkgs](https://github.com/NixOS/nixpkgs/) people are asked to test builds with sandboxing enabled (see `Tested using sandboxing` in the pull request template) because in [Hydra](https://nixos.org/hydra/) sandboxing is also used.
|
||||
|
||||
If you are on Linux, sandboxing is enabled by default.
|
||||
On other platforms, sandboxing is disabled by default due to a small performance hit on each build.
|
||||
|
||||
Please enable sandboxing **before** building the package by adding the following to: `/etc/nix/nix.conf`:
|
||||
|
||||
```ini
|
||||
sandbox = true
|
||||
```
|
||||
|
||||
#### Built on platform(s)
|
||||
|
||||
Many Nix packages are designed to run on multiple platforms. As such, it’s important to let the maintainer know which platforms your changes have been tested on. It’s not always practical to test a change on all platforms, and is not required for a pull request to be merged. Only check the systems you tested the build on in this section.
|
||||
|
||||
#### Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
|
||||
|
||||
Packages with automated tests are much more likely to be merged in a timely fashion because it doesn’t require as much manual testing by the maintainer to verify the functionality of the package. If there are existing tests for the package, they should be run to verify your changes do not break the tests. Tests can only be run on Linux. For more details on writing and running tests, see the [section in the NixOS manual](https://nixos.org/nixos/manual/index.html#sec-nixos-tests).
|
||||
|
||||
#### Tested compilation of all pkgs that depend on this change using `nixpkgs-review`
|
||||
|
||||
If you are modifying a package, 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:
|
||||
|
||||
```ShellSession
|
||||
nix-shell -p nixpkgs-review --run "nixpkgs-review pr 12345"
|
||||
```
|
||||
|
||||
Alternatively, with flakes (and analogously for the other commands below):
|
||||
|
||||
```ShellSession
|
||||
nix run nixpkgs#nixpkgs-review -- pr 12345
|
||||
```
|
||||
|
||||
Review uncommitted changes:
|
||||
|
||||
```ShellSession
|
||||
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/`)
|
||||
|
||||
It’s important to test any executables generated by a build when you change or create a package in nixpkgs. This can be done by looking in `./result/bin` and running any files in there, or at a minimum, the main executable for the package. For example, if you make a change to texlive, you probably would only check the binaries associated with the change you made rather than testing all of them.
|
||||
|
||||
#### Meets Nixpkgs contribution standards
|
||||
|
||||
The last checkbox is about whether it fits the guidelines in this `CONTRIBUTING.md` file. This document has detailed information on standards the Nix community has for commit messages, reviews, licensing of contributions you make to the project, etc... Everyone should read and understand the standards the community has for contributing before submitting a pull request.
|
||||
|
||||
### Rebasing between branches (i.e. from master to staging)
|
||||
[rebase]: #rebasing-between-branches-ie-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.
|
||||
|
||||
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 be retargeted to
|
||||
`staging`. 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
|
||||
```
|
||||
|
||||
## How to backport pull requests
|
||||
[pr-backport]: #how-to-backport-pull-requests
|
||||
|
||||
Once a pull request has been merged into `master`, a backport pull request to the corresponding `release-YY.MM` branch can be created either automatically or manually.
|
||||
|
||||
### Automatically backporting changes
|
||||
|
||||
> [!Note]
|
||||
> You have to be a [Nixpkgs maintainer](./maintainers) to automatically create a backport pull request.
|
||||
|
||||
Add the [`backport release-YY.MM` label](https://github.com/NixOS/nixpkgs/labels?q=backport) to the pull request on the `master` branch.
|
||||
This will cause [a GitHub Action](.github/workflows/backport.yml) to open a pull request to the `release-YY.MM` branch a few minutes later.
|
||||
This can be done on both open or already merged pull requests.
|
||||
|
||||
### Manually backporting changes
|
||||
|
||||
To manually create a backport pull request, follow [the standard pull request process][pr-create], with these notable differences:
|
||||
|
||||
- Use `release-YY.MM` for the base branch, both for the local branch and the pull request.
|
||||
|
||||
> [!Warning]
|
||||
> Do not use the `nixos-YY.MM` branch, that is a branch pointing to the tested release channel commit
|
||||
|
||||
- Instead of manually making and committing the changes, use [`git cherry-pick -x`](https://git-scm.com/docs/git-cherry-pick) for each commit from the pull request you'd like to backport.
|
||||
Either `git cherry-pick -x <commit>` when the reason for the backport is obvious (such as minor versions, fixes, etc.), otherwise use `git cherry-pick -xe <commit>` to add a reason for the backport to the commit message.
|
||||
Here is [an example](https://github.com/nixos/nixpkgs/commit/5688c39af5a6c5f3d646343443683da880eaefb8) of this.
|
||||
|
||||
> [!Warning]
|
||||
> 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.
|
||||
|
||||
- In the pull request description, link to the original pull request to `master`.
|
||||
The pull request title should include `[YY.MM]` matching the release you're backporting to.
|
||||
|
||||
- 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.
|
||||
|
||||
## How to review pull requests
|
||||
[pr-review]: #how-to-review-pull-requests
|
||||
|
||||
> [!Warning]
|
||||
> The following section is a draft, and the policy for reviewing is still being discussed in issues such as [#11166](https://github.com/NixOS/nixpkgs/issues/11166) and [#20836](https://github.com/NixOS/nixpkgs/issues/20836).
|
||||
|
||||
The Nixpkgs project receives a fairly high number of contributions via GitHub pull requests. Reviewing and approving these is an important task and a way to contribute to the project.
|
||||
|
||||
The high change rate of Nixpkgs makes any pull request that remains open for too long subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid this issue. GitHub provides sort filters that can be used to see the [most recently](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) and the [least recently](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc) updated pull requests. We highly encourage looking at [this list of ready to merge, unreviewed pull requests](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone).
|
||||
|
||||
When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community member and their work.
|
||||
|
||||
GitHub provides reactions as a simple and quick way to provide feedback to pull requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanation so the submitter has directions to improve their contribution.
|
||||
|
||||
When doing a review:
|
||||
- Aim to drive the proposal to a timely conclusion.
|
||||
- Focus on the proposed changes to keep the scope of the discussion narrow.
|
||||
- Help the contributor prioritise their efforts towards getting their change merged.
|
||||
|
||||
If you find anything related that could be improved but is not immediately required for acceptance, consider
|
||||
- Implementing the changes yourself in a follow-up pull request (and request review from the person who inspired you)
|
||||
- Tracking your idea in an issue
|
||||
- Offering the original contributor to review a follow-up pull request
|
||||
- Making concrete [suggestions](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request) in the same pull request.
|
||||
|
||||
For example, follow-up changes could involve refactoring code in the affected files.
|
||||
|
||||
But please remember not to make such additional considerations a blocker, and communicate that to the contributor, for example by following the [conventional comments](https://conventionalcomments.org/) pattern.
|
||||
If the related change is essential for the contribution at hand, make clear why you think it is important to address that first.
|
||||
|
||||
Pull request reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review.
|
||||
|
||||
All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to their liking.
|
||||
|
||||
To get more information about how to review specific parts of Nixpkgs, refer to the documents linked to in the [overview section][overview].
|
||||
|
||||
If a pull request contains documentation changes that might require feedback from the documentation team, ping [@NixOS/documentation-team](https://github.com/orgs/nixos/teams/documentation-team) on the pull request.
|
||||
|
||||
If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process. The main reviewers for a topic can be hard to find as there is no list, but checking past pull requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints.
|
||||
|
||||
Container system, boot system and library changes are some examples of the pull requests fitting this category.
|
||||
|
||||
## How to merge pull requests yourself
|
||||
[pr-merge]: #how-to-merge-pull-requests
|
||||
|
||||
To streamline automated updates, leverage the nixpkgs-merge-bot by simply commenting `@NixOS/nixpkgs-merge-bot merge`. The bot will verify if the following conditions are met, refusing to merge otherwise:
|
||||
|
||||
- the PR author should be @r-ryantm;
|
||||
- the commenter that issued the command should be among the package maintainers;
|
||||
- the package should reside in `pkgs/by-name`.
|
||||
|
||||
Further, nixpkgs-merge-bot will ensure all ofBorg checks (except the Darwin-related ones) are successfully completed before merging the pull request. Should the checks still be underway, the bot patiently waits for ofBorg to finish before attempting the merge again.
|
||||
|
||||
For other pull requests, please see [I opened a PR, how do I get it merged?](#i-opened-a-pr-how-do-i-get-it-merged).
|
||||
|
||||
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.
|
||||
|
||||
Please note that contributors with commit rights unactive for more than three months will have their commit rights revoked.
|
||||
-->
|
||||
|
||||
Please see the discussion in [GitHub nixpkgs issue #321665](https://github.com/NixOS/nixpkgs/issues/321665) for information on how to proceed to be granted this level of access.
|
||||
|
||||
In a case a contributor definitively leaves the Nix community, they should create an issue or post on [Discourse](https://discourse.nixos.org) with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
|
||||
|
||||
# Flow of merged pull requests
|
||||
|
||||
After a pull request is merged, it eventually makes it to the [official Hydra CI](https://hydra.nixos.org/).
|
||||
Hydra regularly evaluates and builds Nixpkgs, updating [the official channels](https://channels.nixos.org/) when specific Hydra jobs succeeded.
|
||||
See [Nix Channel Status](https://status.nixos.org/) for the current channels and their state.
|
||||
Here's a brief overview of the main Git branches and what channels they're used for:
|
||||
|
||||
- `master`: The main branch, used for the unstable channels such as `nixpkgs-unstable`, `nixos-unstable` and `nixos-unstable-small`.
|
||||
- `release-YY.MM` (e.g. `release-24.05`): The NixOS release branches, used for the stable channels such as `nixos-24.05`, `nixos-24.05-small` and `nixpkgs-24.05-darwin`.
|
||||
|
||||
When a channel is updated, a corresponding Git branch is also updated to point to the corresponding commit.
|
||||
So e.g. the [`nixpkgs-unstable` branch](https://github.com/nixos/nixpkgs/tree/nixpkgs-unstable) corresponds to the Git commit from the [`nixpkgs-unstable` channel](https://channels.nixos.org/nixpkgs-unstable).
|
||||
|
||||
Nixpkgs in its entirety is tied to the NixOS release process, which is documented in the [NixOS Release Wiki](https://nixos.github.io/release-wiki/).
|
||||
|
||||
See [this section][branch] to know when to use the release branches.
|
||||
|
||||
## Staging
|
||||
[staging]: #staging
|
||||
|
||||
The staging workflow exists to batch Hydra builds of many packages together.
|
||||
It is coordinated in the [Staging room](https://matrix.to/#/#staging:nixos.org) on Matrix.
|
||||
|
||||
It works by directing commits that cause [mass rebuilds][mass-rebuild] to a separate `staging` branch that isn't directly built by Hydra.
|
||||
Regularly, the `staging` branch is _manually_ merged into a `staging-next` branch to be built by Hydra using the [`nixpkgs:staging-next` jobset](https://hydra.nixos.org/jobset/nixpkgs/staging-next).
|
||||
The `staging-next` branch should then only receive changes that fix Hydra builds;
|
||||
**for anything else, ask the [Staging room](https://matrix.to/#/#staging:nixos.org) first**.
|
||||
Once it is verified that there are no major regressions, it is merged into `master` using [a pull request](https://github.com/NixOS/nixpkgs/pulls?q=head%3Astaging-next).
|
||||
This is done manually in order to ensure it's a good use of Hydra's computing resources.
|
||||
By keeping the `staging-next` branch separate from `staging`, this batching does not block developers from merging changes into `staging`.
|
||||
|
||||
In order for the `staging` and `staging-next` branches to be up-to-date with the latest commits on `master`, there are regular _automated_ merges from `master` into `staging-next` and `staging`.
|
||||
This is implemented using GitHub workflows [here](.github/workflows/periodic-merge-6h.yml) and [here](.github/workflows/periodic-merge-24h.yml).
|
||||
|
||||
> [!Note]
|
||||
> Changes must be sufficiently tested before being merged into any branch.
|
||||
> Hydra builds should not be used as testing platform.
|
||||
|
||||
Here is a Git history diagram showing the flow of commits between the three branches:
|
||||
```mermaid
|
||||
%%{init: {
|
||||
'theme': 'base',
|
||||
'themeVariables': {
|
||||
'gitInv0': '#ff0000',
|
||||
'gitInv1': '#ff0000',
|
||||
'git2': '#ff4444',
|
||||
'commitLabelFontSize': '15px'
|
||||
},
|
||||
'gitGraph': {
|
||||
'showCommitLabel':true,
|
||||
'mainBranchName': 'master',
|
||||
'rotateCommitLabel': true
|
||||
}
|
||||
} }%%
|
||||
gitGraph
|
||||
commit id:" "
|
||||
branch staging
|
||||
commit id:" "
|
||||
branch staging-next
|
||||
|
||||
merge master id:"automatic"
|
||||
checkout staging
|
||||
merge staging-next id:"automatic "
|
||||
|
||||
checkout staging-next
|
||||
merge staging type:HIGHLIGHT id:"manual"
|
||||
commit id:"fixup"
|
||||
|
||||
checkout master
|
||||
checkout staging
|
||||
checkout master
|
||||
commit id:" "
|
||||
checkout staging-next
|
||||
merge master id:"automatic "
|
||||
checkout staging
|
||||
merge staging-next id:"automatic "
|
||||
|
||||
checkout staging-next
|
||||
commit id:"fixup "
|
||||
checkout master
|
||||
merge staging-next type:HIGHLIGHT id:"manual (PR)"
|
||||
```
|
||||
|
||||
|
||||
Here's an overview of the different branches:
|
||||
|
||||
| branch | `master` | `staging-next` | `staging` |
|
||||
| --- | --- | --- | --- |
|
||||
| Used for development | ✔️ | ❌ | ✔️ |
|
||||
| Built by Hydra | ✔️ | ✔️ | ❌ |
|
||||
| [Mass rebuilds][mass-rebuild] | ❌ | ⚠️ Only to fix Hydra builds | ✔️ |
|
||||
| Critical security fixes | ✔️ for non-mass-rebuilds | ✔️ for mass-rebuilds | ❌ |
|
||||
| Automatically merged into | `staging-next` | `staging` | - |
|
||||
| Manually merged into | - | `master` | `staging-next` |
|
||||
|
||||
The staging workflow is used for all main branches, `master` and `release-YY.MM`, with corresponding names:
|
||||
- `master`/`release-YY.MM`
|
||||
- `staging`/`staging-YY.MM`
|
||||
- `staging-next`/`staging-next-YY.MM`
|
||||
|
||||
# Conventions
|
||||
|
||||
## Branch conventions
|
||||
<!-- This section is relevant to both contributors and reviewers -->
|
||||
[branch]: #branch-conventions
|
||||
|
||||
Most changes should go to the `master` branch, but sometimes other branches should be used instead.
|
||||
Use the following decision process to figure out which one it should be:
|
||||
|
||||
Is the change [acceptable for releases][release-acceptable] and do you wish to have the change in the release?
|
||||
- No: Use the `master` branch, do not backport the pull request.
|
||||
- Yes: Can the change be implemented the same way on the `master` and release branches?
|
||||
For example, a packages major version might differ between the `master` and release branches, such that separate security patches are required.
|
||||
- Yes: Use the `master` branch and [backport the pull request](#how-to-backport-pull-requests).
|
||||
- No: Create separate pull requests to the `master` and `release-XX.YY` branches.
|
||||
|
||||
Furthermore, if the change causes a [mass rebuild][mass-rebuild], use the appropriate staging branch instead:
|
||||
- Mass rebuilds to `master` should go to `staging` instead.
|
||||
- Mass rebuilds to `release-XX.YY` should go to `staging-XX.YY` instead.
|
||||
|
||||
See [this section][staging] for more details about such changes propagate between the branches.
|
||||
|
||||
### Changes acceptable for releases
|
||||
[release-acceptable]: #changes-acceptable-for-releases
|
||||
|
||||
Only changes to supported releases may be accepted.
|
||||
The oldest supported release (`YYMM`) can be found using
|
||||
```
|
||||
nix-instantiate --eval -A lib.trivial.oldestSupportedRelease
|
||||
```
|
||||
|
||||
The release branches should generally only receive backwards-compatible changes, both for the Nix expressions and derivations.
|
||||
Here are some examples of backwards-compatible changes that are okay to backport:
|
||||
- ✔️ New packages, modules and functions
|
||||
- ✔️ Security fixes
|
||||
- ✔️ Package version updates
|
||||
- ✔️ Patch versions with fixes
|
||||
- ✔️ Minor versions with new functionality, but no breaking changes
|
||||
|
||||
In addition, major package version updates with breaking changes are also acceptable for:
|
||||
- ✔️ Services that would fail without up-to-date client software, such as `spotify`, `steam`, and `discord`
|
||||
- ✔️ Security critical applications, such as `firefox` and `chromium`
|
||||
|
||||
### Changes causing mass rebuilds
|
||||
[mass-rebuild]: #changes-causing-mass-rebuilds
|
||||
|
||||
Which changes cause mass rebuilds is not formally defined.
|
||||
In order to help the decision, CI automatically assigns [`rebuild` labels](https://github.com/NixOS/nixpkgs/labels?q=rebuild) to pull requests based on the number of packages they cause rebuilds for.
|
||||
As a rule of thumb, if the number of rebuilds is **over 500**, it can be considered a mass rebuild.
|
||||
To get a sense for what changes are considered mass rebuilds, see [previously merged pull requests to the staging branches](https://github.com/NixOS/nixpkgs/issues?q=base%3Astaging+-base%3Astaging-next+is%3Amerged).
|
||||
|
||||
## Commit conventions
|
||||
[commit-conventions]: #commit-conventions
|
||||
|
||||
- Create a commit for each logical unit.
|
||||
|
||||
- Check for unnecessary whitespace with `git diff --check` before committing.
|
||||
|
||||
- If you have commits `pkg-name: oh, forgot to insert whitespace`: squash commits in this case. Use `git rebase -i`.
|
||||
See [Squashing Commits](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_squashing) for 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).
|
||||
|
||||
- When adding yourself as maintainer in the same pull request, make a separate
|
||||
commit with the message `maintainers: add <handle>`.
|
||||
Add the commit before those making changes to the package or module.
|
||||
See [Nixpkgs Maintainers](./maintainers/README.md) for details.
|
||||
|
||||
- Make sure you read about any commit conventions specific to the area you're touching. See:
|
||||
- [Commit conventions](./pkgs/README.md#commit-conventions) for changes to `pkgs`.
|
||||
- [Commit conventions](./lib/README.md#commit-conventions) for changes to `lib`.
|
||||
- [Commit conventions](./nixos/README.md#commit-conventions) for changes to `nixos`.
|
||||
- [Commit conventions](./doc/README.md#commit-conventions) for changes to `doc`, the Nixpkgs manual.
|
||||
|
||||
### Writing good commit messages
|
||||
[writing-good-commit-messages]: #writing-good-commit-messages
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Pull requests should not be squash merged in order to keep complete commit messages and GPG signatures intact and must not be when the change doesn't make sense as a single commit.
|
||||
|
||||
## Code conventions
|
||||
[code-conventions]: #code-conventions
|
||||
|
||||
### Release notes
|
||||
|
||||
If you removed packages or made some major NixOS changes, write about it in the release notes for the next stable release in [`nixos/doc/manual/release-notes`](./nixos/doc/manual/release-notes).
|
||||
|
||||
### File naming and organisation
|
||||
|
||||
Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be `all-packages.nix`, not `allPackages.nix` or `AllPackages.nix`.
|
||||
|
||||
### Syntax
|
||||
|
||||
- Set up [editorconfig](https://editorconfig.org/) for your editor, such that [the settings](./.editorconfig) are automatically applied.
|
||||
|
||||
- Use `lowerCamelCase` for variable names, not `UpperCamelCase`. Note, this rule does not apply to package attribute names, which instead follow the rules in [package naming](./pkgs/README.md#package-naming).
|
||||
|
||||
- New files must be formatted by entering the `nix-shell` from the repository root and running `nixfmt`.
|
||||
|
||||
- Functions should list their expected arguments as precisely as possible. That is, write
|
||||
|
||||
```nix
|
||||
{ stdenv, fetchurl, perl }: <...>
|
||||
```
|
||||
|
||||
instead of
|
||||
|
||||
```nix
|
||||
args: with args; <...>
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```nix
|
||||
{ stdenv, fetchurl, perl, ... }: <...>
|
||||
```
|
||||
|
||||
For functions that are truly generic in the number of arguments (such as wrappers around `mkDerivation`) that have some required arguments, you should write them using an `@`-pattern:
|
||||
|
||||
```nix
|
||||
{ stdenv, doCoverageAnalysis ? false, ... } @ args:
|
||||
|
||||
stdenv.mkDerivation (args // {
|
||||
foo = if doCoverageAnalysis then "bla" else "";
|
||||
})
|
||||
```
|
||||
|
||||
instead of
|
||||
|
||||
```nix
|
||||
args:
|
||||
|
||||
args.stdenv.mkDerivation (args // {
|
||||
foo = if args ? doCoverageAnalysis && args.doCoverageAnalysis then "bla" else "";
|
||||
})
|
||||
```
|
||||
|
||||
- Unnecessary string conversions should be avoided. Do
|
||||
|
||||
```nix
|
||||
{
|
||||
rev = version;
|
||||
}
|
||||
```
|
||||
|
||||
instead of
|
||||
|
||||
```nix
|
||||
{
|
||||
rev = "${version}";
|
||||
}
|
||||
```
|
||||
|
||||
- Building lists conditionally _should_ be done with `lib.optional(s)` instead of using `if cond then [ ... ] else null` or `if cond then [ ... ] else [ ]`.
|
||||
|
||||
```nix
|
||||
{
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin iconv;
|
||||
}
|
||||
```
|
||||
|
||||
instead of
|
||||
|
||||
```nix
|
||||
{
|
||||
buildInputs = if stdenv.hostPlatform.isDarwin then [ iconv ] else null;
|
||||
}
|
||||
```
|
||||
|
||||
As an exception, an explicit conditional expression with null can be used when fixing a important bug without triggering a mass rebuild.
|
||||
If this is done a follow up pull request _should_ be created to change the code to `lib.optional(s)`.
|
||||
|
||||
# Practical contributing advice
|
||||
|
||||
To contribute effectively and efficiently, you need to be aware of how the contributing process generally works.
|
||||
This section aims to document the process as we live it in Nixpkgs to set expectations right and give practical tips on how to work with it.
|
||||
|
||||
## I opened a PR, how do I get it merged?
|
||||
[i-opened-a-pr-how-do-i-get-it-merged]:#i-opened-a-pr-how-do-i-get-it-merged
|
||||
|
||||
In order for your PR to be merged, someone with merge permissions on the repository ("committer") needs to review and merge it.
|
||||
Because the group of people with merge permissions is mostly a collection of independent unpaid volunteers who do this in their own free time, this can take some time to happen.
|
||||
It is entirely normal for your PR to sit around without any feedback for days, weeks or sometimes even months.
|
||||
We strive to avoid the latter cases of course but the reality of it is that this does happen quite frequently.
|
||||
Even when you get feedback, follow-up feedback may take similarly long.
|
||||
Don't be intimidated by this and kindly ask for feedback again every so often.
|
||||
If your change is good it will eventually be merged at some point.
|
||||
|
||||
There are some things you can do to help speed up the process of your PR being merged though.
|
||||
In order to speed the process up, you need to know what needs to happen before a committer will actually hit the merge button.
|
||||
This section intends to give a little overview and insight of what happens after you create your PR.
|
||||
|
||||
### The committer's perspective
|
||||
|
||||
PRs have varying quality and even the best people make mistakes.
|
||||
It is the role of the committer team to assess whether any PR's changes are good changes or not.
|
||||
In order for any PR to be merged, at least one committer needs to be convinced of its quality enough to merge it.
|
||||
|
||||
Committers typically assess three aspects of your PR:
|
||||
|
||||
1. Whether the change's intention is necessary and desirable
|
||||
2. Whether the code quality of your changes is good
|
||||
3. Whether the artefacts produced by the code are good
|
||||
|
||||
If you want your PR to get merged quickly and smoothly, it is in your best interest to help convince committers in these three aspects.
|
||||
|
||||
### How to help committers assess your PR
|
||||
|
||||
For the committer to judge your intention, it's best to explain why you've made your change.
|
||||
This does not apply to trivial changes like version updates because the intention is obvious (though linking the changelog is appreciated).
|
||||
For any more nuanced changed or even major version upgrades, it helps if you explain the background behind your change a bit.
|
||||
E.g. if you're adding a package, explain what it is and why it should be in Nixpkgs.
|
||||
This goes hand in hand with [Writing good commit messages](#writing-good-commit-messages).
|
||||
|
||||
For the code quality assessment, you cannot do anything yourself as only the committer can do this and they already have your code to look at.
|
||||
In order to minimise the need for back and forth though, do take a look over your code changes yourself and try to put yourself into the shoes of someone who didn't just write that code.
|
||||
Would you immediately know what the code does or why it is needed by glancing at it?
|
||||
If not, reviewers will notice this and will ask you to clarify the code by refactoring it and/or adding a few explanations in code comments.
|
||||
Doing this preemptively can save you and the committer a lot of time.
|
||||
To better convey the "story" of your change, consider dividing your change into multiple atomic commits.
|
||||
There is a balance to strike however: over-fragmentation causes friction.
|
||||
|
||||
The code artefacts are the hardest for committers to assess because PRs touch all sorts of components: applications, libraries, NixOS modules, editor plugins and many many other things.
|
||||
Any individual committer can only really assess components that they themselves know how to use however and yet they must still be convinced somehow.
|
||||
There isn't a good generic solution to this but there are some ways easing the committer's job here:
|
||||
|
||||
- Provide smoke tests that the committer can run without much research or setup.
|
||||
|
||||
Committers usually don't have the time or interest to learn how your component works and how they could test its functionality.
|
||||
If you can provide a quick guide on how to use the component in a meaningful way or a ready-made command that demonstrates that the component works as expected, the committer can easily convince themselves that your change is good.
|
||||
If it can be automated, you could even turn this smoke test into an automated NixOS test which reviewers could simply run via Nix.
|
||||
- Invite other users of the component to try it out and report their findings.
|
||||
|
||||
If a committer sees the testimonials of other users trying your change and it works as expected for them, that too can convince the committer of your PR's quality.
|
||||
- Describe what you have done to test your PR.
|
||||
|
||||
If you can convince the committer that you have done sufficient quality assurance on your changes and they trust your report, this too can convince them of your PR's quality, albeit not as strongly as the methods above.
|
||||
- Become a maintainer of the component.
|
||||
|
||||
This isn't something you can do on your first few PRs touching a component but listed maintainers generally receive more trust when it comes to changes to their maintained components and committers may opt to merge changes without deeper review when they see they're done by their respective maintainer.
|
||||
|
||||
Even if you adhere to all of these recommendations, it is still quite possible for your PR to be forgotten or abandoned by any given committer.
|
||||
Please remain mindful of the fact that they are doing this on their own volition and unpaid in their free time and therefore [owe you nothing](https://mikemcquaid.com/open-source-maintainers-owe-you-nothing/).
|
||||
Causing a stink in such a situation is a surefire way to get any other potential committer to not want to look at your PR either.
|
||||
Ask them nicely whether they still intend to review your PR and find yourself another committer to look at your PR if not.
|
||||
|
||||
### How can I get a committer to look at my PR?
|
||||
|
||||
- Improve skimmability: use a simple descriptive PR title (details go in commit titles) outlining _what_ is done and _why_.
|
||||
- Improve discoverability: apply all relevant labels, tick all relevant PR body checkboxes.
|
||||
- Wait. Reviewers frequently browse open PRs and may happen to run across yours and take a look.
|
||||
- Get non-committers to review/approve. Many committers filter open PRs for low-hanging fruit that are already been reviewed.
|
||||
- [@-mention](https://github.blog/news-insights/mention-somebody-they-re-notified/) someone and ask them nicely
|
||||
- Post in one of the channels made for this purpose if there has been no activity for at least one week
|
||||
- The current "PRs ready for review" or "PRs already reviewed" threads in the [NixOS Discourse](https://discourse.nixos.org/c/dev/14) (of course choose the one that applies to your situation)
|
||||
- The [Nixpkgs Review Requests Matrix room](https://matrix.to/#/#review-requests:nixos.org).
|
||||
|
||||
### CI failed or got stuck on my PR, what do I do?
|
||||
|
||||
First ensure that the failure is actually related to your change.
|
||||
Sometimes, the CI system simply has a hiccup or the check was broken by someone else before you made your changes.
|
||||
Read through the error message; it's usually quite easy to tell whether it is caused by anything you did by checking whether it mentions the component you touched anywhere.
|
||||
If it is indeed caused by your change, obviously try to fix it.
|
||||
Don't be afraid of asking for advice if you're uncertain how to do that, others have likely fixed such issues dozens of times and can help you out.
|
||||
Your PR is unlikely to be merged if it has a known issue and it is the purpose of CI to alert you aswell as reviewers to these issues.
|
||||
|
||||
ofBorg builds can often get stuck, particularly in PRs targeting `staging` and in builders for the Darwin platform. Reviewers will know how to handle them or when to ignore them.
|
||||
Don't worry about it.
|
||||
If there is a build failure however and it happened due to a package related to your change, you need to investigate it of course.
|
||||
If ofBorg reveals the build to be broken on some platform and you don't have access to that platform, you should set your package's `meta.broken` accordingly.
|
||||
|
||||
When in any doubt, please ask via a comment in your PR or through one of the help channels.
|
||||
|
||||
## I received a review on my PR, how do I get it over the finish line?
|
||||
|
||||
In the review process, the committer will have left some sort of feedback on your PR.
|
||||
They may have immediately approved of your PR or even merged it but the more likely case is that they want you to change a few things or that they require further input.
|
||||
|
||||
A reviewer may have taken a look at the code and it looked good to them ("Diff LGTM") but they still need to be convinced of the artefact's quality.
|
||||
They might also be waiting on input from other users of the component or its listed maintainer on whether the intention of your PR makes sense for the component.
|
||||
If you know of people who could help clarify any of this, please bring the PR to their attention.
|
||||
The current state of the PR is frequently not clearly communicated, so please don't hesitate to ask about it if it's unclear to you.
|
||||
|
||||
It's also possible for the reviewer to not be convinced that your PR is necessary or that the method you've chose to achieve your intention is the right one.
|
||||
|
||||
Please explain your intentions and reasoning to the committer in such a case.
|
||||
There may be constraints you had to work with which they're not aware of or qualities of your approach that they didn't immediately notice.
|
||||
(If these weren't clear to the reviewer, that's a good sign you should explain them in your commit message or code comments!)
|
||||
|
||||
There are some further pitfalls and realities which this section intends to make you aware of.
|
||||
|
||||
### Aim to reduce cycles
|
||||
|
||||
Please be prepared for it to take a while before the reviewer gets back to you after you respond.
|
||||
This is simply the reality of community projects at the scale of Nixpkgs.
|
||||
As such, make sure to respond to _all_ feedback, either by applying suggested changes or argue in favor of something else or no change.
|
||||
It wastes everyone time waiting for a couple of days just for the reviewer to remind you to address something they asked for.
|
||||
|
||||
### A reviewer requested a bunch of insubstantial changes on my PR
|
||||
|
||||
The people involved in Nixpkgs care about code quality because, once in Nixpkgs, it needs to be maintained for many years to come.
|
||||
It is therefore likely that other people will ask you to do some things in another way or adhere to some standard.
|
||||
Sometimes however, they also care a bit too much and may ask you to adhere to a personal preference of theirs.
|
||||
It's not always easy to tell which is which and whether the requests are critically important to merging the PR.
|
||||
Sometimes another reviewer may also come along with totally different opinions on some points too.
|
||||
|
||||
It is convention to mark review comments that are not critical to the PR as nitpicks but this is not always followed.
|
||||
As the PR author, you should still take a look at these as they will often reveal best practices and unwritten rules that usually have good reasons behind them and you may want to incorporate them into your modus operandi.
|
||||
|
||||
Please keep in mind that reviewers almost always mean well here.
|
||||
Their intent is not to denounce your code, they want your code to be as good as it can be.
|
||||
Through their experience, they may also take notice of a seemingly insignificant issues that have caused significant burden before.
|
||||
|
||||
Sometimes however, they can also get a bit carried away and become too perfectionistic.
|
||||
If you feel some of the requests are unreasonable, out of scope, or merely a matter of personal preference, try to nicely remind the reviewers that you may not intend this code to be 100% perfect or that you have different taste in some regards and press them on whether they think that these requests are *critical* to the PR's success.
|
||||
|
||||
While we do have a set of [official standards for the Nix community](https://github.com/NixOS/rfcs/), we don't have standards for everything and there are often multiple valid ways to achieve the same goal.
|
||||
Unless there are standards forbidding the patterns used in your code or there are serious technical, maintainability or readability issues with your code, you can insist to keep the code the way you made it and disregard the requests.
|
||||
Please communicate this clearly though; a simple "I prefer it this way and see no major issue with it" can save you a lot of arguing.
|
||||
|
||||
If you are unsure about some change requests, please ask reviewers *why* they requested them.
|
||||
This will usually reveal how important they deem it to be and will help educate you about standards, best practices, unwritten rules aswell as preferences people have and why.
|
||||
|
||||
Some committers may have stronger opinions on some things and therefore (understandably) may not want to merge your PR if you don't follow their requests.
|
||||
It is totally fine to get yourself a second or third opinion in such a case.
|
||||
|
||||
### Committers work on a push-basis
|
||||
|
||||
It's possible for you to get a review but nothing happens afterwards, even if you reply to review comments.
|
||||
A committer not following up on your PR does not necessarily mean they're disinterested or unresponsive, they may have simply forgotten to follow up on it or had some other circumstances preventing them from doing so.
|
||||
|
||||
Committers typically handle many other PRs besides yours and it is not realistic for them to keep up with all of them to a degree where they could reasonably remember to follow up on all PRs that they had intended following up upon.
|
||||
If someone left an approving review on your PR and didn't merge a few days later, the most likely case is that they simply forgot.
|
||||
|
||||
Please see it as your responsibility to actively remind reviewers of your open PRs.
|
||||
|
||||
The easiest way to do so is to cause them a Github notification.
|
||||
Github notifies people involved in the PR whenever you add a comment to your PR, push your PR or re-request their review.
|
||||
Doing any of that will get you people's attention again.
|
||||
Everyone deserves proper attention, and yes that includes you!
|
||||
However please be mindful that committers can sadly not always give everyone the attention they deserve.
|
||||
|
||||
It may very well be the case that you have to do this every time you need the committer to follow up upon your PR.
|
||||
Again, this is a community project so please be mindful of people's circumstances here; be nice when requesting reviews again.
|
||||
|
||||
It may also be the case that the committer has lost interest or isn't familiar enough with the component you're touching to be comfortable merging your PR.
|
||||
They will likely not immediately state that fact however, so please ask for clarification and don't hesitate to find yourself another committer to take a look at your PR.
|
||||
|
||||
### Nothing helped
|
||||
|
||||
If you followed these guidelines but still got no results or if you feel that you have been wronged in some way, please explicitly reach out to the greater community via its communication channels.
|
||||
|
||||
The [NixOS Discourse](https://discourse.nixos.org/) is a great place to do this as it has historically been the asynchronous medium with the greatest concentration of committers and other people who are significantly involved in Nixpkgs.
|
||||
There is a dedicated discourse thread [PRs in distress](https://discourse.nixos.org/t/prs-in-distress/3604) where you can link your PR if everything else fails.
|
||||
The [Nixpkgs / NixOS contributions Matrix channel](https://matrix.to/#/#dev:nixos.org) is the best synchronous channel with the same qualities.
|
||||
|
||||
Please reserve these for cases where you've made a serious effort in trying to get the attention of multiple active committers and provided realistic means for them to assess your PR's quality though.
|
||||
As mentioned previously, it is unfortunately perfectly normal for a PR to sit around for weeks on end due to the realities of this being a community project.
|
||||
Please don't blow up situations where progress is happening but is merely not going fast enough for your tastes.
|
||||
Honking in a traffic jam will not make you go any faster.
|
20
third_party/nixpkgs/COPYING
vendored
Normal file
20
third_party/nixpkgs/COPYING
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright (c) 2003-2024 Eelco Dolstra and the Nixpkgs/NixOS contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
101
third_party/nixpkgs/README.md
vendored
Normal file
101
third_party/nixpkgs/README.md
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
<p align="center">
|
||||
<a href="https://nixos.org">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/NixOS/nixos-homepage/main/public/logo/nixos-hires.png">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/NixOS/nixos-artwork/master/logo/nixos-white.png">
|
||||
<img src="https://raw.githubusercontent.com/NixOS/nixos-homepage/main/public/logo/nixos-hires.png" width="500px" alt="NixOS logo">
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md"><img src="https://img.shields.io/github/contributors-anon/NixOS/nixpkgs" alt="Contributors badge" /></a>
|
||||
<a href="https://opencollective.com/nixos"><img src="https://opencollective.com/nixos/tiers/supporter/badge.svg?label=supporters&color=brightgreen" alt="Open Collective supporters" /></a>
|
||||
</p>
|
||||
|
||||
[Nixpkgs](https://github.com/nixos/nixpkgs) is a collection of over
|
||||
100,000 software packages that can be installed with the
|
||||
[Nix](https://nixos.org/nix/) package manager. It also implements
|
||||
[NixOS](https://nixos.org/nixos/), a purely-functional Linux distribution.
|
||||
|
||||
# Manuals
|
||||
|
||||
* [NixOS Manual](https://nixos.org/nixos/manual) - how to install, configure, and maintain a purely-functional Linux distribution
|
||||
* [Nixpkgs Manual](https://nixos.org/nixpkgs/manual/) - contributing to Nixpkgs and using programming-language-specific Nix expressions
|
||||
* [Nix Package Manager Manual](https://nixos.org/nix/manual) - how to write Nix expressions (programs), and how to use Nix command line tools
|
||||
|
||||
# Community
|
||||
|
||||
* [Discourse Forum](https://discourse.nixos.org/)
|
||||
* [Matrix Chat](https://matrix.to/#/#community:nixos.org)
|
||||
* [NixOS Weekly](https://weekly.nixos.org/)
|
||||
* [Official wiki](https://wiki.nixos.org/)
|
||||
* [Community-maintained list of ways to get in touch](https://wiki.nixos.org/wiki/Get_In_Touch#Chat) (Discord, Telegram, IRC, etc.)
|
||||
|
||||
# Other Project Repositories
|
||||
|
||||
The sources of all official Nix-related projects are in the [NixOS
|
||||
organization on GitHub](https://github.com/NixOS/). Here are some of
|
||||
the main ones:
|
||||
|
||||
* [Nix](https://github.com/NixOS/nix) - the purely functional package manager
|
||||
* [NixOps](https://github.com/NixOS/nixops) - the tool to remotely deploy NixOS machines
|
||||
* [nixos-hardware](https://github.com/NixOS/nixos-hardware) - NixOS profiles to optimize settings for different hardware
|
||||
* [Nix RFCs](https://github.com/NixOS/rfcs) - the formal process for making substantial changes to the community
|
||||
* [NixOS homepage](https://github.com/NixOS/nixos-homepage) - the [NixOS.org](https://nixos.org) website
|
||||
* [hydra](https://github.com/NixOS/hydra) - our continuous integration system
|
||||
* [NixOS Artwork](https://github.com/NixOS/nixos-artwork) - NixOS artwork
|
||||
|
||||
# Continuous Integration and Distribution
|
||||
|
||||
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 24.05 release](https://hydra.nixos.org/jobset/nixos/release-24.05)
|
||||
* [Tests for unstable/master](https://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
|
||||
* [Tests for the NixOS 24.05 release](https://hydra.nixos.org/job/nixos/release-24.05/tested#tabs-constituents)
|
||||
|
||||
Artifacts successfully built with Hydra are published to cache at
|
||||
https://cache.nixos.org/. When successful build and test criteria are
|
||||
met, the Nixpkgs expressions are distributed via [Nix
|
||||
channels](https://nixos.org/manual/nix/stable/package-management/channels.html).
|
||||
|
||||
# Contributing
|
||||
|
||||
Nixpkgs is among the most active projects on GitHub. While thousands
|
||||
of open issues and pull requests might seem a lot at first, it helps
|
||||
consider it in the context of the scope of the project. Nixpkgs
|
||||
describes how to build tens of thousands of pieces of software and implements a
|
||||
Linux distribution. The [GitHub Insights](https://github.com/NixOS/nixpkgs/pulse)
|
||||
page gives a sense of the project activity.
|
||||
|
||||
Community contributions are always welcome through GitHub Issues and
|
||||
Pull Requests.
|
||||
|
||||
For more information about contributing to the project, please visit
|
||||
the [contributing page](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
# Donations
|
||||
|
||||
The infrastructure for NixOS and related projects is maintained by a
|
||||
nonprofit organization, the [NixOS
|
||||
Foundation](https://nixos.org/nixos/foundation.html). To ensure the
|
||||
continuity and expansion of the NixOS infrastructure, we are looking
|
||||
for donations to our organization.
|
||||
|
||||
You can donate to the NixOS foundation through [SEPA bank
|
||||
transfers](https://nixos.org/donate.html) or by using Open Collective:
|
||||
|
||||
<a href="https://opencollective.com/nixos#support"><img src="https://opencollective.com/nixos/tiers/supporter.svg?width=890" /></a>
|
||||
|
||||
# License
|
||||
|
||||
Nixpkgs is licensed under the [MIT License](COPYING).
|
||||
|
||||
Note: MIT license does not apply to the packages built by Nixpkgs,
|
||||
merely to the files in this repository (the Nix expressions, build
|
||||
scripts, NixOS modules, etc.). It also might not apply to patches
|
||||
included in Nixpkgs, which may be derivative works of the packages to
|
||||
which they apply. The aforementioned artifacts are all covered by the
|
||||
licenses of the respective packages.
|
425
third_party/nixpkgs/ci/OWNERS
vendored
Normal file
425
third_party/nixpkgs/ci/OWNERS
vendored
Normal file
|
@ -0,0 +1,425 @@
|
|||
# This file is used to describe who owns what in this repository.
|
||||
# Users/teams will get review requests for PRs that change their files.
|
||||
#
|
||||
# This file does not replace `meta.maintainers`
|
||||
# but is instead used for other things than derivations and modules,
|
||||
# like documentation, package sets, and other assets.
|
||||
#
|
||||
# This file uses the same syntax as the natively supported CODEOWNERS file,
|
||||
# see https://help.github.com/articles/about-codeowners/ for documentation.
|
||||
# However it comes with some notable differences:
|
||||
# - There is no need for user/team listed here to have write access.
|
||||
# - No reviews will be requested for PRs that target the wrong base branch.
|
||||
#
|
||||
# Processing of this file is implemented in workflows/codeowners-v2.yml
|
||||
|
||||
# CI
|
||||
/.github/workflows @NixOS/Security @Mic92 @zowoq
|
||||
/.github/workflows/check-nix-format.yml @infinisil
|
||||
/.github/workflows/nixpkgs-vet.yml @infinisil @philiptaron
|
||||
/.github/workflows/codeowners-v2.yml @infinisil
|
||||
/ci @infinisil @philiptaron @NixOS/Security
|
||||
/ci/OWNERS @infinisil @philiptaron
|
||||
|
||||
# Development support
|
||||
/.editorconfig @Mic92 @zowoq
|
||||
/shell.nix @infinisil @NixOS/Security
|
||||
|
||||
# Libraries
|
||||
/lib @infinisil
|
||||
/lib/systems @alyssais @ericson2314 @NixOS/stdenv
|
||||
/lib/generators.nix @infinisil @Profpatsch
|
||||
/lib/cli.nix @infinisil @Profpatsch
|
||||
/lib/debug.nix @infinisil @Profpatsch
|
||||
/lib/asserts.nix @infinisil @Profpatsch
|
||||
/lib/path/* @infinisil
|
||||
/lib/fileset @infinisil
|
||||
## Libraries / Module system
|
||||
/lib/modules.nix @infinisil @roberth
|
||||
/lib/types.nix @infinisil @roberth
|
||||
/lib/options.nix @infinisil @roberth
|
||||
/lib/tests/modules.sh @infinisil @roberth
|
||||
/lib/tests/modules @infinisil @roberth
|
||||
|
||||
# Nixpkgs Internals
|
||||
/default.nix @Ericson2314
|
||||
/pkgs/top-level/default.nix @Ericson2314
|
||||
/pkgs/top-level/impure.nix @Ericson2314
|
||||
/pkgs/top-level/stage.nix @Ericson2314
|
||||
/pkgs/top-level/splice.nix @Ericson2314
|
||||
/pkgs/top-level/release-cross.nix @Ericson2314
|
||||
/pkgs/top-level/by-name-overlay.nix @infinisil @philiptaron
|
||||
/pkgs/stdenv @philiptaron @NixOS/stdenv
|
||||
/pkgs/stdenv/generic @Ericson2314 @NixOS/stdenv
|
||||
/pkgs/stdenv/generic/check-meta.nix @Ericson2314 @NixOS/stdenv
|
||||
/pkgs/stdenv/cross @Ericson2314 @NixOS/stdenv
|
||||
/pkgs/build-support @philiptaron
|
||||
/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 @layus
|
||||
/pkgs/by-name/au/auto-patchelf @layus
|
||||
/pkgs/pkgs-lib @infinisil
|
||||
## Format generators/serializers
|
||||
/pkgs/pkgs-lib/formats/libconfig @h7x4
|
||||
/pkgs/pkgs-lib/formats/hocon @h7x4
|
||||
|
||||
# Nixpkgs build-support
|
||||
/pkgs/build-support/writers @lassulus @Profpatsch
|
||||
|
||||
# Nixpkgs make-disk-image
|
||||
/doc/build-helpers/images/makediskimage.section.md @raitobezarius
|
||||
/nixos/lib/make-disk-image.nix @raitobezarius
|
||||
|
||||
# Nix, the package manager
|
||||
# @raitobezarius is not "code owner", but is listed here to be notified of changes
|
||||
# pertaining to the Nix package manager.
|
||||
# i.e. no authority over those files.
|
||||
pkgs/tools/package-management/nix/ @NixOS/nix-team @raitobezarius
|
||||
nixos/modules/installer/tools/nix-fallback-paths.nix @NixOS/nix-team @raitobezarius
|
||||
|
||||
# Nixpkgs documentation
|
||||
/maintainers/scripts/db-to-md.sh @jtojnar @ryantm
|
||||
/maintainers/scripts/doc @jtojnar @ryantm
|
||||
|
||||
# Contributor documentation
|
||||
/CONTRIBUTING.md @infinisil
|
||||
/.github/PULL_REQUEST_TEMPLATE.md @infinisil
|
||||
/doc/contributing/ @infinisil
|
||||
/doc/contributing/contributing-to-documentation.chapter.md @jtojnar @infinisil
|
||||
/lib/README.md @infinisil
|
||||
/doc/README.md @infinisil
|
||||
/nixos/README.md @infinisil
|
||||
/pkgs/README.md @infinisil
|
||||
/pkgs/by-name/README.md @infinisil
|
||||
/maintainers/README.md @infinisil
|
||||
|
||||
# User-facing development documentation
|
||||
/doc/development.md @infinisil
|
||||
/doc/development @infinisil
|
||||
|
||||
# NixOS Internals
|
||||
/nixos/default.nix @infinisil
|
||||
/nixos/lib/from-env.nix @infinisil
|
||||
/nixos/lib/eval-config.nix @infinisil
|
||||
/nixos/modules/system/activation/bootspec.nix @grahamc @cole-h @raitobezarius
|
||||
/nixos/modules/system/activation/bootspec.cue @grahamc @cole-h @raitobezarius
|
||||
|
||||
# NixOS integration test driver
|
||||
/nixos/lib/test-driver @tfc
|
||||
|
||||
# NixOS QEMU virtualisation
|
||||
/nixos/modules/virtualisation/qemu-vm.nix @raitobezarius
|
||||
|
||||
# ACME
|
||||
/nixos/modules/security/acme @NixOS/acme
|
||||
|
||||
# Systemd
|
||||
/nixos/modules/system/boot/systemd.nix @NixOS/systemd
|
||||
/nixos/modules/system/boot/systemd @NixOS/systemd
|
||||
/nixos/lib/systemd-*.nix @NixOS/systemd
|
||||
/pkgs/os-specific/linux/systemd @NixOS/systemd
|
||||
|
||||
# Systemd-boot
|
||||
/nixos/modules/system/boot/loader/systemd-boot @JulienMalka
|
||||
|
||||
# Images and installer media
|
||||
/nixos/modules/profiles/installation-device.nix @ElvishJerricco
|
||||
/nixos/modules/installer/cd-dvd/ @ElvishJerricco
|
||||
/nixos/modules/installer/sd-card/
|
||||
|
||||
# Amazon
|
||||
/nixos/modules/virtualisation/amazon-init.nix @arianvp
|
||||
/nixos/modules/virtualisation/ec2-data.nix @arianvp
|
||||
/nixos/modules/virtualisation/amazon-options.nix @arianvp
|
||||
/nixos/modules/virtualisation/amazon-image.nix @arianvp
|
||||
/nixos/maintainers/scripts/ec2/ @arianvp
|
||||
/nixos/modules/services/misc/amazon-ssm-agent.nix @arianvp
|
||||
/nixos/tests/amazon-ssm-agent.nix @arianvp
|
||||
/nixos/modules/system/boot/grow-partition.nix @arianvp
|
||||
|
||||
|
||||
|
||||
# Updaters
|
||||
## update.nix
|
||||
/maintainers/scripts/update.nix @jtojnar
|
||||
/maintainers/scripts/update.py @jtojnar
|
||||
## common-updater-scripts
|
||||
/pkgs/common-updater/scripts/update-source-version @jtojnar
|
||||
|
||||
# Python-related code and docs
|
||||
/doc/languages-frameworks/python.section.md @mweinelt @natsukium
|
||||
/maintainers/scripts/update-python-libraries @natsukium
|
||||
/pkgs/development/interpreters/python @natsukium
|
||||
/pkgs/top-level/python-packages.nix @natsukium
|
||||
/pkgs/top-level/release-python.nix @natsukium
|
||||
|
||||
# Haskell
|
||||
/doc/languages-frameworks/haskell.section.md @sternenseemann @maralorn
|
||||
/maintainers/scripts/haskell @sternenseemann @maralorn
|
||||
/pkgs/development/compilers/ghc @sternenseemann @maralorn
|
||||
/pkgs/development/haskell-modules @sternenseemann @maralorn
|
||||
/pkgs/test/haskell @sternenseemann @maralorn
|
||||
/pkgs/top-level/release-haskell.nix @sternenseemann @maralorn
|
||||
/pkgs/top-level/haskell-packages.nix @sternenseemann @maralorn
|
||||
|
||||
# Perl
|
||||
/pkgs/development/interpreters/perl @stigtsp @zakame @marcusramberg
|
||||
/pkgs/top-level/perl-packages.nix @stigtsp @zakame @marcusramberg
|
||||
/pkgs/development/perl-modules @stigtsp @zakame @marcusramberg
|
||||
|
||||
# R
|
||||
/pkgs/applications/science/math/R @jbedo
|
||||
/pkgs/development/r-modules @jbedo
|
||||
|
||||
# Rust
|
||||
/pkgs/development/compilers/rust @alyssais @Mic92 @zowoq @winterqt @figsoda
|
||||
/pkgs/build-support/rust @zowoq @winterqt @figsoda
|
||||
/doc/languages-frameworks/rust.section.md @zowoq @winterqt @figsoda
|
||||
|
||||
# Tcl
|
||||
/pkgs/development/interpreters/tcl @fgaz
|
||||
/pkgs/development/libraries/tk @fgaz
|
||||
/pkgs/top-level/tcl-packages.nix @fgaz
|
||||
/pkgs/development/tcl-modules @fgaz
|
||||
/doc/languages-frameworks/tcl.section.md @fgaz
|
||||
|
||||
# C compilers
|
||||
/pkgs/development/compilers/gcc
|
||||
/pkgs/development/compilers/llvm @alyssais @RossComputerGuy @NixOS/llvm
|
||||
/pkgs/development/compilers/emscripten @raitobezarius
|
||||
/doc/languages-frameworks/emscripten.section.md @raitobezarius
|
||||
|
||||
# Audio
|
||||
/nixos/modules/services/audio/botamusique.nix @mweinelt
|
||||
/nixos/modules/services/audio/snapserver.nix @mweinelt
|
||||
/nixos/tests/botamusique.nix @mweinelt
|
||||
/nixos/tests/snapcast.nix @mweinelt
|
||||
|
||||
# Browsers
|
||||
/pkgs/applications/networking/browsers/firefox @mweinelt
|
||||
/pkgs/applications/networking/browsers/chromium @emilylange
|
||||
/nixos/tests/chromium.nix @emilylange
|
||||
|
||||
# Certificate Authorities
|
||||
pkgs/data/misc/cacert/ @ajs124 @lukegb @mweinelt
|
||||
pkgs/development/libraries/nss/ @ajs124 @lukegb @mweinelt
|
||||
pkgs/development/python-modules/buildcatrust/ @ajs124 @lukegb @mweinelt
|
||||
|
||||
# Jetbrains
|
||||
/pkgs/applications/editors/jetbrains @edwtjo
|
||||
|
||||
# Licenses
|
||||
/lib/licenses.nix @alyssais
|
||||
|
||||
# Qt
|
||||
/pkgs/development/libraries/qt-5 @K900 @NickCao @SuperSandro2000 @ttuegel
|
||||
/pkgs/development/libraries/qt-6 @K900 @NickCao @SuperSandro2000 @ttuegel
|
||||
|
||||
# KDE / Plasma 5
|
||||
/pkgs/applications/kde @K900 @NickCao @SuperSandro2000 @ttuegel
|
||||
/pkgs/desktops/plasma-5 @K900 @NickCao @SuperSandro2000 @ttuegel
|
||||
/pkgs/development/libraries/kde-frameworks @K900 @NickCao @SuperSandro2000 @ttuegel
|
||||
|
||||
# KDE / Plasma 6
|
||||
/pkgs/kde @K900 @NickCao @SuperSandro2000 @ttuegel
|
||||
/maintainers/scripts/kde @K900 @NickCao @SuperSandro2000 @ttuegel
|
||||
|
||||
# PostgreSQL and related stuff
|
||||
/pkgs/servers/sql/postgresql @NixOS/postgres
|
||||
/nixos/modules/services/databases/postgresql.md @NixOS/postgres
|
||||
/nixos/modules/services/databases/postgresql.nix @NixOS/postgres
|
||||
/nixos/tests/postgresql.nix @NixOS/postgres
|
||||
|
||||
# Hardened profile & related modules
|
||||
/nixos/modules/profiles/hardened.nix @joachifm
|
||||
/nixos/modules/security/lock-kernel-modules.nix @joachifm
|
||||
/nixos/modules/security/misc.nix @joachifm
|
||||
/nixos/tests/hardened.nix @joachifm
|
||||
/pkgs/os-specific/linux/kernel/hardened/ @fabianhjr @joachifm
|
||||
|
||||
# Home Automation
|
||||
/nixos/modules/services/home-automation/home-assistant.nix @mweinelt
|
||||
/nixos/modules/services/home-automation/zigbee2mqtt.nix @mweinelt
|
||||
/nixos/tests/home-assistant.nix @mweinelt
|
||||
/nixos/tests/zigbee2mqtt.nix @mweinelt
|
||||
/pkgs/servers/home-assistant @mweinelt
|
||||
/pkgs/tools/misc/esphome @mweinelt
|
||||
|
||||
# Network Time Daemons
|
||||
/pkgs/by-name/ch/chrony @thoughtpolice
|
||||
/pkgs/tools/networking/ntp @thoughtpolice
|
||||
/pkgs/tools/networking/openntpd @thoughtpolice
|
||||
/nixos/modules/services/networking/ntp @thoughtpolice
|
||||
|
||||
# Network
|
||||
/pkgs/tools/networking/kea/default.nix @mweinelt
|
||||
/pkgs/tools/networking/babeld/default.nix @mweinelt
|
||||
/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
|
||||
|
||||
# Web servers
|
||||
/doc/packages/nginx.section.md @raitobezarius
|
||||
/pkgs/servers/http/nginx/ @raitobezarius
|
||||
/nixos/modules/services/web-servers/nginx/ @raitobezarius
|
||||
|
||||
# Dhall
|
||||
/pkgs/development/dhall-modules @Gabriella439 @Profpatsch @ehmry
|
||||
/pkgs/development/interpreters/dhall @Gabriella439 @Profpatsch @ehmry
|
||||
|
||||
# Idris
|
||||
/pkgs/development/idris-modules @Infinisil
|
||||
/pkgs/development/compilers/idris2 @mattpolzin
|
||||
|
||||
# Bazel
|
||||
/pkgs/development/tools/build-managers/bazel @Profpatsch
|
||||
|
||||
# NixOS modules for e-mail and dns services
|
||||
/nixos/modules/services/mail/mailman.nix @peti
|
||||
/nixos/modules/services/mail/postfix.nix @peti
|
||||
/nixos/modules/services/networking/bind.nix @peti
|
||||
/nixos/modules/services/mail/rspamd.nix @peti
|
||||
|
||||
# Emacs
|
||||
/pkgs/applications/editors/emacs/elisp-packages @NixOS/emacs
|
||||
/pkgs/applications/editors/emacs @NixOS/emacs
|
||||
/pkgs/top-level/emacs-packages.nix @NixOS/emacs
|
||||
/doc/packages/emacs.section.md @NixOS/emacs
|
||||
/nixos/modules/services/editors/emacs.md @NixOS/emacs
|
||||
|
||||
# Kakoune
|
||||
/pkgs/applications/editors/kakoune @philiptaron
|
||||
|
||||
# Neovim
|
||||
/pkgs/applications/editors/neovim @NixOS/neovim
|
||||
|
||||
# VimPlugins
|
||||
/pkgs/applications/editors/vim/plugins @NixOS/neovim
|
||||
|
||||
# VsCode Extensions
|
||||
/pkgs/applications/editors/vscode/extensions
|
||||
|
||||
# PHP interpreter, packages, extensions, tests and documentation
|
||||
/doc/languages-frameworks/php.section.md @aanderse @drupol @globin @ma27 @talyz
|
||||
/nixos/tests/php @aanderse @drupol @globin @ma27 @talyz
|
||||
/pkgs/build-support/php/build-pecl.nix @aanderse @drupol @globin @ma27 @talyz
|
||||
/pkgs/build-support/php @drupol
|
||||
/pkgs/development/interpreters/php @jtojnar @aanderse @drupol @globin @ma27 @talyz
|
||||
/pkgs/development/php-packages @aanderse @drupol @globin @ma27 @talyz
|
||||
/pkgs/top-level/php-packages.nix @jtojnar @aanderse @drupol @globin @ma27 @talyz
|
||||
|
||||
# Docker tools
|
||||
/pkgs/build-support/docker @roberth
|
||||
/nixos/tests/docker-tools* @roberth
|
||||
/doc/build-helpers/images/dockertools.section.md @roberth
|
||||
|
||||
# Blockchains
|
||||
/pkgs/applications/blockchains @mmahut @RaghavSood
|
||||
|
||||
# Go
|
||||
/doc/languages-frameworks/go.section.md @kalbasit @katexochen @Mic92 @zowoq
|
||||
/pkgs/build-support/go @kalbasit @katexochen @Mic92 @zowoq
|
||||
/pkgs/development/compilers/go @kalbasit @katexochen @Mic92 @zowoq
|
||||
|
||||
# GNOME
|
||||
/pkgs/desktops/gnome @jtojnar
|
||||
/pkgs/desktops/gnome/extensions @jtojnar
|
||||
/pkgs/build-support/make-hardcode-gsettings-patch @jtojnar
|
||||
|
||||
# Cinnamon
|
||||
/pkgs/by-name/ci/cinnamon-* @mkg20001
|
||||
/pkgs/by-name/cj/cjs @mkg20001
|
||||
/pkgs/by-name/mu/muffin @mkg20001
|
||||
/pkgs/by-name/ne/nemo @mkg20001
|
||||
/pkgs/by-name/ne/nemo-* @mkg20001
|
||||
|
||||
# Xfce
|
||||
/doc/hooks/xfce4-dev-tools.section.md @NixOS/xfce
|
||||
|
||||
# nim
|
||||
/doc/languages-frameworks/nim.section.md @ehmry
|
||||
/pkgs/build-support/build-nim-package.nix @ehmry
|
||||
/pkgs/top-level/nim-overrides.nix @ehmry
|
||||
|
||||
# terraform providers
|
||||
/pkgs/applications/networking/cluster/terraform-providers @zowoq
|
||||
|
||||
# Forgejo
|
||||
nixos/modules/services/misc/forgejo.nix @adamcstephens @bendlas @emilylange
|
||||
pkgs/by-name/fo/forgejo/ @adamcstephens @bendlas @emilylange
|
||||
|
||||
# Dotnet
|
||||
/pkgs/build-support/dotnet @corngood
|
||||
/pkgs/development/compilers/dotnet @corngood
|
||||
/pkgs/test/dotnet @corngood
|
||||
/doc/languages-frameworks/dotnet.section.md @corngood
|
||||
|
||||
# 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
|
||||
/pkgs/development/tools/pnpm @Scrumplex @gepbird
|
||||
|
||||
# OCaml
|
||||
/pkgs/build-support/ocaml @ulrikstrid
|
||||
/pkgs/development/compilers/ocaml @ulrikstrid
|
||||
/pkgs/development/ocaml-modules @ulrikstrid
|
||||
|
||||
# ZFS
|
||||
pkgs/os-specific/linux/zfs/2_1.nix @raitobezarius
|
||||
pkgs/os-specific/linux/zfs/generic.nix @raitobezarius
|
||||
nixos/modules/tasks/filesystems/zfs.nix @raitobezarius
|
||||
nixos/tests/zfs.nix @raitobezarius
|
||||
|
||||
# Zig
|
||||
/pkgs/development/compilers/zig @figsoda
|
||||
/doc/hooks/zig.section.md @figsoda
|
||||
|
||||
# Buildbot
|
||||
nixos/modules/services/continuous-integration/buildbot @Mic92 @zowoq
|
||||
nixos/tests/buildbot.nix @Mic92 @zowoq
|
||||
pkgs/development/tools/continuous-integration/buildbot @Mic92 @zowoq
|
||||
|
||||
# Pretix
|
||||
pkgs/by-name/pr/pretix/ @mweinelt
|
||||
pkgs/by-name/pr/pretalx/ @mweinelt
|
||||
nixos/modules/services/web-apps/pretix.nix @mweinelt
|
||||
nixos/modules/services/web-apps/pretalx.nix @mweinelt
|
||||
nixos/tests/web-apps/pretix.nix @mweinelt
|
||||
nixos/tests/web-apps/pretalx.nix @mweinelt
|
||||
|
||||
# incus/lxc
|
||||
nixos/maintainers/scripts/incus/ @adamcstephens
|
||||
nixos/modules/virtualisation/incus.nix @adamcstephens
|
||||
nixos/modules/virtualisation/lxc* @adamcstephens
|
||||
nixos/tests/incus/ @adamcstephens
|
||||
pkgs/by-name/in/incus/ @adamcstephens
|
||||
pkgs/by-name/lx/lxc* @adamcstephens
|
||||
|
||||
# ExpidusOS, Flutter
|
||||
/pkgs/development/compilers/flutter @RossComputerGuy
|
||||
/pkgs/desktops/expidus @RossComputerGuy
|
||||
|
||||
# GNU Tar & Zip
|
||||
/pkgs/tools/archivers/gnutar @RossComputerGuy
|
||||
/pkgs/tools/archivers/zip @RossComputerGuy
|
||||
|
||||
# SELinux
|
||||
/pkgs/os-specific/linux/checkpolicy @RossComputerGuy
|
||||
/pkgs/os-specific/linux/libselinux @RossComputerGuy
|
||||
/pkgs/os-specific/linux/libsepol @RossComputerGuy
|
||||
|
||||
# installShellFiles
|
||||
/pkgs/by-name/in/installShellFiles/* @Ericson2314
|
||||
/pkgs/test/install-shell-files/* @Ericson2314
|
||||
/doc/hooks/installShellFiles.section.md @Ericson2314
|
||||
|
||||
# Darwin
|
||||
/pkgs/by-name/ap/apple-sdk @NixOS/darwin-core
|
||||
/pkgs/os-specific/darwin/apple-source-releases @NixOS/darwin-core
|
||||
/pkgs/stdenv/darwin @NixOS/darwin-core
|
98
third_party/nixpkgs/ci/README.md
vendored
Normal file
98
third_party/nixpkgs/ci/README.md
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
# CI support files
|
||||
|
||||
This directory contains files to support CI, such as [GitHub Actions](https://github.com/NixOS/nixpkgs/tree/master/.github/workflows) and [Ofborg](https://github.com/nixos/ofborg).
|
||||
This is in contrast with [`maintainers/scripts`](../maintainers/scripts) which is for human use instead.
|
||||
|
||||
## Pinned Nixpkgs
|
||||
|
||||
CI may need certain packages from Nixpkgs.
|
||||
In order to ensure that the needed packages are generally available without building,
|
||||
[`pinned-nixpkgs.json`](./pinned-nixpkgs.json) contains a pinned Nixpkgs version tested by Hydra.
|
||||
|
||||
Run [`update-pinned-nixpkgs.sh`](./update-pinned-nixpkgs.sh) to update it.
|
||||
|
||||
## `ci/nixpkgs-vet.sh BASE_BRANCH [REPOSITORY]`
|
||||
|
||||
Runs the [`nixpkgs-vet` tool](https://github.com/NixOS/nixpkgs-vet) on the HEAD commit, closely matching what CI does. This can't do exactly the same as CI, because CI needs to rely on GitHub's server-side Git history to compute the mergeability of PRs before the check can be started.
|
||||
In turn, when contributors are running this tool locally, we don't want to have to push commits to test them, and we can also rely on the local Git history to do the mergeability check.
|
||||
|
||||
Arguments:
|
||||
|
||||
- `BASE_BRANCH`: The base branch to use, e.g. master or release-24.05
|
||||
- `REPOSITORY`: The repository from which to fetch the base branch. Defaults to <https://github.com/NixOS/nixpkgs.git>.
|
||||
|
||||
## `ci/nixpkgs-vet`
|
||||
|
||||
This directory contains scripts and files used and related to [`nixpkgs-vet`](https://github.com/NixOS/nixpkgs-vet/), which the CI uses to implement `pkgs/by-name` checks, along with many other Nixpkgs architecture rules.
|
||||
See also the [CI GitHub Action](../.github/workflows/nixpkgs-vet.yml).
|
||||
|
||||
## `ci/nixpkgs-vet/update-pinned-tool.sh`
|
||||
|
||||
Updates the pinned [`nixpkgs-vet` tool](https://github.com/NixOS/nixpkgs-vet) in [`ci/nixpkgs-vet/pinned-version.txt`](./nixpkgs-vet/pinned-version.txt) to the latest [release](https://github.com/NixOS/nixpkgs-vet/releases).
|
||||
|
||||
Each release contains a pre-built `x86_64-linux` version of the tool which is used by CI.
|
||||
|
||||
This script currently needs to be called manually when the CI tooling needs to be updated.
|
||||
|
||||
Why not just build the tooling right from the PRs Nixpkgs version?
|
||||
|
||||
- Because it allows CI to check all PRs, even if they would break the CI tooling.
|
||||
- Because it makes the CI check very fast, since no Nix builds need to be done, even for mass rebuilds.
|
||||
- Because it improves security, since we don't have to build potentially untrusted code from PRs.
|
||||
The tool only needs a very minimal Nix evaluation at runtime, which can work with [readonly-mode](https://nixos.org/manual/nix/stable/command-ref/opt-common.html#opt-readonly-mode) and [restrict-eval](https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-restrict-eval).
|
||||
|
||||
## `get-merge-commit.sh GITHUB_REPO PR_NUMBER`
|
||||
|
||||
Check whether a PR is mergeable and return the test merge commit as
|
||||
[computed by GitHub](https://docs.github.com/en/rest/guides/using-the-rest-api-to-interact-with-your-git-database?apiVersion=2022-11-28#checking-mergeability-of-pull-requests).
|
||||
|
||||
Arguments:
|
||||
- `GITHUB_REPO`: The repository of the PR, e.g. `NixOS/nixpkgs`
|
||||
- `PR_NUMBER`: The PR number, e.g. `1234`
|
||||
|
||||
Exit codes:
|
||||
- 0: The PR can be merged, the test merge commit hash is returned on stdout
|
||||
- 1: The PR cannot be merged because it's not open anymore
|
||||
- 2: The PR cannot be merged because it has a merge conflict
|
||||
- 3: The merge commit isn't being computed, GitHub is likely having internal issues, unknown if the PR is mergeable
|
||||
|
||||
### Usage
|
||||
|
||||
This script can be used in GitHub Actions workflows as follows:
|
||||
|
||||
```yaml
|
||||
on: pull_request_target
|
||||
|
||||
# We need a token to query the API, but it doesn't need any special permissions
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Important: Because of `pull_request_target`, this doesn't check out the PR,
|
||||
# but rather the base branch of the PR, which is needed so we don't run untrusted code
|
||||
- uses: actions/checkout@<VERSION>
|
||||
with:
|
||||
path: base
|
||||
sparse-checkout: ci
|
||||
- name: Resolving the merge commit
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
if mergedSha=$(base/ci/get-merge-commit.sh ${{ github.repository }} ${{ github.event.number }}); then
|
||||
echo "Checking the merge commit $mergedSha"
|
||||
echo "mergedSha=$mergedSha" >> "$GITHUB_ENV"
|
||||
else
|
||||
# Skipping so that no notifications are sent
|
||||
echo "Skipping the rest..."
|
||||
fi
|
||||
rm -rf base
|
||||
- uses: actions/checkout@<VERSION>
|
||||
# Add this to _all_ subsequent steps to skip them
|
||||
if: env.mergedSha
|
||||
with:
|
||||
ref: ${{ env.mergedSha }}
|
||||
- ...
|
||||
```
|
31
third_party/nixpkgs/ci/codeowners-validator/default.nix
vendored
Normal file
31
third_party/nixpkgs/ci/codeowners-validator/default.nix
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
}:
|
||||
buildGoModule {
|
||||
name = "codeowners-validator";
|
||||
src = fetchFromGitHub {
|
||||
owner = "mszostok";
|
||||
repo = "codeowners-validator";
|
||||
rev = "f3651e3810802a37bd965e6a9a7210728179d076";
|
||||
hash = "sha256-5aSmmRTsOuPcVLWfDF6EBz+6+/Qpbj66udAmi1CLmWQ=";
|
||||
};
|
||||
patches = [
|
||||
# https://github.com/mszostok/codeowners-validator/pull/222
|
||||
(fetchpatch {
|
||||
name = "user-write-access-check";
|
||||
url = "https://github.com/mszostok/codeowners-validator/compare/f3651e3810802a37bd965e6a9a7210728179d076...840eeb88b4da92bda3e13c838f67f6540b9e8529.patch";
|
||||
hash = "sha256-t3Dtt8SP9nbO3gBrM0nRE7+G6N/ZIaczDyVHYAG/6mU=";
|
||||
})
|
||||
# Undoes part of the above PR: We don't want to require write access
|
||||
# to the repository, that's only needed for GitHub's native CODEOWNERS.
|
||||
# Furthermore, it removes an unneccessary check from the code
|
||||
# that breaks tokens generated for GitHub Apps.
|
||||
./permissions.patch
|
||||
# Allows setting a custom CODEOWNERS path using the OWNERS_FILE env var
|
||||
./owners-file-name.patch
|
||||
];
|
||||
postPatch = "rm -r docs/investigation";
|
||||
vendorHash = "sha256-R+pW3xcfpkTRqfS2ETVOwG8PZr0iH5ewroiF7u8hcYI=";
|
||||
}
|
15
third_party/nixpkgs/ci/codeowners-validator/owners-file-name.patch
vendored
Normal file
15
third_party/nixpkgs/ci/codeowners-validator/owners-file-name.patch
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
diff --git a/pkg/codeowners/owners.go b/pkg/codeowners/owners.go
|
||||
index 6910bd2..e0c95e9 100644
|
||||
--- a/pkg/codeowners/owners.go
|
||||
+++ b/pkg/codeowners/owners.go
|
||||
@@ -39,6 +39,10 @@ func NewFromPath(repoPath string) ([]Entry, error) {
|
||||
// openCodeownersFile finds a CODEOWNERS file and returns content.
|
||||
// see: https://help.github.com/articles/about-code-owners/#codeowners-file-location
|
||||
func openCodeownersFile(dir string) (io.Reader, error) {
|
||||
+ if file, ok := os.LookupEnv("OWNERS_FILE"); ok {
|
||||
+ return fs.Open(file)
|
||||
+ }
|
||||
+
|
||||
var detectedFiles []string
|
||||
for _, p := range []string{".", "docs", ".github"} {
|
||||
pth := path.Join(dir, p)
|
36
third_party/nixpkgs/ci/codeowners-validator/permissions.patch
vendored
Normal file
36
third_party/nixpkgs/ci/codeowners-validator/permissions.patch
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
diff --git a/internal/check/valid_owner.go b/internal/check/valid_owner.go
|
||||
index a264bcc..610eda8 100644
|
||||
--- a/internal/check/valid_owner.go
|
||||
+++ b/internal/check/valid_owner.go
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
const scopeHeader = "X-OAuth-Scopes"
|
||||
|
||||
var reqScopes = map[github.Scope]struct{}{
|
||||
- github.ScopeReadOrg: {},
|
||||
}
|
||||
|
||||
type ValidOwnerConfig struct {
|
||||
@@ -223,10 +222,7 @@ func (v *ValidOwner) validateTeam(ctx context.Context, name string) *validateErr
|
||||
for _, t := range v.repoTeams {
|
||||
// GitHub normalizes name before comparison
|
||||
if strings.EqualFold(t.GetSlug(), team) {
|
||||
- if t.Permissions["push"] {
|
||||
- return nil
|
||||
- }
|
||||
- return newValidateError("Team %q cannot review PRs on %q as neither it nor any parent team has write permissions.", team, v.orgRepoName)
|
||||
+ return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,10 +241,7 @@ func (v *ValidOwner) validateGitHubUser(ctx context.Context, name string) *valid
|
||||
for _, u := range v.repoUsers {
|
||||
// GitHub normalizes name before comparison
|
||||
if strings.EqualFold(u.GetLogin(), userName) {
|
||||
- if u.Permissions["push"] {
|
||||
- return nil
|
||||
- }
|
||||
- return newValidateError("User %q cannot review PRs on %q as they don't have write permissions.", userName, v.orgRepoName)
|
||||
+ return nil
|
||||
}
|
||||
}
|
||||
|
29
third_party/nixpkgs/ci/default.nix
vendored
Normal file
29
third_party/nixpkgs/ci/default.nix
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
let
|
||||
pinnedNixpkgs = builtins.fromJSON (builtins.readFile ./pinned-nixpkgs.json);
|
||||
in
|
||||
{
|
||||
system ? builtins.currentSystem,
|
||||
|
||||
nixpkgs ? null,
|
||||
}:
|
||||
let
|
||||
nixpkgs' =
|
||||
if nixpkgs == null then
|
||||
fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgs.rev}.tar.gz";
|
||||
sha256 = pinnedNixpkgs.sha256;
|
||||
}
|
||||
else
|
||||
nixpkgs;
|
||||
|
||||
pkgs = import nixpkgs' {
|
||||
inherit system;
|
||||
config = { };
|
||||
overlays = [ ];
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit pkgs;
|
||||
requestReviews = pkgs.callPackage ./request-reviews { };
|
||||
codeownersValidator = pkgs.callPackage ./codeowners-validator { };
|
||||
}
|
62
third_party/nixpkgs/ci/get-merge-commit.sh
vendored
Executable file
62
third_party/nixpkgs/ci/get-merge-commit.sh
vendored
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/env bash
|
||||
# See ./README.md for docs
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
log() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
if (( $# < 2 )); then
|
||||
log "Usage: $0 GITHUB_REPO PR_NUMBER"
|
||||
exit 99
|
||||
fi
|
||||
repo=$1
|
||||
prNumber=$2
|
||||
|
||||
# Retry the API query this many times
|
||||
retryCount=5
|
||||
# Start with 5 seconds, but double every retry
|
||||
retryInterval=5
|
||||
|
||||
while true; do
|
||||
log "Checking whether the pull request can be merged"
|
||||
prInfo=$(gh api \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"/repos/$repo/pulls/$prNumber")
|
||||
|
||||
# Non-open PRs won't have their mergeability computed no matter what
|
||||
state=$(jq -r .state <<< "$prInfo")
|
||||
if [[ "$state" != open ]]; then
|
||||
log "PR is not open anymore"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mergeable=$(jq -r .mergeable <<< "$prInfo")
|
||||
if [[ "$mergeable" == "null" ]]; then
|
||||
if (( retryCount == 0 )); then
|
||||
log "Not retrying anymore. It's likely that GitHub is having internal issues: check https://www.githubstatus.com/"
|
||||
exit 3
|
||||
else
|
||||
(( retryCount -= 1 )) || true
|
||||
|
||||
# null indicates that GitHub is still computing whether it's mergeable
|
||||
# Wait a couple seconds before trying again
|
||||
log "GitHub is still computing whether this PR can be merged, waiting $retryInterval seconds before trying again ($retryCount retries left)"
|
||||
sleep "$retryInterval"
|
||||
|
||||
(( retryInterval *= 2 )) || true
|
||||
fi
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$mergeable" == "true" ]]; then
|
||||
log "The PR can be merged"
|
||||
jq -r .merge_commit_sha <<< "$prInfo"
|
||||
else
|
||||
log "The PR has a merge conflict"
|
||||
exit 2
|
||||
fi
|
71
third_party/nixpkgs/ci/nixpkgs-vet.sh
vendored
Executable file
71
third_party/nixpkgs/ci/nixpkgs-vet.sh
vendored
Executable file
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p jq
|
||||
|
||||
set -o pipefail -o errexit -o nounset
|
||||
|
||||
trace() { echo >&2 "$@"; }
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
cleanup() {
|
||||
# Don't exit early if anything fails to cleanup
|
||||
set +o errexit
|
||||
|
||||
trace -n "Cleaning up.. "
|
||||
|
||||
[[ -e "$tmp/base" ]] && git worktree remove --force "$tmp/base"
|
||||
[[ -e "$tmp/merged" ]] && git worktree remove --force "$tmp/merged"
|
||||
|
||||
rm -rf "$tmp"
|
||||
|
||||
trace "Done"
|
||||
}
|
||||
trap cleanup exit
|
||||
|
||||
|
||||
repo=https://github.com/NixOS/nixpkgs.git
|
||||
|
||||
if (( $# != 0 )); then
|
||||
baseBranch=$1
|
||||
shift
|
||||
else
|
||||
trace "Usage: $0 BASE_BRANCH [REPOSITORY]"
|
||||
trace "BASE_BRANCH: The base branch to use, e.g. master or release-23.11"
|
||||
trace "REPOSITORY: The repository to fetch the base branch from, defaults to $repo"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( $# != 0 )); then
|
||||
repo=$1
|
||||
shift
|
||||
fi
|
||||
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
trace -e "\e[33mWarning: Dirty tree, uncommitted changes won't be taken into account\e[0m"
|
||||
fi
|
||||
headSha=$(git rev-parse HEAD)
|
||||
trace -e "Using HEAD commit \e[34m$headSha\e[0m"
|
||||
|
||||
trace -n "Creating Git worktree for the HEAD commit in $tmp/merged.. "
|
||||
git worktree add --detach -q "$tmp/merged" HEAD
|
||||
trace "Done"
|
||||
|
||||
trace -n "Fetching base branch $baseBranch to compare against.. "
|
||||
git fetch -q "$repo" refs/heads/"$baseBranch"
|
||||
baseSha=$(git rev-parse FETCH_HEAD)
|
||||
trace -e "\e[34m$baseSha\e[0m"
|
||||
|
||||
trace -n "Creating Git worktree for the base branch in $tmp/base.. "
|
||||
git worktree add -q "$tmp/base" "$baseSha"
|
||||
trace "Done"
|
||||
|
||||
trace -n "Merging base branch into the HEAD commit in $tmp/merged.. "
|
||||
git -C "$tmp/merged" merge -q --no-edit "$baseSha"
|
||||
trace -e "\e[34m$(git -C "$tmp/merged" rev-parse HEAD)\e[0m"
|
||||
trace -n "Reading pinned nixpkgs-vet version from pinned-version.txt.. "
|
||||
toolVersion=$(<"$tmp/merged/ci/nixpkgs-vet/pinned-version.txt")
|
||||
trace -e "\e[34m$toolVersion\e[0m"
|
||||
|
||||
trace -n "Building tool.. "
|
||||
nix-build https://github.com/NixOS/nixpkgs-vet/tarball/"$toolVersion" -o "$tmp/tool" -A build
|
||||
trace "Running nixpkgs-vet.."
|
||||
"$tmp/tool/bin/nixpkgs-vet" --base "$tmp/base" "$tmp/merged"
|
1
third_party/nixpkgs/ci/nixpkgs-vet/pinned-version.txt
vendored
Normal file
1
third_party/nixpkgs/ci/nixpkgs-vet/pinned-version.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
0.1.4
|
22
third_party/nixpkgs/ci/nixpkgs-vet/update-pinned-tool.sh
vendored
Executable file
22
third_party/nixpkgs/ci/nixpkgs-vet/update-pinned-tool.sh
vendored
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p jq curl
|
||||
|
||||
set -o pipefail -o errexit -o nounset
|
||||
|
||||
trace() { echo >&2 "$@"; }
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
repository=NixOS/nixpkgs-vet
|
||||
pin_file=$SCRIPT_DIR/pinned-version.txt
|
||||
|
||||
trace -n "Fetching latest release of $repository.. "
|
||||
latestRelease=$(curl -sSfL \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/"$repository"/releases/latest)
|
||||
latestVersion=$(jq .tag_name -r <<< "$latestRelease")
|
||||
trace "$latestVersion"
|
||||
|
||||
trace "Updating $pin_file"
|
||||
echo "$latestVersion" > "$pin_file"
|
4
third_party/nixpkgs/ci/pinned-nixpkgs.json
vendored
Normal file
4
third_party/nixpkgs/ci/pinned-nixpkgs.json
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rev": "4de4818c1ffa76d57787af936e8a23648bda6be4",
|
||||
"sha256": "0l3b9jr5ydzqgvd10j12imc9jqb6jv5v2bdi1gyy5cwkwplfay67"
|
||||
}
|
43
third_party/nixpkgs/ci/request-reviews/default.nix
vendored
Normal file
43
third_party/nixpkgs/ci/request-reviews/default.nix
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
makeWrapper,
|
||||
coreutils,
|
||||
codeowners,
|
||||
jq,
|
||||
curl,
|
||||
github-cli,
|
||||
gitMinimal,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "request-reviews";
|
||||
src = lib.fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = lib.fileset.unions [
|
||||
./get-reviewers.sh
|
||||
./request-reviews.sh
|
||||
./verify-base-branch.sh
|
||||
./dev-branches.txt
|
||||
];
|
||||
};
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
mv dev-branches.txt $out/bin
|
||||
for bin in *.sh; do
|
||||
mv "$bin" "$out/bin"
|
||||
wrapProgram "$out/bin/$bin" \
|
||||
--set PATH ${
|
||||
lib.makeBinPath [
|
||||
coreutils
|
||||
codeowners
|
||||
jq
|
||||
curl
|
||||
github-cli
|
||||
gitMinimal
|
||||
]
|
||||
}
|
||||
done
|
||||
'';
|
||||
}
|
7
third_party/nixpkgs/ci/request-reviews/dev-branches.txt
vendored
Normal file
7
third_party/nixpkgs/ci/request-reviews/dev-branches.txt
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Trusted development branches:
|
||||
# These generally require PRs to update and are built by Hydra.
|
||||
master
|
||||
staging
|
||||
release-*
|
||||
staging-*
|
||||
haskell-updates
|
126
third_party/nixpkgs/ci/request-reviews/get-reviewers.sh
vendored
Executable file
126
third_party/nixpkgs/ci/request-reviews/get-reviewers.sh
vendored
Executable file
|
@ -0,0 +1,126 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Get the code owners of the files changed by a PR,
|
||||
# suitable to be consumed by the API endpoint to request reviews:
|
||||
# https://docs.github.com/en/rest/pulls/review-requests?apiVersion=2022-11-28#request-reviewers-for-a-pull-request
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
log() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
if (( "$#" < 7 )); then
|
||||
log "Usage: $0 GIT_REPO OWNERS_FILE BASE_REPO BASE_REF HEAD_REF PR_NUMBER PR_AUTHOR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gitRepo=$1
|
||||
ownersFile=$2
|
||||
baseRepo=$3
|
||||
baseRef=$4
|
||||
headRef=$5
|
||||
prNumber=$6
|
||||
prAuthor=$7
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' exit
|
||||
|
||||
git -C "$gitRepo" diff --name-only --merge-base "$baseRef" "$headRef" > "$tmp/touched-files"
|
||||
readarray -t touchedFiles < "$tmp/touched-files"
|
||||
log "This PR touches ${#touchedFiles[@]} files"
|
||||
|
||||
# Get the owners file from the base, because we don't want to allow PRs to
|
||||
# remove code owners to avoid pinging them
|
||||
git -C "$gitRepo" show "$baseRef":"$ownersFile" > "$tmp"/codeowners
|
||||
|
||||
# Associative array with the user as the key for easy de-duplication
|
||||
# Make sure to always lowercase keys to avoid duplicates with different casings
|
||||
declare -A users=()
|
||||
|
||||
for file in "${touchedFiles[@]}"; do
|
||||
result=$(codeowners --file "$tmp"/codeowners "$file")
|
||||
|
||||
read -r file owners <<< "$result"
|
||||
if [[ "$owners" == "(unowned)" ]]; then
|
||||
log "File $file is unowned"
|
||||
continue
|
||||
fi
|
||||
log "File $file is owned by $owners"
|
||||
|
||||
# Split up multiple owners, separated by arbitrary amounts of spaces
|
||||
IFS=" " read -r -a entries <<< "$owners"
|
||||
|
||||
for entry in "${entries[@]}"; do
|
||||
# GitHub technically also supports Emails as code owners,
|
||||
# but we can't easily support that, so let's not
|
||||
if [[ ! "$entry" =~ @(.*) ]]; then
|
||||
warn -e "\e[33mCodeowner \"$entry\" for file $file is not valid: Must start with \"@\"\e[0m" >&2
|
||||
# Don't fail, because the PR for which this script runs can't fix it,
|
||||
# it has to be fixed in the base branch
|
||||
continue
|
||||
fi
|
||||
# The first regex match is everything after the @
|
||||
entry=${BASH_REMATCH[1]}
|
||||
|
||||
if [[ "$entry" =~ (.*)/(.*) ]]; then
|
||||
# Teams look like $org/$team
|
||||
org=${BASH_REMATCH[1]}
|
||||
team=${BASH_REMATCH[2]}
|
||||
|
||||
# Instead of requesting a review from the team itself,
|
||||
# we request reviews from the individual users.
|
||||
# This is because once somebody from a team reviewed the PR,
|
||||
# the API doesn't expose that the team was already requested for a review,
|
||||
# so we wouldn't be able to avoid rerequesting reviews
|
||||
# without saving some some extra state somewhere
|
||||
|
||||
# We could also consider implementing a more advanced heuristic
|
||||
# in the future that e.g. only pings one team member,
|
||||
# but escalates to somebody else if that member doesn't respond in time.
|
||||
gh api \
|
||||
--cache=1h \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"/orgs/$org/teams/$team/members" \
|
||||
--jq '.[].login' > "$tmp/team-members"
|
||||
readarray -t members < "$tmp/team-members"
|
||||
log "Team $entry has these members: ${members[*]}"
|
||||
|
||||
for user in "${members[@]}"; do
|
||||
users[${user,,}]=
|
||||
done
|
||||
else
|
||||
# Everything else is a user
|
||||
users[${entry,,}]=
|
||||
fi
|
||||
done
|
||||
|
||||
done
|
||||
|
||||
# Cannot request a review from the author
|
||||
if [[ -v users[${prAuthor,,}] ]]; then
|
||||
log "One or more files are owned by the PR author, ignoring"
|
||||
unset 'users[${prAuthor,,}]'
|
||||
fi
|
||||
|
||||
gh api \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"/repos/$baseRepo/pulls/$prNumber/reviews" \
|
||||
--jq '.[].user.login' > "$tmp/already-reviewed-by"
|
||||
|
||||
# And we don't want to rerequest reviews from people who already reviewed
|
||||
while read -r user; do
|
||||
if [[ -v users[${user,,}] ]]; then
|
||||
log "User $user is a code owner but has already left a review, ignoring"
|
||||
unset 'users[${user,,}]'
|
||||
fi
|
||||
done < "$tmp/already-reviewed-by"
|
||||
|
||||
# Turn it into a JSON for the GitHub API call to request PR reviewers
|
||||
jq -n \
|
||||
--arg users "${!users[*]}" \
|
||||
'{
|
||||
reviewers: $users | split(" "),
|
||||
}'
|
95
third_party/nixpkgs/ci/request-reviews/request-reviews.sh
vendored
Executable file
95
third_party/nixpkgs/ci/request-reviews/request-reviews.sh
vendored
Executable file
|
@ -0,0 +1,95 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Requests reviews for a PR after verifying that the base branch is correct
|
||||
|
||||
set -euo pipefail
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' exit
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
log() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
effect() {
|
||||
if [[ -n "${DRY_MODE:-}" ]]; then
|
||||
log "Skipping in dry mode:" "${@@Q}"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
if (( $# < 3 )); then
|
||||
log "Usage: $0 GITHUB_REPO PR_NUMBER OWNERS_FILE"
|
||||
exit 1
|
||||
fi
|
||||
baseRepo=$1
|
||||
prNumber=$2
|
||||
ownersFile=$3
|
||||
|
||||
log "Fetching PR info"
|
||||
prInfo=$(gh api \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"/repos/$baseRepo/pulls/$prNumber")
|
||||
|
||||
baseBranch=$(jq -r .base.ref <<< "$prInfo")
|
||||
log "Base branch: $baseBranch"
|
||||
prRepo=$(jq -r .head.repo.full_name <<< "$prInfo")
|
||||
log "PR repo: $prRepo"
|
||||
prBranch=$(jq -r .head.ref <<< "$prInfo")
|
||||
log "PR branch: $prBranch"
|
||||
prAuthor=$(jq -r .user.login <<< "$prInfo")
|
||||
log "PR author: $prAuthor"
|
||||
|
||||
extraArgs=()
|
||||
if pwdRepo=$(git rev-parse --show-toplevel 2>/dev/null); then
|
||||
# Speedup for local runs
|
||||
extraArgs+=(--reference-if-able "$pwdRepo")
|
||||
fi
|
||||
|
||||
log "Fetching Nixpkgs commit history"
|
||||
# We only need the commit history, not the contents, so we can do a tree-less clone using tree:0
|
||||
# https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-quick-summary
|
||||
git clone --bare --filter=tree:0 --no-tags --origin upstream "${extraArgs[@]}" https://github.com/"$baseRepo".git "$tmp"/nixpkgs.git
|
||||
|
||||
log "Fetching the PR commit history"
|
||||
# Fetch the PR
|
||||
git -C "$tmp/nixpkgs.git" remote add fork https://github.com/"$prRepo".git
|
||||
# This remote config is the same as --filter=tree:0 when cloning
|
||||
git -C "$tmp/nixpkgs.git" config remote.fork.partialclonefilter tree:0
|
||||
git -C "$tmp/nixpkgs.git" config remote.fork.promisor true
|
||||
|
||||
git -C "$tmp/nixpkgs.git" fetch --no-tags fork "$prBranch"
|
||||
headRef=$(git -C "$tmp/nixpkgs.git" rev-parse refs/remotes/fork/"$prBranch")
|
||||
|
||||
log "Checking correctness of the base branch"
|
||||
if ! "$SCRIPT_DIR"/verify-base-branch.sh "$tmp/nixpkgs.git" "$headRef" "$baseRepo" "$baseBranch" "$prRepo" "$prBranch" | tee "$tmp/invalid-base-error" >&2; then
|
||||
log "Posting error as comment"
|
||||
if ! response=$(effect gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"/repos/$baseRepo/issues/$prNumber/comments" \
|
||||
-F "body=@$tmp/invalid-base-error"); then
|
||||
log "Failed to post the comment: $response"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Getting code owners to request reviews from"
|
||||
"$SCRIPT_DIR"/get-reviewers.sh "$tmp/nixpkgs.git" "$ownersFile" "$baseRepo" "$baseBranch" "$headRef" "$prNumber" "$prAuthor" > "$tmp/reviewers.json"
|
||||
|
||||
log "Requesting reviews from: $(<"$tmp/reviewers.json")"
|
||||
|
||||
if ! response=$(effect gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"/repos/$baseRepo/pulls/$prNumber/requested_reviewers" \
|
||||
--input "$tmp/reviewers.json"); then
|
||||
log "Failed to request reviews: $response"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Successfully requested reviews"
|
104
third_party/nixpkgs/ci/request-reviews/verify-base-branch.sh
vendored
Executable file
104
third_party/nixpkgs/ci/request-reviews/verify-base-branch.sh
vendored
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Check that a PR doesn't include commits from other development branches.
|
||||
# Fails with next steps if it does
|
||||
|
||||
set -euo pipefail
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' exit
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
log() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
# Small helper to check whether an element is in a list
|
||||
# Usage: `elementIn foo "${list[@]}"`
|
||||
elementIn() {
|
||||
local e match=$1
|
||||
shift
|
||||
for e; do
|
||||
if [[ "$e" == "$match" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
if (( $# < 6 )); then
|
||||
log "Usage: $0 LOCAL_REPO HEAD_REF BASE_REPO BASE_BRANCH PR_REPO PR_BRANCH"
|
||||
exit 1
|
||||
fi
|
||||
localRepo=$1
|
||||
headRef=$2
|
||||
baseRepo=$3
|
||||
baseBranch=$4
|
||||
prRepo=$5
|
||||
prBranch=$6
|
||||
|
||||
# All development branches
|
||||
devBranchPatterns=()
|
||||
while read -r pattern; do
|
||||
if [[ "$pattern" != '#'* ]]; then
|
||||
devBranchPatterns+=("$pattern")
|
||||
fi
|
||||
done < "$SCRIPT_DIR/dev-branches.txt"
|
||||
|
||||
git -C "$localRepo" branch --list --format "%(refname:short)" "${devBranchPatterns[@]}" > "$tmp/dev-branches"
|
||||
readarray -t devBranches < "$tmp/dev-branches"
|
||||
|
||||
if [[ "$baseRepo" == "$prRepo" ]] && elementIn "$prBranch" "${devBranches[@]}"; then
|
||||
log "This PR merges $prBranch into $baseBranch, no commit check necessary"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# The current merge base of the PR
|
||||
prMergeBase=$(git -C "$localRepo" merge-base "$baseBranch" "$headRef")
|
||||
log "The PR's merge base with the base branch $baseBranch is $prMergeBase"
|
||||
|
||||
# This is purely for debugging
|
||||
git -C "$localRepo" rev-list --reverse "$baseBranch".."$headRef" > "$tmp/pr-commits"
|
||||
log "The PR includes these $(wc -l < "$tmp/pr-commits") commits:"
|
||||
cat <"$tmp/pr-commits" >&2
|
||||
|
||||
for testBranch in "${devBranches[@]}"; do
|
||||
|
||||
if [[ -z "$(git -C "$localRepo" rev-list -1 --since="1 month ago" "$testBranch")" ]]; then
|
||||
log "Not checking $testBranch, was inactive for the last month"
|
||||
continue
|
||||
fi
|
||||
log "Checking if commits from $testBranch are included in the PR"
|
||||
|
||||
# We need to check for any commits that are in the PR which are also in the test branch.
|
||||
# We could check each commit from the PR individually, but that's unnecessarily slow.
|
||||
#
|
||||
# This does _almost_ what we want: `git rev-list --count headRef testBranch ^baseBranch`,
|
||||
# except that it includes commits that are reachable from _either_ headRef or testBranch,
|
||||
# instead of restricting it to ones reachable by both
|
||||
|
||||
# Easily fixable though, because we can use `git merge-base testBranch headRef`
|
||||
# to get the least common ancestor (aka merge base) commit reachable by both.
|
||||
# If the branch being tested is indeed the right base branch,
|
||||
# this is then also the commit from that branch that the PR is based on top of.
|
||||
testMergeBase=$(git -C "$localRepo" merge-base "$testBranch" "$headRef")
|
||||
|
||||
# And then use the `git rev-list --count`, but replacing the non-working
|
||||
# `headRef testBranch` with the merge base of the two.
|
||||
extraCommits=$(git -C "$localRepo" rev-list --count "$testMergeBase" ^"$baseBranch")
|
||||
|
||||
if (( extraCommits != 0 )); then
|
||||
log -e "\e[33m"
|
||||
echo "The PR's base branch is set to $baseBranch, but $extraCommits commits from the $testBranch branch are included. Make sure you know the [right base branch for your changes](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#branch-conventions), then:"
|
||||
echo "- If the changes should go to the $testBranch branch, [change the base branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request) to $testBranch"
|
||||
echo "- If the changes should go to the $baseBranch branch, rebase your PR onto the merge base with the $baseBranch branch:"
|
||||
echo " \`\`\`bash"
|
||||
echo " # git rebase --onto \$(git merge-base upstream/$baseBranch HEAD) \$(git merge-base upstream/$testBranch HEAD)"
|
||||
echo " git rebase --onto $prMergeBase $testMergeBase"
|
||||
echo " git push --force-with-lease"
|
||||
echo " \`\`\`"
|
||||
log -e "\e[m"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
log "Base branch is correct, no commits from development branches are included"
|
17
third_party/nixpkgs/ci/update-pinned-nixpkgs.sh
vendored
Executable file
17
third_party/nixpkgs/ci/update-pinned-nixpkgs.sh
vendored
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p jq
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# https://stackoverflow.com/a/246128
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
repo=https://github.com/nixos/nixpkgs
|
||||
branch=nixpkgs-unstable
|
||||
file=$SCRIPT_DIR/pinned-nixpkgs.json
|
||||
|
||||
defaultRev=$(git ls-remote "$repo" refs/heads/"$branch" | cut -f1)
|
||||
rev=${1:-$defaultRev}
|
||||
sha256=$(nix-prefetch-url --unpack "$repo/archive/$rev.tar.gz" --name source)
|
||||
|
||||
jq -n --arg rev "$rev" --arg sha256 "$sha256" '$ARGS.named' | tee /dev/stderr > $file
|
28
third_party/nixpkgs/default.nix
vendored
Normal file
28
third_party/nixpkgs/default.nix
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
let requiredVersion = import ./lib/minver.nix; in
|
||||
|
||||
if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then
|
||||
|
||||
abort ''
|
||||
|
||||
This version of Nixpkgs requires Nix >= ${requiredVersion}, please upgrade:
|
||||
|
||||
- If you are running NixOS, `nixos-rebuild' can be used to upgrade your system.
|
||||
|
||||
- Alternatively, with Nix > 2.0 `nix upgrade-nix' can be used to imperatively
|
||||
upgrade Nix. You may use `nix-env --version' to check which version you have.
|
||||
|
||||
- If you installed Nix using the install script (https://nixos.org/nix/install),
|
||||
it is safe to upgrade by running it again:
|
||||
|
||||
curl -L https://nixos.org/nix/install | sh
|
||||
|
||||
For more information, please see the NixOS release notes at
|
||||
https://nixos.org/nixos/manual or locally at
|
||||
${toString ./nixos/doc/manual/release-notes}.
|
||||
|
||||
If you need further help, see https://nixos.org/nixos/support.html
|
||||
''
|
||||
|
||||
else
|
||||
|
||||
import ./pkgs/top-level/impure.nix
|
387
third_party/nixpkgs/doc/README.md
vendored
Normal file
387
third_party/nixpkgs/doc/README.md
vendored
Normal file
|
@ -0,0 +1,387 @@
|
|||
# Contributing to the Nixpkgs reference manual
|
||||
|
||||
This directory houses the sources files for the Nixpkgs reference manual.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> We are actively restructuring our documentation to follow the [Diátaxis framework](https://diataxis.fr/)
|
||||
>
|
||||
> Going forward, this directory should **only** contain [reference documentation](https://nix.dev/contributing/documentation/diataxis#reference).
|
||||
> For tutorials, guides and explanations, contribute to <https://nix.dev/> instead.
|
||||
>
|
||||
> We are actively working to generate **all** reference documentation from the [doc-comments](https://github.com/NixOS/rfcs/blob/master/rfcs/0145-doc-strings.md) present in code.
|
||||
> This also provides the benefit of using `:doc` in the `nix repl` to view reference documentation locally on the fly.
|
||||
|
||||
For documentation only relevant for contributors, use Markdown files next to the source and regular code comments.
|
||||
|
||||
> [!TIP]
|
||||
> Feedback for improving support for parsing and rendering doc-comments is highly appreciated.
|
||||
> [Open an issue](https://github.com/NixOS/nixpkgs/issues/new?labels=6.topic%3A+documentation&title=Doc%3A+) to request bugfixes or new features.
|
||||
|
||||
Rendered documentation:
|
||||
- [Unstable (from master)](https://nixos.org/manual/nixpkgs/unstable/)
|
||||
- [Stable (from latest release)](https://nixos.org/manual/nixpkgs/stable/)
|
||||
|
||||
The rendering tool is [nixos-render-docs](../pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs), sometimes abbreviated `nrd`.
|
||||
|
||||
## Contributing to this documentation
|
||||
|
||||
You can quickly check your edits with `nix-build`:
|
||||
|
||||
```ShellSession
|
||||
$ cd /path/to/nixpkgs
|
||||
$ nix-build doc
|
||||
```
|
||||
|
||||
If the build succeeds, the manual will be in `./result/share/doc/nixpkgs/manual.html`.
|
||||
|
||||
### devmode
|
||||
|
||||
The shell in the manual source directory makes available a command, `devmode`.
|
||||
It is a daemon, that:
|
||||
1. watches the manual's source for changes and when they occur — rebuilds
|
||||
2. HTTP serves the manual, injecting a script that triggers reload on changes
|
||||
3. opens the manual in the default browser
|
||||
|
||||
## Syntax
|
||||
|
||||
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.
|
||||
|
||||
Additional syntax extensions are available, all of which can be used in NixOS option documentation. The following extensions are currently used:
|
||||
|
||||
#### Tables
|
||||
|
||||
Tables, using the [GitHub-flavored Markdown syntax](https://github.github.com/gfm/#tables-extension-).
|
||||
|
||||
#### 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).
|
||||
|
||||
It uses the widely compatible [header attributes](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/attributes.md) syntax:
|
||||
|
||||
```markdown
|
||||
## Syntax {#sec-contributing-markup}
|
||||
```
|
||||
|
||||
> [!Note]
|
||||
> NixOS option documentation does not support headings in general.
|
||||
|
||||
#### Inline Anchors
|
||||
|
||||
Allow linking arbitrary place in the text (e.g. individual list items, sentences…).
|
||||
|
||||
They are defined using a hybrid of the link syntax with the attributes syntax known from headings, called [bracketed spans](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/bracketed_spans.md):
|
||||
|
||||
```markdown
|
||||
- []{#ssec-gnome-hooks-glib} `glib` setup hook will populate `GSETTINGS_SCHEMAS_PATH` and then `wrapGApps*` hook will prepend it to `XDG_DATA_DIRS`.
|
||||
```
|
||||
|
||||
#### Automatic links
|
||||
|
||||
If you **omit a link text** for a link pointing to a section, the text will be substituted automatically. For example `[](#chap-contributing)`.
|
||||
|
||||
This syntax is taken from [MyST](https://myst-parser.readthedocs.io/en/latest/using/syntax.html#targets-and-cross-referencing).
|
||||
|
||||
|
||||
#### HTML
|
||||
|
||||
Inlining HTML is not allowed. Parts of the documentation gets rendered to various non-HTML formats, such as man pages in the case of NixOS manual.
|
||||
|
||||
#### Roles
|
||||
|
||||
If you want to link to a man page, you can use `` {manpage}`nix.conf(5)` ``. The references will turn into links when a mapping exists in [`doc/manpage-urls.json`](./manpage-urls.json).
|
||||
|
||||
A few markups for other kinds of literals are also available:
|
||||
|
||||
- `` {command}`rm -rfi` ``
|
||||
- `` {env}`XDG_DATA_DIRS` ``
|
||||
- `` {file}`/etc/passwd` ``
|
||||
- `` {option}`networking.useDHCP` ``
|
||||
- `` {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.
|
||||
|
||||
#### Admonitions
|
||||
|
||||
Set off from the text to bring attention to something.
|
||||
|
||||
It uses pandoc’s [fenced `div`s syntax](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/fenced_divs.md):
|
||||
|
||||
```markdown
|
||||
::: {.warning}
|
||||
This is a warning
|
||||
:::
|
||||
```
|
||||
|
||||
The following are supported:
|
||||
|
||||
- `caution`
|
||||
- `important`
|
||||
- `note`
|
||||
- `tip`
|
||||
- `warning`
|
||||
- `example`
|
||||
|
||||
Example admonitions require a title to work.
|
||||
If you don't provide one, the manual won't be built.
|
||||
|
||||
```markdown
|
||||
::: {.example #ex-showing-an-example}
|
||||
|
||||
# Title for this example
|
||||
|
||||
Text for the example.
|
||||
:::
|
||||
```
|
||||
|
||||
#### [Definition lists](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/definition_lists.md)
|
||||
|
||||
For defining a group of terms:
|
||||
|
||||
```markdown
|
||||
pear
|
||||
: green or yellow bulbous fruit
|
||||
|
||||
watermelon
|
||||
: green fruit with red flesh
|
||||
```
|
||||
|
||||
## Commit conventions
|
||||
|
||||
- Make sure you read about the [commit conventions](../CONTRIBUTING.md#commit-conventions) common to Nixpkgs as a whole.
|
||||
|
||||
- If creating a commit purely for documentation changes, format the commit message in the following way:
|
||||
|
||||
```
|
||||
doc: (documentation summary)
|
||||
|
||||
(Motivation for change, relevant links, additional information.)
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
* doc: update the kernel config documentation to use `nix-shell`
|
||||
* doc: add information about `nix-update-script`
|
||||
|
||||
Closes #216321.
|
||||
|
||||
- If the commit contains more than just documentation changes, follow the commit message format relevant for the rest of the changes.
|
||||
|
||||
## Documentation conventions
|
||||
|
||||
In an effort to keep the Nixpkgs manual in a consistent style, please follow the conventions below, unless they prevent you from properly documenting something.
|
||||
In that case, please open an issue about the particular documentation convention and tag it with a "needs: documentation" label.
|
||||
When needed, each convention explain why it exists, so you can make a decision whether to follow it or not based on your particular case.
|
||||
Note that these conventions are about the **structure** of the manual (and its source files), not about the content that goes in it.
|
||||
You, as the writer of documentation, are still in charge of its content.
|
||||
|
||||
### One sentence per line
|
||||
|
||||
Put each sentence in its own line.
|
||||
This makes reviews and suggestions much easier, since GitHub's review system is based on lines.
|
||||
It also helps identifying long sentences at a glance.
|
||||
|
||||
### Callouts and examples
|
||||
|
||||
Use the [admonition syntax](#admonitions) for callouts and examples.
|
||||
|
||||
### Provide self-contained examples
|
||||
|
||||
Provide at least one example per function, and make examples self-contained.
|
||||
This is easier to understand for beginners.
|
||||
It also helps with testing that it actually works – especially once we introduce automation.
|
||||
|
||||
Example code should be such that it can be passed to `pkgs.callPackage`.
|
||||
Instead of something like:
|
||||
|
||||
```nix
|
||||
pkgs.dockerTools.buildLayeredImage {
|
||||
name = "hello";
|
||||
contents = [ pkgs.hello ];
|
||||
}
|
||||
```
|
||||
|
||||
Write something like:
|
||||
|
||||
```nix
|
||||
{ dockerTools, hello }:
|
||||
dockerTools.buildLayeredImage {
|
||||
name = "hello";
|
||||
contents = [ hello ];
|
||||
}
|
||||
```
|
||||
|
||||
### REPLs
|
||||
|
||||
When showing inputs/outputs of any [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop), such as a shell or the Nix REPL, use a format as you'd see in the REPL, while trying to visually separate inputs from outputs.
|
||||
This means that for a shell, you should use a format like the following:
|
||||
```shell
|
||||
$ nix-build -A hello '<nixpkgs>' \
|
||||
--option require-sigs false \
|
||||
--option trusted-substituters file:///tmp/hello-cache \
|
||||
--option substituters file:///tmp/hello-cache
|
||||
/nix/store/zhl06z4lrfrkw5rp0hnjjfrgsclzvxpm-hello-2.12.1
|
||||
```
|
||||
Note how the input is preceded by `$` on the first line and indented on subsequent lines, and how the output is provided as you'd see on the shell.
|
||||
|
||||
For the Nix REPL, you should use a format like the following:
|
||||
```shell
|
||||
nix-repl> builtins.attrNames { a = 1; b = 2; }
|
||||
[ "a" "b" ]
|
||||
```
|
||||
Note how the input is preceded by `nix-repl>` and the output is provided as you'd see on the Nix REPL.
|
||||
|
||||
### Headings for inputs, outputs and examples
|
||||
|
||||
When documenting functions or anything that has inputs/outputs and example usage, use nested headings to clearly separate inputs, outputs, and examples.
|
||||
Keep examples as the last nested heading, and link to the examples wherever applicable in the documentation.
|
||||
|
||||
The purpose of this convention is to provide a familiar structure for navigating the manual, so any reader can expect to find content related to inputs in an "inputs" heading, examples in an "examples" heading, and so on.
|
||||
An example:
|
||||
```
|
||||
## buildImage
|
||||
|
||||
Some explanation about the function here.
|
||||
Describe a particular scenario, and point to [](#ex-dockerTools-buildImage), which is an example demonstrating it.
|
||||
|
||||
### Inputs
|
||||
|
||||
Documentation for the inputs of `buildImage`.
|
||||
Perhaps even point to [](#ex-dockerTools-buildImage) again when talking about something specifically linked to it.
|
||||
|
||||
### Passthru outputs
|
||||
|
||||
Documentation for any passthru outputs of `buildImage`.
|
||||
|
||||
### Examples
|
||||
|
||||
Note that this is the last nested heading in the `buildImage` section.
|
||||
|
||||
:::{.example #ex-dockerTools-buildImage}
|
||||
|
||||
# Using `buildImage`
|
||||
|
||||
Example of how to use `buildImage` goes here.
|
||||
|
||||
:::
|
||||
```
|
||||
|
||||
### Function arguments
|
||||
|
||||
Use [definition lists](#definition-lists) to document function arguments, and the attributes of such arguments as well as their [types](https://nixos.org/manual/nix/stable/language/values).
|
||||
For example:
|
||||
|
||||
```markdown
|
||||
# pkgs.coolFunction {#pkgs.coolFunction}
|
||||
|
||||
`pkgs.coolFunction` *`name`* *`config`*
|
||||
|
||||
Description of what `callPackage` does.
|
||||
|
||||
|
||||
## Inputs {#pkgs-coolFunction-inputs}
|
||||
|
||||
If something's special about `coolFunction`'s general argument handling, you can say so here.
|
||||
Otherwise, just describe the single argument or start the arguments' definition list without introduction.
|
||||
|
||||
*`name`* (String)
|
||||
|
||||
: The name of the resulting image.
|
||||
|
||||
*`config`* (Attribute set)
|
||||
|
||||
: Introduce the parameter. Maybe you have a test to make sure `{ }` is a sensible default; then you can say: these attributes are optional; `{ }` is a valid argument.
|
||||
|
||||
`outputHash` (String; _optional_)
|
||||
|
||||
: A brief explanation including when and when not to pass this attribute.
|
||||
|
||||
: _Default:_ the output path's hash.
|
||||
```
|
||||
|
||||
Checklist:
|
||||
- Start with a synopsis, to show the order of positional arguments.
|
||||
- Metavariables are in emphasized code spans: ``` *`arg1`* ```. Metavariables are placeholders where users may write arbitrary expressions. This includes positional arguments.
|
||||
- Attribute names are regular code spans: ``` `attr1` ```. These identifiers can _not_ be picked freely by users, so they are _not_ metavariables.
|
||||
- _optional_ attributes have a _`Default:`_ if it's easily described as a value.
|
||||
- _optional_ attributes have a _`Default behavior:`_ if it's not easily described using a value.
|
||||
- Nix types aren't in code spans, because they are not code
|
||||
- Nix types are capitalized, to distinguish them from the camelCase Module System types, which _are_ code and behave like functions.
|
||||
|
||||
#### Examples
|
||||
|
||||
To define a referenceable figure use the following fencing:
|
||||
|
||||
```markdown
|
||||
:::{.example #an-attribute-set-example}
|
||||
# An attribute set example
|
||||
|
||||
You can add text before
|
||||
|
||||
```nix
|
||||
{ a = 1; b = 2;}
|
||||
```
|
||||
|
||||
and after code fencing
|
||||
:::
|
||||
```
|
||||
|
||||
Defining examples through the `example` fencing class adds them to a "List of Examples" section after the Table of Contents.
|
||||
Though this is not shown in the rendered documentation on nixos.org.
|
||||
|
||||
#### Figures
|
||||
|
||||
To define a referenceable figure use the following fencing:
|
||||
|
||||
```markdown
|
||||
::: {.figure #nixos-logo}
|
||||
# NixOS Logo
|
||||
![NixOS logo](./nixos_logo.png)
|
||||
:::
|
||||
```
|
||||
|
||||
Defining figures through the `figure` fencing class adds them to a `List of Figures` after the `Table of Contents`.
|
||||
Though this is not shown in the rendered documentation on nixos.org.
|
||||
|
||||
#### Footnotes
|
||||
|
||||
To add a foonote explanation, use the following syntax:
|
||||
|
||||
```markdown
|
||||
Sometimes it's better to add context [^context] in a footnote.
|
||||
|
||||
[^context]: This explanation will be rendered at the end of the chapter.
|
||||
```
|
||||
|
||||
#### Inline comments
|
||||
|
||||
Inline comments are supported with following syntax:
|
||||
|
||||
```markdown
|
||||
<!-- This is an inline comment -->
|
||||
```
|
||||
|
||||
The comments will not be rendered in the rendered HTML.
|
||||
|
||||
#### Link reference definitions
|
||||
|
||||
Links can reference a label, for example, to make the link target reusable:
|
||||
|
||||
```markdown
|
||||
::: {.note}
|
||||
Reference links can also be used to [shorten URLs][url-id] and keep the markdown readable.
|
||||
:::
|
||||
|
||||
[url-id]: https://github.com/NixOS/nixpkgs/blob/19d4f7dc485f74109bd66ef74231285ff797a823/doc/README.md
|
||||
```
|
||||
|
||||
This syntax is taken from [CommonMark](https://spec.commonmark.org/0.30/#link-reference-definitions).
|
||||
|
||||
#### Typographic replacements
|
||||
|
||||
Typographic replacements are enabled. Check the [list of possible replacement patterns check](https://github.com/executablebooks/markdown-it-py/blob/3613e8016ecafe21709471ee0032a90a4157c2d1/markdown_it/rules_core/replacements.py#L1-L15).
|
||||
|
||||
## Getting help
|
||||
|
||||
If you need documentation-specific help or reviews, ping [@NixOS/documentation-team](https://github.com/orgs/nixos/teams/documentation-team) on your pull request.
|
3
third_party/nixpkgs/doc/anchor-use.js
vendored
Normal file
3
third_party/nixpkgs/doc/anchor-use.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
document.addEventListener('DOMContentLoaded', function(event) {
|
||||
anchors.add('h1[id]:not(div.note h1, div.warning h1, div.tip h1, div.caution h1, div.important h1), h2[id]:not(div.note h2, div.warning h2, div.tip h2, div.caution h2, div.important h2), h3[id]:not(div.note h3, div.warning h3, div.tip h3, div.caution h3, div.important h3), h4[id]:not(div.note h4, div.warning h4, div.tip h4, div.caution h4, div.important h4), h5[id]:not(div.note h5, div.warning h5, div.tip h5, div.caution h5, div.important h5), h6[id]:not(div.note h6, div.warning h6, div.tip h6, div.caution h6, div.important h6)');
|
||||
});
|
9
third_party/nixpkgs/doc/anchor.min.js
vendored
Normal file
9
third_party/nixpkgs/doc/anchor.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
29
third_party/nixpkgs/doc/build-helpers.md
vendored
Normal file
29
third_party/nixpkgs/doc/build-helpers.md
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Build helpers {#part-builders}
|
||||
|
||||
A build helper is a function that produces derivations.
|
||||
|
||||
:::{.warning}
|
||||
This is not to be confused with the [`builder` argument of the Nix `derivation` primitive](https://nixos.org/manual/nix/unstable/language/derivations.html), which refers to the executable that produces the build result, or [remote builder](https://nixos.org/manual/nix/stable/advanced-topics/distributed-builds.html), which refers to a remote machine that could run such an executable.
|
||||
:::
|
||||
|
||||
Such a function is usually designed to abstract over a typical workflow for a given programming language or framework.
|
||||
This allows declaring a build recipe by setting a limited number of options relevant to the particular use case instead of using the `derivation` function directly.
|
||||
|
||||
[`stdenv.mkDerivation`](#part-stdenv) is the most widely used build helper, and serves as a basis for many others.
|
||||
In addition, it offers various options to customize parts of the builds.
|
||||
|
||||
There is no uniform interface for build helpers.
|
||||
[Trivial build helpers](#chap-trivial-builders) and [fetchers](#chap-pkgs-fetchers) have various input types for convenience.
|
||||
[Language- or framework-specific build helpers](#chap-language-support) usually follow the style of `stdenv.mkDerivation`, which accepts an attribute set or a fixed-point function taking an attribute set.
|
||||
|
||||
```{=include=} chapters
|
||||
build-helpers/fetchers.chapter.md
|
||||
build-helpers/trivial-build-helpers.chapter.md
|
||||
build-helpers/testers.chapter.md
|
||||
build-helpers/dev-shell-tools.chapter.md
|
||||
build-helpers/special.md
|
||||
build-helpers/images.md
|
||||
hooks/index.md
|
||||
languages-frameworks/index.md
|
||||
packages/index.md
|
||||
```
|
75
third_party/nixpkgs/doc/build-helpers/dev-shell-tools.chapter.md
vendored
Normal file
75
third_party/nixpkgs/doc/build-helpers/dev-shell-tools.chapter.md
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
# Development Shell helpers {#chap-devShellTools}
|
||||
|
||||
The `nix-shell` command has popularized the concept of transient shell environments for development or testing purposes.
|
||||
<!--
|
||||
We should try to document the product, not its development process in the Nixpkgs reference manual,
|
||||
but *something* needs to be said to provide context for this library.
|
||||
This is the most future proof sentence I could come up with while Nix itself does yet make use of this.
|
||||
Relevant is the current status of the devShell attribute "project": https://github.com/NixOS/nix/issues/7501
|
||||
-->
|
||||
However, `nix-shell` is not the only way to create such environments, and even `nix-shell` itself can indirectly benefit from this library.
|
||||
|
||||
This library provides a set of functions that help create such environments.
|
||||
|
||||
## `devShellTools.valueToString` {#sec-devShellTools-valueToString}
|
||||
|
||||
Converts Nix values to strings in the way the [`derivation` built-in function](https://nix.dev/manual/nix/2.23/language/derivations) does.
|
||||
|
||||
:::{.example}
|
||||
## `valueToString` usage examples
|
||||
|
||||
```nix
|
||||
devShellTools.valueToString (builtins.toFile "foo" "bar")
|
||||
=> "/nix/store/...-foo"
|
||||
```
|
||||
|
||||
```nix
|
||||
devShellTools.valueToString false
|
||||
=> ""
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## `devShellTools.unstructuredDerivationInputEnv` {#sec-devShellTools-unstructuredDerivationInputEnv}
|
||||
|
||||
Convert a set of derivation attributes (as would be passed to [`derivation`]) to a set of environment variables that can be used in a shell script.
|
||||
This function does not support `__structuredAttrs`, but does support `passAsFile`.
|
||||
|
||||
:::{.example}
|
||||
## `unstructuredDerivationInputEnv` usage example
|
||||
|
||||
```nix
|
||||
devShellTools.unstructuredDerivationInputEnv {
|
||||
drvAttrs = {
|
||||
name = "foo";
|
||||
buildInputs = [ hello figlet ];
|
||||
builder = bash;
|
||||
args = [ "-c" "${./builder.sh}" ];
|
||||
};
|
||||
}
|
||||
=> {
|
||||
name = "foo";
|
||||
buildInputs = "/nix/store/...-hello /nix/store/...-figlet";
|
||||
builder = "/nix/store/...-bash";
|
||||
}
|
||||
```
|
||||
|
||||
Note that `args` is not included, because Nix does not added it to the builder process environment.
|
||||
|
||||
:::
|
||||
|
||||
## `devShellTools.derivationOutputEnv` {#sec-devShellTools-derivationOutputEnv}
|
||||
|
||||
Takes the relevant parts of a derivation and returns a set of environment variables, that would be present in the derivation.
|
||||
|
||||
:::{.example}
|
||||
## `derivationOutputEnv` usage example
|
||||
|
||||
```nix
|
||||
let
|
||||
pkg = hello;
|
||||
in
|
||||
devShellTools.derivationOutputEnv { outputList = pkg.outputs; outputMap = pkg; }
|
||||
```
|
||||
|
||||
:::
|
890
third_party/nixpkgs/doc/build-helpers/fetchers.chapter.md
vendored
Normal file
890
third_party/nixpkgs/doc/build-helpers/fetchers.chapter.md
vendored
Normal file
|
@ -0,0 +1,890 @@
|
|||
# Fetchers {#chap-pkgs-fetchers}
|
||||
|
||||
Building software with Nix often requires downloading source code and other files from the internet.
|
||||
To this end, we use functions that we call _fetchers_, which obtain remote sources via various protocols and services.
|
||||
|
||||
Nix provides built-in fetchers such as [`builtins.fetchTarball`](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-fetchTarball).
|
||||
Nixpkgs provides its own fetchers, which work differently:
|
||||
|
||||
- A built-in fetcher will download and cache files at evaluation time and produce a [store path](https://nixos.org/manual/nix/stable/glossary#gloss-store-path).
|
||||
A Nixpkgs fetcher will create a ([fixed-output](https://nixos.org/manual/nix/stable/glossary#gloss-fixed-output-derivation)) [derivation](https://nixos.org/manual/nix/stable/glossary#gloss-derivation), and files are downloaded at build time.
|
||||
- Built-in fetchers will invalidate their cache after [`tarball-ttl`](https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-tarball-ttl) expires, and will require network activity to check if the cache entry is up to date.
|
||||
Nixpkgs fetchers only re-download if the specified hash changes or the store object is not available.
|
||||
- Built-in fetchers do not use [substituters](https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-substituters).
|
||||
Derivations produced by Nixpkgs fetchers will use any configured binary cache transparently.
|
||||
|
||||
This significantly reduces the time needed to evaluate Nixpkgs, and allows [Hydra](https://nixos.org/hydra) to retain and re-distribute sources used by Nixpkgs in the [public binary cache](https://cache.nixos.org).
|
||||
For these reasons, Nix's built-in fetchers are not allowed in Nixpkgs.
|
||||
|
||||
The following table summarises the differences:
|
||||
|
||||
| Fetchers | Download | Output | Cache | Re-download when |
|
||||
|-|-|-|-|-|
|
||||
| `builtins.fetch*` | evaluation time | store path | `/nix/store`, `~/.cache/nix` | `tarball-ttl` expires, cache miss in `~/.cache/nix`, output store object not in local store |
|
||||
| `pkgs.fetch*` | build time | derivation | `/nix/store`, substituters | output store object not available |
|
||||
|
||||
:::{.tip}
|
||||
`pkgs.fetchFrom*` helpers retrieve _snapshots_ of version-controlled sources, as opposed to the entire version history, which is more efficient.
|
||||
`pkgs.fetchgit` by default also has the same behaviour, but can be changed through specific attributes given to it.
|
||||
:::
|
||||
|
||||
## Caveats {#chap-pkgs-fetchers-caveats}
|
||||
|
||||
Because Nixpkgs fetchers are fixed-output derivations, an [output hash](https://nixos.org/manual/nix/stable/language/advanced-attributes#adv-attr-outputHash) has to be specified, usually indirectly through a `hash` attribute.
|
||||
This hash refers to the derivation output, which can be different from the remote source itself!
|
||||
|
||||
This has the following implications that you should be aware of:
|
||||
|
||||
- Use Nix (or Nix-aware) tooling to produce the output hash.
|
||||
|
||||
- When changing any fetcher parameters, always update the output hash.
|
||||
Use one of the methods from [](#sec-pkgs-fetchers-updating-source-hashes).
|
||||
Otherwise, existing store objects that match the output hash will be re-used rather than fetching new content.
|
||||
|
||||
:::{.note}
|
||||
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.
|
||||
:::
|
||||
|
||||
## Updating source hashes {#sec-pkgs-fetchers-updating-source-hashes}
|
||||
|
||||
There are several ways to obtain the hash corresponding to a remote source.
|
||||
Unless you understand how the fetcher you're using calculates the hash from the downloaded contents, you should use [the fake hash method](#sec-pkgs-fetchers-updating-source-hashes-fakehash-method).
|
||||
|
||||
1. []{#sec-pkgs-fetchers-updating-source-hashes-fakehash-method} The fake hash method: In your package recipe, set the hash to one of
|
||||
|
||||
- `""`
|
||||
- `lib.fakeHash`
|
||||
- `lib.fakeSha256`
|
||||
- `lib.fakeSha512`
|
||||
|
||||
Attempt to build, extract the calculated hashes from error messages, and put them into the recipe.
|
||||
|
||||
:::{.warning}
|
||||
You must use one of these four fake hashes and not some arbitrarily-chosen hash.
|
||||
See [](#sec-pkgs-fetchers-secure-hashes) for details.
|
||||
:::
|
||||
|
||||
:::{.example #ex-fetchers-update-fod-hash}
|
||||
# Update source hash with the fake hash method
|
||||
|
||||
Consider the following recipe that produces a plain file:
|
||||
|
||||
```nix
|
||||
{ fetchurl }:
|
||||
fetchurl {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/23.05/.version";
|
||||
hash = "sha256-ZHl1emidXVojm83LCVrwULpwIzKE/mYwfztVkvpruOM=";
|
||||
}
|
||||
```
|
||||
|
||||
A common mistake is to update a fetcher parameter, such as `url`, without updating the hash:
|
||||
|
||||
```nix
|
||||
{ fetchurl }:
|
||||
fetchurl {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/.version";
|
||||
hash = "sha256-ZHl1emidXVojm83LCVrwULpwIzKE/mYwfztVkvpruOM=";
|
||||
}
|
||||
```
|
||||
|
||||
**This will produce the same output as before!**
|
||||
Set the hash to an empty string:
|
||||
|
||||
```nix
|
||||
{ fetchurl }:
|
||||
fetchurl {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/.version";
|
||||
hash = "";
|
||||
}
|
||||
```
|
||||
|
||||
When building the package, use the error message to determine the correct hash:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(some output removed for clarity)
|
||||
error: hash mismatch in fixed-output derivation '/nix/store/7yynn53jpc93l76z9zdjj4xdxgynawcw-version.drv':
|
||||
specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
got: sha256-BZqI7r0MNP29yGH5+yW2tjU9OOpOCEvwWKrWCv5CQ0I=
|
||||
error: build of '/nix/store/bqdjcw5ij5ymfbm41dq230chk9hdhqff-version.drv' failed
|
||||
```
|
||||
:::
|
||||
|
||||
2. Prefetch the source with [`nix-prefetch-<type> <URL>`](https://search.nixos.org/packages?buckets={%22package_attr_set%22%3A[%22No%20package%20set%22]%2C%22package_license_set%22%3A[]%2C%22package_maintainers_set%22%3A[]%2C%22package_platforms%22%3A[]}&query=nix-prefetch), where `<type>` is one of
|
||||
|
||||
- `url`
|
||||
- `git`
|
||||
- `hg`
|
||||
- `cvs`
|
||||
- `bzr`
|
||||
- `svn`
|
||||
|
||||
The hash is printed to stdout.
|
||||
|
||||
3. Prefetch by package source (with `nix-prefetch-url '<nixpkgs>' -A <package>.src`, where `<package>` is package attribute name).
|
||||
The hash is printed to stdout.
|
||||
|
||||
This works well when you've upgraded the existing package version and want to find out new hash, but is useless if the package can't be accessed by attribute or the package has multiple sources (`.srcs`, architecture-dependent sources, etc).
|
||||
|
||||
4. Upstream hash: use it when upstream provides `sha256` or `sha512`.
|
||||
Don't use it when upstream provides `md5`, compute `sha256` instead.
|
||||
|
||||
A little nuance is that `nix-prefetch-*` tools produce hashes with the `nix32` encoding (a Nix-specific base32 adaptation), but upstream usually provides hexadecimal (`base16`) encoding.
|
||||
Fetchers understand both formats.
|
||||
Nixpkgs does not standardise on any one format.
|
||||
|
||||
You can convert between hash formats with [`nix-hash`](https://nixos.org/manual/nix/stable/command-ref/nix-hash).
|
||||
|
||||
5. Extract the hash from a local source archive with `sha256sum`.
|
||||
Use `nix-prefetch-url file:///path/to/archive` if you want the custom Nix `base32` hash.
|
||||
|
||||
## Obtaining hashes securely {#sec-pkgs-fetchers-secure-hashes}
|
||||
|
||||
It's always a good idea to avoid Man-in-the-Middle (MITM) attacks when downloading source contents.
|
||||
Otherwise, you could unknowingly download malware instead of the intended source, and instead of the actual source hash, you'll end up using the hash of malware.
|
||||
Here are security considerations for this scenario:
|
||||
|
||||
- `http://` URLs are not secure to prefetch hashes.
|
||||
|
||||
- Upstream hashes should be obtained via a secure protocol.
|
||||
|
||||
- `https://` URLs give you more protections when using `nix-prefetch-*` or for upstream hashes.
|
||||
|
||||
- `https://` URLs are secure when using the [fake hash method](#sec-pkgs-fetchers-updating-source-hashes-fakehash-method) *only if* you use one of the listed fake hashes.
|
||||
If you use any other hash, the download will be exposed to MITM attacks even if you use HTTPS URLs.
|
||||
|
||||
In more concrete terms, if you use any other hash, the [`--insecure` flag](https://curl.se/docs/manpage.html#-k) will be passed to the underlying call to `curl` when downloading content.
|
||||
|
||||
## Proxy usage {#sec-pkgs-fetchers-proxy}
|
||||
|
||||
Nixpkgs fetchers can make use of a http(s) proxy. Each fetcher will automatically inherit proxy-related environment variables (`http_proxy`, `https_proxy`, etc) via [impureEnvVars](https://nixos.org/manual/nix/stable/language/advanced-attributes#adv-attr-impureEnvVars).
|
||||
|
||||
The environment variable `NIX_SSL_CERT_FILE` is also inherited in fetchers, and can be used to provide a custom certificate bundle to fetchers. This is usually required for a https proxy to work without certificate validation errors.
|
||||
|
||||
[]{#fetchurl}
|
||||
## `fetchurl` {#sec-pkgs-fetchers-fetchurl}
|
||||
|
||||
`fetchurl` returns a [fixed-output derivation](https://nixos.org/manual/nix/stable/glossary.html#gloss-fixed-output-derivation) which downloads content from a given URL and stores the unaltered contents within the Nix store.
|
||||
|
||||
It uses {manpage}`curl(1)` internally, and allows its behaviour to be modified by specifying a few attributes in the argument to `fetchurl` (see the documentation for attributes `curlOpts`, `curlOptsList`, and `netrcPhase`).
|
||||
|
||||
The resulting [store path](https://nixos.org/manual/nix/stable/store/store-path) is determined by the hash given to `fetchurl`, and also the `name` (or `pname` and `version`) values.
|
||||
|
||||
If neither `name` nor `pname` and `version` are specified when calling `fetchurl`, it will default to using the [basename](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-baseNameOf) of `url` or the first element of `urls`.
|
||||
If `pname` and `version` are specified, `fetchurl` will use those values and will ignore `name`, even if it is also specified.
|
||||
|
||||
### Inputs {#sec-pkgs-fetchers-fetchurl-inputs}
|
||||
|
||||
`fetchurl` requires an attribute set with the following attributes:
|
||||
|
||||
`url` (String; _optional_)
|
||||
: The URL to download from.
|
||||
|
||||
:::{.note}
|
||||
Either `url` or `urls` must be specified, but not both.
|
||||
:::
|
||||
|
||||
All URLs of the format [specified here](https://curl.se/docs/url-syntax.html#rfc-3986-plus) are supported.
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`urls` (List of String; _optional_)
|
||||
: A list of URLs, specifying download locations for the same content.
|
||||
Each URL will be tried in order until one of them succeeds with some content or all of them fail.
|
||||
See [](#ex-fetchers-fetchurl-nixpkgs-version-multiple-urls) to understand how this attribute affects the behaviour of `fetchurl`.
|
||||
|
||||
:::{.note}
|
||||
Either `url` or `urls` must be specified, but not both.
|
||||
:::
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
`hash` (String; _optional_)
|
||||
: Hash of the derivation output of `fetchurl`, following the format for integrity metadata as defined by [SRI](https://www.w3.org/TR/SRI/).
|
||||
For more information, see [](#chap-pkgs-fetchers-caveats).
|
||||
|
||||
:::{.note}
|
||||
It is recommended that you use the `hash` attribute instead of the other hash-specific attributes that exist for backwards compatibility.
|
||||
|
||||
If `hash` is not specified, you must specify `outputHash` and `outputHashAlgo`, or one of `sha512`, `sha256`, or `sha1`.
|
||||
:::
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`outputHash` (String; _optional_)
|
||||
: Hash of the derivation output of `fetchurl` in the format expected by Nix.
|
||||
See [the documentation on the Nix manual](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-outputHash) for more information about its format.
|
||||
|
||||
:::{.note}
|
||||
It is recommended that you use the `hash` attribute instead.
|
||||
|
||||
If `outputHash` is specified, you must also specify `outputHashAlgo`.
|
||||
:::
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`outputHashAlgo` (String; _optional_)
|
||||
: Algorithm used to generate the value specified in `outputHash`.
|
||||
See [the documentation on the Nix manual](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-outputHashAlgo) for more information about the values it supports.
|
||||
|
||||
:::{.note}
|
||||
It is recommended that you use the `hash` attribute instead.
|
||||
|
||||
The value specified in `outputHashAlgo` will be ignored if `outputHash` isn't also specified.
|
||||
:::
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`sha1` (String; _optional_)
|
||||
: SHA-1 hash of the derivation output of `fetchurl` in the format expected by Nix.
|
||||
See [the documentation on the Nix manual](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-outputHash) for more information about its format.
|
||||
|
||||
:::{.note}
|
||||
It is recommended that you use the `hash` attribute instead.
|
||||
:::
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`sha256` (String; _optional_)
|
||||
: SHA-256 hash of the derivation output of `fetchurl` in the format expected by Nix.
|
||||
See [the documentation on the Nix manual](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-outputHash) for more information about its format.
|
||||
|
||||
:::{.note}
|
||||
It is recommended that you use the `hash` attribute instead.
|
||||
:::
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`sha512` (String; _optional_)
|
||||
: SHA-512 hash of the derivation output of `fetchurl` in the format expected by Nix.
|
||||
See [the documentation on the Nix manual](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-outputHash) for more information about its format.
|
||||
|
||||
:::{.note}
|
||||
It is recommended that you use the `hash` attribute instead.
|
||||
:::
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`name` (String; _optional_)
|
||||
: The symbolic name of the downloaded file when saved in the Nix store.
|
||||
See [the `fetchurl` overview](#sec-pkgs-fetchers-fetchurl) for details on how the name of the file is decided.
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`pname` (String; _optional_)
|
||||
: A base name, which will be combined with `version` to form the symbolic name of the downloaded file when saved in the Nix store.
|
||||
See [the `fetchurl` overview](#sec-pkgs-fetchers-fetchurl) for details on how the name of the file is decided.
|
||||
|
||||
:::{.note}
|
||||
If `pname` is specified, you must also specify `version`, otherwise `fetchurl` will ignore the value of `pname`.
|
||||
:::
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`version` (String; _optional_)
|
||||
: A version, which will be combined with `pname` to form the symbolic name of the downloaded file when saved in the Nix store.
|
||||
See [the `fetchurl` overview](#sec-pkgs-fetchers-fetchurl) for details on how the name of the file is decided.
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`recursiveHash` (Boolean; _optional_) []{#sec-pkgs-fetchers-fetchurl-inputs-recursiveHash}
|
||||
: If set to `true`, will signal to Nix that the hash given to `fetchurl` was calculated using the `"recursive"` mode.
|
||||
See [the documentation on the Nix manual](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-outputHashMode) for more information about the existing modes.
|
||||
|
||||
By default, `fetchurl` uses `"recursive"` mode when the `executable` attribute is set to `true`, so you don't need to specify `recursiveHash` in this case.
|
||||
|
||||
_Default value:_ `false`.
|
||||
|
||||
`executable` (Boolean; _optional_)
|
||||
: If `true`, sets the executable bit on the downloaded file.
|
||||
|
||||
_Default value_: `false`.
|
||||
|
||||
`downloadToTemp` (Boolean; _optional_) []{#sec-pkgs-fetchers-fetchurl-inputs-downloadToTemp}
|
||||
: If `true`, saves the downloaded file to a temporary location instead of the expected Nix store location.
|
||||
This is useful when used in conjunction with `postFetch` attribute, otherwise `fetchurl` will not produce any meaningful output.
|
||||
|
||||
The location of the downloaded file will be set in the `$downloadedFile` variable, which should be used by the script in the `postFetch` attribute.
|
||||
See [](#ex-fetchers-fetchurl-nixpkgs-version-postfetch) to understand how to work with this attribute.
|
||||
|
||||
_Default value:_ `false`.
|
||||
|
||||
`postFetch` (String; _optional_)
|
||||
: Script executed after the file has been downloaded successfully, and before `fetchurl` finishes running.
|
||||
Useful for post-processing, to check or transform the file in some way.
|
||||
See [](#ex-fetchers-fetchurl-nixpkgs-version-postfetch) to understand how to work with this attribute.
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`netrcPhase` (String or Null; _optional_)
|
||||
: Script executed to create a {manpage}`netrc(5)` file to be used with {manpage}`curl(1)`.
|
||||
The script should create the `netrc` file (note that it does not begin with a ".") in the directory it's currently running in (`$PWD`).
|
||||
|
||||
The script is executed during the setup done by `fetchurl` before it runs any of its code to download the specified content.
|
||||
|
||||
:::{.note}
|
||||
If specified, `fetchurl` will automatically alter its invocation of {manpage}`curl(1)` to use the `netrc` file, so you don't need to add anything to `curlOpts` or `curlOptsList`.
|
||||
:::
|
||||
|
||||
:::{.caution}
|
||||
Since `netrcPhase` needs to be specified in your source Nix code, any secrets that you put directly in it will be world-readable by design (both in your source code, and when the derivation gets created in the Nix store).
|
||||
|
||||
If you want to avoid this behaviour, see the documentation of `netrcImpureEnvVars` for an alternative way of dealing with these secrets.
|
||||
:::
|
||||
|
||||
_Default value_: `null`.
|
||||
|
||||
`netrcImpureEnvVars` (List of String; _optional_)
|
||||
: If specified, `fetchurl` will add these environment variable names to the list of [impure environment variables](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-impureEnvVars), which will be passed from the environment of the calling user to the builder running the `fetchurl` code.
|
||||
|
||||
This is useful when used with `netrcPhase` to hide any secrets that are used in it, because the script in `netrcPhase` only needs to reference the environment variables with the secrets in them instead.
|
||||
However, note that these are called _impure_ variables for a reason:
|
||||
the environment that starts the build needs to have these variables declared for everything to work properly, which means that additional setup is required outside what Nix controls.
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
`curlOpts` (String; _optional_)
|
||||
: If specified, this value will be appended to the invocation of {manpage}`curl(1)` when downloading the URL(s) given to `fetchurl`.
|
||||
Multiple arguments can be separated by spaces normally, but values with whitespaces will be interpreted as multiple arguments (instead of a single value), even if the value is escaped.
|
||||
See `curlOptsList` for a way to pass values with whitespaces in them.
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`curlOptsList` (List of String; _optional_)
|
||||
: If specified, each element of this list will be passed as an argument to the invocation of {manpage}`curl(1)` when downloading the URL(s) given to `fetchurl`.
|
||||
This allows passing values that contain spaces, with no escaping needed.
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
`showURLs` (Boolean; _optional_)
|
||||
: If set to `true`, this will stop `fetchurl` from downloading anything at all.
|
||||
Instead, it will output a list of all the URLs it would've used to download the content (after resolving `mirror://` URLs, for example).
|
||||
This is useful for debugging.
|
||||
|
||||
_Default value:_ `false`.
|
||||
|
||||
`meta` (Attribute Set; _optional_)
|
||||
: Specifies any [meta-attributes](#chap-meta) for the derivation returned by `fetchurl`.
|
||||
|
||||
_Default value:_ `{}`.
|
||||
|
||||
`passthru` (Attribute Set; _optional_)
|
||||
: Specifies any extra [`passthru`](#chap-passthru) attributes for the derivation returned by `fetchurl`.
|
||||
Note that `fetchurl` defines [`passthru` attributes of its own](#ssec-pkgs-fetchers-fetchurl-passthru-outputs).
|
||||
Attributes specified in `passthru` can override the default attributes returned by `fetchurl`.
|
||||
|
||||
_Default value:_ `{}`.
|
||||
|
||||
`preferLocalBuild` (Boolean; _optional_)
|
||||
: This is the same attribute as [defined in the Nix manual](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-preferLocalBuild).
|
||||
It is `true` by default because making a remote machine download the content just duplicates network traffic (since the local machine might download the results from the derivation anyway), but this could be useful in cases where network access is restricted on local machines.
|
||||
|
||||
_Default value:_ `true`.
|
||||
|
||||
`nativeBuildInputs` (List of Attribute Set; _optional_)
|
||||
: Additional packages needed to download the content.
|
||||
This is useful if you need extra packages for `postFetch` or `netrcPhase`, for example.
|
||||
Has the same semantics as in [](#var-stdenv-nativeBuildInputs).
|
||||
See [](#ex-fetchers-fetchurl-nixpkgs-version-postfetch) to understand how this can be used with `postFetch`.
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
### Passthru outputs {#ssec-pkgs-fetchers-fetchurl-passthru-outputs}
|
||||
|
||||
`fetchurl` also defines its own [`passthru`](#chap-passthru) attributes:
|
||||
|
||||
`url` (String)
|
||||
|
||||
: The same `url` attribute passed in the argument to `fetchurl`.
|
||||
|
||||
### Examples {#ssec-pkgs-fetchers-fetchurl-examples}
|
||||
|
||||
:::{.example #ex-fetchers-fetchurl-nixpkgs-version}
|
||||
# Using `fetchurl` to download a file
|
||||
|
||||
The following package downloads a small file from a URL and shows the most common way to use `fetchurl`:
|
||||
|
||||
```nix
|
||||
{ fetchurl }:
|
||||
fetchurl {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/.version";
|
||||
hash = "sha256-BZqI7r0MNP29yGH5+yW2tjU9OOpOCEvwWKrWCv5CQ0I=";
|
||||
}
|
||||
```
|
||||
|
||||
After building the package, the file will be downloaded and place into the Nix store:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(output removed for clarity)
|
||||
/nix/store/4g9y3x851wqrvim4zcz5x2v3zivmsq8n-version
|
||||
|
||||
$ cat /nix/store/4g9y3x851wqrvim4zcz5x2v3zivmsq8n-version
|
||||
23.11
|
||||
```
|
||||
:::
|
||||
|
||||
:::{.example #ex-fetchers-fetchurl-nixpkgs-version-multiple-urls}
|
||||
# Using `fetchurl` to download a file with multiple possible URLs
|
||||
|
||||
The following package adapts [](#ex-fetchers-fetchurl-nixpkgs-version) to use multiple URLs.
|
||||
The first URL was crafted to intentionally return an error to illustrate how `fetchurl` will try multiple URLs until it finds one that works (or all URLs fail).
|
||||
|
||||
```nix
|
||||
{ fetchurl }:
|
||||
fetchurl {
|
||||
urls = [
|
||||
"https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/does-not-exist"
|
||||
"https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/.version"
|
||||
];
|
||||
hash = "sha256-BZqI7r0MNP29yGH5+yW2tjU9OOpOCEvwWKrWCv5CQ0I=";
|
||||
}
|
||||
```
|
||||
|
||||
After building the package, both URLs will be used to download the file:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(some output removed for clarity)
|
||||
trying https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/does-not-exist
|
||||
(some output removed for clarity)
|
||||
curl: (22) The requested URL returned error: 404
|
||||
|
||||
trying https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/.version
|
||||
(some output removed for clarity)
|
||||
/nix/store/n9asny31z32q7sdw6a8r1gllrsfy53kl-does-not-exist
|
||||
|
||||
$ cat /nix/store/n9asny31z32q7sdw6a8r1gllrsfy53kl-does-not-exist
|
||||
23.11
|
||||
```
|
||||
|
||||
However, note that the name of the file was derived from the first URL (this is further explained in [the `fetchurl` overview](#sec-pkgs-fetchers-fetchurl)).
|
||||
To ensure the result will have the same name regardless of which URLs are used, we can modify the package:
|
||||
|
||||
```nix
|
||||
{ fetchurl }:
|
||||
fetchurl {
|
||||
name = "nixpkgs-version";
|
||||
urls = [
|
||||
"https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/does-not-exist"
|
||||
"https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/.version"
|
||||
];
|
||||
hash = "sha256-BZqI7r0MNP29yGH5+yW2tjU9OOpOCEvwWKrWCv5CQ0I=";
|
||||
}
|
||||
```
|
||||
|
||||
After building the package, the result will have the name we specified:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(output removed for clarity)
|
||||
/nix/store/zczb6wl3al6jm9sm5h3pr6nqn0i5ji9z-nixpkgs-version
|
||||
```
|
||||
:::
|
||||
|
||||
:::{.example #ex-fetchers-fetchurl-nixpkgs-version-postfetch}
|
||||
# Manipulating the content downloaded by `fetchurl`
|
||||
|
||||
It might be useful to manipulate the content downloaded by `fetchurl` directly in its derivation.
|
||||
In this example, we'll adapt [](#ex-fetchers-fetchurl-nixpkgs-version) to append the result of running the `hello` package to the contents we download, purely to illustrate how to manipulate the content.
|
||||
|
||||
```nix
|
||||
{ fetchurl, hello, lib }:
|
||||
fetchurl {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/23.11/.version";
|
||||
|
||||
nativeBuildInputs = [ hello ];
|
||||
|
||||
downloadToTemp = true;
|
||||
postFetch = ''
|
||||
${lib.getExe hello} >> $downloadedFile
|
||||
mv $downloadedFile $out
|
||||
'';
|
||||
|
||||
hash = "sha256-ceooQQYmDx5+0nfg40uU3NNI2yKrixP7HZ/xLZUNv+w=";
|
||||
}
|
||||
```
|
||||
|
||||
After building the package, the resulting file will have "Hello, world!" appended to it:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(output removed for clarity)
|
||||
/nix/store/ifi6pp7q0ag5h7c5v9h1c1c7bhd10c7f-version
|
||||
|
||||
$ cat /nix/store/ifi6pp7q0ag5h7c5v9h1c1c7bhd10c7f-version
|
||||
23.11
|
||||
Hello, world!
|
||||
```
|
||||
|
||||
Note that the `hash` specified in the package is different than the hash specified in [](#ex-fetchers-fetchurl-nixpkgs-version), because the contents of the output have changed (even though the actual file that was downloaded is the same).
|
||||
See [](#chap-pkgs-fetchers-caveats) for more details on how to work with the `hash` attribute when the output changes.
|
||||
:::
|
||||
|
||||
## `fetchzip` {#sec-pkgs-fetchers-fetchzip}
|
||||
|
||||
Returns a [fixed-output derivation](https://nixos.org/manual/nix/stable/glossary.html#gloss-fixed-output-derivation) which downloads an archive from a given URL and decompresses it.
|
||||
|
||||
Despite its name, `fetchzip` is not limited to `.zip` files but can also be used with [various compressed tarball formats](#tar-files) by default.
|
||||
This can extended by specifying additional attributes, see [](#ex-fetchers-fetchzip-rar-archive) to understand how to do that.
|
||||
|
||||
### Inputs {#sec-pkgs-fetchers-fetchzip-inputs}
|
||||
|
||||
`fetchzip` requires an attribute set, and most attributes are passed to the underlying call to [`fetchurl`](#sec-pkgs-fetchers-fetchurl).
|
||||
|
||||
The attributes below are treated differently by `fetchzip` when compared to what `fetchurl` expects:
|
||||
|
||||
`name` (String; _optional_)
|
||||
: Works as defined in `fetchurl`, but has a different default value than `fetchurl`.
|
||||
|
||||
_Default value:_ `"source"`.
|
||||
|
||||
`nativeBuildInputs` (List of Attribute Set; _optional_)
|
||||
: Works as defined in `fetchurl`, but it is also augmented by `fetchzip` to include packages to deal with additional archives (such as `.zip`).
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
`postFetch` (String; _optional_)
|
||||
: Works as defined in `fetchurl`, but it is also augmented with the code needed to make `fetchzip` work.
|
||||
|
||||
:::{.caution}
|
||||
It is only safe to modify files in `$out` in `postFetch`.
|
||||
Consult the implementation of `fetchzip` for anything more involved.
|
||||
:::
|
||||
|
||||
_Default value:_ `""`.
|
||||
|
||||
`stripRoot` (Boolean; _optional_)
|
||||
: If `true`, the decompressed contents are moved one level up the directory tree.
|
||||
|
||||
This is useful for archives that decompress into a single directory which commonly includes some values that change with time, such as version numbers.
|
||||
When this is the case (and `stripRoot` is `true`), `fetchzip` will remove this directory and make the decompressed contents available in the top-level directory.
|
||||
|
||||
[](#ex-fetchers-fetchzip-simple-striproot) shows what this attribute does.
|
||||
|
||||
This attribute is **not** passed through to `fetchurl`.
|
||||
|
||||
_Default value:_ `true`.
|
||||
|
||||
`extension` (String or Null; _optional_)
|
||||
: If set, the archive downloaded by `fetchzip` will be renamed to a filename with the extension specified in this attribute.
|
||||
|
||||
This is useful when making `fetchzip` support additional types of archives, because the implementation may use the extension of an archive to determine whether they can decompress it.
|
||||
If the URL you're using to download the contents doesn't end with the extension associated with the archive, use this attribute to fix the filename of the archive.
|
||||
|
||||
This attribute is **not** passed through to `fetchurl`.
|
||||
|
||||
_Default value:_ `null`.
|
||||
|
||||
`recursiveHash` (Boolean; _optional_)
|
||||
: Works [as defined in `fetchurl`](#sec-pkgs-fetchers-fetchurl-inputs-recursiveHash), but its default value is different than for `fetchurl`.
|
||||
|
||||
_Default value:_ `true`.
|
||||
|
||||
`downloadToTemp` (Boolean; _optional_)
|
||||
: Works [as defined in `fetchurl`](#sec-pkgs-fetchers-fetchurl-inputs-downloadToTemp), but its default value is different than for `fetchurl`.
|
||||
|
||||
_Default value:_ `true`.
|
||||
|
||||
`extraPostFetch` **DEPRECATED**
|
||||
: This attribute is deprecated.
|
||||
Please use `postFetch` instead.
|
||||
|
||||
This attribute is **not** passed through to `fetchurl`.
|
||||
|
||||
### Examples {#sec-pkgs-fetchers-fetchzip-examples}
|
||||
|
||||
::::{.example #ex-fetchers-fetchzip-simple-striproot}
|
||||
# Using `fetchzip` to output contents directly
|
||||
|
||||
The following recipe shows how to use `fetchzip` to decompress a `.tar.gz` archive:
|
||||
|
||||
```nix
|
||||
{ fetchzip }:
|
||||
fetchzip {
|
||||
url = "https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0.tar.gz";
|
||||
hash = "sha256-3ABYlME9R8klcpJ7MQpyFEFwHmxDDEzIYBqu/CpDYmg=";
|
||||
}
|
||||
```
|
||||
|
||||
This archive has all its contents in a directory named `patchelf-0.18.0`.
|
||||
This means that after decompressing, you'd have to enter this directory to see the contents of the archive.
|
||||
However, `fetchzip` makes this easier through the attribute `stripRoot` (enabled by default).
|
||||
|
||||
After building the recipe, the derivation output will show all the files in the archive at the top level:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(output removed for clarity)
|
||||
/nix/store/1b7h3fvmgrcddvs0m299hnqxlgli1yjw-source
|
||||
|
||||
$ ls /nix/store/1b7h3fvmgrcddvs0m299hnqxlgli1yjw-source
|
||||
aclocal.m4 completions configure.ac m4 Makefile.in patchelf.spec README.md tests
|
||||
build-aux configure COPYING Makefile.am patchelf.1 patchelf.spec.in src version
|
||||
```
|
||||
|
||||
If `stripRoot` is set to `false`, the derivation output will be the decompressed archive as-is:
|
||||
|
||||
```nix
|
||||
{ fetchzip }:
|
||||
fetchzip {
|
||||
url = "https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0.tar.gz";
|
||||
hash = "sha256-uv3FuKE4DqpHT3yfE0qcnq0gYjDNQNKZEZt2+PUAneg=";
|
||||
stripRoot = false;
|
||||
}
|
||||
```
|
||||
|
||||
:::{.caution}
|
||||
The hash changed!
|
||||
Whenever changing attributes of a Nixpkgs fetcher, [remember to invalidate the hash](#chap-pkgs-fetchers-caveats), otherwise you won't get the results you're expecting!
|
||||
:::
|
||||
|
||||
After building the recipe:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(output removed for clarity)
|
||||
/nix/store/2hy5bxw7xgbgxkn0i4x6hjr8w3dbx16c-source
|
||||
|
||||
$ ls /nix/store/2hy5bxw7xgbgxkn0i4x6hjr8w3dbx16c-source
|
||||
patchelf-0.18.0
|
||||
```
|
||||
::::
|
||||
|
||||
::::{.example #ex-fetchers-fetchzip-rar-archive}
|
||||
# Using `fetchzip` to decompress a `.rar` file
|
||||
|
||||
The `unrar` package provides a [setup hook](#ssec-setup-hooks) to decompress `.rar` archives during the [unpack phase](#ssec-unpack-phase), which can be used with `fetchzip` to decompress those archives:
|
||||
|
||||
```nix
|
||||
{ fetchzip, unrar }:
|
||||
fetchzip {
|
||||
url = "https://archive.org/download/SpaceCadet_Plus95/Space_Cadet.rar";
|
||||
hash = "sha256-fC+zsR8BY6vXpUkVd6i1jF0IZZxVKVvNi6VWCKT+pA4=";
|
||||
stripRoot = false;
|
||||
nativeBuildInputs = [ unrar ];
|
||||
}
|
||||
```
|
||||
|
||||
Since this particular `.rar` file doesn't put its contents in a directory inside the archive, `stripRoot` must be set to `false`.
|
||||
|
||||
After building the recipe, the derivation output will show the decompressed files:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(output removed for clarity)
|
||||
/nix/store/zpn7knxfva6rfjja2gbb4p3l9w1f0d36-source
|
||||
|
||||
$ ls /nix/store/zpn7knxfva6rfjja2gbb4p3l9w1f0d36-source
|
||||
FONT.DAT PINBALL.DAT PINBALL.EXE PINBALL2.MID TABLE.BMP WMCONFIG.EXE
|
||||
MSCREATE.DIR PINBALL.DOC PINBALL.MID Sounds WAVEMIX.INF
|
||||
```
|
||||
::::
|
||||
|
||||
## `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.
|
||||
- `decode`: Pipe the downloaded data through this command before processing it as a 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 `hash` argument is changed as well.
|
||||
|
||||
|
||||
Most other fetchers return a directory rather than a single file.
|
||||
|
||||
|
||||
## `fetchDebianPatch` {#fetchdebianpatch}
|
||||
|
||||
A wrapper around `fetchpatch`, which takes:
|
||||
- `patch` and `hash`: the patch's filename,
|
||||
and its hash after normalization by `fetchpatch` ;
|
||||
- `pname`: the Debian source package's name ;
|
||||
- `version`: the upstream version number ;
|
||||
- `debianRevision`: the [Debian revision number] if applicable ;
|
||||
- the `area` of the Debian archive: `main` (default), `contrib`, or `non-free`.
|
||||
|
||||
Here is an example of `fetchDebianPatch` in action:
|
||||
|
||||
```nix
|
||||
{ lib
|
||||
, fetchDebianPatch
|
||||
, buildPythonPackage
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pysimplesoap";
|
||||
version = "1.16.2";
|
||||
src = <...>;
|
||||
|
||||
patches = [
|
||||
(fetchDebianPatch {
|
||||
inherit pname version;
|
||||
debianRevision = "5";
|
||||
name = "Add-quotes-to-SOAPAction-header-in-SoapClient.patch";
|
||||
hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0=";
|
||||
})
|
||||
];
|
||||
|
||||
# ...
|
||||
}
|
||||
```
|
||||
|
||||
Patches are fetched from `sources.debian.org`, and so must come from a
|
||||
package version that was uploaded to the Debian archive. Packages may
|
||||
be removed from there once that specific version isn't in any suite
|
||||
anymore (stable, testing, unstable, etc.), so maintainers should use
|
||||
`copy-tarballs.pl` to archive the patch if it needs to be available
|
||||
longer-term.
|
||||
|
||||
[Debian revision number]: https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
|
||||
|
||||
|
||||
## `fetchsvn` {#fetchsvn}
|
||||
|
||||
Used with Subversion. Expects `url` to a Subversion directory, `rev`, and `hash`.
|
||||
|
||||
## `fetchgit` {#fetchgit}
|
||||
|
||||
Used with Git. Expects `url` to a Git repo, `rev`, and `hash`. `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.
|
||||
|
||||
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 }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "hello";
|
||||
src = fetchgit {
|
||||
url = "https://...";
|
||||
sparseCheckout = [
|
||||
"directory/to/be/included"
|
||||
"another/directory"
|
||||
];
|
||||
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## `fetchfossil` {#fetchfossil}
|
||||
|
||||
Used with Fossil. Expects `url` to a Fossil archive, `rev`, and `hash`.
|
||||
|
||||
## `fetchcvs` {#fetchcvs}
|
||||
|
||||
Used with CVS. Expects `cvsRoot`, `tag`, and `hash`.
|
||||
|
||||
## `fetchhg` {#fetchhg}
|
||||
|
||||
Used with Mercurial. Expects `url`, `rev`, and `hash`.
|
||||
|
||||
A number of fetcher functions wrap part of `fetchurl` and `fetchzip`. They are mainly convenience functions intended for commonly used destinations of source code in Nixpkgs. These wrapper fetchers are listed below.
|
||||
|
||||
## `fetchFromGitea` {#fetchfromgitea}
|
||||
|
||||
`fetchFromGitea` expects five arguments. `domain` is the gitea server name. `owner` is a string corresponding to the Gitea user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every Gitea HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. Finally, `hash` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available but `hash` is currently preferred.
|
||||
|
||||
## `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, `hash` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available, but `hash` is currently preferred.
|
||||
|
||||
To use a different GitHub instance, use `githubBase` (defaults to `"github.com"`).
|
||||
|
||||
`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. It behaves similarly to `fetchFromGitHub`, and expects `owner`, `repo`, `rev`, and `hash`.
|
||||
|
||||
To use a specific GitLab instance, use `domain` (defaults to `"gitlab.com"`).
|
||||
|
||||
|
||||
## `fetchFromGitiles` {#fetchfromgitiles}
|
||||
|
||||
This is used with Gitiles repositories. The arguments expected are similar to `fetchgit`.
|
||||
|
||||
## `fetchFromBitbucket` {#fetchfrombitbucket}
|
||||
|
||||
This is used with BitBucket repositories. The arguments expected are very similar to `fetchFromGitHub` above.
|
||||
|
||||
## `fetchFromSavannah` {#fetchfromsavannah}
|
||||
|
||||
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.
|
||||
|
||||
## `fetchFromSourcehut` {#fetchfromsourcehut}
|
||||
|
||||
This is used with sourcehut repositories. Similar to `fetchFromGitHub` above,
|
||||
it expects `owner`, `repo`, `rev` and `hash`, but don't forget the tilde (~)
|
||||
in front of the username! Expected arguments also include `vc` ("git" (default)
|
||||
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`.
|
||||
|
||||
## `requireFile` {#requirefile}
|
||||
|
||||
`requireFile` allows requesting files that cannot be fetched automatically, but whose content is known.
|
||||
This is a useful last-resort workaround for license restrictions that prohibit redistribution, or for downloads that are only accessible after authenticating interactively in a browser.
|
||||
If the requested file is present in the Nix store, the resulting derivation will not be built, because its expected output is already available.
|
||||
Otherwise, the builder will run, but fail with a message explaining to the user how to provide the file. The following code, for example:
|
||||
|
||||
```nix
|
||||
requireFile {
|
||||
name = "jdk-${version}_linux-x64_bin.tar.gz";
|
||||
url = "https://www.oracle.com/java/technologies/javase-jdk11-downloads.html";
|
||||
hash = "sha256-lL00+F7jjT71nlKJ7HRQuUQ7kkxVYlZh//5msD8sjeI=";
|
||||
}
|
||||
```
|
||||
results in this error message:
|
||||
```
|
||||
***
|
||||
Unfortunately, we cannot download file jdk-11.0.10_linux-x64_bin.tar.gz automatically.
|
||||
Please go to https://www.oracle.com/java/technologies/javase-jdk11-downloads.html to download it yourself, and add it to the Nix store
|
||||
using either
|
||||
nix-store --add-fixed sha256 jdk-11.0.10_linux-x64_bin.tar.gz
|
||||
or
|
||||
nix-prefetch-url --type sha256 file:///path/to/jdk-11.0.10_linux-x64_bin.tar.gz
|
||||
|
||||
***
|
||||
```
|
||||
|
||||
This function should only be used by non-redistributable software with an unfree license that we need to require the user to download manually.
|
||||
It produces packages that cannot be built automatically.
|
||||
|
||||
## `fetchtorrent` {#fetchtorrent}
|
||||
|
||||
`fetchtorrent` expects two arguments. `url` which can either be a Magnet URI (Magnet Link) such as `magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c` or an HTTP URL pointing to a `.torrent` file. It can also take a `config` argument which will craft a `settings.json` configuration file and give it to `transmission`, the underlying program that is performing the fetch. The available config options for `transmission` can be found [here](https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md#options)
|
||||
|
||||
```nix
|
||||
{ fetchtorrent }:
|
||||
|
||||
fetchtorrent {
|
||||
config = { peer-limit-global = 100; };
|
||||
url = "magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c";
|
||||
hash = "";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters {#fetchtorrent-parameters}
|
||||
|
||||
- `url`: Magnet URI (Magnet Link) such as `magnet:?xt=urn:btih:dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c` or an HTTP URL pointing to a `.torrent` file.
|
||||
|
||||
- `backend`: Which bittorrent program to use. Default: `"transmission"`. Valid values are `"rqbit"` or `"transmission"`. These are the two most suitable torrent clients for fetching in a fixed-output derivation at the time of writing, as they can be easily exited after usage. `rqbit` is written in Rust and has a smaller closure size than `transmission`, and the performance and peer discovery properties differs between these clients, requiring experimentation to decide upon which is the best.
|
||||
|
||||
- `config`: When using `transmission` as the `backend`, a json configuration can
|
||||
be supplied to transmission. Refer to the [upstream documentation](https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md) for information on how to configure.
|
||||
|
12
third_party/nixpkgs/doc/build-helpers/images.md
vendored
Normal file
12
third_party/nixpkgs/doc/build-helpers/images.md
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Images {#chap-images}
|
||||
|
||||
This chapter describes tools for creating various types of images.
|
||||
|
||||
```{=include=} sections
|
||||
images/appimagetools.section.md
|
||||
images/dockertools.section.md
|
||||
images/ocitools.section.md
|
||||
images/portableservice.section.md
|
||||
images/makediskimage.section.md
|
||||
images/binarycache.section.md
|
||||
```
|
167
third_party/nixpkgs/doc/build-helpers/images/appimagetools.section.md
vendored
Normal file
167
third_party/nixpkgs/doc/build-helpers/images/appimagetools.section.md
vendored
Normal file
|
@ -0,0 +1,167 @@
|
|||
# pkgs.appimageTools {#sec-pkgs-appimageTools}
|
||||
|
||||
`pkgs.appimageTools` is a set of functions for extracting and wrapping [AppImage](https://appimage.org/) files.
|
||||
They are meant to be used if traditional packaging from source is infeasible, or if it would take too long.
|
||||
To quickly run an AppImage file, `pkgs.appimage-run` can be used as well.
|
||||
|
||||
::: {.warning}
|
||||
The `appimageTools` API is unstable and may be subject to backwards-incompatible changes in the future.
|
||||
:::
|
||||
|
||||
## Wrapping {#ssec-pkgs-appimageTools-wrapping}
|
||||
|
||||
Use `wrapType2` to wrap any AppImage.
|
||||
This will create a FHS environment with many packages [expected to exist](https://github.com/AppImage/pkg2appimage/blob/master/excludelist) for the AppImage to work.
|
||||
`wrapType2` expects an argument with the `src` attribute, and either a `name` attribute or `pname` and `version` attributes.
|
||||
|
||||
It will eventually call into [`buildFHSEnv`](#sec-fhs-environments), and any extra attributes in the argument to `wrapType2` will be passed through to it.
|
||||
This means that you can pass the `extraInstallCommands` attribute, for example, and it will have the same effect as described in [`buildFHSEnv`](#sec-fhs-environments).
|
||||
|
||||
::: {.note}
|
||||
In the past, `appimageTools` provided both `wrapType1` and `wrapType2`, to be used depending on the type of AppImage that was being wrapped.
|
||||
However, [those were unified early 2020](https://github.com/NixOS/nixpkgs/pull/81833), meaning that both `wrapType1` and `wrapType2` have the same behaviour now.
|
||||
:::
|
||||
|
||||
:::{.example #ex-wrapping-appimage-from-github}
|
||||
|
||||
# Wrapping an AppImage from GitHub
|
||||
|
||||
```nix
|
||||
{ appimageTools, fetchurl }:
|
||||
let
|
||||
pname = "nuclear";
|
||||
version = "0.6.30";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/nukeop/nuclear/releases/download/v${version}/${pname}-v${version}.AppImage";
|
||||
hash = "sha256-he1uGC1M/nFcKpMM9JKY4oeexJcnzV0ZRxhTjtJz6xw=";
|
||||
};
|
||||
in
|
||||
appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
The argument passed to `wrapType2` can also contain an `extraPkgs` attribute, which allows you to include additional packages inside the FHS environment your AppImage is going to run in.
|
||||
`extraPkgs` must be a function that returns a list of packages.
|
||||
There are a few ways to learn which dependencies an application needs:
|
||||
|
||||
- Looking through the extracted AppImage files, reading its scripts and running `patchelf` and `ldd` on its executables.
|
||||
This can also be done in `appimage-run`, by setting `APPIMAGE_DEBUG_EXEC=bash`.
|
||||
- Running `strace -vfefile` on the wrapped executable, looking for libraries that can't be found.
|
||||
|
||||
:::{.example #ex-wrapping-appimage-with-extrapkgs}
|
||||
|
||||
# Wrapping an AppImage with extra packages
|
||||
|
||||
```nix
|
||||
{ appimageTools, fetchurl }:
|
||||
let
|
||||
pname = "irccloud";
|
||||
version = "0.16.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/irccloud/irccloud-desktop/releases/download/v${version}/IRCCloud-${version}-linux-x86_64.AppImage";
|
||||
hash = "sha256-/hMPvYdnVB1XjKgU2v47HnVvW4+uC3rhRjbucqin4iI=";
|
||||
};
|
||||
in appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
extraPkgs = pkgs: [ pkgs.at-spi2-core ];
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## Extracting {#ssec-pkgs-appimageTools-extracting}
|
||||
|
||||
Use `extract` if you need to extract the contents of an AppImage.
|
||||
This is usually used in Nixpkgs to install extra files in addition to [wrapping](#ssec-pkgs-appimageTools-wrapping) the AppImage.
|
||||
`extract` expects an argument with the `src` attribute, and either a `name` attribute or `pname` and `version` attributes.
|
||||
|
||||
::: {.note}
|
||||
In the past, `appimageTools` provided both `extractType1` and `extractType2`, to be used depending on the type of AppImage that was being extracted.
|
||||
However, [those were unified early 2020](https://github.com/NixOS/nixpkgs/pull/81572), meaning that both `extractType1` and `extractType2` have the same behaviour as `extract` now.
|
||||
:::
|
||||
|
||||
:::{.example #ex-extracting-appimage}
|
||||
|
||||
# Extracting an AppImage to install extra files
|
||||
|
||||
This example was adapted from a real package in Nixpkgs to show how `extract` is usually used in combination with `wrapType2`.
|
||||
Note how `appimageContents` is used in `extraInstallCommands` to install additional files that were extracted from the AppImage.
|
||||
|
||||
```nix
|
||||
{ appimageTools, fetchurl }:
|
||||
let
|
||||
pname = "irccloud";
|
||||
version = "0.16.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/irccloud/irccloud-desktop/releases/download/v${version}/IRCCloud-${version}-linux-x86_64.AppImage";
|
||||
hash = "sha256-/hMPvYdnVB1XjKgU2v47HnVvW4+uC3rhRjbucqin4iI=";
|
||||
};
|
||||
|
||||
appimageContents = appimageTools.extract {
|
||||
inherit pname version src;
|
||||
};
|
||||
in appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
|
||||
extraPkgs = pkgs: [ pkgs.at-spi2-core ];
|
||||
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/${pname}-${version} $out/bin/${pname}
|
||||
install -m 444 -D ${appimageContents}/irccloud.desktop $out/share/applications/irccloud.desktop
|
||||
install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/512x512/apps/irccloud.png \
|
||||
$out/share/icons/hicolor/512x512/apps/irccloud.png
|
||||
substituteInPlace $out/share/applications/irccloud.desktop \
|
||||
--replace-fail 'Exec=AppRun' 'Exec=${pname}'
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
The argument passed to `extract` can also contain a `postExtract` attribute, which allows you to execute additional commands after the files are extracted from the AppImage.
|
||||
`postExtract` must be a string with commands to run.
|
||||
|
||||
:::{.example #ex-extracting-appimage-with-postextract}
|
||||
|
||||
# Extracting an AppImage to install extra files, using `postExtract`
|
||||
|
||||
This is a rewrite of [](#ex-extracting-appimage) to use `postExtract`.
|
||||
|
||||
```nix
|
||||
{ appimageTools, fetchurl }:
|
||||
let
|
||||
pname = "irccloud";
|
||||
version = "0.16.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/irccloud/irccloud-desktop/releases/download/v${version}/IRCCloud-${version}-linux-x86_64.AppImage";
|
||||
hash = "sha256-/hMPvYdnVB1XjKgU2v47HnVvW4+uC3rhRjbucqin4iI=";
|
||||
};
|
||||
|
||||
appimageContents = appimageTools.extract {
|
||||
inherit pname version src;
|
||||
postExtract = ''
|
||||
substituteInPlace $out/irccloud.desktop --replace-fail 'Exec=AppRun' 'Exec=${pname}'
|
||||
'';
|
||||
};
|
||||
in appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
|
||||
extraPkgs = pkgs: [ pkgs.at-spi2-core ];
|
||||
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/${pname}-${version} $out/bin/${pname}
|
||||
install -m 444 -D ${appimageContents}/irccloud.desktop $out/share/applications/irccloud.desktop
|
||||
install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/512x512/apps/irccloud.png \
|
||||
$out/share/icons/hicolor/512x512/apps/irccloud.png
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
58
third_party/nixpkgs/doc/build-helpers/images/binarycache.section.md
vendored
Normal file
58
third_party/nixpkgs/doc/build-helpers/images/binarycache.section.md
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
# pkgs.mkBinaryCache {#sec-pkgs-binary-cache}
|
||||
|
||||
`pkgs.mkBinaryCache` is a function for creating Nix flat-file binary caches.
|
||||
Such a cache exists as a directory on disk, and can be used as a Nix substituter by passing `--substituter file:///path/to/cache` to Nix commands.
|
||||
|
||||
Nix packages are most commonly shared between machines using [HTTP, SSH, or S3](https://nixos.org/manual/nix/stable/package-management/sharing-packages.html), but a flat-file binary cache can still be useful in some situations.
|
||||
For example, you can copy it directly to another machine, or make it available on a network file system.
|
||||
It can also be a convenient way to make some Nix packages available inside a container via bind-mounting.
|
||||
|
||||
`mkBinaryCache` expects an argument with the `rootPaths` attribute.
|
||||
`rootPaths` must be a list of derivations.
|
||||
The transitive closure of these derivations' outputs will be copied into the cache.
|
||||
|
||||
::: {.note}
|
||||
This function is meant for advanced use cases.
|
||||
The more idiomatic way to work with flat-file binary caches is via the [nix-copy-closure](https://nixos.org/manual/nix/stable/command-ref/nix-copy-closure.html) command.
|
||||
You may also want to consider [dockerTools](#sec-pkgs-dockerTools) for your containerization needs.
|
||||
:::
|
||||
|
||||
[]{#sec-pkgs-binary-cache-example}
|
||||
:::{.example #ex-mkbinarycache-copying-package-closure}
|
||||
|
||||
# Copying a package and its closure to another machine with `mkBinaryCache`
|
||||
|
||||
The following derivation will construct a flat-file binary cache containing the closure of `hello`.
|
||||
|
||||
```nix
|
||||
{ mkBinaryCache, hello }:
|
||||
mkBinaryCache {
|
||||
rootPaths = [hello];
|
||||
}
|
||||
```
|
||||
|
||||
Build the cache on a machine.
|
||||
Note that the command still builds the exact nix package above, but adds some boilerplate to build it directly from an expression.
|
||||
|
||||
```shellSession
|
||||
$ nix-build -E 'let pkgs = import <nixpkgs> {}; in pkgs.callPackage ({ mkBinaryCache, hello }: mkBinaryCache { rootPaths = [hello]; }) {}'
|
||||
/nix/store/azf7xay5xxdnia4h9fyjiv59wsjdxl0g-binary-cache
|
||||
```
|
||||
|
||||
Copy the resulting directory to another machine, which we'll call `host2`:
|
||||
|
||||
```shellSession
|
||||
$ scp result host2:/tmp/hello-cache
|
||||
```
|
||||
|
||||
At this point, the cache can be used as a substituter when building derivations on `host2`:
|
||||
|
||||
```shellSession
|
||||
$ nix-build -A hello '<nixpkgs>' \
|
||||
--option require-sigs false \
|
||||
--option trusted-substituters file:///tmp/hello-cache \
|
||||
--option substituters file:///tmp/hello-cache
|
||||
/nix/store/zhl06z4lrfrkw5rp0hnjjfrgsclzvxpm-hello-2.12.1
|
||||
```
|
||||
|
||||
:::
|
1630
third_party/nixpkgs/doc/build-helpers/images/dockertools.section.md
vendored
Normal file
1630
third_party/nixpkgs/doc/build-helpers/images/dockertools.section.md
vendored
Normal file
File diff suppressed because it is too large
Load diff
106
third_party/nixpkgs/doc/build-helpers/images/makediskimage.section.md
vendored
Normal file
106
third_party/nixpkgs/doc/build-helpers/images/makediskimage.section.md
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
# `<nixpkgs/nixos/lib/make-disk-image.nix>` {#sec-make-disk-image}
|
||||
|
||||
`<nixpkgs/nixos/lib/make-disk-image.nix>` is a function to create _disk images_ in multiple formats: raw, QCOW2 (QEMU), QCOW2-Compressed (compressed version), VDI (VirtualBox), VPC (VirtualPC).
|
||||
|
||||
This function can create images in two ways:
|
||||
|
||||
- using `cptofs` without any virtual machine to create a Nix store disk image,
|
||||
- using a virtual machine to create a full NixOS installation.
|
||||
|
||||
When testing early-boot or lifecycle parts of NixOS such as a bootloader or multiple generations, it is necessary to opt for a full NixOS system installation.
|
||||
Whereas for many web servers, applications, it is possible to work with a Nix store only disk image and is faster to build.
|
||||
|
||||
NixOS tests also use this function when preparing the VM. The `cptofs` method is used when `virtualisation.useBootLoader` is false (the default). Otherwise the second method is used.
|
||||
|
||||
## Features {#sec-make-disk-image-features}
|
||||
|
||||
For reference, read the function signature source code for documentation on arguments: <https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/make-disk-image.nix>.
|
||||
Features are separated in various sections depending on if you opt for a Nix-store only image or a full NixOS image.
|
||||
|
||||
### Common {#sec-make-disk-image-features-common}
|
||||
|
||||
- arbitrary NixOS configuration
|
||||
- automatic or bound disk size: `diskSize` parameter, `additionalSpace` can be set when `diskSize` is `auto` to add a constant of disk space
|
||||
- multiple partition table layouts: EFI, legacy, legacy + GPT, hybrid, none through `partitionTableType` parameter
|
||||
- OVMF or EFI firmwares and variables templates can be customized
|
||||
- root filesystem `fsType` can be customized to whatever `mkfs.${fsType}` exist during operations
|
||||
- root filesystem label can be customized, defaults to `nix-store` if it's a Nix store image, otherwise `nixpkgs/nixos`
|
||||
- arbitrary code can be executed after disk image was produced with `postVM`
|
||||
- the current nixpkgs can be realized as a channel in the disk image, which will change the hash of the image when the sources are updated
|
||||
- additional store paths can be provided through `additionalPaths`
|
||||
|
||||
### Full NixOS image {#sec-make-disk-image-features-full-image}
|
||||
|
||||
- arbitrary contents with permissions can be placed in the target filesystem using `contents`
|
||||
- a `/etc/nixpkgs/nixos/configuration.nix` can be provided through `configFile`
|
||||
- bootloaders are supported
|
||||
- EFI variables can be mutated during image production and the result is exposed in `$out`
|
||||
- boot partition size when partition table is `efi` or `hybrid`
|
||||
|
||||
### On bit-to-bit reproducibility {#sec-make-disk-image-features-reproducibility}
|
||||
|
||||
Images are **NOT** deterministic, please do not hesitate to try to fix this, source of determinisms are (not exhaustive) :
|
||||
|
||||
- bootloader installation have timestamps
|
||||
- SQLite Nix store database contain registration times
|
||||
- `/etc/shadow` is in a non-deterministic order
|
||||
|
||||
A `deterministic` flag is available for best efforts determinism.
|
||||
|
||||
## Usage {#sec-make-disk-image-usage}
|
||||
|
||||
To produce a Nix-store only image:
|
||||
```nix
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
lib = pkgs.lib;
|
||||
make-disk-image = import <nixpkgs/nixos/lib/make-disk-image.nix>;
|
||||
in
|
||||
make-disk-image {
|
||||
inherit pkgs lib;
|
||||
config = {};
|
||||
additionalPaths = [ ];
|
||||
format = "qcow2";
|
||||
onlyNixStore = true;
|
||||
partitionTableType = "none";
|
||||
installBootLoader = false;
|
||||
touchEFIVars = false;
|
||||
diskSize = "auto";
|
||||
additionalSpace = "0M"; # Defaults to 512M.
|
||||
copyChannel = false;
|
||||
}
|
||||
```
|
||||
|
||||
Some arguments can be left out, they are shown explicitly for the sake of the example.
|
||||
|
||||
Building this derivation will provide a QCOW2 disk image containing only the Nix store and its registration information.
|
||||
|
||||
To produce a NixOS installation image disk with UEFI and bootloader installed:
|
||||
```nix
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
lib = pkgs.lib;
|
||||
make-disk-image = import <nixpkgs/nixos/lib/make-disk-image.nix>;
|
||||
evalConfig = import <nixpkgs/nixos/lib/eval-config.nix>;
|
||||
in
|
||||
make-disk-image {
|
||||
inherit pkgs lib;
|
||||
inherit (evalConfig {
|
||||
modules = [
|
||||
{
|
||||
fileSystems."/" = { device = "/dev/vda"; fsType = "ext4"; autoFormat = true; };
|
||||
boot.grub.device = "/dev/vda";
|
||||
}
|
||||
];
|
||||
}) config;
|
||||
format = "qcow2";
|
||||
onlyNixStore = false;
|
||||
partitionTableType = "legacy+gpt";
|
||||
installBootLoader = true;
|
||||
touchEFIVars = true;
|
||||
diskSize = "auto";
|
||||
additionalSpace = "0M"; # Defaults to 512M.
|
||||
copyChannel = false;
|
||||
memSize = 2048; # Qemu VM memory size in megabytes. Defaults to 1024M.
|
||||
}
|
||||
```
|
104
third_party/nixpkgs/doc/build-helpers/images/ocitools.section.md
vendored
Normal file
104
third_party/nixpkgs/doc/build-helpers/images/ocitools.section.md
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
# pkgs.ociTools {#sec-pkgs-ociTools}
|
||||
|
||||
`pkgs.ociTools` is a set of functions for creating runtime container bundles according to the [OCI runtime specification v1.0.0](https://github.com/opencontainers/runtime-spec/blob/v1.0.0/spec.md).
|
||||
It makes no assumptions about the container runner you choose to use to run the created container.
|
||||
|
||||
The set of functions in `pkgs.ociTools` currently does not handle the [OCI image specification](https://github.com/opencontainers/image-spec).
|
||||
|
||||
At a high-level an OCI implementation would download an OCI Image then unpack that image into an OCI Runtime filesystem bundle.
|
||||
At this point the OCI Runtime Bundle would be run by an OCI Runtime.
|
||||
`pkgs.ociTools` provides utilities to create OCI Runtime bundles.
|
||||
|
||||
## buildContainer {#ssec-pkgs-ociTools-buildContainer}
|
||||
|
||||
This function creates an OCI runtime container (consisting of a `config.json` and a root filesystem directory) that runs a single command inside of it.
|
||||
The nix store of the container will contain all referenced dependencies of the given command.
|
||||
|
||||
This function has an assumption that the container will run on POSIX platforms, and sets configurations (such as the user running the process or certain mounts) according to this assumption.
|
||||
Because of this, a container built with `buildContainer` will not work on Windows or other non-POSIX platforms without modifications to the container configuration.
|
||||
These modifications aren't supported by `buildContainer`.
|
||||
|
||||
For `linux` platforms, `buildContainer` also configures the following namespaces (see {manpage}`unshare(1)`) to isolate the OCI container from the global namespace:
|
||||
PID, network, mount, IPC, and UTS.
|
||||
|
||||
Note that no user namespace is created, which means that you won't be able to run the container unless you are the `root` user.
|
||||
|
||||
### Inputs {#ssec-pkgs-ociTools-buildContainer-inputs}
|
||||
|
||||
`buildContainer` expects an argument with the following attributes:
|
||||
|
||||
`args` (List of String)
|
||||
|
||||
: Specifies a set of arguments to run inside the container.
|
||||
Any packages referenced by `args` will be made available inside the container.
|
||||
|
||||
`mounts` (Attribute Set; _optional_)
|
||||
|
||||
: Would specify additional mounts that the runtime must make available to the container.
|
||||
|
||||
:::{.warning}
|
||||
As explained in [issue #290879](https://github.com/NixOS/nixpkgs/issues/290879), this attribute is currently ignored.
|
||||
:::
|
||||
|
||||
:::{.note}
|
||||
`buildContainer` includes a minimal set of necessary filesystems to be mounted into the container, and this set can't be changed with the `mounts` attribute.
|
||||
:::
|
||||
|
||||
_Default value:_ `{}`.
|
||||
|
||||
`readonly` (Boolean; _optional_)
|
||||
|
||||
: If `true`, sets the container's root filesystem as read-only.
|
||||
|
||||
_Default value:_ `false`.
|
||||
|
||||
`os` **DEPRECATED**
|
||||
|
||||
: Specifies the operating system on which the container filesystem is based on.
|
||||
If specified, its value should follow the [OCI Image Configuration Specification](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
|
||||
According to the linked specification, all possible values for `$GOOS` in [the Go docs](https://go.dev/doc/install/source#environment) should be valid, but will commonly be one of `darwin` or `linux`.
|
||||
|
||||
_Default value:_ `"linux"`.
|
||||
|
||||
`arch` **DEPRECATED**
|
||||
|
||||
: Used to specify the architecture for which the binaries in the container filesystem have been compiled.
|
||||
If specified, its value should follow the [OCI Image Configuration Specification](https://github.com/opencontainers/image-spec/blob/main/config.md#properties).
|
||||
According to the linked specification, all possible values for `$GOARCH` in [the Go docs](https://go.dev/doc/install/source#environment) should be valid, but will commonly be one of `386`, `amd64`, `arm`, or `arm64`.
|
||||
|
||||
_Default value:_ `x86_64`.
|
||||
|
||||
### Examples {#ssec-pkgs-ociTools-buildContainer-examples}
|
||||
|
||||
::: {.example #ex-ociTools-buildContainer-bash}
|
||||
# Creating an OCI runtime container that runs `bash`
|
||||
|
||||
This example uses `ociTools.buildContainer` to create a simple container that runs `bash`.
|
||||
|
||||
```nix
|
||||
{ ociTools, lib, bash }:
|
||||
ociTools.buildContainer {
|
||||
args = [
|
||||
(lib.getExe bash)
|
||||
];
|
||||
|
||||
readonly = false;
|
||||
}
|
||||
```
|
||||
|
||||
As an example of how to run the container generated by this package, we'll use `runc` to start the container.
|
||||
Any other tool that supports OCI containers could be used instead.
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(some output removed for clarity)
|
||||
/nix/store/7f9hgx0arvhzp2a3qphp28rxbn748l25-join
|
||||
|
||||
$ cd /nix/store/7f9hgx0arvhzp2a3qphp28rxbn748l25-join
|
||||
$ nix-shell -p runc
|
||||
[nix-shell:/nix/store/7f9hgx0arvhzp2a3qphp28rxbn748l25-join]$ sudo runc run ocitools-example
|
||||
help
|
||||
GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu)
|
||||
(some output removed for clarity)
|
||||
```
|
||||
:::
|
174
third_party/nixpkgs/doc/build-helpers/images/portableservice.section.md
vendored
Normal file
174
third_party/nixpkgs/doc/build-helpers/images/portableservice.section.md
vendored
Normal file
|
@ -0,0 +1,174 @@
|
|||
# pkgs.portableService {#sec-pkgs-portableService}
|
||||
|
||||
`pkgs.portableService` is a function to create [Portable Services](https://systemd.io/PORTABLE_SERVICES/) in a read-only, immutable, `squashfs` raw disk image.
|
||||
This lets you use Nix to build images which can be run on many recent Linux distributions.
|
||||
|
||||
::: {.note}
|
||||
Portable services are supported starting with systemd 239 (released on 2018-06-22).
|
||||
:::
|
||||
|
||||
The generated image will contain the file system structure as required by the Portable Services specification, along with the packages given to `portableService` and all of their dependencies.
|
||||
When generated, the image will exist in the Nix store with the `.raw` file extension, as required by the specification.
|
||||
See [](#ex-portableService-hello) to understand how to use the output of `portableService`.
|
||||
|
||||
## Inputs {#ssec-pkgs-portableService-inputs}
|
||||
|
||||
`portableService` expects one argument with the following attributes:
|
||||
|
||||
`pname` (String)
|
||||
|
||||
: The name of the portable service.
|
||||
The generated image will be named according to the template `$pname_$version.raw`, which is supported by the Portable Services specification.
|
||||
|
||||
`version` (String)
|
||||
|
||||
: The version of the portable service.
|
||||
The generated image will be named according to the template `$pname_$version.raw`, which is supported by the Portable Services specification.
|
||||
|
||||
`units` (List of Attribute Set)
|
||||
|
||||
: A list of derivations for systemd unit files.
|
||||
Each derivation must produce a single file, and must have a name that starts with the value of `pname` and ends with the suffix of the unit type (e.g. ".service", ".socket", ".timer", and so on).
|
||||
See [](#ex-portableService-hello) to better understand this naming constraint.
|
||||
|
||||
`description` (String or Null; _optional_)
|
||||
|
||||
: If specified, the value is added as `PORTABLE_PRETTY_NAME` to the `/etc/os-release` file in the generated image.
|
||||
This could be used to provide more information to anyone inspecting the image.
|
||||
|
||||
_Default value:_ `null`.
|
||||
|
||||
`homepage` (String or Null; _optional_)
|
||||
|
||||
: If specified, the value is added as `HOME_URL` to the `/etc/os-release` file in the generated image.
|
||||
This could be used to provide more information to anyone inspecting the image.
|
||||
|
||||
_Default value:_ `null`.
|
||||
|
||||
`symlinks` (List of Attribute Set; _optional_)
|
||||
|
||||
: A list of attribute sets in the format `{object, symlink}`.
|
||||
For each item in the list, `portableService` will create a symlink in the path specified by `symlink` (relative to the root of the image) that points to `object`.
|
||||
|
||||
All packages that `object` depends on and their dependencies are automatically copied into the image.
|
||||
|
||||
This can be used to create symlinks for applications that assume some files to exist globally (`/etc/ssl` or `/bin/bash`, for example).
|
||||
See [](#ex-portableService-symlinks) to understand how to do that.
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
`contents` (List of Attribute Set; _optional_)
|
||||
|
||||
: A list of additional derivations to be included as-is in the image.
|
||||
These derivations will be included directly in a `/nix/store` directory inside the image.
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
`squashfsTools` (Attribute Set; _optional_)
|
||||
|
||||
: Allows you to override the package that provides {manpage}`mksquashfs(1)`, which is used internally by `portableService`.
|
||||
|
||||
_Default value:_ `pkgs.squashfsTools`.
|
||||
|
||||
`squash-compression` (String; _optional_)
|
||||
|
||||
: Passed as the compression option to {manpage}`mksquashfs(1)`, which is used internally by `portableService`.
|
||||
|
||||
_Default value:_ `"xz -Xdict-size 100%"`.
|
||||
|
||||
`squash-block-size` (String; _optional_)
|
||||
|
||||
: Passed as the block size option to {manpage}`mksquashfs(1)`, which is used internally by `portableService`.
|
||||
|
||||
_Default value:_ `"1M"`.
|
||||
|
||||
## Examples {#ssec-pkgs-portableService-examples}
|
||||
|
||||
[]{#ex-pkgs-portableService}
|
||||
:::{.example #ex-portableService-hello}
|
||||
# Building a Portable Service image
|
||||
|
||||
The following example builds a Portable Service image with the `hello` package, along with a service unit that runs it.
|
||||
|
||||
```nix
|
||||
{ lib, writeText, portableService, hello }:
|
||||
let
|
||||
hello-service = writeText "hello.service" ''
|
||||
[Unit]
|
||||
Description=Hello world service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=${lib.getExe hello}
|
||||
'';
|
||||
in
|
||||
portableService {
|
||||
pname = "hello";
|
||||
inherit (hello) version;
|
||||
units = [ hello-service ];
|
||||
}
|
||||
```
|
||||
|
||||
After building the package, the generated image can be loaded into a system through {manpage}`portablectl(1)`:
|
||||
|
||||
```shell
|
||||
$ nix-build
|
||||
(some output removed for clarity)
|
||||
/nix/store/8c20z1vh7z8w8dwagl8w87b45dn5k6iq-hello-img-2.12.1
|
||||
|
||||
$ portablectl attach /nix/store/8c20z1vh7z8w8dwagl8w87b45dn5k6iq-hello-img-2.12.1/hello_2.12.1.raw
|
||||
Created directory /etc/systemd/system.attached.
|
||||
Created directory /etc/systemd/system.attached/hello.service.d.
|
||||
Written /etc/systemd/system.attached/hello.service.d/20-portable.conf.
|
||||
Created symlink /etc/systemd/system.attached/hello.service.d/10-profile.conf → /usr/lib/systemd/portable/profile/default/service.conf.
|
||||
Copied /etc/systemd/system.attached/hello.service.
|
||||
Created symlink /etc/portables/hello_2.12.1.raw → /nix/store/8c20z1vh7z8w8dwagl8w87b45dn5k6iq-hello-img-2.12.1/hello_2.12.1.raw.
|
||||
|
||||
$ systemctl start hello
|
||||
$ journalctl -u hello
|
||||
Feb 28 22:39:16 hostname systemd[1]: Starting Hello world service...
|
||||
Feb 28 22:39:16 hostname hello[102887]: Hello, world!
|
||||
Feb 28 22:39:16 hostname systemd[1]: hello.service: Deactivated successfully.
|
||||
Feb 28 22:39:16 hostname systemd[1]: Finished Hello world service.
|
||||
|
||||
$ portablectl detach hello_2.12.1
|
||||
Removed /etc/systemd/system.attached/hello.service.
|
||||
Removed /etc/systemd/system.attached/hello.service.d/10-profile.conf.
|
||||
Removed /etc/systemd/system.attached/hello.service.d/20-portable.conf.
|
||||
Removed /etc/systemd/system.attached/hello.service.d.
|
||||
Removed /etc/portables/hello_2.12.1.raw.
|
||||
Removed /etc/systemd/system.attached.
|
||||
```
|
||||
:::
|
||||
|
||||
:::{.example #ex-portableService-symlinks}
|
||||
# Specifying symlinks when building a Portable Service image
|
||||
|
||||
Some services may expect files or directories to be available globally.
|
||||
An example is a service which expects all trusted SSL certificates to exist in a specific location by default.
|
||||
|
||||
To make things available globally, you must specify the `symlinks` attribute when using `portableService`.
|
||||
The following package builds on the package from [](#ex-portableService-hello) to make `/etc/ssl` available globally (this is only for illustrative purposes, because `hello` doesn't use `/etc/ssl`).
|
||||
|
||||
```nix
|
||||
{ lib, writeText, portableService, hello, cacert }:
|
||||
let
|
||||
hello-service = writeText "hello.service" ''
|
||||
[Unit]
|
||||
Description=Hello world service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=${lib.getExe hello}
|
||||
'';
|
||||
in
|
||||
portableService {
|
||||
pname = "hello";
|
||||
inherit (hello) version;
|
||||
units = [ hello-service ];
|
||||
symlinks = [
|
||||
{ object = "${cacert}/etc/ssl"; symlink = "/etc/ssl"; }
|
||||
];
|
||||
}
|
||||
```
|
||||
:::
|
12
third_party/nixpkgs/doc/build-helpers/special.md
vendored
Normal file
12
third_party/nixpkgs/doc/build-helpers/special.md
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Special build helpers {#chap-special}
|
||||
|
||||
This chapter describes several special build helpers.
|
||||
|
||||
```{=include=} sections
|
||||
special/fakenss.section.md
|
||||
special/fhs-environments.section.md
|
||||
special/makesetuphook.section.md
|
||||
special/mkshell.section.md
|
||||
special/vm-tools.section.md
|
||||
special/checkpoint-build.section.md
|
||||
```
|
43
third_party/nixpkgs/doc/build-helpers/special/checkpoint-build.section.md
vendored
Normal file
43
third_party/nixpkgs/doc/build-helpers/special/checkpoint-build.section.md
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
# pkgs.checkpointBuildTools {#sec-checkpoint-build}
|
||||
|
||||
`pkgs.checkpointBuildTools` provides a way to build derivations incrementally. It consists of two functions to make checkpoint builds using Nix possible.
|
||||
|
||||
For hermeticity, Nix derivations do not allow any state to be carried over between builds, making a transparent incremental build within a derivation impossible.
|
||||
|
||||
However, we can tell Nix explicitly what the previous build state was, by representing that previous state as a derivation output. This allows the passed build state to be used for an incremental build.
|
||||
|
||||
To change a normal derivation to a checkpoint based build, these steps must be taken:
|
||||
- apply `prepareCheckpointBuild` on the desired derivation, e.g.
|
||||
```nix
|
||||
{
|
||||
checkpointArtifacts = (pkgs.checkpointBuildTools.prepareCheckpointBuild pkgs.virtualbox);
|
||||
}
|
||||
```
|
||||
- change something you want in the sources of the package, e.g. use a source override:
|
||||
```nix
|
||||
{
|
||||
changedVBox = pkgs.virtualbox.overrideAttrs (old: {
|
||||
src = path/to/vbox/sources;
|
||||
});
|
||||
}
|
||||
```
|
||||
- use `mkCheckpointBuild changedVBox checkpointArtifacts`
|
||||
- enjoy shorter build times
|
||||
|
||||
## Example {#sec-checkpoint-build-example}
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
inherit (pkgs.checkpointBuildTools)
|
||||
prepareCheckpointBuild
|
||||
mkCheckpointBuild
|
||||
;
|
||||
helloCheckpoint = prepareCheckpointBuild pkgs.hello;
|
||||
changedHello = pkgs.hello.overrideAttrs (_: {
|
||||
doCheck = false;
|
||||
patchPhase = ''
|
||||
sed -i 's/Hello, world!/Hello, Nix!/g' src/hello.c
|
||||
'';
|
||||
});
|
||||
in mkCheckpointBuild changedHello helloCheckpoint
|
||||
```
|
77
third_party/nixpkgs/doc/build-helpers/special/fakenss.section.md
vendored
Normal file
77
third_party/nixpkgs/doc/build-helpers/special/fakenss.section.md
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
# fakeNss {#sec-fakeNss}
|
||||
|
||||
Provides `/etc/passwd` and `/etc/group` files that contain `root` and `nobody`, allowing user/group lookups to work in binaries that insist on doing those.
|
||||
This might be a better choice than a custom script running `useradd` and related utilities if you only need those files to exist with some entries.
|
||||
|
||||
`fakeNss` also provides `/etc/nsswitch.conf`, configuring NSS host resolution to first check `/etc/hosts` before checking DNS, since the default in the absence of a config file (`dns [!UNAVAIL=return] files`) is quite unexpected.
|
||||
|
||||
It also creates an empty directory at `/var/empty` because it uses that as the home directory for the `root` and `nobody` users.
|
||||
The `/var/empty` directory can also be used as a `chroot` target to prevent file access in processes that do not need to access files, if your container runs such processes.
|
||||
|
||||
The user entries created by `fakeNss` use the `/bin/sh` shell, which is not provided by `fakeNss` because in most cases it won't be used.
|
||||
If you need that to be available, see [`dockerTools.binSh`](#sssec-pkgs-dockerTools-helpers-binSh) or provide your own.
|
||||
|
||||
## Inputs {#sec-fakeNss-inputs}
|
||||
|
||||
`fakeNss` is made available in Nixpkgs as a package rather than a function, but it has two attributes that can be overridden and might be useful in particular cases.
|
||||
For more details on how overriding works, see [](#ex-fakeNss-overriding) and [](#sec-pkg-override).
|
||||
|
||||
`extraPasswdLines` (List of Strings; _optional_)
|
||||
|
||||
: A list of lines that will be added to `/etc/passwd`.
|
||||
Useful if extra users need to exist in the output of `fakeNss`.
|
||||
If `extraPasswdLines` is specified, it will **not** override the `root` and `nobody` entries created by `fakeNss`.
|
||||
Those entries will always exist.
|
||||
|
||||
Lines specified here must follow the format in {manpage}`passwd(5)`.
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
`extraGroupLines` (List of Strings; _optional_)
|
||||
|
||||
: A list of lines that will be added to `/etc/group`.
|
||||
Useful if extra groups need to exist in the output of `fakeNss`.
|
||||
If `extraGroupLines` is specified, it will **not** override the `root` and `nobody` entries created by `fakeNss`.
|
||||
Those entries will always exist.
|
||||
|
||||
Lines specified here must follow the format in {manpage}`group(5)`.
|
||||
|
||||
_Default value:_ `[]`.
|
||||
|
||||
## Examples {#sec-fakeNss-examples}
|
||||
|
||||
:::{.example #ex-fakeNss-dockerTools-buildImage}
|
||||
# Using `fakeNss` with `dockerTools.buildImage`
|
||||
|
||||
This example shows how to use `fakeNss` as-is.
|
||||
It is useful with functions in `dockerTools` to allow building Docker images that have the `/etc/passwd` and `/etc/group` files.
|
||||
This example includes the `hello` binary in the image so it can do something besides just have the extra files.
|
||||
|
||||
```nix
|
||||
{ dockerTools, fakeNss, hello }:
|
||||
dockerTools.buildImage {
|
||||
name = "image-with-passwd";
|
||||
tag = "latest";
|
||||
|
||||
copyToRoot = [ fakeNss hello ];
|
||||
|
||||
config = {
|
||||
Cmd = [ "/bin/hello" ];
|
||||
};
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
:::{.example #ex-fakeNss-overriding}
|
||||
# Using `fakeNss` with an override to add extra lines
|
||||
|
||||
The following code uses `override` to add extra lines to `/etc/passwd` and `/etc/group` to create another user and group entry.
|
||||
|
||||
```nix
|
||||
{ fakeNss }:
|
||||
fakeNss.override {
|
||||
extraPasswdLines = ["newuser:x:9001:9001:new user:/var/empty:/bin/sh"];
|
||||
extraGroupLines = ["newuser:x:9001:"];
|
||||
}
|
||||
```
|
||||
:::
|
60
third_party/nixpkgs/doc/build-helpers/special/fhs-environments.section.md
vendored
Normal file
60
third_party/nixpkgs/doc/build-helpers/special/fhs-environments.section.md
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
# buildFHSEnv {#sec-fhs-environments}
|
||||
|
||||
`buildFHSEnv` provides a way to build and run FHS-compatible lightweight sandboxes. It creates an isolated root filesystem with the host's `/nix/store`, so its footprint in terms of disk space is quite small. This allows you to run software which is hard or unfeasible to patch for NixOS; 3rd-party source trees with FHS assumptions, games distributed as tarballs, software with integrity checking and/or external self-updated binaries for instance.
|
||||
It uses Linux' namespaces feature to create temporary lightweight environments which are destroyed after all child processes exit, without requiring elevated privileges. It works similar to containerisation technology such as Docker or FlatPak but provides no security-relevant separation from the host system.
|
||||
|
||||
Accepted arguments are:
|
||||
|
||||
- `name`
|
||||
The name of the environment, and the wrapper executable if `pname` is unset.
|
||||
- `pname`
|
||||
The pname of the environment and the wrapper executable.
|
||||
- `version`
|
||||
The version of the environment.
|
||||
- `targetPkgs`
|
||||
Packages to be installed for the main host's architecture (i.e. x86_64 on x86_64 installations). Along with libraries binaries are also installed.
|
||||
- `multiPkgs`
|
||||
Packages to be installed for all architectures supported by a host (i.e. i686 and x86_64 on x86_64 installations). Only libraries are installed by default.
|
||||
- `multiArch`
|
||||
Whether to install 32bit multiPkgs into the FHSEnv in 64bit environments
|
||||
- `extraBuildCommands`
|
||||
Additional commands to be executed for finalizing the directory structure.
|
||||
- `extraBuildCommandsMulti`
|
||||
Like `extraBuildCommands`, but executed only on multilib architectures.
|
||||
- `extraOutputsToInstall`
|
||||
Additional derivation outputs to be linked for both target and multi-architecture packages.
|
||||
- `extraInstallCommands`
|
||||
Additional commands to be executed for finalizing the derivation with runner script.
|
||||
- `runScript`
|
||||
A shell command to be executed inside the sandbox. It defaults to `bash`. Command line arguments passed to the resulting wrapper are appended to this command by default.
|
||||
This command must be escaped; i.e. `"foo app" --do-stuff --with "some file"`. See `lib.escapeShellArgs`.
|
||||
- `profile`
|
||||
Optional script for `/etc/profile` within the sandbox.
|
||||
|
||||
You can create a simple environment using a `shell.nix` like this:
|
||||
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
(pkgs.buildFHSEnv {
|
||||
name = "simple-x11-env";
|
||||
targetPkgs = pkgs: (with pkgs; [
|
||||
udev
|
||||
alsa-lib
|
||||
]) ++ (with pkgs.xorg; [
|
||||
libX11
|
||||
libXcursor
|
||||
libXrandr
|
||||
]);
|
||||
multiPkgs = pkgs: (with pkgs; [
|
||||
udev
|
||||
alsa-lib
|
||||
]);
|
||||
runScript = "bash";
|
||||
}).env
|
||||
```
|
||||
|
||||
Running `nix-shell` on it would drop you into a shell inside an FHS env where those libraries and binaries are available in FHS-compliant paths. Applications that expect an FHS structure (i.e. proprietary binaries) can run inside this environment without modification.
|
||||
You can build a wrapper by running your binary in `runScript`, e.g. `./bin/start.sh`. Relative paths work as expected.
|
||||
|
||||
Additionally, the FHS builder links all relocated gsettings-schemas (the glib setup-hook moves them to `share/gsettings-schemas/${name}/glib-2.0/schemas`) to their standard FHS location. This means you don't need to wrap binaries with `wrapGApps*` hook.
|
55
third_party/nixpkgs/doc/build-helpers/special/makesetuphook.section.md
vendored
Normal file
55
third_party/nixpkgs/doc/build-helpers/special/makesetuphook.section.md
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
# pkgs.makeSetupHook {#sec-pkgs.makeSetupHook}
|
||||
|
||||
`pkgs.makeSetupHook` is a build helper that produces hooks that go in to `nativeBuildInputs`
|
||||
|
||||
## Usage {#sec-pkgs.makeSetupHook-usage}
|
||||
|
||||
```nix
|
||||
pkgs.makeSetupHook {
|
||||
name = "something-hook";
|
||||
propagatedBuildInputs = [ pkgs.commandsomething ];
|
||||
depsTargetTargetPropagated = [ pkgs.libsomething ];
|
||||
} ./script.sh;
|
||||
```
|
||||
|
||||
### setup hook that depends on the hello package and runs hello and @shell@ is substituted with path to bash {#sec-pkgs.makeSetupHook-usage-example}
|
||||
|
||||
```nix
|
||||
pkgs.makeSetupHook
|
||||
{
|
||||
name = "run-hello-hook";
|
||||
# Put dependencies here if they have hooks or necessary dependencies propagated
|
||||
# otherwise prefer direct paths to executables.
|
||||
propagatedBuildInputs = [
|
||||
pkgs.hello
|
||||
pkgs.cowsay
|
||||
];
|
||||
substitutions = {
|
||||
shell = "${pkgs.bash}/bin/bash";
|
||||
cowsay = "${pkgs.cowsay}/bin/cowsay";
|
||||
};
|
||||
}
|
||||
(
|
||||
writeScript "run-hello-hook.sh" ''
|
||||
#!@shell@
|
||||
# the direct path to the executable has to be here because
|
||||
# this will be run when the file is sourced
|
||||
# at which point '$PATH' has not yet been populated with inputs
|
||||
@cowsay@ cow
|
||||
|
||||
_printHelloHook() {
|
||||
hello
|
||||
}
|
||||
preConfigureHooks+=(_printHelloHook)
|
||||
''
|
||||
);
|
||||
```
|
||||
|
||||
## Attributes {#sec-pkgs.makeSetupHook-attributes}
|
||||
|
||||
* `name` Set the name of the hook.
|
||||
* `propagatedBuildInputs` Runtime dependencies (such as binaries) of the hook.
|
||||
* `depsTargetTargetPropagated` Non-binary dependencies.
|
||||
* `meta`
|
||||
* `passthru`
|
||||
* `substitutions` Variables for `substituteAll`
|
41
third_party/nixpkgs/doc/build-helpers/special/mkshell.section.md
vendored
Normal file
41
third_party/nixpkgs/doc/build-helpers/special/mkshell.section.md
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
# pkgs.mkShell {#sec-pkgs-mkShell}
|
||||
|
||||
`pkgs.mkShell` is a specialized `stdenv.mkDerivation` that removes some
|
||||
repetition when using it with `nix-shell` (or `nix develop`).
|
||||
|
||||
## Usage {#sec-pkgs-mkShell-usage}
|
||||
|
||||
Here is a common usage example:
|
||||
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.mkShell {
|
||||
packages = [ pkgs.gnumake ];
|
||||
|
||||
inputsFrom = [ pkgs.hello pkgs.gnutar ];
|
||||
|
||||
shellHook = ''
|
||||
export DEBUG=1
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
## Attributes {#sec-pkgs-mkShell-attributes}
|
||||
|
||||
* `name` (default: `nix-shell`). Set the name of the derivation.
|
||||
* `packages` (default: `[]`). Add executable packages to the `nix-shell` environment.
|
||||
* `inputsFrom` (default: `[]`). Add build dependencies of the listed derivations to the `nix-shell` environment.
|
||||
* `shellHook` (default: `""`). Bash statements that are executed by `nix-shell`.
|
||||
|
||||
... all the attributes of `stdenv.mkDerivation`.
|
||||
|
||||
## Variants {#sec-pkgs-mkShell-variants}
|
||||
|
||||
`pkgs.mkShellNoCC` is a variant that uses `stdenvNoCC` instead of `stdenv` as base environment. This is useful if no C compiler is needed in the shell environment.
|
||||
|
||||
## Building the shell {#sec-pkgs-mkShell-building}
|
||||
|
||||
This derivation output will contain a text file that contains a reference to
|
||||
all the build inputs. This is useful in CI where we want to make sure that
|
||||
every derivation, and its dependencies, build properly. Or when creating a GC
|
||||
root so that the build dependencies don't get garbage-collected.
|
150
third_party/nixpkgs/doc/build-helpers/special/vm-tools.section.md
vendored
Normal file
150
third_party/nixpkgs/doc/build-helpers/special/vm-tools.section.md
vendored
Normal file
|
@ -0,0 +1,150 @@
|
|||
# vmTools {#sec-vm-tools}
|
||||
|
||||
A set of VM related utilities, that help in building some packages in more advanced scenarios.
|
||||
|
||||
## `vmTools.createEmptyImage` {#vm-tools-createEmptyImage}
|
||||
|
||||
A bash script fragment that produces a disk image at `destination`.
|
||||
|
||||
### Attributes {#vm-tools-createEmptyImage-attributes}
|
||||
|
||||
* `size`. The disk size, in MiB.
|
||||
* `fullName`. Name that will be written to `${destination}/nix-support/full-name`.
|
||||
* `destination` (optional, default `$out`). Where to write the image files.
|
||||
|
||||
## `vmTools.runInLinuxVM` {#vm-tools-runInLinuxVM}
|
||||
|
||||
Run a derivation in a Linux virtual machine (using Qemu/KVM).
|
||||
By default, there is no disk image; the root filesystem is a `tmpfs`, and the Nix store is shared with the host (via the [9P protocol](https://wiki.qemu.org/Documentation/9p#9p_Protocol)).
|
||||
Thus, any pure Nix derivation should run unmodified.
|
||||
|
||||
If the build fails and Nix is run with the `-K/--keep-failed` option, a script `run-vm` will be left behind in the temporary build directory that allows you to boot into the VM and debug it interactively.
|
||||
|
||||
### Attributes {#vm-tools-runInLinuxVM-attributes}
|
||||
|
||||
* `preVM` (optional). Shell command to be evaluated *before* the VM is started (i.e., on the host).
|
||||
* `memSize` (optional, default `512`). The memory size of the VM in MiB.
|
||||
* `diskImage` (optional). A file system image to be attached to `/dev/sda`.
|
||||
Note that currently we expect the image to contain a filesystem, not a full disk image with a partition table etc.
|
||||
|
||||
### Examples {#vm-tools-runInLinuxVM-examples}
|
||||
|
||||
Build the derivation hello inside a VM:
|
||||
```nix
|
||||
{ pkgs }: with pkgs; with vmTools;
|
||||
runInLinuxVM hello
|
||||
```
|
||||
|
||||
Build inside a VM with extra memory:
|
||||
```nix
|
||||
{ pkgs }: with pkgs; with vmTools;
|
||||
runInLinuxVM (hello.overrideAttrs (_: { memSize = 1024; }))
|
||||
```
|
||||
|
||||
Use VM with a disk image (implicitly sets `diskImage`, see [`vmTools.createEmptyImage`](#vm-tools-createEmptyImage)):
|
||||
```nix
|
||||
{ pkgs }: with pkgs; with vmTools;
|
||||
runInLinuxVM (hello.overrideAttrs (_: {
|
||||
preVM = createEmptyImage {
|
||||
size = 1024;
|
||||
fullName = "vm-image";
|
||||
};
|
||||
}))
|
||||
```
|
||||
|
||||
## `vmTools.extractFs` {#vm-tools-extractFs}
|
||||
|
||||
Takes a file, such as an ISO, and extracts its contents into the store.
|
||||
|
||||
### Attributes {#vm-tools-extractFs-attributes}
|
||||
|
||||
* `file`. Path to the file to be extracted.
|
||||
Note that currently we expect the image to contain a filesystem, not a full disk image with a partition table etc.
|
||||
* `fs` (optional). Filesystem of the contents of the file.
|
||||
|
||||
### Examples {#vm-tools-extractFs-examples}
|
||||
|
||||
Extract the contents of an ISO file:
|
||||
```nix
|
||||
{ pkgs }: with pkgs; with vmTools;
|
||||
extractFs { file = ./image.iso; }
|
||||
```
|
||||
|
||||
## `vmTools.extractMTDfs` {#vm-tools-extractMTDfs}
|
||||
|
||||
Like [](#vm-tools-extractFs), but it makes use of a [Memory Technology Device (MTD)](https://en.wikipedia.org/wiki/Memory_Technology_Device).
|
||||
|
||||
## `vmTools.runInLinuxImage` {#vm-tools-runInLinuxImage}
|
||||
|
||||
Like [](#vm-tools-runInLinuxVM), but instead of using `stdenv` from the Nix store, run the build using the tools provided by `/bin`, `/usr/bin`, etc. from the specified filesystem image, which typically is a filesystem containing a [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard)-based Linux distribution.
|
||||
|
||||
## `vmTools.makeImageTestScript` {#vm-tools-makeImageTestScript}
|
||||
|
||||
Generate a script that can be used to run an interactive session in the given image.
|
||||
|
||||
### Examples {#vm-tools-makeImageTestScript-examples}
|
||||
|
||||
Create a script for running a Fedora 27 VM:
|
||||
```nix
|
||||
{ pkgs }: with pkgs; with vmTools;
|
||||
makeImageTestScript diskImages.fedora27x86_64
|
||||
```
|
||||
|
||||
Create a script for running an Ubuntu 20.04 VM:
|
||||
```nix
|
||||
{ pkgs }: with pkgs; with vmTools;
|
||||
makeImageTestScript diskImages.ubuntu2004x86_64
|
||||
```
|
||||
|
||||
## `vmTools.diskImageFuns` {#vm-tools-diskImageFuns}
|
||||
|
||||
A set of functions that build a predefined set of minimal Linux distributions images.
|
||||
|
||||
### Images {#vm-tools-diskImageFuns-images}
|
||||
|
||||
* Fedora
|
||||
* `fedora26x86_64`
|
||||
* `fedora27x86_64`
|
||||
* CentOS
|
||||
* `centos6i386`
|
||||
* `centos6x86_64`
|
||||
* `centos7x86_64`
|
||||
* Ubuntu
|
||||
* `ubuntu1404i386`
|
||||
* `ubuntu1404x86_64`
|
||||
* `ubuntu1604i386`
|
||||
* `ubuntu1604x86_64`
|
||||
* `ubuntu1804i386`
|
||||
* `ubuntu1804x86_64`
|
||||
* `ubuntu2004i386`
|
||||
* `ubuntu2004x86_64`
|
||||
* `ubuntu2204i386`
|
||||
* `ubuntu2204x86_64`
|
||||
* Debian
|
||||
* `debian10i386`
|
||||
* `debian10x86_64`
|
||||
* `debian11i386`
|
||||
* `debian11x86_64`
|
||||
* `debian12i386`
|
||||
* `debian12x86_64`
|
||||
|
||||
### Attributes {#vm-tools-diskImageFuns-attributes}
|
||||
|
||||
* `size` (optional, defaults to `4096`). The size of the image, in MiB.
|
||||
* `extraPackages` (optional). A list names of additional packages from the distribution that should be included in the image.
|
||||
|
||||
### Examples {#vm-tools-diskImageFuns-examples}
|
||||
|
||||
8GiB image containing Firefox in addition to the default packages:
|
||||
```nix
|
||||
{ pkgs }: with pkgs; with vmTools;
|
||||
diskImageFuns.ubuntu2004x86_64 { extraPackages = [ "firefox" ]; size = 8192; }
|
||||
```
|
||||
|
||||
## `vmTools.diskImageExtraFuns` {#vm-tools-diskImageExtraFuns}
|
||||
|
||||
Shorthand for `vmTools.diskImageFuns.<attr> { extraPackages = ... }`.
|
||||
|
||||
## `vmTools.diskImages` {#vm-tools-diskImages}
|
||||
|
||||
Shorthand for `vmTools.diskImageFuns.<attr> { }`.
|
441
third_party/nixpkgs/doc/build-helpers/testers.chapter.md
vendored
Normal file
441
third_party/nixpkgs/doc/build-helpers/testers.chapter.md
vendored
Normal file
|
@ -0,0 +1,441 @@
|
|||
# Testers {#chap-testers}
|
||||
|
||||
This chapter describes several testing builders which are available in the `testers` namespace.
|
||||
|
||||
## `hasPkgConfigModules` {#tester-hasPkgConfigModules}
|
||||
|
||||
<!-- Old anchor name so links still work -->
|
||||
[]{#tester-hasPkgConfigModule}
|
||||
Checks whether a package exposes a given list of `pkg-config` modules.
|
||||
If the `moduleNames` argument is omitted, `hasPkgConfigModules` will use `meta.pkgConfigModules`.
|
||||
|
||||
:::{.example #ex-haspkgconfigmodules-defaultvalues}
|
||||
|
||||
# Check that `pkg-config` modules are exposed using default values
|
||||
|
||||
```nix
|
||||
{
|
||||
passthru.tests.pkg-config = testers.hasPkgConfigModules {
|
||||
package = finalAttrs.finalPackage;
|
||||
};
|
||||
|
||||
meta.pkgConfigModules = [ "libfoo" ];
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
:::{.example #ex-haspkgconfigmodules-explicitmodules}
|
||||
|
||||
# Check that `pkg-config` modules are exposed using explicit module names
|
||||
|
||||
```nix
|
||||
{
|
||||
passthru.tests.pkg-config = testers.hasPkgConfigModules {
|
||||
package = finalAttrs.finalPackage;
|
||||
moduleNames = [ "libfoo" ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## `lycheeLinkCheck` {#tester-lycheeLinkCheck}
|
||||
|
||||
Check a packaged static site's links with the [`lychee` package](https://search.nixos.org/packages?show=lychee&type=packages&query=lychee).
|
||||
|
||||
You may use Nix to reproducibly build static websites, such as for software documentation.
|
||||
Some packages will install documentation in their `out` or `doc` outputs, or maybe you have dedicated package where you've made your static site reproducible by running a generator, such as [Hugo](https://gohugo.io/) or [mdBook](https://rust-lang.github.io/mdBook/), in a derivation.
|
||||
|
||||
If you have a static site that can be built with Nix, you can use `lycheeLinkCheck` to check that the hyperlinks in your site are correct, and do so as part of your Nix workflow and CI.
|
||||
|
||||
:::{.example #ex-lycheelinkcheck}
|
||||
|
||||
# Check hyperlinks in the `nix` documentation
|
||||
|
||||
```nix
|
||||
testers.lycheeLinkCheck {
|
||||
site = nix.doc + "/share/doc/nix/manual";
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Return value {#tester-lycheeLinkCheck-return}
|
||||
|
||||
This tester produces a package that does not produce useful outputs, but only succeeds if the hyperlinks in your site are correct. The build log will list the broken links.
|
||||
|
||||
It has two modes:
|
||||
|
||||
- Build the returned derivation; its build process will check that internal hyperlinks are correct. This runs in the sandbox, so it will not check external hyperlinks, but it is quick and reliable.
|
||||
|
||||
- Invoke the `.online` attribute with [`nix run`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-run) ([experimental](https://nixos.org/manual/nix/stable/contributing/experimental-features#xp-feature-nix-command)). This runs outside the sandbox, and checks that both internal and external hyperlinks are correct.
|
||||
Example:
|
||||
|
||||
```shell
|
||||
nix run nixpkgs#lychee.tests.ok.online
|
||||
```
|
||||
|
||||
### Inputs {#tester-lycheeLinkCheck-inputs}
|
||||
|
||||
`site` (path or derivation) {#tester-lycheeLinkCheck-param-site}
|
||||
|
||||
: The path to the files to check.
|
||||
|
||||
`remap` (attribe set, optional) {#tester-lycheeLinkCheck-param-remap}
|
||||
|
||||
: An attribute set where the attribute names are regular expressions.
|
||||
The values should be strings, derivations, or path values.
|
||||
|
||||
In the returned check's default configuration, external URLs are only checked when you run the `.online` attribute.
|
||||
|
||||
By adding remappings, you can check offline that URLs to external resources are correct, by providing a stand-in from the file system.
|
||||
|
||||
Before checking the existence of a URL, the regular expressions are matched and replaced by their corresponding values.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
{
|
||||
"https://nix\\.dev/manual/nix/[a-z0-9.-]*" = "${nix.doc}/share/doc/nix/manual";
|
||||
"https://nixos\\.org/manual/nix/(un)?stable" = "${emptyDirectory}/placeholder-to-disallow-old-nix-docs-urls";
|
||||
}
|
||||
```
|
||||
|
||||
Store paths in the attribute values are automatically prefixed with `file://`, because lychee requires this for paths in the file system.
|
||||
If this is a problem, or if you need to control the order in which replacements are performed, use `extraConfig.remap` instead.
|
||||
|
||||
`extraConfig` (attribute set) {#tester-lycheeLinkCheck-param-extraConfig}
|
||||
|
||||
: Extra configuration to pass to `lychee` in its [configuration file](https://github.com/lycheeverse/lychee/blob/master/lychee.example.toml).
|
||||
It is automatically [translated](https://nixos.org/manual/nixos/stable/index.html#sec-settings-nix-representable) to TOML.
|
||||
|
||||
Example: `{ "include_verbatim" = true; }`
|
||||
|
||||
`lychee` (derivation, optional) {#tester-lycheeLinkCheck-param-lychee}
|
||||
|
||||
: The `lychee` package to use.
|
||||
|
||||
## `shellcheck` {#tester-shellcheck}
|
||||
|
||||
Runs files through `shellcheck`, a static analysis tool for shell scripts.
|
||||
|
||||
:::{.example #ex-shellcheck}
|
||||
# Run `testers.shellcheck`
|
||||
|
||||
A single script
|
||||
|
||||
```nix
|
||||
testers.shellcheck {
|
||||
name = "shellcheck";
|
||||
src = ./script.sh;
|
||||
}
|
||||
```
|
||||
|
||||
Multiple files
|
||||
|
||||
```nix
|
||||
let
|
||||
inherit (lib) fileset;
|
||||
in
|
||||
testers.shellcheck {
|
||||
name = "shellcheck";
|
||||
src = fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = fileset.unions [
|
||||
./lib.sh
|
||||
./nixbsd-activate
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Inputs {#tester-shellcheck-inputs}
|
||||
|
||||
[`src` (path or string)]{#tester-shellcheck-param-src}
|
||||
|
||||
: The path to the shell script(s) to check.
|
||||
This can be a single file or a directory containing shell files.
|
||||
All files in `src` will be checked, so you may want to provide `fileset`-based source instead of a whole directory.
|
||||
|
||||
### Return value {#tester-shellcheck-return}
|
||||
|
||||
A derivation that runs `shellcheck` on the given script(s).
|
||||
The build will fail if `shellcheck` finds any issues.
|
||||
|
||||
## `testVersion` {#tester-testVersion}
|
||||
|
||||
Checks that the output from running a command contains the specified version string in it as a whole word.
|
||||
|
||||
NOTE: In most cases, [`versionCheckHook`](#versioncheckhook) should be preferred, but this function is provided and documented here anyway. The motivation for adding either tests would be:
|
||||
|
||||
- Catch dynamic linking errors and such and missing environment variables that should be added by wrapping.
|
||||
- Probable protection against accidentally building the wrong version, for example when using an "old" hash in a fixed-output derivation.
|
||||
|
||||
By default, the command to be run will be inferred from the given `package` attribute:
|
||||
it will check `meta.mainProgram` first, and fall back to `pname` or `name`.
|
||||
The default argument to the command is `--version`, and the version to be checked will be inferred from the given `package` attribute as well.
|
||||
|
||||
:::{.example #ex-testversion-hello}
|
||||
|
||||
# Check a program version using all the default values
|
||||
|
||||
This example will run the command `hello --version`, and then check that the version of the `hello` package is in the output of the command.
|
||||
|
||||
```nix
|
||||
{
|
||||
passthru.tests.version = testers.testVersion { package = hello; };
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
:::{.example #ex-testversion-different-commandversion}
|
||||
|
||||
# Check the program version using a specified command and expected version string
|
||||
|
||||
This example will run the command `leetcode -V`, and then check that `leetcode 0.4.2` is in the output of the command as a whole word (separated by whitespaces).
|
||||
This means that an output like "leetcode 0.4.21" would fail the tests, and an output like "You're running leetcode 0.4.2" would pass the tests.
|
||||
|
||||
A common usage of the `version` attribute is to specify `version = "v${version}"`.
|
||||
|
||||
```nix
|
||||
{
|
||||
version = "0.4.2";
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = leetcode-cli;
|
||||
command = "leetcode -V";
|
||||
version = "leetcode ${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)
|
||||
|
||||
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.
|
||||
|
||||
:::{.example #ex-testBuildFailure-showingenvironmentchanges}
|
||||
|
||||
# Check that a build fails, and verify the changes made during build
|
||||
|
||||
```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
|
||||
''
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## `testEqualContents` {#tester-testEqualContents}
|
||||
|
||||
Check that two paths have the same contents.
|
||||
|
||||
:::{.example #ex-testEqualContents-toyexample}
|
||||
|
||||
# Check that two paths have the same contents
|
||||
|
||||
```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 #ex-testEqualDerivation-hello}
|
||||
|
||||
# Check that two packages produce the same derivation
|
||||
|
||||
```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 #ex-invalidateFetcherByDrvHash-nix}
|
||||
|
||||
# Prevent nix from reusing the output of a fetcher
|
||||
|
||||
```nix
|
||||
{
|
||||
tests.fetchgit = testers.invalidateFetcherByDrvHash fetchgit {
|
||||
name = "nix-source";
|
||||
url = "https://github.com/NixOS/nix";
|
||||
rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
|
||||
hash = "sha256-7DszvbCNTjpzGRmpIVAWXk20P0/XTrWZ79KSOGLrUWY=";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## `runCommand` {#tester-runCommand}
|
||||
|
||||
`runCommand :: { name, script, stdenv ? stdenvNoCC, hash ? "...", ... } -> Derivation`
|
||||
|
||||
This is a wrapper around `pkgs.runCommandWith`, which
|
||||
- produces a fixed-output derivation, enabling the command(s) to access the network ;
|
||||
- salts the derivation's name based on its inputs, ensuring the command is re-run whenever the inputs changes.
|
||||
|
||||
It accepts the following attributes:
|
||||
- the derivation's `name` ;
|
||||
- the `script` to be executed ;
|
||||
- `stdenv`, the environment to use, defaulting to `stdenvNoCC` ;
|
||||
- the derivation's output `hash`, defaulting to the empty file's.
|
||||
The derivation's `outputHashMode` is set by default to recursive, so the `script` can output a directory as well.
|
||||
|
||||
All other attributes are passed through to [`mkDerivation`](#sec-using-stdenv),
|
||||
including `nativeBuildInputs` to specify dependencies available to the `script`.
|
||||
|
||||
:::{.example #ex-tester-runCommand-nix}
|
||||
|
||||
# Run a command with network access
|
||||
|
||||
```nix
|
||||
testers.runCommand {
|
||||
name = "access-the-internet";
|
||||
command = ''
|
||||
curl -o /dev/null https://example.com
|
||||
touch $out
|
||||
'';
|
||||
nativeBuildInputs = with pkgs; [ cacert curl ];
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## `runNixOSTest` {#tester-runNixOSTest}
|
||||
|
||||
A helper function that behaves exactly like the NixOS `runTest`, except it also assigns this Nixpkgs package set as the `pkgs` of the test and makes the `nixpkgs.*` options read-only.
|
||||
|
||||
If your test is part of the Nixpkgs repository, or if you need a more general entrypoint, see ["Calling a test" in the NixOS manual](https://nixos.org/manual/nixos/stable/index.html#sec-calling-nixos-tests).
|
||||
|
||||
:::{.example #ex-runNixOSTest-hello}
|
||||
|
||||
# Run a NixOS test using `runNixOSTest`
|
||||
|
||||
```nix
|
||||
pkgs.testers.runNixOSTest ({ lib, ... }: {
|
||||
name = "hello";
|
||||
nodes.machine = { pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.hello ];
|
||||
};
|
||||
testScript = ''
|
||||
machine.succeed("hello")
|
||||
'';
|
||||
})
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## `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 {#tester-nixosTest-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 {#tester-nixosTest-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`.
|
806
third_party/nixpkgs/doc/build-helpers/trivial-build-helpers.chapter.md
vendored
Normal file
806
third_party/nixpkgs/doc/build-helpers/trivial-build-helpers.chapter.md
vendored
Normal file
|
@ -0,0 +1,806 @@
|
|||
# Trivial build helpers {#chap-trivial-builders}
|
||||
|
||||
Nixpkgs provides a variety of wrapper functions that help build commonly useful derivations.
|
||||
Like [`stdenv.mkDerivation`](#sec-using-stdenv), each of these build helpers creates a derivation, but the arguments passed are different (usually simpler) from those required by `stdenv.mkDerivation`.
|
||||
|
||||
|
||||
## `runCommandWith` {#trivial-builder-runCommandWith}
|
||||
|
||||
The function `runCommandWith` returns a derivation built using the specified command(s), in a specified environment.
|
||||
|
||||
It is the underlying base function of all [`runCommand*` variants].
|
||||
The general behavior is controlled via a single attribute set passed
|
||||
as the first argument, and allows specifying `stdenv` freely.
|
||||
|
||||
The following [`runCommand*` variants] exist: `runCommand`, `runCommandCC`, and `runCommandLocal`.
|
||||
|
||||
[`runCommand*` variants]: #trivial-builder-runCommand
|
||||
|
||||
### Type {#trivial-builder-runCommandWith-Type}
|
||||
|
||||
```
|
||||
runCommandWith :: {
|
||||
name :: name;
|
||||
stdenv? :: Derivation;
|
||||
runLocal? :: Bool;
|
||||
derivationArgs? :: { ... };
|
||||
} -> String -> Derivation
|
||||
```
|
||||
|
||||
### Inputs {#trivial-builder-runCommandWith-Inputs}
|
||||
|
||||
`name` (String)
|
||||
: The derivation's name, which Nix will append to the store path; see [`mkDerivation`](#sec-using-stdenv).
|
||||
|
||||
`runLocal` (Boolean)
|
||||
: If set to `true` this forces the derivation to be built locally, not using [substitutes] nor remote builds.
|
||||
This is intended for very cheap commands (<1s execution time) which can be sped up by avoiding the network round-trip(s).
|
||||
Its effect is to set [`preferLocalBuild = true`][preferLocalBuild] and [`allowSubstitutes = false`][allowSubstitutes].
|
||||
|
||||
::: {.note}
|
||||
This prevents the use of [substituters][substituter], so only set `runLocal` (or use `runCommandLocal`) when 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`.
|
||||
:::
|
||||
|
||||
`stdenv` (Derivation)
|
||||
: The [standard environment](#chap-stdenv) to use, defaulting to `pkgs.stdenv`
|
||||
|
||||
`derivationArgs` (Attribute set)
|
||||
: Additional arguments for [`mkDerivation`](#sec-using-stdenv).
|
||||
|
||||
`buildCommand` (String)
|
||||
: Shell commands to run in the derivation builder.
|
||||
|
||||
::: {.note}
|
||||
You have to create a file or directory `$out` for Nix to be able to run the builder successfully.
|
||||
:::
|
||||
|
||||
[allowSubstitutes]: https://nixos.org/nix/manual/#adv-attr-allowSubstitutes
|
||||
[preferLocalBuild]: https://nixos.org/nix/manual/#adv-attr-preferLocalBuild
|
||||
[substituter]: https://nix.dev/manual/nix/latest/glossary#gloss-substituter
|
||||
[substitutes]: https://nix.dev/manual/nix/2.23/glossary#gloss-substitute
|
||||
|
||||
::: {.example #ex-runcommandwith}
|
||||
# Invocation of `runCommandWith`
|
||||
|
||||
```nix
|
||||
runCommandWith {
|
||||
name = "example";
|
||||
derivationArgs.nativeBuildInputs = [ cowsay ];
|
||||
} ''
|
||||
cowsay > $out <<EOMOO
|
||||
'runCommandWith' is a bit cumbersome,
|
||||
so we have more ergonomic wrappers.
|
||||
EOMOO
|
||||
''
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## `runCommand` and `runCommandCC` {#trivial-builder-runCommand}
|
||||
|
||||
The function `runCommand` returns a derivation built using the specified command(s), in the `stdenvNoCC` environment.
|
||||
|
||||
`runCommandCC` is similar but uses the default compiler environment. To minimize dependencies, `runCommandCC`
|
||||
should only be used when the build command needs a C compiler.
|
||||
|
||||
`runCommandLocal` is also similar to `runCommand`, but forces the derivation to be built locally.
|
||||
See the note on [`runCommandWith`] about `runLocal`.
|
||||
|
||||
[`runCommandWith`]: #trivial-builder-runCommandWith
|
||||
|
||||
### Type {#trivial-builder-runCommand-Type}
|
||||
|
||||
```
|
||||
runCommand :: String -> AttrSet -> String -> Derivation
|
||||
runCommandCC :: String -> AttrSet -> String -> Derivation
|
||||
runCommandLocal :: String -> AttrSet -> String -> Derivation
|
||||
```
|
||||
|
||||
### Input {#trivial-builder-runCommand-Input}
|
||||
|
||||
While the type signature(s) differ from [`runCommandWith`], individual arguments with the same name will have the same type and meaning:
|
||||
|
||||
`name` (String)
|
||||
: The derivation's name
|
||||
|
||||
`derivationArgs` (Attribute set)
|
||||
: Additional parameters passed to [`mkDerivation`]
|
||||
|
||||
`buildCommand` (String)
|
||||
: The command(s) run to build the derivation.
|
||||
|
||||
|
||||
::: {.example #ex-runcommand-simple}
|
||||
# Invocation of `runCommand`
|
||||
|
||||
```nix
|
||||
runCommand "my-example" {} ''
|
||||
echo My example command is running
|
||||
|
||||
mkdir $out
|
||||
|
||||
echo I can write data to the Nix store > $out/message
|
||||
|
||||
echo I can also run basic commands like:
|
||||
|
||||
echo ls
|
||||
ls
|
||||
|
||||
echo whoami
|
||||
whoami
|
||||
|
||||
echo date
|
||||
date
|
||||
''
|
||||
```
|
||||
:::
|
||||
|
||||
::: {.note}
|
||||
`runCommand name derivationArgs buildCommand` is equivalent to
|
||||
```nix
|
||||
runCommandWith {
|
||||
inherit name derivationArgs;
|
||||
stdenv = stdenvNoCC;
|
||||
} buildCommand
|
||||
```
|
||||
|
||||
Likewise, `runCommandCC name derivationArgs buildCommand` is equivalent to
|
||||
```nix
|
||||
runCommandWith {
|
||||
inherit name derivationArgs;
|
||||
} buildCommand
|
||||
```
|
||||
:::
|
||||
|
||||
|
||||
## Writing text files {#trivial-builder-text-writing}
|
||||
|
||||
Nixpkgs provides the following functions for producing derivations which write text files or executable scripts into the Nix store.
|
||||
They are useful for creating files from Nix expression, and are all implemented as convenience wrappers around `writeTextFile`.
|
||||
|
||||
Each of these functions will cause a derivation to be produced.
|
||||
When you coerce the result of each of these functions to a string with [string interpolation](https://nixos.org/manual/nix/stable/language/string-interpolation) or [`builtins.toString`](https://nixos.org/manual/nix/stable/language/builtins#builtins-toString), it will evaluate to the [store path](https://nixos.org/manual/nix/stable/store/store-path) of this derivation.
|
||||
|
||||
:::: {.note}
|
||||
Some of these functions will put the resulting files within a directory inside the [derivation output](https://nixos.org/manual/nix/stable/language/derivations#attr-outputs).
|
||||
If you need to refer to the resulting files somewhere else in a Nix expression, append their path to the derivation's store path.
|
||||
|
||||
For example, if the file destination is a directory:
|
||||
|
||||
```nix
|
||||
{
|
||||
my-file = writeTextFile {
|
||||
name = "my-file";
|
||||
text = ''
|
||||
Contents of File
|
||||
'';
|
||||
destination = "/share/my-file";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Remember to append "/share/my-file" to the resulting store path when using it elsewhere:
|
||||
|
||||
```nix
|
||||
writeShellScript "evaluate-my-file.sh" ''
|
||||
cat ${my-file}/share/my-file
|
||||
''
|
||||
```
|
||||
::::
|
||||
|
||||
### `makeDesktopItem` {#trivial-builder-makeDesktopItem}
|
||||
|
||||
Write an [XDG desktop file](https://specifications.freedesktop.org/desktop-entry-spec/1.4/) to the Nix store.
|
||||
|
||||
This function is usually used to add desktop items to a package through the `copyDesktopItems` hook.
|
||||
|
||||
`makeDesktopItem` adheres to version 1.4 of the specification.
|
||||
|
||||
#### Inputs {#trivial-builder-makeDesktopItem-inputs}
|
||||
|
||||
`makeDesktopItem` takes an attribute set that accepts most values from the [XDG specification](https://specifications.freedesktop.org/desktop-entry-spec/1.4/ar01s06.html).
|
||||
|
||||
All recognised keys from the specification are supported with the exception of the "Hidden" field. The keys are converted into camelCase format, but correspond 1:1 to their equivalent in the specification: `genericName`, `noDisplay`, `comment`, `icon`, `onlyShowIn`, `notShowIn`, `dbusActivatable`, `tryExec`, `exec`, `path`, `terminal`, `mimeTypes`, `categories`, `implements`, `keywords`, `startupNotify`, `startupWMClass`, `url`, `prefersNonDefaultGPU`.
|
||||
|
||||
The "Version" field is hardcoded to the version `makeDesktopItem` currently adheres to.
|
||||
|
||||
The following fields are either required, are of a different type than in the specification, carry specific default values, or are additional fields supported by `makeDesktopItem`:
|
||||
|
||||
`name` (String)
|
||||
|
||||
: The name of the desktop file in the Nix store.
|
||||
|
||||
`type` (String; _optional_)
|
||||
|
||||
: Default value: `"Application"`
|
||||
|
||||
`desktopName` (String)
|
||||
|
||||
: Corresponds to the "Name" field of the specification.
|
||||
|
||||
`actions` (List of Attribute set; _optional_)
|
||||
|
||||
: A list of attribute sets {name, exec?, icon?}
|
||||
|
||||
`extraConfig` (Attribute set; _optional_)
|
||||
|
||||
: Additional key/value pairs to be added verbatim to the desktop file. Attributes need to be prefixed with 'X-'.
|
||||
|
||||
#### Examples {#trivial-builder-makeDesktopItem-examples}
|
||||
|
||||
::: {.example #ex-makeDesktopItem}
|
||||
# Usage 1 of `makeDesktopItem`
|
||||
|
||||
Write a desktop file `/nix/store/<store path>/my-program.desktop` to the Nix store.
|
||||
|
||||
```nix
|
||||
{makeDesktopItem}:
|
||||
makeDesktopItem {
|
||||
name = "my-program";
|
||||
desktopName = "My Program";
|
||||
genericName = "Video Player";
|
||||
noDisplay = false;
|
||||
comment = "Cool video player";
|
||||
icon = "/path/to/icon";
|
||||
onlyShowIn = [ "KDE" ];
|
||||
dbusActivatable = true;
|
||||
tryExec = "my-program";
|
||||
exec = "my-program --someflag";
|
||||
path = "/some/working/path";
|
||||
terminal = false;
|
||||
actions.example = {
|
||||
name = "New Window";
|
||||
exec = "my-program --new-window";
|
||||
icon = "/some/icon";
|
||||
};
|
||||
mimeTypes = [ "video/mp4" ];
|
||||
categories = [ "Utility" ];
|
||||
implements = [ "org.my-program" ];
|
||||
keywords = [ "Video" "Player" ];
|
||||
startupNotify = false;
|
||||
startupWMClass = "MyProgram";
|
||||
prefersNonDefaultGPU = false;
|
||||
extraConfig.X-SomeExtension = "somevalue";
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::: {.example #ex2-makeDesktopItem}
|
||||
# Usage 2 of `makeDesktopItem`
|
||||
|
||||
Override the `hello` package to add a desktop item.
|
||||
|
||||
```nix
|
||||
{ copyDesktopItems
|
||||
, hello
|
||||
, makeDesktopItem }:
|
||||
|
||||
hello.overrideAttrs {
|
||||
nativeBuildInputs = [ copyDesktopItems ];
|
||||
|
||||
desktopItems = [(makeDesktopItem {
|
||||
name = "hello";
|
||||
desktopName = "Hello";
|
||||
exec = "hello";
|
||||
})];
|
||||
}
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### `writeTextFile` {#trivial-builder-writeTextFile}
|
||||
|
||||
Write a text file to the Nix store.
|
||||
|
||||
`writeTextFile` takes an attribute set with the following possible attributes:
|
||||
|
||||
`name` (String)
|
||||
|
||||
: Corresponds to the name used in the Nix store path identifier.
|
||||
|
||||
`text` (String)
|
||||
|
||||
: The contents of the file.
|
||||
|
||||
`executable` (Bool, _optional_)
|
||||
|
||||
: Make this file have the executable bit set.
|
||||
|
||||
Default: `false`
|
||||
|
||||
`destination` (String, _optional_)
|
||||
|
||||
: A subpath under the derivation's output path into which to put the file.
|
||||
Subdirectories are created automatically when the derivation is realised.
|
||||
|
||||
By default, the store path itself will be a file containing the text contents.
|
||||
|
||||
Default: `""`
|
||||
|
||||
`checkPhase` (String, _optional_)
|
||||
|
||||
: Commands to run after generating the file.
|
||||
|
||||
Default: `""`
|
||||
|
||||
`meta` (Attribute set, _optional_)
|
||||
|
||||
: Additional metadata for the derivation.
|
||||
|
||||
Default: `{}`
|
||||
|
||||
`allowSubstitutes` (Bool, _optional_)
|
||||
|
||||
: Whether to allow substituting from a binary cache.
|
||||
Passed through to [`allowSubstitutes`](https://nixos.org/manual/nix/stable/language/advanced-attributes#adv-attr-allowSubstitutes) of the underlying call to `builtins.derivation`.
|
||||
|
||||
It defaults to `false`, as running the derivation's simple `builder` executable locally is assumed to be faster than network operations.
|
||||
Set it to true if the `checkPhase` step is expensive.
|
||||
|
||||
Default: `false`
|
||||
|
||||
`preferLocalBuild` (Bool, _optional_)
|
||||
|
||||
: Whether to prefer building locally, even if faster [remote build machines](https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-substituters) are available.
|
||||
|
||||
Passed through to [`preferLocalBuild`](https://nixos.org/manual/nix/stable/language/advanced-attributes#adv-attr-preferLocalBuild) of the underlying call to `builtins.derivation`.
|
||||
|
||||
It defaults to `true` for the same reason `allowSubstitutes` defaults to `false`.
|
||||
|
||||
Default: `true`
|
||||
|
||||
`derivationArgs` (Attribute set, _optional_)
|
||||
|
||||
: Extra arguments to pass to the underlying call to `stdenv.mkDerivation`.
|
||||
|
||||
Default: `{}`
|
||||
|
||||
The resulting store path will include some variation of the name, and it will be a file unless `destination` is used, in which case it will be a directory.
|
||||
|
||||
::: {.example #ex-writeTextFile}
|
||||
# Usage 1 of `writeTextFile`
|
||||
|
||||
Write `my-file` to `/nix/store/<store path>/some/subpath/my-cool-script`, making it executable.
|
||||
Also run a check on the resulting file in a `checkPhase`, and supply values for the less-used options.
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-cool-script";
|
||||
text = ''
|
||||
#!/bin/sh
|
||||
echo "This is my cool script!"
|
||||
'';
|
||||
executable = true;
|
||||
destination = "/some/subpath/my-cool-script";
|
||||
checkPhase = ''
|
||||
${pkgs.shellcheck}/bin/shellcheck $out/some/subpath/my-cool-script
|
||||
'';
|
||||
meta = {
|
||||
license = pkgs.lib.licenses.cc0;
|
||||
};
|
||||
allowSubstitutes = true;
|
||||
preferLocalBuild = false;
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
::: {.example #ex2-writeTextFile}
|
||||
# Usage 2 of `writeTextFile`
|
||||
|
||||
Write the string `Contents of File` to `/nix/store/<store path>`.
|
||||
See also the [](#trivial-builder-writeText) helper function.
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-file";
|
||||
text = ''
|
||||
Contents of File
|
||||
'';
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
::: {.example #ex3-writeTextFile}
|
||||
# Usage 3 of `writeTextFile`
|
||||
|
||||
Write an executable script `my-script` to `/nix/store/<store path>/bin/my-script`.
|
||||
See also the [](#trivial-builder-writeScriptBin) helper function.
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-script";
|
||||
text = ''
|
||||
echo "hi"
|
||||
'';
|
||||
executable = true;
|
||||
destination = "/bin/my-script";
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
### `writeText` {#trivial-builder-writeText}
|
||||
|
||||
Write a text file to the Nix store
|
||||
|
||||
`writeText` takes the following arguments:
|
||||
a string.
|
||||
|
||||
`name` (String)
|
||||
|
||||
: The name used in the Nix store path.
|
||||
|
||||
`text` (String)
|
||||
|
||||
: The contents of the file.
|
||||
|
||||
The store path will include the name, and it will be a file.
|
||||
|
||||
::: {.example #ex-writeText}
|
||||
# Usage of `writeText`
|
||||
|
||||
Write the string `Contents of File` to `/nix/store/<store path>`:
|
||||
|
||||
```nix
|
||||
writeText "my-file"
|
||||
''
|
||||
Contents of File
|
||||
''
|
||||
```
|
||||
:::
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-file";
|
||||
text = ''
|
||||
Contents of File
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
### `writeTextDir` {#trivial-builder-writeTextDir}
|
||||
|
||||
Write a text file within a subdirectory of the Nix store.
|
||||
|
||||
`writeTextDir` takes the following arguments:
|
||||
|
||||
`path` (String)
|
||||
|
||||
: The destination within the Nix store path under which to create the file.
|
||||
|
||||
`text` (String)
|
||||
|
||||
: The contents of the file.
|
||||
|
||||
The store path will be a directory.
|
||||
|
||||
::: {.example #ex-writeTextDir}
|
||||
# Usage of `writeTextDir`
|
||||
|
||||
Write the string `Contents of File` to `/nix/store/<store path>/share/my-file`:
|
||||
|
||||
```nix
|
||||
writeTextDir "share/my-file"
|
||||
''
|
||||
Contents of File
|
||||
''
|
||||
```
|
||||
:::
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-file";
|
||||
text = ''
|
||||
Contents of File
|
||||
'';
|
||||
destination = "/share/my-file";
|
||||
}
|
||||
```
|
||||
|
||||
### `writeScript` {#trivial-builder-writeScript}
|
||||
|
||||
Write an executable script file to the Nix store.
|
||||
|
||||
`writeScript` takes the following arguments:
|
||||
|
||||
`name` (String)
|
||||
|
||||
: The name used in the Nix store path.
|
||||
|
||||
`text` (String)
|
||||
|
||||
: The contents of the file.
|
||||
|
||||
The created file is marked as executable.
|
||||
The store path will include the name, and it will be a file.
|
||||
|
||||
::: {.example #ex-writeScript}
|
||||
# Usage of `writeScript`
|
||||
|
||||
Write the string `Contents of File` to `/nix/store/<store path>` and make the file executable.
|
||||
|
||||
```nix
|
||||
writeScript "my-file"
|
||||
''
|
||||
Contents of File
|
||||
''
|
||||
```
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-file";
|
||||
text = ''
|
||||
Contents of File
|
||||
'';
|
||||
executable = true;
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
### `writeScriptBin` {#trivial-builder-writeScriptBin}
|
||||
|
||||
Write a script within a `bin` subdirectory of a directory in the Nix store.
|
||||
This is for consistency with the convention of software packages placing executables under `bin`.
|
||||
|
||||
`writeScriptBin` takes the following arguments:
|
||||
|
||||
`name` (String)
|
||||
|
||||
: The name used in the Nix store path and within the file created under the store path.
|
||||
|
||||
`text` (String)
|
||||
|
||||
: The contents of the file.
|
||||
|
||||
The created file is marked as executable.
|
||||
The file's contents will be put into `/nix/store/<store path>/bin/<name>`.
|
||||
The store path will include the name, and it will be a directory.
|
||||
|
||||
::: {.example #ex-writeScriptBin}
|
||||
# Usage of `writeScriptBin`
|
||||
|
||||
```nix
|
||||
writeScriptBin "my-script"
|
||||
''
|
||||
echo "hi"
|
||||
''
|
||||
```
|
||||
:::
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-script";
|
||||
text = ''
|
||||
echo "hi"
|
||||
'';
|
||||
executable = true;
|
||||
destination = "/bin/my-script";
|
||||
}
|
||||
```
|
||||
|
||||
### `writeShellScript` {#trivial-builder-writeShellScript}
|
||||
|
||||
Write a Bash script to the store.
|
||||
|
||||
`writeShellScript` takes the following arguments:
|
||||
|
||||
`name` (String)
|
||||
|
||||
: The name used in the Nix store path.
|
||||
|
||||
`text` (String)
|
||||
|
||||
: The contents of the file.
|
||||
|
||||
The created file is marked as executable.
|
||||
The store path will include the name, and it will be a file.
|
||||
|
||||
This function is almost exactly like [](#trivial-builder-writeScript), except that it prepends to the file a [shebang](https://en.wikipedia.org/wiki/Shebang_%28Unix%29) line that points to the version of Bash used in Nixpkgs.
|
||||
<!-- this cannot be changed in practice, so there is no point pretending it's somehow generic -->
|
||||
|
||||
::: {.example #ex-writeShellScript}
|
||||
# Usage of `writeShellScript`
|
||||
|
||||
```nix
|
||||
writeShellScript "my-script"
|
||||
''
|
||||
echo "hi"
|
||||
''
|
||||
```
|
||||
:::
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-script";
|
||||
text = ''
|
||||
#! ${pkgs.runtimeShell}
|
||||
echo "hi"
|
||||
'';
|
||||
executable = true;
|
||||
}
|
||||
```
|
||||
|
||||
### `writeShellScriptBin` {#trivial-builder-writeShellScriptBin}
|
||||
|
||||
Write a Bash script to a "bin" subdirectory of a directory in the Nix store.
|
||||
|
||||
`writeShellScriptBin` takes the following arguments:
|
||||
|
||||
`name` (String)
|
||||
|
||||
: The name used in the Nix store path and within the file generated under the store path.
|
||||
|
||||
`text` (String)
|
||||
|
||||
: The contents of the file.
|
||||
|
||||
The file's contents will be put into `/nix/store/<store path>/bin/<name>`.
|
||||
The store path will include the the name, and it will be a directory.
|
||||
|
||||
This function is a combination of [](#trivial-builder-writeShellScript) and [](#trivial-builder-writeScriptBin).
|
||||
|
||||
::: {.example #ex-writeShellScriptBin}
|
||||
# Usage of `writeShellScriptBin`
|
||||
|
||||
```nix
|
||||
writeShellScriptBin "my-script"
|
||||
''
|
||||
echo "hi"
|
||||
''
|
||||
```
|
||||
:::
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
```nix
|
||||
writeTextFile {
|
||||
name = "my-script";
|
||||
text = ''
|
||||
#! ${pkgs.runtimeShell}
|
||||
echo "hi"
|
||||
'';
|
||||
executable = true;
|
||||
destination = "/bin/my-script";
|
||||
}
|
||||
```
|
||||
|
||||
## `concatTextFile`, `concatText`, `concatScript` {#trivial-builder-concatText}
|
||||
|
||||
These functions concatenate `files` to the Nix store in a single file. This is useful for configuration files structured in lines of text. `concatTextFile` takes an attribute set and expects two arguments, `name` and `files`. `name` corresponds to the name used in the Nix store path. `files` will be the files to be concatenated. You can also set `executable` to true to make this file have the executable bit set.
|
||||
`concatText` and`concatScript` are simple wrappers over `concatTextFile`.
|
||||
|
||||
Here are a few examples:
|
||||
```nix
|
||||
|
||||
# Writes my-file to /nix/store/<store path>
|
||||
concatTextFile {
|
||||
name = "my-file";
|
||||
files = [ drv1 "${drv2}/path/to/file" ];
|
||||
}
|
||||
# See also the `concatText` helper function below.
|
||||
|
||||
# Writes executable my-file to /nix/store/<store path>/bin/my-file
|
||||
concatTextFile {
|
||||
name = "my-file";
|
||||
files = [ drv1 "${drv2}/path/to/file" ];
|
||||
executable = true;
|
||||
destination = "/bin/my-file";
|
||||
}
|
||||
# Writes contents of files to /nix/store/<store path>
|
||||
concatText "my-file" [ file1 file2 ]
|
||||
|
||||
# Writes contents of files to /nix/store/<store path>
|
||||
concatScript "my-file" [ file1 file2 ]
|
||||
```
|
||||
|
||||
## `writeShellApplication` {#trivial-builder-writeShellApplication}
|
||||
|
||||
`writeShellApplication` is similar to `writeShellScriptBin` and `writeScriptBin` but supports runtime dependencies with `runtimeInputs`.
|
||||
Writes an executable shell script to `/nix/store/<store path>/bin/<name>` and checks its syntax with [`shellcheck`](https://github.com/koalaman/shellcheck) and the `bash`'s `-n` option.
|
||||
Some basic Bash options are set by default (`errexit`, `nounset`, and `pipefail`), but can be overridden with `bashOptions`.
|
||||
|
||||
Extra arguments may be passed to `stdenv.mkDerivation` by setting `derivationArgs`; note that variables set in this manner will be set when the shell script is _built,_ not when it's run.
|
||||
Runtime environment variables can be set with the `runtimeEnv` argument.
|
||||
|
||||
For example, the following shell application can refer to `curl` directly, rather than needing to write `${curl}/bin/curl`:
|
||||
|
||||
```nix
|
||||
writeShellApplication {
|
||||
name = "show-nixos-org";
|
||||
|
||||
runtimeInputs = [ curl w3m ];
|
||||
|
||||
text = ''
|
||||
curl -s 'https://nixos.org' | w3m -dump -T text/html
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
## `symlinkJoin` {#trivial-builder-symlinkJoin}
|
||||
|
||||
This can be used to put many derivations into the same directory structure. It works by creating a new derivation and adding symlinks to each of the paths listed. It expects two arguments, `name`, and `paths`. `name` (or alternatively `pname` and `version`) is the name used in the Nix store path for the created derivation. `paths` is a list of paths that will be symlinked. These paths can be to Nix store derivations or any other subdirectory contained within.
|
||||
Here is an example:
|
||||
```nix
|
||||
# adds symlinks of hello and stack to current build and prints "links added"
|
||||
symlinkJoin { name = "myexample"; paths = [ pkgs.hello pkgs.stack ]; postBuild = "echo links added"; }
|
||||
```
|
||||
This creates a derivation with a directory structure like the following:
|
||||
```
|
||||
/nix/store/sglsr5g079a5235hy29da3mq3hv8sjmm-myexample
|
||||
|-- bin
|
||||
| |-- hello -> /nix/store/qy93dp4a3rqyn2mz63fbxjg228hffwyw-hello-2.10/bin/hello
|
||||
| `-- stack -> /nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/bin/stack
|
||||
`-- share
|
||||
|-- bash-completion
|
||||
| `-- completions
|
||||
| `-- stack -> /nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/share/bash-completion/completions/stack
|
||||
|-- fish
|
||||
| `-- vendor_completions.d
|
||||
| `-- stack.fish -> /nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/share/fish/vendor_completions.d/stack.fish
|
||||
...
|
||||
```
|
||||
|
||||
## `writeReferencesToFile` {#trivial-builder-writeReferencesToFile}
|
||||
|
||||
Deprecated. Use [`writeClosure`](#trivial-builder-writeClosure) instead.
|
||||
|
||||
## `writeClosure` {#trivial-builder-writeClosure}
|
||||
|
||||
Given a list of [store paths](https://nixos.org/manual/nix/stable/glossary#gloss-store-path) (or string-like expressions coercible to store paths), write their collective [closure](https://nixos.org/manual/nix/stable/glossary#gloss-closure) to a text file.
|
||||
|
||||
The result is equivalent to the output of `nix-store -q --requisites`.
|
||||
|
||||
For example,
|
||||
|
||||
```nix
|
||||
writeClosure [ (writeScriptBin "hi" ''${hello}/bin/hello'') ]
|
||||
```
|
||||
|
||||
produces an output path `/nix/store/<hash>-runtime-deps` containing
|
||||
|
||||
```
|
||||
/nix/store/<hash>-hello-2.10
|
||||
/nix/store/<hash>-hi
|
||||
/nix/store/<hash>-libidn2-2.3.0
|
||||
/nix/store/<hash>-libunistring-0.9.10
|
||||
/nix/store/<hash>-glibc-2.32-40
|
||||
```
|
||||
|
||||
You can see that this includes `hi`, the original input path,
|
||||
`hello`, which is a direct reference, but also
|
||||
the other paths that are indirectly required to run `hello`.
|
||||
|
||||
## `writeDirectReferencesToFile` {#trivial-builder-writeDirectReferencesToFile}
|
||||
|
||||
Writes the set of references to the output file, that is, their immediate dependencies.
|
||||
|
||||
This produces the equivalent of `nix-store -q --references`.
|
||||
|
||||
For example,
|
||||
|
||||
```nix
|
||||
writeDirectReferencesToFile (writeScriptBin "hi" ''${hello}/bin/hello'')
|
||||
```
|
||||
|
||||
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
|
||||
by `hi`'s output.
|
10
third_party/nixpkgs/doc/contributing.md
vendored
Normal file
10
third_party/nixpkgs/doc/contributing.md
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Contributing to Nixpkgs {#part-contributing}
|
||||
|
||||
```{=include=} chapters
|
||||
contributing/quick-start.chapter.md
|
||||
contributing/coding-conventions.chapter.md
|
||||
contributing/submitting-changes.chapter.md
|
||||
contributing/vulnerability-roundup.chapter.md
|
||||
contributing/reviewing-contributions.chapter.md
|
||||
contributing/contributing-to-documentation.chapter.md
|
||||
```
|
63
third_party/nixpkgs/doc/contributing/coding-conventions.chapter.md
vendored
Normal file
63
third_party/nixpkgs/doc/contributing/coding-conventions.chapter.md
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Coding conventions {#chap-conventions}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Syntax {#sec-syntax}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Package naming {#sec-package-naming}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## File naming and organisation {#sec-organisation}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Versioning {#sec-versioning}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Fetching Sources {#sec-sources}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Obtaining source hash {#sec-source-hashes}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
### Obtaining hashes securely {#sec-source-hashes-security}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Patches {#sec-patches}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Package tests {#sec-package-tests}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
### Writing inline package tests {#ssec-inline-package-tests-writing}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
### Writing larger package tests {#ssec-package-tests-writing}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
### Running package tests {#ssec-package-tests-running}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
### Examples of package tests {#ssec-package-tests-examples}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
### Linking NixOS module tests to a package {#ssec-nixos-tests-linking}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
### Import From Derivation {#ssec-import-from-derivation}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
11
third_party/nixpkgs/doc/contributing/contributing-to-documentation.chapter.md
vendored
Normal file
11
third_party/nixpkgs/doc/contributing/contributing-to-documentation.chapter.md
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Contributing to Nixpkgs documentation {#chap-contributing}
|
||||
|
||||
This section has been moved to [doc/README.md](https://github.com/NixOS/nixpkgs/blob/master/doc/README.md).
|
||||
|
||||
## devmode {#sec-contributing-devmode}
|
||||
|
||||
This section has been moved to [doc/README.md](https://github.com/NixOS/nixpkgs/blob/master/doc/README.md).
|
||||
|
||||
## Syntax {#sec-contributing-markup}
|
||||
|
||||
This section has been moved to [doc/README.md](https://github.com/NixOS/nixpkgs/blob/master/doc/README.md).
|
3
third_party/nixpkgs/doc/contributing/quick-start.chapter.md
vendored
Normal file
3
third_party/nixpkgs/doc/contributing/quick-start.chapter.md
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Quick Start to Adding a Package {#chap-quick-start}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
35
third_party/nixpkgs/doc/contributing/reviewing-contributions.chapter.md
vendored
Normal file
35
third_party/nixpkgs/doc/contributing/reviewing-contributions.chapter.md
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Reviewing contributions {#chap-reviewing-contributions}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Package updates {#reviewing-contributions-package-updates}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## New packages {#reviewing-contributions-new-packages}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Module updates {#reviewing-contributions-module-updates}
|
||||
|
||||
This section has been moved to [nixos/README.md](https://github.com/NixOS/nixpkgs/blob/master/nixos/README.md).
|
||||
|
||||
## New modules {#reviewing-contributions-new-modules}
|
||||
|
||||
This section has been moved to [nixos/README.md](https://github.com/NixOS/nixpkgs/blob/master/nixos/README.md).
|
||||
|
||||
## Individual maintainer list {#reviewing-contributions-individual-maintainer-list}
|
||||
|
||||
This section has been moved to [maintainers/README.md](https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md).
|
||||
|
||||
## Maintainer teams {#reviewing-contributions-maintainer-teams}
|
||||
|
||||
This section has been moved to [maintainers/README.md](https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md).
|
||||
|
||||
## Other submissions {#reviewing-contributions-other-submissions}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Merging pull requests {#reviewing-contributions--merging-pull-requests}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
88
third_party/nixpkgs/doc/contributing/submitting-changes.chapter.md
vendored
Normal file
88
third_party/nixpkgs/doc/contributing/submitting-changes.chapter.md
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
# Submitting changes {#chap-submitting-changes}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Submitting changes {#submitting-changes-submitting-changes}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Submitting security fixes {#submitting-changes-submitting-security-fixes}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Deprecating/removing packages {#submitting-changes-deprecating-packages}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
### Steps to remove a package from Nixpkgs {#steps-to-remove-a-package-from-nixpkgs}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Pull Request Template {#submitting-changes-pull-request-template}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Tested using sandboxing {#submitting-changes-tested-with-sandbox}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Built on platform(s) {#submitting-changes-platform-diversity}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests) {#submitting-changes-nixos-tests}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Tested compilation of all pkgs that depend on this change using `nixpkgs-review` {#submitting-changes-tested-compilation}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Tested execution of all binary files (usually in `./result/bin/`) {#submitting-changes-tested-execution}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Meets Nixpkgs contribution standards {#submitting-changes-contribution-standards}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Hotfixing pull requests {#submitting-changes-hotfixing-pull-requests}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Commit policy {#submitting-changes-commit-policy}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Branches {#submitting-changes-branches}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
#### Master branch {#submitting-changes-master-branch}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
#### Staging branch {#submitting-changes-staging-branch}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
#### Staging-next branch {#submitting-changes-staging-next-branch}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
#### Stable release branches {#submitting-changes-stable-release-branches}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
#### Automatically backporting a Pull Request {#submitting-changes-stable-release-branches-automatic-backports}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
#### Manually backporting changes {#submitting-changes-stable-release-branches-manual-backports}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
#### Acceptable backport criteria {#acceptable-backport-criteria}
|
||||
|
||||
This section has been moved to [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
11
third_party/nixpkgs/doc/contributing/vulnerability-roundup.chapter.md
vendored
Normal file
11
third_party/nixpkgs/doc/contributing/vulnerability-roundup.chapter.md
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Vulnerability Roundup {#chap-vulnerability-roundup}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Issues {#vulnerability-roundup-issues}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
||||
|
||||
## Triaging and Fixing {#vulnerability-roundup-triaging-and-fixing}
|
||||
|
||||
This section has been moved to [pkgs/README.md](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md).
|
6
third_party/nixpkgs/doc/default.nix
vendored
Normal file
6
third_party/nixpkgs/doc/default.nix
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
pkgs ? (import ./.. { }),
|
||||
nixpkgs ? { },
|
||||
}:
|
||||
|
||||
pkgs.nixpkgs-manual.override { inherit nixpkgs; }
|
10
third_party/nixpkgs/doc/development.md
vendored
Normal file
10
third_party/nixpkgs/doc/development.md
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Development of Nixpkgs {#part-development}
|
||||
|
||||
This section shows you how Nixpkgs is being developed and how you can interact with the contributors and the latest updates.
|
||||
If you are interested in contributing yourself, see [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
|
||||
|
||||
<!-- In the future this section should also include: How to test pull requests, how to know if pull requests are available in channels, etc. -->
|
||||
|
||||
```{=include=} chapters
|
||||
development/opening-issues.chapter.md
|
||||
```
|
7
third_party/nixpkgs/doc/development/opening-issues.chapter.md
vendored
Normal file
7
third_party/nixpkgs/doc/development/opening-issues.chapter.md
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Opening issues {#sec-opening-issues}
|
||||
|
||||
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
||||
* Make sure there is no open issue on the topic
|
||||
* [Submit a new issue](https://github.com/NixOS/nixpkgs/issues/new/choose) by choosing the kind of topic and fill out the template
|
||||
|
||||
<!-- In the future this section could also include more detailed information on the issue templates -->
|
54
third_party/nixpkgs/doc/doc-support/epub.nix
vendored
Normal file
54
third_party/nixpkgs/doc/doc-support/epub.nix
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
# To build this derivation, run `nix-build -A nixpkgs-manual.epub`
|
||||
{
|
||||
lib,
|
||||
runCommand,
|
||||
docbook_xsl_ns,
|
||||
libxslt,
|
||||
zip,
|
||||
}:
|
||||
runCommand "manual.epub"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
libxslt
|
||||
zip
|
||||
];
|
||||
|
||||
epub = ''
|
||||
<book xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
version="5.0"
|
||||
xml:id="nixpkgs-manual">
|
||||
<info>
|
||||
<title>Nixpkgs Manual</title>
|
||||
<subtitle>Version ${lib.version}</subtitle>
|
||||
</info>
|
||||
<chapter>
|
||||
<title>Temporarily unavailable</title>
|
||||
<para>
|
||||
The Nixpkgs manual is currently not available in EPUB format,
|
||||
please use the <link xlink:href="https://nixos.org/nixpkgs/manual">HTML manual</link>
|
||||
instead.
|
||||
</para>
|
||||
<para>
|
||||
If you've used the EPUB manual in the past and it has been useful to you, please
|
||||
<link xlink:href="https://github.com/NixOS/nixpkgs/issues/237234">let us know</link>.
|
||||
</para>
|
||||
</chapter>
|
||||
</book>
|
||||
'';
|
||||
|
||||
passAsFile = [ "epub" ];
|
||||
}
|
||||
''
|
||||
mkdir scratch
|
||||
xsltproc \
|
||||
--param chapter.autolabel 0 \
|
||||
--nonet \
|
||||
--output scratch/ \
|
||||
${docbook_xsl_ns}/xml/xsl/docbook/epub/docbook.xsl \
|
||||
$epubPath
|
||||
|
||||
echo "application/epub+zip" > mimetype
|
||||
zip -0Xq -b "$TMPDIR" "$out" mimetype
|
||||
cd scratch && zip -Xr9D -b "$TMPDIR" "$out" *
|
||||
''
|
144
third_party/nixpkgs/doc/doc-support/lib-function-docs.nix
vendored
Normal file
144
third_party/nixpkgs/doc/doc-support/lib-function-docs.nix
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
# Generates the documentation for library functions via nixdoc.
|
||||
# To build this derivation, run `nix-build -A nixpkgs-manual.lib-docs`
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
nixdoc,
|
||||
nix,
|
||||
nixpkgs ? { },
|
||||
libsets ? [
|
||||
{
|
||||
name = "asserts";
|
||||
description = "assertion functions";
|
||||
}
|
||||
{
|
||||
name = "attrsets";
|
||||
description = "attribute set functions";
|
||||
}
|
||||
{
|
||||
name = "strings";
|
||||
description = "string manipulation functions";
|
||||
}
|
||||
{
|
||||
name = "versions";
|
||||
description = "version string functions";
|
||||
}
|
||||
{
|
||||
name = "trivial";
|
||||
description = "miscellaneous functions";
|
||||
}
|
||||
{
|
||||
name = "fixedPoints";
|
||||
baseName = "fixed-points";
|
||||
description = "explicit recursion functions";
|
||||
}
|
||||
{
|
||||
name = "lists";
|
||||
description = "list manipulation functions";
|
||||
}
|
||||
{
|
||||
name = "debug";
|
||||
description = "debugging functions";
|
||||
}
|
||||
{
|
||||
name = "options";
|
||||
description = "NixOS / nixpkgs option handling";
|
||||
}
|
||||
{
|
||||
name = "path";
|
||||
description = "path functions";
|
||||
}
|
||||
{
|
||||
name = "filesystem";
|
||||
description = "filesystem functions";
|
||||
}
|
||||
{
|
||||
name = "fileset";
|
||||
description = "file set functions";
|
||||
}
|
||||
{
|
||||
name = "sources";
|
||||
description = "source filtering functions";
|
||||
}
|
||||
{
|
||||
name = "cli";
|
||||
description = "command-line serialization functions";
|
||||
}
|
||||
{
|
||||
name = "generators";
|
||||
description = "functions that create file formats from nix data structures";
|
||||
}
|
||||
{
|
||||
name = "gvariant";
|
||||
description = "GVariant formatted string serialization functions";
|
||||
}
|
||||
{
|
||||
name = "customisation";
|
||||
description = "Functions to customise (derivation-related) functions, derivations, or attribute sets";
|
||||
}
|
||||
{
|
||||
name = "meta";
|
||||
description = "functions for derivation metadata";
|
||||
}
|
||||
{
|
||||
name = "derivations";
|
||||
description = "miscellaneous derivation-specific functions";
|
||||
}
|
||||
],
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nixpkgs-lib-docs";
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
root = ../..;
|
||||
fileset = ../../lib;
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
nixdoc
|
||||
nix
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
export NIX_STATE_DIR=$(mktemp -d)
|
||||
nix-instantiate --eval --strict --json ${./lib-function-locations.nix} \
|
||||
--arg nixpkgsPath "./." \
|
||||
--argstr revision ${nixpkgs.rev or "master"} \
|
||||
--argstr libsetsJSON ${lib.escapeShellArg (builtins.toJSON libsets)} \
|
||||
--store $(mktemp -d) \
|
||||
> locations.json
|
||||
|
||||
function docgen {
|
||||
name=$1
|
||||
baseName=$2
|
||||
description=$3
|
||||
# TODO: wrap lib.$name in <literal>, make nixdoc not escape it
|
||||
if [[ -e "lib/$baseName.nix" ]]; then
|
||||
nixdoc -c "$name" -d "lib.$name: $description" -l locations.json -f "lib/$baseName.nix" > "$out/$name.md"
|
||||
else
|
||||
nixdoc -c "$name" -d "lib.$name: $description" -l locations.json -f "lib/$baseName/default.nix" > "$out/$name.md"
|
||||
fi
|
||||
echo "$out/$name.md" >> "$out/index.md"
|
||||
}
|
||||
|
||||
mkdir -p "$out"
|
||||
|
||||
cat > "$out/index.md" << 'EOF'
|
||||
```{=include=} sections auto-id-prefix=auto-generated
|
||||
EOF
|
||||
|
||||
${lib.concatMapStrings (
|
||||
{
|
||||
name,
|
||||
baseName ? name,
|
||||
description,
|
||||
}:
|
||||
''
|
||||
docgen ${name} ${baseName} ${lib.escapeShellArg description}
|
||||
''
|
||||
) libsets}
|
||||
|
||||
echo '```' >> "$out/index.md"
|
||||
'';
|
||||
}
|
74
third_party/nixpkgs/doc/doc-support/lib-function-locations.nix
vendored
Normal file
74
third_party/nixpkgs/doc/doc-support/lib-function-locations.nix
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
{ nixpkgsPath, revision, libsetsJSON }:
|
||||
let
|
||||
lib = import (nixpkgsPath + "/lib");
|
||||
libsets = builtins.fromJSON libsetsJSON;
|
||||
|
||||
libDefPos = prefix: set:
|
||||
builtins.concatMap
|
||||
(name: [{
|
||||
name = builtins.concatStringsSep "." (prefix ++ [name]);
|
||||
location = builtins.unsafeGetAttrPos name set;
|
||||
}] ++ lib.optionals
|
||||
(builtins.length prefix == 0 && builtins.isAttrs set.${name})
|
||||
(libDefPos (prefix ++ [name]) set.${name})
|
||||
) (builtins.attrNames set);
|
||||
|
||||
libset = toplib:
|
||||
builtins.map
|
||||
(subsetname: {
|
||||
subsetname = subsetname;
|
||||
functions = libDefPos [] toplib.${subsetname};
|
||||
})
|
||||
(builtins.map (x: x.name) libsets);
|
||||
|
||||
flattenedLibSubset = { subsetname, functions }:
|
||||
builtins.map
|
||||
(fn: {
|
||||
name = "lib.${subsetname}.${fn.name}";
|
||||
value = fn.location;
|
||||
})
|
||||
functions;
|
||||
|
||||
locatedlibsets = libs: builtins.map flattenedLibSubset (libset libs);
|
||||
removeFilenamePrefix = prefix: filename:
|
||||
let
|
||||
prefixLen = (builtins.stringLength prefix) + 1; # +1 to remove the leading /
|
||||
filenameLen = builtins.stringLength filename;
|
||||
substr = builtins.substring prefixLen filenameLen filename;
|
||||
in substr;
|
||||
|
||||
removeNixpkgs = removeFilenamePrefix (builtins.toString nixpkgsPath);
|
||||
|
||||
liblocations =
|
||||
builtins.filter
|
||||
(elem: elem.value != null)
|
||||
(lib.lists.flatten
|
||||
(locatedlibsets lib));
|
||||
|
||||
fnLocationRelative = { name, value }:
|
||||
{
|
||||
inherit name;
|
||||
value = value // { file = removeNixpkgs value.file; };
|
||||
};
|
||||
|
||||
relativeLocs = (builtins.map fnLocationRelative liblocations);
|
||||
sanitizeId = builtins.replaceStrings
|
||||
[ "'" ]
|
||||
[ "-prime" ];
|
||||
|
||||
urlPrefix = "https://github.com/NixOS/nixpkgs/blob/${revision}";
|
||||
jsonLocs = builtins.listToAttrs
|
||||
(builtins.map
|
||||
({ name, value }: {
|
||||
name = sanitizeId name;
|
||||
value =
|
||||
let
|
||||
text = "${value.file}:${builtins.toString value.line}";
|
||||
target = "${urlPrefix}/${value.file}#L${builtins.toString value.line}";
|
||||
in
|
||||
"[${text}](${target}) in `<nixpkgs>`";
|
||||
})
|
||||
relativeLocs);
|
||||
|
||||
in
|
||||
jsonLocs
|
28
third_party/nixpkgs/doc/doc-support/options-doc.nix
vendored
Normal file
28
third_party/nixpkgs/doc/doc-support/options-doc.nix
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
# To build this derivation, run `nix-build -A nixpkgs-manual.optionsDoc`
|
||||
{ lib, nixosOptionsDoc }:
|
||||
|
||||
let
|
||||
modules = lib.evalModules {
|
||||
modules = [ ../../pkgs/top-level/config.nix ];
|
||||
class = "nixpkgsConfig";
|
||||
};
|
||||
|
||||
root = toString ../..;
|
||||
|
||||
transformDeclaration =
|
||||
decl:
|
||||
let
|
||||
declStr = toString decl;
|
||||
subpath = lib.removePrefix "/" (lib.removePrefix root declStr);
|
||||
in
|
||||
assert lib.hasPrefix root declStr;
|
||||
{
|
||||
url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}";
|
||||
name = subpath;
|
||||
};
|
||||
in
|
||||
nixosOptionsDoc {
|
||||
inherit (modules) options;
|
||||
documentType = "none";
|
||||
transformOptions = opt: opt // { declarations = map transformDeclaration opt.declarations; };
|
||||
}
|
106
third_party/nixpkgs/doc/doc-support/package.nix
vendored
Normal file
106
third_party/nixpkgs/doc/doc-support/package.nix
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
# This file describes the Nixpkgs manual, which happens to use module docs infra originally
|
||||
# developed for NixOS. To build this derivation, run `nix-build -A nixpkgs-manual`.
|
||||
#
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
callPackage,
|
||||
documentation-highlighter,
|
||||
nixos-render-docs,
|
||||
nixpkgs ? { },
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation (
|
||||
finalAttrs:
|
||||
let
|
||||
inherit (finalAttrs.finalPackage.optionsDoc) optionsJSON;
|
||||
inherit (finalAttrs.finalPackage) epub lib-docs pythonInterpreterTable;
|
||||
in
|
||||
{
|
||||
name = "nixpkgs-manual";
|
||||
|
||||
nativeBuildInputs = [ nixos-render-docs ];
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
root = ../.;
|
||||
fileset = lib.fileset.unions [
|
||||
(lib.fileset.fileFilter (file: file.hasExt "md" || file.hasExt "md.in") ../.)
|
||||
../style.css
|
||||
../anchor-use.js
|
||||
../anchor.min.js
|
||||
../manpage-urls.json
|
||||
];
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
substituteInPlace ./languages-frameworks/python.section.md \
|
||||
--subst-var-by python-interpreter-table "$(<"${pythonInterpreterTable}")"
|
||||
|
||||
cat \
|
||||
./functions/library.md.in \
|
||||
${lib-docs}/index.md \
|
||||
> ./functions/library.md
|
||||
substitute ./manual.md.in ./manual.md \
|
||||
--replace-fail '@MANUAL_VERSION@' '${lib.version}'
|
||||
|
||||
mkdir -p out/media
|
||||
|
||||
mkdir -p out/highlightjs
|
||||
cp -t out/highlightjs \
|
||||
${documentation-highlighter}/highlight.pack.js \
|
||||
${documentation-highlighter}/LICENSE \
|
||||
${documentation-highlighter}/mono-blue.css \
|
||||
${documentation-highlighter}/loader.js
|
||||
|
||||
cp -t out ./style.css ./anchor.min.js ./anchor-use.js
|
||||
|
||||
nixos-render-docs manual html \
|
||||
--manpage-urls ./manpage-urls.json \
|
||||
--revision ${nixpkgs.rev or "master"} \
|
||||
--stylesheet style.css \
|
||||
--stylesheet highlightjs/mono-blue.css \
|
||||
--script ./highlightjs/highlight.pack.js \
|
||||
--script ./highlightjs/loader.js \
|
||||
--script ./anchor.min.js \
|
||||
--script ./anchor-use.js \
|
||||
--toc-depth 1 \
|
||||
--section-toc-depth 1 \
|
||||
manual.md \
|
||||
out/index.html
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
dest="$out/share/doc/nixpkgs"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
mv out "$dest"
|
||||
mv "$dest/index.html" "$dest/manual.html"
|
||||
|
||||
cp ${epub} "$dest/nixpkgs-manual.epub"
|
||||
|
||||
mkdir -p $out/nix-support/
|
||||
echo "doc manual $dest manual.html" >> $out/nix-support/hydra-build-products
|
||||
echo "doc manual $dest nixpkgs-manual.epub" >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
lib-docs = callPackage ./lib-function-docs.nix { inherit nixpkgs; };
|
||||
|
||||
epub = callPackage ./epub.nix { };
|
||||
|
||||
optionsDoc = callPackage ./options-doc.nix { };
|
||||
|
||||
pythonInterpreterTable = callPackage ./python-interpreter-table.nix { };
|
||||
|
||||
shell = callPackage ../../pkgs/tools/nix/web-devmode.nix {
|
||||
buildArgs = "./.";
|
||||
open = "/share/doc/nixpkgs/manual.html";
|
||||
};
|
||||
|
||||
tests.manpage-urls = callPackage ../tests/manpage-urls.nix { };
|
||||
};
|
||||
}
|
||||
)
|
64
third_party/nixpkgs/doc/doc-support/python-interpreter-table.nix
vendored
Normal file
64
third_party/nixpkgs/doc/doc-support/python-interpreter-table.nix
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
# To build this derivation, run `nix-build -A nixpkgs-manual.pythonInterpreterTable`
|
||||
{
|
||||
lib,
|
||||
writeText,
|
||||
pkgs,
|
||||
pythonInterpreters,
|
||||
}:
|
||||
let
|
||||
isPythonInterpreter =
|
||||
name:
|
||||
/*
|
||||
NB: Package names that don't follow the regular expression:
|
||||
- `python-cosmopolitan` is not part of `pkgs.pythonInterpreters`.
|
||||
- `_prebuilt` interpreters are used for bootstrapping internally.
|
||||
- `python3Minimal` contains python packages, left behind conservatively.
|
||||
- `rustpython` lacks `pythonVersion` and `implementation`.
|
||||
*/
|
||||
(lib.strings.match "(pypy|python)([[:digit:]]*)" name) != null;
|
||||
|
||||
interpreterName =
|
||||
pname:
|
||||
let
|
||||
cuteName = {
|
||||
cpython = "CPython";
|
||||
pypy = "PyPy";
|
||||
};
|
||||
interpreter = pkgs.${pname};
|
||||
in
|
||||
"${cuteName.${interpreter.implementation}} ${interpreter.pythonVersion}";
|
||||
|
||||
interpreters = lib.reverseList (
|
||||
lib.naturalSort (lib.filter isPythonInterpreter (lib.attrNames pythonInterpreters))
|
||||
);
|
||||
|
||||
aliases =
|
||||
pname:
|
||||
lib.attrNames (
|
||||
lib.filterAttrs (
|
||||
name: value:
|
||||
isPythonInterpreter name && name != pname && interpreterName name == interpreterName pname
|
||||
) pkgs
|
||||
);
|
||||
|
||||
result = map (pname: {
|
||||
inherit pname;
|
||||
aliases = aliases pname;
|
||||
interpreter = interpreterName pname;
|
||||
}) interpreters;
|
||||
|
||||
toMarkdown =
|
||||
data:
|
||||
let
|
||||
line = package: ''
|
||||
| ${package.pname} | ${lib.concatStringsSep ", " package.aliases or [ ]} | ${package.interpreter} |
|
||||
'';
|
||||
in
|
||||
lib.concatStringsSep "" (map line data);
|
||||
|
||||
in
|
||||
writeText "python-interpreter-table.md" ''
|
||||
| Package | Aliases | Interpeter |
|
||||
|---------|---------|------------|
|
||||
${toMarkdown result}
|
||||
''
|
11
third_party/nixpkgs/doc/functions.md
vendored
Normal file
11
third_party/nixpkgs/doc/functions.md
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Functions reference {#chap-functions}
|
||||
|
||||
The nixpkgs repository has several utility functions to manipulate Nix expressions.
|
||||
|
||||
```{=include=} sections
|
||||
functions/library.md
|
||||
functions/generators.section.md
|
||||
functions/debug.section.md
|
||||
functions/prefer-remote-fetch.section.md
|
||||
functions/nix-gitignore.section.md
|
||||
```
|
5
third_party/nixpkgs/doc/functions/debug.section.md
vendored
Normal file
5
third_party/nixpkgs/doc/functions/debug.section.md
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Debugging Nix Expressions {#sec-debug}
|
||||
|
||||
Nix is a unityped, dynamic language, this means every value can potentially appear anywhere. Since it is also non-strict, evaluation order and what ultimately is evaluated might surprise you. Therefore it is important to be able to debug nix expressions.
|
||||
|
||||
In the `lib/debug.nix` file you will find a number of functions that help (pretty-)printing values while evaluation is running. You can even specify how deep these values should be printed recursively, and transform them on the fly. Please consult the docstrings in `lib/debug.nix` for usage information.
|
57
third_party/nixpkgs/doc/functions/generators.section.md
vendored
Normal file
57
third_party/nixpkgs/doc/functions/generators.section.md
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
# Generators {#sec-generators}
|
||||
Generators are functions that create file formats from nix data structures, e. g. for configuration files. There are generators available for: `INI`, `JSON` and `YAML`
|
||||
|
||||
All generators follow a similar call interface: `generatorName configFunctions data`, where `configFunctions` is an attrset of user-defined functions that format nested parts of the content. They each have common defaults, so often they do not need to be set manually. An example is `mkSectionName ? (name: libStr.escape [ "[" "]" ] name)` from the `INI` generator. It receives the name of a section and sanitizes it. The default `mkSectionName` escapes `[` and `]` with a backslash.
|
||||
|
||||
Generators can be fine-tuned to produce exactly the file format required by your application/service. One example is an INI-file format which uses `: ` as separator, the strings `"yes"`/`"no"` as boolean values and requires all string values to be quoted:
|
||||
|
||||
```nix
|
||||
let
|
||||
inherit (lib) generators isString;
|
||||
|
||||
customToINI = generators.toINI {
|
||||
# specifies how to format a key/value pair
|
||||
mkKeyValue = generators.mkKeyValueDefault {
|
||||
# specifies the generated string for a subset of nix values
|
||||
mkValueString = v:
|
||||
if v == true then ''"yes"''
|
||||
else if v == false then ''"no"''
|
||||
else if isString v then ''"${v}"''
|
||||
# and delegates all other values to the default generator
|
||||
else generators.mkValueStringDefault {} v;
|
||||
} ":";
|
||||
};
|
||||
|
||||
# the INI file can now be given as plain old nix values
|
||||
in customToINI {
|
||||
main = {
|
||||
pushinfo = true;
|
||||
autopush = false;
|
||||
host = "localhost";
|
||||
port = 42;
|
||||
};
|
||||
mergetool = {
|
||||
merge = "diff3";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
This will produce the following INI file as nix string:
|
||||
|
||||
```INI
|
||||
[main]
|
||||
autopush:"no"
|
||||
host:"localhost"
|
||||
port:42
|
||||
pushinfo:"yes"
|
||||
str\:ange:"very::strange"
|
||||
|
||||
[mergetool]
|
||||
merge:"diff3"
|
||||
```
|
||||
|
||||
::: {.note}
|
||||
Nix store paths can be converted to strings by enclosing a derivation attribute like so: `"${drv}"`.
|
||||
:::
|
||||
|
||||
Detailed documentation for each generator can be found [here](#sec-functions-library-generators)
|
5
third_party/nixpkgs/doc/functions/library.md.in
vendored
Normal file
5
third_party/nixpkgs/doc/functions/library.md.in
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Nixpkgs Library Functions {#sec-functions-library}
|
||||
|
||||
Nixpkgs provides a standard library at `pkgs.lib`, or through `import <nixpkgs/lib>`.
|
||||
|
||||
<!-- nixdoc-generated documentation must be appended here during build! -->
|
56
third_party/nixpkgs/doc/functions/nix-gitignore.section.md
vendored
Normal file
56
third_party/nixpkgs/doc/functions/nix-gitignore.section.md
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
# pkgs.nix-gitignore {#sec-pkgs-nix-gitignore}
|
||||
|
||||
`pkgs.nix-gitignore` is a function that acts similarly to `builtins.filterSource` but also allows filtering with the help of the gitignore format.
|
||||
|
||||
## Usage {#sec-pkgs-nix-gitignore-usage}
|
||||
|
||||
`pkgs.nix-gitignore` exports a number of functions, but you'll most likely need either `gitignoreSource` or `gitignoreSourcePure`. As their first argument, they both accept either 1. a file with gitignore lines or 2. a string with gitignore lines, or 3. a list of either of the two. They will be concatenated into a single big string.
|
||||
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> {} }: {
|
||||
|
||||
src = nix-gitignore.gitignoreSource [] ./source;
|
||||
# Simplest version
|
||||
|
||||
src = nix-gitignore.gitignoreSource "supplemental-ignores\n" ./source;
|
||||
# This one reads the ./source/.gitignore and concats the auxiliary ignores
|
||||
|
||||
src = nix-gitignore.gitignoreSourcePure "ignore-this\nignore-that\n" ./source;
|
||||
# Use this string as gitignore, don't read ./source/.gitignore.
|
||||
|
||||
src = nix-gitignore.gitignoreSourcePure ["ignore-this\nignore-that\n" ~/.gitignore] ./source;
|
||||
# It also accepts a list (of strings and paths) that will be concatenated
|
||||
# once the paths are turned to strings via readFile.
|
||||
}
|
||||
```
|
||||
|
||||
These functions are derived from the `Filter` functions by setting the first filter argument to `(_: _: true)`:
|
||||
|
||||
```nix
|
||||
{
|
||||
gitignoreSourcePure = gitignoreFilterSourcePure (_: _: true);
|
||||
gitignoreSource = gitignoreFilterSource (_: _: true);
|
||||
}
|
||||
```
|
||||
|
||||
Those filter functions accept the same arguments the `builtins.filterSource` function would pass to its filters, thus `fn: gitignoreFilterSourcePure fn ""` should be extensionally equivalent to `filterSource`. The file is blacklisted if it's blacklisted by either your filter or the gitignoreFilter.
|
||||
|
||||
If you want to make your own filter from scratch, you may use
|
||||
|
||||
```nix
|
||||
{
|
||||
gitignoreFilter = ign: root: filterPattern (gitignoreToPatterns ign) root;
|
||||
}
|
||||
```
|
||||
|
||||
## gitignore files in subdirectories {#sec-pkgs-nix-gitignore-usage-recursive}
|
||||
|
||||
If you wish to use a filter that would search for .gitignore files in subdirectories, just like git does by default, use this function:
|
||||
|
||||
```nix
|
||||
{
|
||||
# gitignoreFilterRecursiveSource = filter: patterns: root:
|
||||
# OR
|
||||
gitignoreRecursiveSource = gitignoreFilterSourcePure (_: _: true);
|
||||
}
|
||||
```
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue