Skip to content

Commit 3356399

Browse files
committed
Merge branch 'master' into staging-next
2 parents f1fefd4 + 10cc1df commit 3356399

File tree

104 files changed

+1151
-438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1151
-438
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ If applicable, add screenshots to help explain your problem.
2626
Add any other context about the problem here.
2727

2828
### Notify maintainers
29+
2930
<!--
3031
Please @ people who are in the `meta.maintainers` list of the offending package or module.
3132
If in doubt, check `git blame` for whoever last touched something.

.github/ISSUE_TEMPLATE/build_failure.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
---
22
name: Build failure
33
about: Create a report to help us improve
4-
title: ''
4+
title: 'Build failure: PACKAGENAME'
55
labels: '0.kind: build failure'
66
assignees: ''
77

88
---
99

1010
### Steps To Reproduce
11+
1112
Steps to reproduce the behavior:
1213
1. build *X*
1314

1415
### Build log
16+
1517
```
1618
log here if short otherwise a link to a gist
1719
```
1820

1921
### Additional context
22+
2023
Add any other context about the problem here.
2124

2225
### Notify maintainers
26+
2327
<!--
2428
Please @ people who are in the `meta.maintainers` list of the offending package or module.
2529
If in doubt, check `git blame` for whoever last touched something.
2630
-->
2731

2832
### Metadata
33+
2934
Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result.
3035

3136
```console

.github/ISSUE_TEMPLATE/missing_documentation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Missing or incorrect documentation
33
about: Help us improve the Nixpkgs and NixOS reference manuals
4-
title: ''
4+
title: 'Documentation: '
55
labels: '9.needs: documentation'
66
assignees: ''
77

@@ -11,6 +11,10 @@ assignees: ''
1111

1212
<!-- describe your problem -->
1313

14+
## Proposal
15+
16+
<!-- propose a solution (optional) -->
17+
1418
## Checklist
1519

1620
<!-- make sure this issue is not redundant or obsolete -->
@@ -26,7 +30,3 @@ assignees: ''
2630
[open documentation issues]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+label%3A%229.needs%3A+documentation%22
2731
[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
2832

29-
## Proposal
30-
31-
<!-- propose a solution -->
32-
Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,28 @@
11
---
22
name: Out-of-date package reports
33
about: For packages that are out-of-date
4-
title: ''
4+
title: 'Update request: PACKAGENAME OLDVERSION → NEWVERSION'
55
labels: '9.needs: package (update)'
66
assignees: ''
77

88
---
99

10-
11-
###### Checklist
12-
13-
<!-- Note that these are hard requirements -->
14-
15-
<!--
16-
You can use the "Go to file" functionality on GitHub to find the package
17-
Then you can go to the history for this package
18-
Find the latest "package_name: old_version -> new_version" commit
19-
The "new_version" is the current version of the package
20-
-->
21-
- [ ] Checked the [nixpkgs master branch](https://github.com/NixOS/nixpkgs)
10+
- Package name:
11+
- Latest released version:
12+
<!-- Search your package here: https://search.nixos.org/packages?channel=unstable -->
13+
- Current version on the unstable channel:
14+
- Current version on the stable/release channel:
2215
<!--
2316
Type the name of your package and try to find an open pull request for the package
2417
If you find an open pull request, you can review it!
2518
There's a high chance that you'll have the new version right away while helping the community!
2619
-->
2720
- [ ] Checked the [nixpkgs pull requests](https://github.com/NixOS/nixpkgs/pulls)
2821

29-
###### Project name
30-
`nix search` name:
31-
<!--
32-
The current version can be found easily with the same process as above for checking the master branch
33-
If an open PR is present for the package, take this version as the current one and link to the PR
34-
-->
35-
current version:
36-
desired version:
37-
38-
###### Notify maintainers
39-
<!--
40-
Search your package here: https://search.nixos.org/packages?channel=unstable
41-
If no maintainer is listed for your package, tag the person that last updated the package
42-
-->
22+
**Notify maintainers**
4323

44-
maintainers:
24+
<!-- If the search.nixos.org result shows no maintainers, tag the person that last updated the package. -->
4525

46-
###### Note for maintainers
26+
-----
4727

48-
Please tag this issue in your PR.
28+
Note for maintainers: Please tag this issue in your PR.

.github/ISSUE_TEMPLATE/packaging_request.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
22
name: Packaging requests
33
about: For packages that are missing
4-
title: ''
4+
title: 'Package request: PACKAGENAME'
55
labels: '0.kind: packaging request'
66
assignees: ''
77

88
---
99

1010
**Project description**
11-
_describe the project a little_
11+
12+
<!-- Describe the project a little: -->
1213

1314
**Metadata**
1415

doc/default.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{ pkgs ? (import ./.. { }), nixpkgs ? { }}:
22
let
3-
lib = pkgs.lib;
43
doc-support = import ./doc-support { inherit pkgs nixpkgs; };
54
in pkgs.stdenv.mkDerivation {
65
name = "nixpkgs-manual";
@@ -15,7 +14,7 @@ in pkgs.stdenv.mkDerivation {
1514
xmlformat
1615
];
1716

18-
src = lib.cleanSource ./.;
17+
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
1918

2019
postPatch = ''
2120
ln -s ${doc-support} ./doc-support/result

doc/stdenv/stdenv.chapter.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ Before and after running `make`, the hooks `preBuild` and `postBuild` are called
626626

627627
### The check phase {#ssec-check-phase}
628628

629-
The check phase checks whether the package was built correctly by running its test suite. The default `checkPhase` calls `make $checkTarget`, but only if the `doCheck` variable is enabled (see below).
629+
The check phase checks whether the package was built correctly by running its test suite. The default `checkPhase` calls `make $checkTarget`, but only if the [`doCheck` variable](#var-stdenv-doCheck) is enabled.
630630

631631
#### Variables controlling the check phase {#variables-controlling-the-check-phase}
632632

@@ -646,7 +646,8 @@ See the [build phase](#var-stdenv-makeFlags) for details.
646646

647647
##### `checkTarget` {#var-stdenv-checkTarget}
648648

649-
The make target that runs the tests. Defaults to `check` if it exists, otherwise `test`; if neither is found, do nothing.
649+
The `make` target that runs the tests.
650+
If unset, use `check` if it exists, otherwise `test`; if neither is found, do nothing.
650651

651652
##### `checkFlags` / `checkFlagsArray` {#var-stdenv-checkFlags}
652653

lib/licenses.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,13 @@ in mkLicense lset) ({
343343
free = false;
344344
};
345345

346+
ecl20 = {
347+
fullName = "Educational Community License, Version 2.0";
348+
url = "https://opensource.org/licenses/ECL-2.0";
349+
shortName = "ECL 2.0";
350+
spdxId = "ECL-2.0";
351+
};
352+
346353
efl10 = {
347354
spdxId = "EFL-1.0";
348355
fullName = "Eiffel Forum License v1.0";

lib/path/default.nix

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ let
44

55
inherit (builtins)
66
isString
7+
isPath
78
split
89
match
910
;
@@ -25,6 +26,10 @@ let
2526
assertMsg
2627
;
2728

29+
inherit (lib.path.subpath)
30+
isValid
31+
;
32+
2833
# Return the reason why a subpath is invalid, or `null` if it's valid
2934
subpathInvalidReason = value:
3035
if ! isString value then
@@ -94,6 +99,52 @@ let
9499

95100
in /* No rec! Add dependencies on this file at the top. */ {
96101

102+
/* Append a subpath string to a path.
103+
104+
Like `path + ("/" + string)` but safer, because it errors instead of returning potentially surprising results.
105+
More specifically, it checks that the first argument is a [path value type](https://nixos.org/manual/nix/stable/language/values.html#type-path"),
106+
and that the second argument is a valid subpath string (see `lib.path.subpath.isValid`).
107+
108+
Type:
109+
append :: Path -> String -> Path
110+
111+
Example:
112+
append /foo "bar/baz"
113+
=> /foo/bar/baz
114+
115+
# subpaths don't need to be normalised
116+
append /foo "./bar//baz/./"
117+
=> /foo/bar/baz
118+
119+
# can append to root directory
120+
append /. "foo/bar"
121+
=> /foo/bar
122+
123+
# first argument needs to be a path value type
124+
append "/foo" "bar"
125+
=> <error>
126+
127+
# second argument needs to be a valid subpath string
128+
append /foo /bar
129+
=> <error>
130+
append /foo ""
131+
=> <error>
132+
append /foo "/bar"
133+
=> <error>
134+
append /foo "../bar"
135+
=> <error>
136+
*/
137+
append =
138+
# The absolute path to append to
139+
path:
140+
# The subpath string to append
141+
subpath:
142+
assert assertMsg (isPath path) ''
143+
lib.path.append: The first argument is of type ${builtins.typeOf path}, but a path was expected'';
144+
assert assertMsg (isValid subpath) ''
145+
lib.path.append: Second argument is not a valid subpath string:
146+
${subpathInvalidReason subpath}'';
147+
path + ("/" + subpath);
97148

98149
/* Whether a value is a valid subpath string.
99150
@@ -133,7 +184,9 @@ in /* No rec! Add dependencies on this file at the top. */ {
133184
subpath.isValid "./foo//bar/"
134185
=> true
135186
*/
136-
subpath.isValid = value:
187+
subpath.isValid =
188+
# The value to check
189+
value:
137190
subpathInvalidReason value == null;
138191

139192

@@ -150,11 +203,11 @@ in /* No rec! Add dependencies on this file at the top. */ {
150203
151204
Laws:
152205
153-
- (Idempotency) Normalising multiple times gives the same result:
206+
- Idempotency - normalising multiple times gives the same result:
154207
155208
subpath.normalise (subpath.normalise p) == subpath.normalise p
156209
157-
- (Uniqueness) There's only a single normalisation for the paths that lead to the same file system node:
210+
- Uniqueness - there's only a single normalisation for the paths that lead to the same file system node:
158211
159212
subpath.normalise p != subpath.normalise q -> $(realpath ${p}) != $(realpath ${q})
160213
@@ -210,9 +263,12 @@ in /* No rec! Add dependencies on this file at the top. */ {
210263
subpath.normalise "/foo"
211264
=> <error>
212265
*/
213-
subpath.normalise = path:
214-
assert assertMsg (subpathInvalidReason path == null)
215-
"lib.path.subpath.normalise: Argument is not a valid subpath string: ${subpathInvalidReason path}";
216-
joinRelPath (splitRelPath path);
266+
subpath.normalise =
267+
# The subpath string to normalise
268+
subpath:
269+
assert assertMsg (isValid subpath) ''
270+
lib.path.subpath.normalise: Argument is not a valid subpath string:
271+
${subpathInvalidReason subpath}'';
272+
joinRelPath (splitRelPath subpath);
217273

218274
}

lib/path/tests/unit.nix

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,44 @@
33
{ libpath }:
44
let
55
lib = import libpath;
6-
inherit (lib.path) subpath;
6+
inherit (lib.path) append subpath;
77

88
cases = lib.runTests {
9+
# Test examples from the lib.path.append documentation
10+
testAppendExample1 = {
11+
expr = append /foo "bar/baz";
12+
expected = /foo/bar/baz;
13+
};
14+
testAppendExample2 = {
15+
expr = append /foo "./bar//baz/./";
16+
expected = /foo/bar/baz;
17+
};
18+
testAppendExample3 = {
19+
expr = append /. "foo/bar";
20+
expected = /foo/bar;
21+
};
22+
testAppendExample4 = {
23+
expr = (builtins.tryEval (append "/foo" "bar")).success;
24+
expected = false;
25+
};
26+
testAppendExample5 = {
27+
expr = (builtins.tryEval (append /foo /bar)).success;
28+
expected = false;
29+
};
30+
testAppendExample6 = {
31+
expr = (builtins.tryEval (append /foo "")).success;
32+
expected = false;
33+
};
34+
testAppendExample7 = {
35+
expr = (builtins.tryEval (append /foo "/bar")).success;
36+
expected = false;
37+
};
38+
testAppendExample8 = {
39+
expr = (builtins.tryEval (append /foo "../bar")).success;
40+
expected = false;
41+
};
42+
43+
# Test examples from the lib.path.subpath.isValid documentation
944
testSubpathIsValidExample1 = {
1045
expr = subpath.isValid null;
1146
expected = false;
@@ -30,6 +65,7 @@ let
3065
expr = subpath.isValid "./foo//bar/";
3166
expected = true;
3267
};
68+
# Some extra tests
3369
testSubpathIsValidTwoDotsEnd = {
3470
expr = subpath.isValid "foo/..";
3571
expected = false;
@@ -71,6 +107,7 @@ let
71107
expected = true;
72108
};
73109

110+
# Test examples from the lib.path.subpath.normalise documentation
74111
testSubpathNormaliseExample1 = {
75112
expr = subpath.normalise "foo//bar";
76113
expected = "./foo/bar";
@@ -107,6 +144,7 @@ let
107144
expr = (builtins.tryEval (subpath.normalise "/foo")).success;
108145
expected = false;
109146
};
147+
# Some extra tests
110148
testSubpathNormaliseIsValidDots = {
111149
expr = subpath.normalise "./foo/.bar/.../baz...qux";
112150
expected = "./foo/.bar/.../baz...qux";

0 commit comments

Comments
 (0)