Robert Hensing
9ca42d5da2
dropEmptyInitThenConcatStringsSep -> concatStringSep: setting value was already harmed
...
Considering that `value` was probably parsed with tokenizeString
prior, it's unlikely to contain empty strings, and we have no
reason to remove them either.
2024-07-13 03:06:24 +02:00
Robert Hensing
4029426ca8
dropEmptyInitThenConcatStringsSep -> concatStringSep: tokens from tokenizeString are not empty
2024-07-13 03:06:24 +02:00
Robert Hensing
0fe3525223
illegal configuration line -> syntax error in configuration line
...
The law has nothing to do with this, although I do feel like a
badass when I mess with the config.
I'm a conf artist.
2024-07-13 03:06:24 +02:00
Robert Hensing
cf3c5cd189
dropEmptyInitThenConcatStringsSep -> concatStringSep: showVersions version is not empty
2024-07-13 03:06:24 +02:00
Robert Hensing
d9043021df
dropEmptyInitThenConcatStringsSep -> concatStringSep: break nix help "" "" "" build
...
Garbage in, error out. Experimental CLI. Zero derivations given.
2024-07-13 03:06:24 +02:00
Robert Hensing
062672b022
dropEmptyInitThenConcatStringsSep -> concatStringSep: CLI commands are not empty
2024-07-13 03:06:24 +02:00
Robert Hensing
0480bfe50b
dropEmptyInitThenConcatStringsSep -> concatStringSep: do not drop attributes with empty names
...
Empty attributes are probably not well supported, but the least we
could do is leave a hint.
Attribute path rendering and parsing should be done according to
Nix expression syntax in my opinion.
2024-07-13 03:06:24 +02:00
Robert Hensing
4b34feb4c2
dropEmptyInitThenConcatStringsSep -> concatStringSep: system string should not be empty
2024-07-13 03:06:24 +02:00
Robert Hensing
837c3612d4
dropEmptyInitThenConcatStringsSep -> concatStringSep: escaped shell args are never empty
2024-07-13 03:06:24 +02:00
Robert Hensing
3b77f13451
dropEmptyInitThenConcatStringsSep -> concatStringSep: experimental features do not render as empty strings
2024-07-13 03:06:24 +02:00
Robert Hensing
e64643bf63
dropEmptyInitThenConcatStringsSep -> concatStringSep: feature should not be empty
...
(System) features are unlikely to be empty strings, but when they
come in through structuredAttrs, they probably can.
I don't think this means we should drop them, but most likely they
will be dropped after this because next time they'll be parsed with
tokenizeString.
TODO: We should forbid empty features.
2024-07-13 03:06:24 +02:00
Robert Hensing
f1966e22d9
dropEmptyInitThenConcatStringsSep -> concatStringSep: store paths are not empty
2024-07-13 03:06:24 +02:00
Robert Hensing
49d100ba8b
dropEmptyInitThenConcatStringsSep -> concatStringSep: output name empty not feasible
...
I don't think it's completely impossible, but I can't construct
one easily as derivationStrict seems to (re)tokenize the outputs
attribute, dropping the empty output.
It's not a scenario we have to account for here.
2024-07-13 03:06:24 +02:00
Robert Hensing
d3e49ac881
dropEmptyInitThenConcatStringsSep -> concatStringSep: shortRefs are not empty
2024-07-13 03:06:24 +02:00
Robert Hensing
608a425550
dropEmptyInitThenConcatStringsSep -> concatStringSep: diag
2024-07-13 03:06:24 +02:00
Robert Hensing
75dde71ff9
dropEmptyInitThenConcatStringsSep -> concatStringSep: sigs are non-empty
...
The sigs field is produced by tokenizeStrings, which does not return
empty strings.
2024-07-13 03:06:24 +02:00
Robert Hensing
3f37785afd
NIX_REMOTE_SYSTEMS: actually support multiple :-separated entries
...
Bug not reported in 6 years, but here you go.
Also it is safe to switch to normal concatStringsSep behavior
because tokenizeString does not produce empty items.
2024-07-13 03:06:24 +02:00
Robert Hensing
39878c8979
dropEmptyInitThenConcatStringsSep -> concatStringSep: preserve empty attr
...
The empty attribute name should not be dropped from attribute paths.
Rendering attribute paths with concatStringsSep is lossy and wrong,
but this is just a first improvement while dealing with the
dropEmptyInitThenConcatStringsSep problem.
2024-07-13 03:06:24 +02:00
Robert Hensing
ea966a70fc
dropEmptyInitThenConcatStringsSep -> concatStringSep: diagnostics and docs
...
These are non-critical, so their behavior is ok to change.
Dropping empty items is not needed and usually not expected.
2024-07-13 03:06:24 +02:00
Robert Hensing
a681d354e7
Add fresh concatStringsSep without bug
...
The buggy version was previously renamed to
dropEmptyInitThenConcatStringsSep
2024-07-13 03:06:24 +02:00
Robert Hensing
79eb0adf9d
dropEmptyInitThenConcatStringSep: Check that we don't drop...
...
... initial empty strings.
The tests pass, which is encouraging.
2024-07-13 03:05:50 +02:00
Robert Hensing
1a8defd06f
Refactor: rename C++ concatStringsSep -> dropEmptyInitThenConcatStringsSep
2024-07-13 03:05:50 +02:00
John Ericson
bc83b9dc1f
Remove comparator.hh
and switch to <=>
in a bunch of places
...
Known behavior changes:
- `MemorySourceAccessor`'s comparison operators no longer forget to
compare the `SourceAccessor` base class.
Progress on #10832
What remains for that issue is hopefully much easier!
2024-07-12 14:54:18 -04:00
Lexi Mattick
6c4470ec2a
Clean up cache for all commands
2024-07-12 11:54:12 -07:00
Lexi Mattick
e764ed31f6
Eval cache: fix cache regressions
...
- Fix eval cache not being persisted in `nix develop` (since #10570 )
- Don't attempt to commit cache transaction if there is no active transaction, which will spew errors in edge cases
- Drive-by: trivial typo fix
2024-07-12 09:45:35 -07:00
Eelco Dolstra
2a95a2d780
Merge pull request #11091 from NixOS/darwin-no-map-spaceship
...
Remove unused `operator<=>`'s that darwin can't generate
2024-07-12 18:40:20 +02:00
Eelco Dolstra
cdc23b67a6
Provide std::hash<SourcePath>
2024-07-12 17:54:27 +02:00
Robert Hensing
11a6db5993
Remove unused operator<=>'s that darwin can't generate
...
It was complaining *a lot*, with dozens of MB of logs.
2024-07-12 17:37:27 +02:00
John Ericson
337a5a23b7
Merge pull request #11089 from NixOS/warnings-includes
...
Fix warnings and optimize includes
2024-07-12 10:29:26 -04:00
Robert Hensing
27eaeebc41
nar-accessor.cc: Silence unused variable warning
2024-07-12 15:38:17 +02:00
Robert Hensing
8df041cbc6
Solve unused header warnings reported by clangd
2024-07-12 15:37:54 +02:00
John Ericson
3fc77f281e
No global settings in libnixfetchers
and libnixflake
...
Progress on #5638
There are still a global fetcher and eval settings, but they are pushed
down into `libnixcmd`, which is a lot less bad a place for this sort of
thing.
Continuing process pioneered in
52bfccf8d8
.
2024-07-12 08:50:28 -04:00
Robert Hensing
f070d68c32
Add BaseError assignment operators
...
The move assignment was implicitly generated and used in
src/libstore/build/goal.cc:90:22:
90 | this->ex = std::move(*ex);
Clang warns about this generated method being deprecated, so making
them explicit fixes the warning.
2024-07-12 14:25:16 +02:00
Eelco Dolstra
61080554ab
SymbolStr: Remove std::string conversion
...
This refactoring allows the symbol table to be stored as something
other than std::strings.
2024-07-11 17:43:10 +02:00
Eelco Dolstra
87323a5689
Remove unused InstallableFlake::getFlakeOutputs()
2024-07-11 16:21:27 +02:00
Robert Hensing
bb312a7174
Edit CompatibilitySettings
2024-07-11 13:59:49 +02:00
Robert Hensing
4fd8f19ecf
Fix build to use CanonPath in new FSO sinks
2024-07-11 12:14:48 +02:00
Robert Hensing
86420753ec
Merge remote-tracking branch 'upstream/master' into support-hardlinks-in-tarballs
2024-07-11 11:43:02 +02:00
Robert Hensing
c4e3e2dc27
Soft-deprecate the compatibility settings
2024-07-10 16:24:31 +02:00
Robert Hensing
d942d505ca
Merge remote-tracking branch 'upstream/master' into more-nix-shell
2024-07-10 16:19:18 +02:00
John Ericson
7a6269ba7b
Package the Nix CLI with Meson
...
Co-Authored-By: Qyriad <qyriad@qyriad.me>
2024-07-08 17:49:44 -04:00
John Ericson
f1d88e0f27
Merge pull request #11064 from obsidiansystems/header-generater
...
Use a meson "generator" to deduplicate `.gen.hh` creation
2024-07-08 12:03:59 -04:00
John Ericson
1439de874f
Merge pull request #11063 from obsidiansystems/config-expr
...
Forgot to include `config-expr.hh` in two places
2024-07-08 11:27:57 -04:00
John Ericson
6e5cec292b
Use a meson "generator" to deduplicate .gen.hh
creation
2024-07-08 11:13:11 -04:00
John Ericson
c5284a84f3
Forgot to include config-expr.hh
in some places
2024-07-08 10:37:34 -04:00
Robert Hensing
cfe3ee3de8
nix-shell
: look up shell.nix
when argument is a directory (#11057 )
...
* Refactor: rename runEnv -> isNixShell
* Refactor: rename left -> remainingArgs
* nix-build.cc: Refactor: extract baseDir variable
* nix-build.cc: Refactor: extract sourcePath, resolvedPath variables
* nix-shell: Look for shell.nix when directory is specified
* Add legacy setting: nix-shell-always-looks-for-shell-nix
* rl-next: Add note about shell.nix lookups
* tests/functional/shell.nix: Implement runHook for dummy stdenv
2024-07-08 14:36:36 +02:00
John Ericson
d8850618b6
Merge pull request #11059 from rhendric/rhendric/reference-manual
...
docs: merge builtin-constants into builtins
2024-07-07 21:47:33 -04:00
Ryan Hendrickson
95890b3e1d
docs: merge builtin-constants into builtins
2024-07-07 15:57:23 -04:00
Robert Hensing
a9592077fb
Merge pull request #11055 from NixOS/packaging-for-nixpkgs
...
Indirections for packaging meson-based granular build for Nixpkgs
2024-07-07 21:33:01 +02:00
Robert Hensing
fd4b17ab2c
Merge pull request #11056 from romain-neil/s3-allow-use-of-proxy
...
Configure aws s3 lib to use system defined proxy, if existent
2024-07-07 02:47:24 +02:00
Robert Hensing
63262e78c7
Add opt-out: nix-shell-shebang-arguments-relative-to-script
2024-07-07 00:55:33 +02:00
Robert Hensing
4c59d6e9f5
Merge branch 'nix-shell-lookup-shell-nix' into more-nix-shell
2024-07-07 00:27:07 +02:00
Robert Hensing
6c6d5263e2
Add legacy setting: nix-shell-always-looks-for-shell-nix
2024-07-07 00:25:56 +02:00
Robert Hensing
f5b59fbc64
Fix and extend nix-shell baseDir test
2024-07-07 00:23:22 +02:00
Robert Hensing
8838f5c746
Merge remote-tracking branch 'matthewbauer/nix-shell-relative-shebang' into more-nix-shell
2024-07-07 00:18:03 +02:00
Robert Hensing
b865625a8e
nix-shell: Look for shell.nix when directory is specified
2024-07-06 23:05:34 +02:00
Robert Hensing
32fb127b9c
Add legacy setting: nix-shell-always-looks-for-shell-nix
2024-07-06 23:05:34 +02:00
Romain NEIL
514062c227
feat: configure aws s3 lib to use system defined proxy, if existent
2024-07-06 21:46:58 +02:00
Robert Hensing
76245ffbeb
nix-build.cc: Refactor: extract sourcePath, resolvedPath variables
2024-07-06 20:55:27 +02:00
Robert Hensing
e9479b272f
nix-build.cc: Refactor: extract baseDir variable
2024-07-06 20:51:45 +02:00
Robert Hensing
5c367ece89
Refactor: rename left -> remainingArgs
2024-07-06 20:03:30 +02:00
Robert Hensing
13181356fc
Refactor: rename runEnv -> isNixShell
2024-07-06 20:01:46 +02:00
Robert Hensing
0729f0a113
packaging: Pass version directly
2024-07-06 17:52:57 +02:00
Robert Hensing
efd5f50f5e
nix-perl: Add deps, use mkMesonDerivation
2024-07-06 17:52:57 +02:00
Robert Hensing
4c014e238b
nix-main: Add openssl
2024-07-06 17:52:57 +02:00
Robert Hensing
4d0c55ae55
api docs: Use mkMesonDerivation
2024-07-06 17:52:57 +02:00
John Ericson
3acf3fc746
Package libnixmain
and libnixcmd
with Meson
...
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-07-05 16:40:55 -04:00
Robert Hensing
0b901e10ee
Merge pull request #11050 from hercules-ci/issue-10677
...
Explain when `man` is missing
2024-07-05 22:25:38 +02:00
John Ericson
ff9b6d0e1f
Merge pull request #11037 from fricklerhandwerk/document-config-parsing
...
use self-descriptive name for config file parser, document
2024-07-05 15:21:26 -04:00
Eelco Dolstra
d5461b9009
Merge pull request #11051 from Mic92/fix-prefetch
...
src/nix/prefetch: fix prefetch containing current directory instead o…
2024-07-05 20:33:05 +02:00
Robert Hensing
ddff76f667
Merge pull request #10973 from NixOS/meson-libexpr
...
Meson build for libexpr libflake, external C API, unit tests
2024-07-05 20:27:12 +02:00
Jörg Thalheim
05381c0b30
Update src/nix/prefetch.cc
...
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2024-07-05 19:45:03 +02:00
Jörg Thalheim
8cea1fbd97
src/nix/prefetch: fix prefetch containing current directory instead of tarball
...
When --unpack was used the nix would add the current directory to the
nix store instead of the content of unpacked.
The reason for this is that std::distance already consumes the iterator.
To fix this we re-instantiate the directory iterator in case the
directory only contains a single entry.
2024-07-05 19:18:49 +02:00
Robert Hensing
6ef00a503a
Explain when man is missing
...
Have you seen this man?
Fixes #10677
2024-07-05 19:18:23 +02:00
Eelco Dolstra
8f280d72ff
Merge pull request #11019 from DeterminateSystems/fix-failed-to-open-archive
...
Tarball fetcher: Fix handling of cached tarballs
2024-07-05 17:10:02 +02:00
Robert Hensing
a476383f46
Merge pull request #11031 from emilazy/push-xsrvoyspsvqx
...
libstore: fix sandboxed builds on macOS
2024-07-05 17:08:39 +02:00
Eelco Dolstra
98bef7c38e
Merge pull request #11035 from siddhantk232/refactor
...
Factor duplicate code into util function `append`
2024-07-05 16:34:23 +02:00
Eelco Dolstra
61e1880847
Merge pull request #11041 from hercules-ci/trace-nix-env-attribute-names
...
getDerivations: add attributes to trace
2024-07-05 16:32:27 +02:00
Eelco Dolstra
e1b6b3ce27
Merge pull request #11020 from DeterminateSystems/fix-tarball-caching
...
Tarball fetcher: Fix fetchToStore() and eval caching
2024-07-05 16:30:12 +02:00
Eelco Dolstra
e7e070d36b
Document
2024-07-05 16:29:16 +02:00
Robert Hensing
09763c7cad
getDerivations: add attributes to trace
...
This improves the error message of nix-env -qa, among others, which
is crucial for understanding some ofborg eval error reports, such as
https://gist.github.com/GrahamcOfBorg/89101ca9c2c855d288178f1d3c78efef
After this change, it will report the same trace, but also start with
```
error:
… while evaluating the attribute 'devShellTools'
… while evaluating the attribute 'nixos'
… while evaluating the attribute 'docker-tools-nix-shell'
… while evaluating the attribute 'aarch64-darwin'
… from call site
at /home/user/h/nixpkgs/outpaths.nix:48:6:
47| tweak = lib.mapAttrs
48| (name: val:
| ^
49| if name == "recurseForDerivations" then true
<same>
```
2024-07-05 15:30:07 +02:00
John Ericson
e4056b9afd
Apply suggestions from code review
...
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-07-04 17:48:27 -04:00
Emily
af2e1142b1
libstore: fix sandboxed builds on macOS
...
The recent fix for CVE-2024-38531 broke the sandbox on macOS
completely. As it’s not practical to use `chroot(2)` on
macOS, the build takes place in the main filesystem tree, and the
world‐unreadable wrapper directory prevents the build from accessing
its `$TMPDIR` at all.
The macOS sandbox probably shouldn’t be treated as any kind of a
security boundary in its current state, but this specific vulnerability
wasn’t possible to exploit on macOS anyway, as creating `set{u,g}id`
binaries is blocked by sandbox policy.
Locking down the build sandbox further may be a good idea in future,
but it already has significant compatibility issues. For now, restore
the previous status quo on macOS.
Thanks to @alois31 for helping me come to a better understanding of
the vulnerability.
Fixes: 1d3696f0fb
Closes : #11002
2024-07-04 16:28:37 +01:00
Emily
76e4adfaac
libstore: clean up the build directory properly
...
After the fix for CVE-2024-38531, this was only removing the nested
build directory, rather than the top‐level temporary directory.
Fixes: 1d3696f0fb
2024-07-04 16:22:02 +01:00
Valentin Gagarin
c66079f1e8
use self-descriptive name for config file parser, document
...
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-07-04 10:36:48 +02:00
siddhantCodes
976c05879f
factor duplicate code into util function append
2024-07-04 11:09:23 +05:30
Eelco Dolstra
5b4102c3b2
Tarball fetcher: Include revCount/lastModified in the fingerprint
...
This can influence the evaluation result so they should be included in
the fingerprint.
2024-07-03 22:05:45 +02:00
kn
10ccdb7a41
Use proper struct sockpeercred for SO_PEERCRED for OpenBSD
...
getsockopt(2) documents this; ucred is wrong ("cr_" member prefix, no pid).
2024-07-03 11:16:39 -04:00
John Ericson
a09360400b
Ident some CPP in nix daemon
...
Makes it easier for me to read.
2024-07-03 11:15:56 -04:00
Eelco Dolstra
1ff186fc6e
nix flake metadata: Show flake fingerprint
...
This is useful for testing/debugging and maybe for sharing eval caches
(since it tells you what file in ~/.cache/nix/eval-cache-v5 to copy).
2024-07-03 17:00:30 +02:00
Eelco Dolstra
9d95c228ee
Tarball fetcher: Fix fetchToStore() and eval caching
2024-07-03 16:50:45 +02:00
John Ericson
30de61f16d
Merge pull request #11018 from siddhantk232/canonpath-fs-sink
...
Use `CanonPath` in `fs-sink.hh`
2024-07-03 10:36:18 -04:00
Eelco Dolstra
79ed3df8f8
Tarball fetcher: Fix handling of cached tarballs
...
Fixes a regression introduced in
5a9e1c0d20
where downloading a cached
file causes the error "Failed to open archive (Unrecognized archive
format)".
2024-07-03 14:14:20 +02:00
siddhantCodes
2cf24a2df0
fix tests and minor changes
...
- use the iterator in `CanonPath` to count `level`
- use the `CanonPath::basename` method
- use `CanonPath::root` instead of `CanonPath{""}`
- remove `Path` and `PathView`, use `std::filesystem::path` directly
2024-07-03 17:43:55 +05:30
Valentin Gagarin
a713476790
docs: split types from syntax ( #11013 )
...
move together all syntactic and semantic information into one
page, and add a page on data types, which in turn links to the syntax and
semantics.
also split out the note on scoping rules into its own page.
Co-authored-by: Ryan Hendrickson <ryan.hendrickson@alum.mit.edu>
2024-07-03 09:03:41 +02:00
John Ericson
451f8a8c19
Put back files for now
...
We'll revert this sometime later
2024-07-02 09:26:22 -04:00
John Ericson
11946817f0
fileset for store unit test data
2024-07-02 09:26:22 -04:00
John Ericson
4d6bc61b8d
Fix things
2024-07-02 09:26:22 -04:00
John Ericson
11dab30be9
Update docs on the unit tests
2024-07-02 09:26:22 -04:00
John Ericson
224c6c3256
Fix test symlinks
2024-07-02 09:26:22 -04:00