forked from LnL7/nix
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into lazy-trees-post-s…
…ettings
- Loading branch information
Showing
226 changed files
with
4,182 additions
and
1,562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
synopsis: "`nix-repl`'s `:doc` shows documentation comments" | ||
significance: significant | ||
issues: | ||
- 3904 | ||
- 10771 | ||
prs: | ||
- 1652 | ||
- 9054 | ||
- 11072 | ||
--- | ||
|
||
`nix repl` has a `:doc` command that previously only rendered documentation for internally defined functions. | ||
This feature has been extended to also render function documentation comments, in accordance with [RFC 145]. | ||
|
||
Example: | ||
|
||
``` | ||
nix-repl> :doc lib.toFunction | ||
Function toFunction | ||
… defined at /home/user/h/nixpkgs/lib/trivial.nix:1072:5 | ||
Turns any non-callable values into constant functions. Returns | ||
callable values as is. | ||
Inputs | ||
v | ||
: Any value | ||
Examples | ||
:::{.example} | ||
## lib.trivial.toFunction usage example | ||
| nix-repl> lib.toFunction 1 2 | ||
| 1 | ||
| | ||
| nix-repl> lib.toFunction (x: x + 1) 2 | ||
| 3 | ||
::: | ||
``` | ||
|
||
Known limitations: | ||
- It does not render documentation for "formals", such as `{ /** the value to return */ x, ... }: x`. | ||
- Some extensions to markdown are not yet supported, as you can see in the example above. | ||
|
||
We'd like to acknowledge Yingchi Long for proposing a proof of concept for this functionality in [#9054](https://github.com/NixOS/nix/pull/9054), as well as @sternenseemann and Johannes Kirschbauer for their contributions, proposals, and their work on [RFC 145]. | ||
|
||
[RFC 145]: https://github.com/NixOS/rfcs/pull/145 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
synopsis: "`nix-shell` shebang uses relative path" | ||
prs: | ||
- 5088 | ||
- 11058 | ||
issues: | ||
- 4232 | ||
--- | ||
|
||
<!-- unfortunately no link target for the specific syntax --> | ||
Relative [path](@docroot@/language/values.md#type-path) literals in `nix-shell` shebang scripts' options are now resolved relative to the [script's location](@docroot@/glossary?highlight=base%20directory#gloss-base-directory). | ||
Previously they were resolved relative to the current working directory. | ||
|
||
For example, consider the following script in `~/myproject/say-hi`: | ||
|
||
```shell | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell --expr 'import ./shell.nix' | ||
#!nix-shell --arg toolset './greeting-tools.nix' | ||
#!nix-shell -i bash | ||
hello | ||
``` | ||
|
||
Older versions of `nix-shell` would resolve `shell.nix` relative to the current working directory; home in this example: | ||
|
||
```console | ||
[hostname:~]$ ./myproject/say-hi | ||
error: | ||
… while calling the 'import' builtin | ||
at «string»:1:2: | ||
1| (import ./shell.nix) | ||
| ^ | ||
|
||
error: path '/home/user/shell.nix' does not exist | ||
``` | ||
|
||
Since this release, `nix-shell` resolves `shell.nix` relative to the script's location, and `~/myproject/shell.nix` is used. | ||
|
||
```console | ||
$ ./myproject/say-hi | ||
Hello, world! | ||
``` | ||
|
||
**Opt-out** | ||
|
||
This is technically a breaking change, so we have added an option so you can adapt independently of your Nix update. | ||
The old behavior can be opted into by setting the option [`nix-shell-shebang-arguments-relative-to-script`](@docroot@/command-ref/conf-file.md#conf-nix-shell-shebang-arguments-relative-to-script) to `false`. | ||
This option will be removed in a future release. | ||
|
||
**`nix` command shebang** | ||
|
||
The experimental [`nix` command shebang](@docroot@/command-ref/new-cli/nix.md?highlight=shebang#shebang-interpreter) already behaves in this script-relative manner. | ||
|
||
Example: | ||
|
||
```shell | ||
#!/usr/bin/env nix | ||
#!nix develop | ||
#!nix --expr ``import ./shell.nix`` | ||
#!nix -c bash | ||
hello | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ let | |
"nix-flake" | ||
"nix-flake-tests" | ||
"nix-main" | ||
"nix-main-c" | ||
"nix-cmd" | ||
"nix-ng" | ||
]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.