Commit graph

18088 commits

Author SHA1 Message Date
Farid Zakaria
945fff5674
Apply suggestions from code review
Add @edolstra suggestion fixes.

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2024-07-15 09:12:56 -07:00
Eelco Dolstra
550b3479cf Include the accessor in the SourcePath hash 2024-07-15 15:46:30 +02:00
Farid Zakaria
104aba0fad Remove nix-daemon from exclusion 2024-07-14 19:57:55 -07:00
Farid Zakaria
bc801e2c59 lint: fix shellcheck for misc/systemv/nix-daemon
Got shellcheck passing for misc/systemv/nix-daemon

Not sure how to test this since it's not running on my NixOS machine and
I see no references to it in the directory otherwise.

See #10795
2024-07-14 19:56:03 -07:00
Farid Zakaria
a4ce96e5f1 doc: Add comment for fetchurl for name & url
fetchurl can be given a name and url aside from just the url.
Giving a name can be useful if the url has invalid characters such as
tilde for the store.
2024-07-14 19:07:18 -07:00
Robert Hensing
9d7397c4ba
Merge pull request #11093 from NixOS/fix-concatStringsSep
Fix C++ `concatStringsSep`
2024-07-14 13:11:29 +02:00
Robert Hensing
7e604f716c concatStrings: Give compiler access to definition for inlining
... at call sites that are may be in the hot path.

I do not know how clever the compiler gets at these sites.
My primary concern is to not regress performance and I am confident
that this achieves it the easy way.
2024-07-14 12:20:45 +02:00
Robert Hensing
97e01107ec dropEmptyInitThenConcatStringsSep -> concatStringSep: empty separator
When the separator is empty, no difference is observable.

Note that concatStringsSep has centralized definitions. This adds the
required definitions. Alternatively, `strings-inline.hh` could be
included at call sites.
2024-07-14 12:10:39 +02:00
Robert Hensing
d40fdb5711 dropEmptyInitThenConcatStringsSep: Update doc and deprecate 2024-07-14 11:50:20 +02:00
Robert Hensing
1c97718146 dropEmptyInitThenConcatStringsSep: Allow it to drop items again
It's usually harmless, if it occurs at all.
2024-07-13 03:06:24 +02:00
Robert Hensing
6b2c277c36 dropEmptyInitThenConcatStringsSep -> concatStringSep: sigs are not empty
... but if they are, I'd like to see at least a hint of it so that
I'd know to fix it.
2024-07-13 03:06:24 +02:00
Robert Hensing
76b2d5ef3d dropEmptyInitThenConcatStringsSep -> concatStringSep: PATH handling
It's still wrong, but one step closer to correct.
Not that anyone should use "" or "." in their PATH, but that is not
for us to intervene.
2024-07-13 03:06:24 +02:00
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
tomberek
b1effc9649
Merge pull request #11080 from NixOS/fix-build-x86_64-darwin-minSDK
packaging: Set darwinMinVersion to fix x86_64-darwin build
2024-07-12 20:50:50 -04:00
John Ericson
db3e99d9d4
Merge pull request #10838 from obsidiansystems/spaceship-no-comparator
Remove `comparator.hh` and switch to `<=>` in a bunch of places
2024-07-12 15:43:17 -04: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
6c5d2a1506
Merge pull request #11090 from amarshall/fix-stackoverflow-build
Fix stackoverflow during doc generation
2024-07-12 17:51:29 +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
Andrew Marshall
51a12b38bd Fix stackoverflow during doc generation
On some systems, previous usage of `match` may cause a stackoverflow
(presumably due to the large size of the match result). Avoid this by
(ab)using `replaceStrings` to test for containment without using
regexes, thereby avoiding the issue. The causal configuration seems to
be the stack size hard limit, which e.g. Amazon Linux sets, whereas most
Linux distros leave unlimited.

Match the fn name to similar fn in nixpkgs.lib, but different
implementation that does not use `match`. This impl gives perhaps
unexpected results when the needle is `""`, but the scope of this is
narrow and that case is a bit odd anyway.

This makes for some duplication-of-work as we do a different
`replaceStrings` if this one is true, but this only runs during doc
generation at build time so has no runtime impact.

See https://github.com/NixOS/nix/issues/11085 for details.
2024-07-12 10:59:40 -04: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
John Ericson
dfb169ca68
Merge pull request #11007 from obsidiansystems/push-down-fetcher-flake-settings
No global settings in `libnixfetchers` and `libnixflake`
2024-07-12 09:41:10 -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