Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflicts in lazy trees from master #14

Draft
wants to merge 176 commits into
base: lazy-trees
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
0402336
Evaluate nix-shell -i args relative to script
matthewbauer Aug 3, 2021
9a46411
tests: ensure nix-shell uses relative paths for expressions
tomberek Nov 26, 2023
f66f498
notes: document change in nix-shell behavior
tomberek Nov 26, 2023
35bdb9c
Support hard links in tarballs
edolstra Jun 11, 2024
bd37a70
Update tests/functional/tarball.sh
edolstra Jun 11, 2024
efd4bf6
Update src/libfetchers/git-utils.cc
edolstra Jun 12, 2024
68b8a28
tests/run.sh: Check that env is mostly unmodified
roberth Jun 10, 2024
316b58d
tests/shell.sh: Check that env is mostly unmodified
roberth Jun 10, 2024
992912f
test-support: Add TracingFileSystemObjectSink
roberth Jul 1, 2024
1fac22b
GitFileSystemObjectSink: Add path context to some messages
roberth Jul 1, 2024
a409c1a
Start unit testing GitFileSystemObjectSink
roberth Jul 1, 2024
f032956
GitFileSystemObjectSink: catch an overflow
roberth Jul 1, 2024
1318135
Refactor: rename runEnv -> isNixShell
roberth Jul 6, 2024
5c367ec
Refactor: rename left -> remainingArgs
roberth Jul 6, 2024
e9479b2
nix-build.cc: Refactor: extract baseDir variable
roberth Jul 6, 2024
76245ff
nix-build.cc: Refactor: extract sourcePath, resolvedPath variables
roberth Jul 6, 2024
32fb127
Add legacy setting: nix-shell-always-looks-for-shell-nix
roberth Jul 6, 2024
a22f8b5
rl-next: Add note about shell.nix lookups
roberth Jul 6, 2024
b865625
nix-shell: Look for shell.nix when directory is specified
roberth Jul 6, 2024
afbe7c3
rl-next: Enter PR
roberth Jul 6, 2024
8838f5c
Merge remote-tracking branch 'matthewbauer/nix-shell-relative-shebang…
roberth Jul 6, 2024
d5854f3
rl-next: Typo
roberth Jul 6, 2024
f5b59fb
Fix and extend nix-shell baseDir test
roberth Jul 6, 2024
6c6d526
Add legacy setting: nix-shell-always-looks-for-shell-nix
roberth Jul 6, 2024
6959ac1
rl-next: Add note about shell.nix lookups
roberth Jul 6, 2024
4c59d6e
Merge branch 'nix-shell-lookup-shell-nix' into more-nix-shell
roberth Jul 6, 2024
63262e7
Add opt-out: nix-shell-shebang-arguments-relative-to-script
roberth Jul 6, 2024
73602a7
nix-shell: Look for shell.nix when directory is specified
roberth Jul 6, 2024
2f1fada
Add legacy setting: nix-shell-always-looks-for-shell-nix
roberth Jul 6, 2024
c4a20a4
rl-next: Add note about shell.nix lookups
roberth Jul 6, 2024
0f8a655
tests/functional/shell.nix: Implement runHook for dummy stdenv
roberth Jul 7, 2024
e1106b4
tests/functional/nix-shell.sh: Fix Polo test for VM test
roberth Jul 7, 2024
3e424b1
Merge branch 'nix-shell-lookup-shell-nix' into more-nix-shell
roberth Jul 7, 2024
193dd5d
Fixup: add missing test file
roberth Jul 7, 2024
48804cf
docs: fill out language/types.md#type-path
rhendric Jul 8, 2024
ab0b54b
Remove the Hydra status check workflow
edolstra Jul 8, 2024
c5284a8
Forgot to include `config-expr.hh` in some places
Ericson2314 Jul 7, 2024
6e5cec2
Use a meson "generator" to deduplicate `.gen.hh` creation
Ericson2314 Jul 8, 2024
1439de8
Merge pull request #11063 from obsidiansystems/config-expr
Ericson2314 Jul 8, 2024
f1d88e0
Merge pull request #11064 from obsidiansystems/header-generater
Ericson2314 Jul 8, 2024
7a6269b
Package the Nix CLI with Meson
Ericson2314 Jul 5, 2024
d69fcbc
Merge pull request #11065 from DeterminateSystems/remove-hydra-status…
roberth Jul 9, 2024
3755493
Merge pull request #11060 from obsidiansystems/meson-nix
Ericson2314 Jul 9, 2024
4c78850
Remove reference to check-hydra-status
edolstra Jul 9, 2024
142e566
Merge pull request #11071 from DeterminateSystems/remove-stray-line
edolstra Jul 9, 2024
d942d50
Merge remote-tracking branch 'upstream/master' into more-nix-shell
roberth Jul 10, 2024
c4e3e2d
Soft-deprecate the compatibility settings
roberth Jul 10, 2024
8642075
Merge remote-tracking branch 'upstream/master' into support-hardlinks…
roberth Jul 11, 2024
4fd8f19
Fix build to use CanonPath in new FSO sinks
roberth Jul 11, 2024
426e2af
Merge pull request #11077 from hercules-ci/support-hardlinks-in-tarballs
Ericson2314 Jul 11, 2024
6f5f741
doc/rl-next/shebang-relative: Update with example
roberth Jul 11, 2024
bb312a7
Edit CompatibilitySettings
roberth Jul 11, 2024
0395ff9
packaging: Set darwinMinVersion to fix x86_64-darwin build
roberth Jul 11, 2024
87323a5
Remove unused InstallableFlake::getFlakeOutputs()
edolstra Jul 11, 2024
0363dbf
Merge pull request #11081 from DeterminateSystems/remove-dead-code
edolstra Jul 11, 2024
6108055
SymbolStr: Remove std::string conversion
edolstra Jun 6, 2024
b57c361
Merge pull request #11082 from DeterminateSystems/symbol-table-string…
edolstra Jul 12, 2024
f070d68
Add BaseError assignment operators
roberth Jul 12, 2024
3fc77f2
No global settings in `libnixfetchers` and `libnixflake`
Ericson2314 Jul 1, 2024
8df041c
Solve unused header warnings reported by clangd
roberth Jul 12, 2024
27eaeeb
nar-accessor.cc: Silence unused variable warning
roberth Jul 12, 2024
dfb169c
Merge pull request #11007 from obsidiansystems/push-down-fetcher-flak…
Ericson2314 Jul 12, 2024
337a5a2
Merge pull request #11089 from NixOS/warnings-includes
Ericson2314 Jul 12, 2024
51a12b3
Fix stackoverflow during doc generation
amarshall Jul 12, 2024
11a6db5
Remove unused operator<=>'s that darwin can't generate
roberth Jul 12, 2024
6c5d2a1
Merge pull request #11090 from amarshall/fix-stackoverflow-build
roberth Jul 12, 2024
cdc23b6
Provide std::hash<SourcePath>
edolstra Jun 6, 2024
750ba9f
Merge remote-tracking branch 'upstream/master' into lazy-trees-post-s…
Ericson2314 Jul 12, 2024
2a95a2d
Merge pull request #11091 from NixOS/darwin-no-map-spaceship
edolstra Jul 12, 2024
e764ed3
Eval cache: fix cache regressions
kognise Jul 12, 2024
6c4470e
Clean up cache for all commands
kognise Jul 12, 2024
bc83b9d
Remove `comparator.hh` and switch to `<=>` in a bunch of places
Ericson2314 May 16, 2024
db3e99d
Merge pull request #10838 from obsidiansystems/spaceship-no-comparator
Ericson2314 Jul 12, 2024
b1effc9
Merge pull request #11080 from NixOS/fix-build-x86_64-darwin-minSDK
tomberek Jul 13, 2024
1a8defd
Refactor: rename C++ concatStringsSep -> dropEmptyInitThenConcatStrin…
roberth Jul 12, 2024
79eb0ad
dropEmptyInitThenConcatStringSep: Check that we don't drop...
roberth Jul 12, 2024
a681d35
Add fresh concatStringsSep without bug
roberth Jul 12, 2024
ea966a7
dropEmptyInitThenConcatStringsSep -> concatStringSep: diagnostics and…
roberth Jul 12, 2024
39878c8
dropEmptyInitThenConcatStringsSep -> concatStringSep: preserve empty …
roberth Jul 12, 2024
3f37785
NIX_REMOTE_SYSTEMS: actually support multiple :-separated entries
roberth Jul 12, 2024
75dde71
dropEmptyInitThenConcatStringsSep -> concatStringSep: sigs are non-empty
roberth Jul 12, 2024
608a425
dropEmptyInitThenConcatStringsSep -> concatStringSep: diag
roberth Jul 12, 2024
d3e49ac
dropEmptyInitThenConcatStringsSep -> concatStringSep: shortRefs are n…
roberth Jul 12, 2024
49d100b
dropEmptyInitThenConcatStringsSep -> concatStringSep: output name emp…
roberth Jul 12, 2024
f1966e2
dropEmptyInitThenConcatStringsSep -> concatStringSep: store paths are…
roberth Jul 12, 2024
e64643b
dropEmptyInitThenConcatStringsSep -> concatStringSep: feature should …
roberth Jul 12, 2024
3b77f13
dropEmptyInitThenConcatStringsSep -> concatStringSep: experimental fe…
roberth Jul 12, 2024
837c361
dropEmptyInitThenConcatStringsSep -> concatStringSep: escaped shell a…
roberth Jul 12, 2024
4b34feb
dropEmptyInitThenConcatStringsSep -> concatStringSep: system string s…
roberth Jul 12, 2024
0480bfe
dropEmptyInitThenConcatStringsSep -> concatStringSep: do not drop att…
roberth Jul 12, 2024
062672b
dropEmptyInitThenConcatStringsSep -> concatStringSep: CLI commands ar…
roberth Jul 12, 2024
d904302
dropEmptyInitThenConcatStringsSep -> concatStringSep: break nix help …
roberth Jul 12, 2024
cf3c5cd
dropEmptyInitThenConcatStringsSep -> concatStringSep: showVersions ve…
roberth Jul 12, 2024
0fe3525
illegal configuration line -> syntax error in configuration line
roberth Jul 12, 2024
4029426
dropEmptyInitThenConcatStringsSep -> concatStringSep: tokens from tok…
roberth Jul 12, 2024
9ca42d5
dropEmptyInitThenConcatStringsSep -> concatStringSep: setting value w…
roberth Jul 12, 2024
76b2d5e
dropEmptyInitThenConcatStringsSep -> concatStringSep: PATH handling
roberth Jul 12, 2024
6b2c277
dropEmptyInitThenConcatStringsSep -> concatStringSep: sigs are not empty
roberth Jul 12, 2024
1c97718
dropEmptyInitThenConcatStringsSep: Allow it to drop items again
roberth Jul 13, 2024
d40fdb5
dropEmptyInitThenConcatStringsSep: Update doc and deprecate
roberth Jul 14, 2024
97e0110
dropEmptyInitThenConcatStringsSep -> concatStringSep: empty separator
roberth Jul 14, 2024
7e604f7
concatStrings: Give compiler access to definition for inlining
roberth Jul 14, 2024
9d7397c
Merge pull request #11093 from NixOS/fix-concatStringsSep
roberth Jul 14, 2024
bc801e2
lint: fix shellcheck for misc/systemv/nix-daemon
fzakaria Jul 15, 2024
104aba0
Remove nix-daemon from exclusion
fzakaria Jul 15, 2024
550b347
Include the accessor in the SourcePath hash
edolstra Jul 15, 2024
63f520f
doc/testing: Typo
roberth Jul 9, 2024
e5af7cb
libutil: Add Pos::getSnippetUpTo(Pos)
roberth Jul 9, 2024
7fae378
Track doc comments and render them in :doc
roberth Jul 8, 2024
e68234c
libexpr: Rearrange lexer files so that yylex_init_extra can be found
roberth Jul 9, 2024
491b9cf
Refactor: extract DocComment::getInnerText(PosTable)
roberth Jul 9, 2024
d4f576b
nix repl: Render docs for attributes
roberth Jul 9, 2024
cef11b2
Add missing .sh in _NIX_TEST_ACCEPT=1 message
roberth Jul 9, 2024
f9243ec
tests/functional/repl.sh: Work around GHA failure
roberth Jul 9, 2024
77e9f9e
libexpr: Get rid of unused line tracking fields
roberth Jul 11, 2024
71cb8bf
libexpr: Rename "column" fields to offset
roberth Jul 11, 2024
8a85529
tests/function/repl: Characterise the missing doc comment behavior
roberth Jul 15, 2024
6bbd493
libcmd/repl-interacter: INT_MAX -> numeric_limits
roberth Jul 15, 2024
131b6cc
nixexpr.hh: Avoid the warning and pragmas
roberth Jul 15, 2024
2181747
Doc comments: use std::unordered_map
roberth Jul 15, 2024
ac89df8
libcmd/repl.cc: Explain evalString call and defend
roberth Jul 15, 2024
6a125e6
Revert "Doc comments: use std::unordered_map"
roberth Jul 15, 2024
ce31a04
Use HintFmt for doc comments
roberth Jul 15, 2024
03d3370
Revert "Use HintFmt for doc comments"
roberth Jul 15, 2024
61a4d3d
getSnippetUpTo: Return optional
roberth Jul 15, 2024
c6b5503
Merge pull request #11072 from NixOS/doc-comments
roberth Jul 15, 2024
1bec90e
tests/functional/repl.sh: fail test on wrong stdout
GoldsteinE Jul 15, 2024
846869d
Make goals use C++20 coroutines (#11005)
L-as Jul 15, 2024
1a273a6
Inline `settings.pluginFiles.name`
Ericson2314 Jul 2, 2024
0feeab7
Move plugins infra to `libnixmain`
Ericson2314 Jul 2, 2024
808082e
Ensure we can construct remote store configs in isolation
Ericson2314 Jul 15, 2024
03326d6
Merge pull request #11110 from GoldsteinE/fix-repl-tests
roberth Jul 15, 2024
4bbadba
Merge pull request #11108 from obsidiansystems/remote-store-constructors
Ericson2314 Jul 16, 2024
9c6678d
Merge pull request #11092 from DeterminateSystems/hash-SourcePath
edolstra Jul 16, 2024
6c9d62d
Doc comments: use std::unordered_map
roberth Jul 15, 2024
3d8fa9f
Pos::getSnippetUpTo(): Fix warning
edolstra Jul 16, 2024
64b4600
Add std::hash<PosIdx>
roberth Jul 16, 2024
9300f85
Merge pull request #11114 from DeterminateSystems/fix-warning
edolstra Jul 16, 2024
d0e9878
Remove unused boost include and split out std-hash.hh
roberth Jul 16, 2024
0a1a116
builtins.genericClosure: fix documentation typo
philiptaron Jul 16, 2024
8f22245
Merge pull request #11119 from philiptaron/attrbute
roberth Jul 16, 2024
5b6a21a
Avoid casting function pointer in libutil test support
L-as Jul 16, 2024
a1f3f10
Check if drv is initialized in DerivationGoal::waiteeDone
L-as Jul 16, 2024
463256b
Merge pull request #11122 from L-as/fix-ub
Ericson2314 Jul 16, 2024
9fae50e
Add parser test for indented strings
infinisil Jul 17, 2024
b230c01
Merge pull request #11014 from obsidiansystems/plugins-libmain
roberth Jul 17, 2024
f5ebaea
Simplify PosIdx::hash()
roberth Jul 17, 2024
ece334b
tests/functional/repl: Characterize side effecting print behavior
roberth Jul 14, 2024
a0635a8
printAttrs: Force item before determining whether to print multi-line
roberth Jul 14, 2024
da3eff6
printList: Force item before determining whether to print multi-line
roberth Jul 14, 2024
464e592
Avoid accessing uninitialized settings in own init (#11117)
L-as Jul 17, 2024
621c23b
Merge pull request #11113 from NixOS/doc-comment-unordered-map
edolstra Jul 17, 2024
87f8ff2
BasicClientConnection::handshake(): Don't send our version twice
edolstra Jul 17, 2024
f0a1c13
doc: add example usage for Gitea in tarball fetcher (#11116)
RTUnreal Jul 17, 2024
05751de
Merge pull request #10931 from hercules-ci/test-run-and-shell-envs
edolstra Jul 17, 2024
b23da1c
Merge pull request #11100 from NixOS/pretty-print-idempotent
edolstra Jul 17, 2024
6867cb1
Merge pull request #11103 from fzakaria/issue-10795
edolstra Jul 17, 2024
a915862
Merge pull request #11126 from DeterminateSystems/dont-send-version-t…
Ericson2314 Jul 17, 2024
1e1a8e8
Merge pull request #11058 from hercules-ci/more-nix-shell
edolstra Jul 17, 2024
17051ca
Merge pull request #11061 from rhendric/rhendric/reference-manual
edolstra Jul 17, 2024
57399bf
Refactor unix domain socket store config (#11109)
fzakaria Jul 18, 2024
2aa9cf3
Move `uriSchemes` to `*StoreConfig`
Ericson2314 Jul 16, 2024
606ace4
Merge pull request #11112 from obsidiansystems/move-schemes-set
Ericson2314 Jul 18, 2024
8ce4287
Merge pull request #11086 from kognise/eval-cache-fixes
roberth Jul 18, 2024
c1d5cf6
Factor out commonality between WorkerProto::Basic{Client,Server}Conne…
edolstra Jul 17, 2024
d231d80
Typo
edolstra Jul 17, 2024
fa7aa03
FdSource: Fix operator =
edolstra Jul 17, 2024
31e1513
libmain: add missing header include
emilazy Jul 18, 2024
a6dccae
Fix non-deterministic parser printing
infinisil Jul 17, 2024
0c91bb9
parser: Remove empty multiline string parts earlier
infinisil Jul 17, 2024
d629b27
Merge pull request #11138 from emilazy/push-znxusvxozllv
Ericson2314 Jul 19, 2024
58a79b6
performOp(): Take a WorkerProto::BasicServerConnection
edolstra Jul 19, 2024
c4213f0
Merge pull request #11125 from DeterminateSystems/basic-connection
edolstra Jul 19, 2024
584f8cb
Merge pull request #11120 from tweag/early-string-cutoff
roberth Jul 20, 2024
56757e1
Merge pull request #11123 from tweag/fix-non-det-parser-printing
roberth Jul 20, 2024
3426e54
Merge remote-tracking branch 'upstream/master' into lazy-trees-post-s…
Ericson2314 Jul 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 0 additions & 20 deletions .github/workflows/hydra_status.yml

This file was deleted.

7 changes: 7 additions & 0 deletions build-utils-meson/generate-header/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bash = find_program('bash', native: true)

gen_header = generator(
bash,
arguments : [ '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ],
output : '@PLAINNAME@.gen.hh',
)
5 changes: 4 additions & 1 deletion doc/manual/generate-manpage.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ let
storeInfo = commandInfo.stores;
inherit inlineHTML;
};
hasInfix = infix: content:
builtins.stringLength content != builtins.stringLength (replaceStrings [ infix ] [ "" ] content);
in
optionalString (details ? doc) (
if match ".*@store-types@.*" details.doc != null
# An alternate implementation with builtins.match stack overflowed on some systems.
if hasInfix "@store-types@" details.doc
then help-stores
else details.doc
);
Expand Down
53 changes: 53 additions & 0 deletions doc/manual/rl-next/repl-doc-renders-doc-comments.md
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
62 changes: 62 additions & 0 deletions doc/manual/rl-next/shebang-relative.md
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
```
2 changes: 1 addition & 1 deletion doc/manual/src/contributing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ A environment variables that Google Test accepts are also worth knowing:
Putting the two together, one might run

```bash
GTEST_BREIF=1 GTEST_FILTER='ErrorTraceTest.*' meson test nix-expr-tests -v
GTEST_BRIEF=1 GTEST_FILTER='ErrorTraceTest.*' meson test nix-expr-tests -v
```

for short but comprensive output.
Expand Down
18 changes: 2 additions & 16 deletions doc/manual/src/language/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,13 @@ This section covers syntax and semantics of the Nix language.

### Path {#path-literal}

*Paths* are distinct from strings and can be expressed by path literals such as `./builder.sh`.

Paths are suitable for referring to local files, and are often preferable over strings.
- Path values do not contain trailing slashes, `.` and `..`, as they are resolved when evaluating a path literal.
- Path literals are automatically resolved relative to their [base directory](@docroot@/glossary.md#gloss-base-directory).
- The files referred to by path values are automatically copied into the Nix store when used in a string interpolation or concatenation.
- Tooling can recognize path literals and provide additional features, such as autocompletion, refactoring automation and jump-to-file.
*Paths* can be expressed by path literals such as `./builder.sh`.

A path literal must contain at least one slash to be recognised as such.
For instance, `builder.sh` is not a path:
it's parsed as an expression that selects the attribute `sh` from the variable `builder`.

Path literals are resolved relative to their [base directory](@docroot@/glossary.md#gloss-base-directory).
Path literals may also refer to absolute paths by starting with a slash.

> **Note**
Expand All @@ -215,15 +210,6 @@ This section covers syntax and semantics of the Nix language.
For example, `~/foo` would be equivalent to `/home/edolstra/foo` for a user whose home directory is `/home/edolstra`.
Path literals that start with `~` are not allowed in [pure](@docroot@/command-ref/conf-file.md#conf-pure-eval) evaluation.

Paths can be used in [string interpolation] and string concatenation.
For instance, evaluating `"${./foo.txt}"` will cause `foo.txt` from the same directory to be copied into the Nix store and result in the string `"/nix/store/<hash>-foo.txt"`.

Note that the Nix language assumes that all input files will remain _unchanged_ while evaluating a Nix expression.
For example, assume you used a file path in an interpolated string during a `nix repl` session.
Later in the same session, after having changed the file contents, evaluating the interpolated string with the file path again might not return a new [store path], since Nix might not re-read the file contents. Use `:r` to reset the repl as needed.

[store path]: @docroot@/store/store-path.md

Path literals can also include [string interpolation], besides being [interpolated into other expressions].

[interpolated into other expressions]: ./string-interpolation.md#interpolated-expressions
Expand Down
31 changes: 30 additions & 1 deletion doc/manual/src/language/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,37 @@ The function [`builtins.isString`](builtins.md#builtins-isString) can be used to

### Path {#type-path}

<!-- TODO(@rhendric, #10970): Incorporate content from syntax.md#path-literal -->
A _path_ in the Nix language is an immutable, finite-length sequence of bytes starting with `/`, representing a POSIX-style, canonical file system path.
Path values are distinct from string values, even if they contain the same sequence of bytes.
Operations that produce paths will simplify the result as the standard C function [`realpath`] would, except that there is no symbolic link resolution.

[`realpath`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

Paths are suitable for referring to local files, and are often preferable over strings.
- Path values do not contain trailing or duplicate slashes, `.`, or `..`.
- Relative path literals are automatically resolved relative to their [base directory].
- Tooling can recognize path literals and provide additional features, such as autocompletion, refactoring automation and jump-to-file.

[base directory]: @docroot@/glossary.md#gloss-base-directory

A file is not required to exist at a given path in order for that path value to be valid, but a path that is converted to a string with [string interpolation] or [string-and-path concatenation] must resolve to a readable file or directory which will be copied into the Nix store.
For instance, evaluating `"${./foo.txt}"` will cause `foo.txt` from the same directory to be copied into the Nix store and result in the string `"/nix/store/<hash>-foo.txt"`.
Operations such as [`import`] can also expect a path to resolve to a readable file or directory.

[string interpolation]: string-interpolation.md#interpolated-expression
[string-and-path concatenation]: operators.md#string-and-path-concatenation
[`import`]: builtins.md#builtins-import

> **Note**
>
> The Nix language assumes that all input files will remain _unchanged_ while evaluating a Nix expression.
> For example, assume you used a file path in an interpolated string during a `nix repl` session.
> Later in the same session, after having changed the file contents, evaluating the interpolated string with the file path again might not return a new [store path], since Nix might not re-read the file contents.
> Use `:r` to reset the repl as needed.

[store path]: @docroot@/store/store-path.md

Path values can be expressed as [path literals](syntax.md#path-literal).
The function [`builtins.isPath`](builtins.md#builtins-isPath) can be used to determine if a value is a path.

### Null {#type-null}
Expand Down
26 changes: 26 additions & 0 deletions doc/manual/src/protocols/tarball-fetcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,30 @@ Link: <https://example.org/hello/442793d9ec0584f6a6e82fa253850c8085bb150a.tar.gz
For tarball flakes, the value of the `lastModified` flake attribute is
defined as the timestamp of the newest file inside the tarball.

## Gitea and Forgejo support

This protocol is supported by Gitea since v1.22.1 and by Forgejo since v7.0.4/v8.0.0 and can be used with the following flake URL schema:

```
https://<domain name>/<owner>/<repo>/archive/<reference or revison>.tar.gz
```

> **Example**
>
>
> ```nix
> # flake.nix
> {
> inputs = {
> foo.url = "https://gitea.example.org/some-person/some-flake/archive/main.tar.gz";
> bar.url = "https://gitea.example.org/some-other-person/other-flake/archive/442793d9ec0584f6a6e82fa253850c8085bb150a.tar.gz";
> qux = {
> url = "https://forgejo.example.org/another-person/some-non-flake-repo/archive/development.tar.gz";
> flake = false;
> };
> };
> outputs = { foo, bar, qux }: { /* ... */ };
> }
```

[Nix Archive]: @docroot@/store/file-system-object/content-address.md#serial-nix-archive
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
++ pkgs.nixComponents.nix-external-api-docs.nativeBuildInputs
++ [
pkgs.buildPackages.cmake
pkgs.shellcheck
modular.pre-commit.settings.package
(pkgs.writeScriptBin "pre-commit-hooks-install"
modular.pre-commit.settings.installationScript)
Expand Down
4 changes: 1 addition & 3 deletions maintainers/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
''^src/libstore/common-protocol-impl\.hh$''
''^src/libstore/common-protocol\.cc$''
''^src/libstore/common-protocol\.hh$''
''^src/libstore/common-ssh-store-config\.hh$''
''^src/libstore/content-address\.cc$''
''^src/libstore/content-address\.hh$''
''^src/libstore/daemon\.cc$''
Expand Down Expand Up @@ -215,7 +216,6 @@
''^src/libstore/serve-protocol\.hh$''
''^src/libstore/sqlite\.cc$''
''^src/libstore/sqlite\.hh$''
''^src/libstore/ssh-store-config\.hh$''
''^src/libstore/ssh-store\.cc$''
''^src/libstore/ssh\.cc$''
''^src/libstore/ssh\.hh$''
Expand Down Expand Up @@ -495,11 +495,9 @@
excludes = [
# We haven't linted these files yet
''^config/install-sh$''
''^misc/systemv/nix-daemon$''
''^misc/bash/completion\.sh$''
''^misc/fish/completion\.fish$''
''^misc/zsh/completion\.zsh$''
''^scripts/check-hydra-status\.sh$''
''^scripts/create-darwin-volume\.sh$''
''^scripts/install-darwin-multi-user\.sh$''
''^scripts/install-multi-user\.sh$''
Expand Down
7 changes: 6 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ project('nix-dev-shell', 'cpp',
subproject_dir : 'src',
)

# Internal Libraries
subproject('libutil')
subproject('libstore')
subproject('libfetchers')
Expand All @@ -14,14 +15,18 @@ subproject('libflake')
subproject('libmain')
subproject('libcmd')

# Executables
subproject('nix')

# Docs
subproject('internal-api-docs')
subproject('external-api-docs')

# C wrappers
# External C wrapper libraries
subproject('libutil-c')
subproject('libstore-c')
subproject('libexpr-c')
subproject('libmain-c')

# Language Bindings
subproject('perl')
Expand Down
17 changes: 12 additions & 5 deletions misc/systemv/nix-daemon
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,28 @@ else
fi

# Source function library.
# shellcheck source=/dev/null
. /etc/init.d/functions

LOCKFILE=/var/lock/subsys/nix-daemon
RUNDIR=/var/run/nix
PIDFILE=${RUNDIR}/nix-daemon.pid
RETVAL=0

base=${0##*/}
# https://www.shellcheck.net/wiki/SC3004
# Check if gettext exists
if ! type gettext > /dev/null 2>&1
then
# If not, create a dummy function that returns the input verbatim
gettext() { printf '%s' "$1"; }
fi

start() {

mkdir -p ${RUNDIR}
chown ${NIX_DAEMON_USER}:${NIX_DAEMON_USER} ${RUNDIR}

echo -n $"Starting nix daemon... "
printf '%s' "$(gettext 'Starting nix daemon... ')"

daemonize -u $NIX_DAEMON_USER -p ${PIDFILE} $NIX_DAEMON_BIN $NIX_DAEMON_OPTS
RETVAL=$?
Expand All @@ -58,7 +65,7 @@ start() {
}

stop() {
echo -n $"Shutting down nix daemon: "
printf '%s' "$(gettext 'Shutting down nix daemon: ')"
killproc -p ${PIDFILE} $NIX_DAEMON_BIN
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
Expand All @@ -67,7 +74,7 @@ stop() {
}

reload() {
echo -n $"Reloading nix daemon... "
printf '%s' "$(gettext 'Reloading nix daemon... ')"
killproc -p ${PIDFILE} $NIX_DAEMON_BIN -HUP
RETVAL=$?
echo
Expand Down Expand Up @@ -105,7 +112,7 @@ case "$1" in
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
printf '%s' "$(gettext "Usage: $0 {start|stop|status|restart|condrestart}")"
exit 2
;;
esac
Expand Down
Loading
Loading