1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 01:39:36 +01:00
Commit graph

12377 commits

Author SHA1 Message Date
gustavderdrache
61c3efb4f4 Make platform checks throw BuildError like other failures 2025-05-23 17:40:02 -04:00
gustavderdrache
0b66fd3c34 Update src/libexpr/include/nix/expr/eval-settings.hh
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-05-22 17:30:14 -04:00
gustavderdrache
8825cd56b5 Log warnings on IFD with new option 2025-05-22 17:30:14 -04:00
Eelco Dolstra
1246506152 Tagging release 2.29.0
-----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCAAxFiEEtUHVUwEnDgvPFcpdgXC0cm1xmN4FAmgvHQQTHGVkb2xzdHJh
 QGdtYWlsLmNvbQAKCRCBcLRybXGY3qVRCACZ22QWsHqvn6EEROSoSLbAH9/LqLOQ
 jvDzVQ3jk+2LznLt+grfaiTP69nL4SmzMjjeRQxGCnKnDNfHyPkxv5ddRJjX0SCA
 A89m6Fctas5frtbhmKDnLBx3lwKEFS0sq2qEp4uYUb9hU1gaByaLUbGcUUXQ2P3c
 fD1lm0uK/Z9IXY4h3/pyfp7tacYynuO+5E8F1C7T81hc/fA8EUBj6Yof1Ykx/Hg5
 Qj+iQ6y1i94XU4Y3SJYy8mjmILdsYNj+ICQ0IYQuWEARTiGZqLfo2uGtSroR5hLy
 PqYpqp9whQOpb7PyoQ28A0Gzc43O/MgpHnZO+KjV07SFXeqDnoWdltse
 =GWRg
 -----END PGP SIGNATURE-----

Merge tag '2.29.0' into sync-2.29

Tagging release 2.29.0
2025-05-22 14:53:09 +02:00
Jörg Thalheim
90eb2f759c libutil-tests/json-utils: fix -Werror=sign-compare error
I am on a newer different nixpkgs branch, so I am getting this error

(cherry picked from commit 1290b7e53d)
2025-05-19 14:16:43 +00:00
Eelco Dolstra
5d7ebaed24 Merge remote-tracking branch 'origin/2.29-maintenance' into sync-2.29 2025-05-19 16:12:55 +02:00
Sergei Zimmerman
29d98da636 libstore: Depend on boost_regex explicitly
(cherry picked from commit 18a5589f9a)
2025-05-18 19:46:17 +00:00
Sergei Zimmerman
b33fd1e4fb libstore: Use boost::regex for GC root discovery
As it turns out using `std::regex` is actually the bottleneck
for root discovery. Just substituting `std::` -> `boost::`
makes root discovery twice as fast (3x if counting only userspace time).

Some rather ad-hoc measurements to motivate the switch:

(On master)

```
nix build github:nixos/nix/1e822bd4149a8bce1da81ee2ad9404986b07914c#nix-cli --out-link result-1e822bd4149a8bce1da81ee2ad9404986b07914c
taskset -c 2,3 hyperfine "result-1e822bd4149a8bce1da81ee2ad9404986b07914c/bin/nix store gc --dry-run --max 0"
Benchmark 1: result-1e822bd4149a8bce1da81ee2ad9404986b07914c/bin/nix store gc --dry-run --max 0
  Time (mean ± σ):     481.6 ms ±   3.9 ms    [User: 336.2 ms, System: 142.0 ms]
  Range (min … max):   474.6 ms … 487.7 ms    10 runs
```

(After this patch)

```
taskset -c 2,3 hyperfine "result/bin/nix store gc --dry-run --max 0"
Benchmark 1: result/bin/nix store gc --dry-run --max 0
  Time (mean ± σ):     254.7 ms ±   9.7 ms    [User: 111.1 ms, System: 141.3 ms]
  Range (min … max):   246.5 ms … 281.3 ms    10 runs
```

`boost::regex` is a drop-in replacement for `std::regex`, but much faster.
Doing a simple before/after comparison doesn't surface any change in behavior:

```
result/bin/nix store gc --dry-run -vvvvv --max 0 |& grep "got additional" | wc -l
result-1e822bd4149a8bce1da81ee2ad9404986b07914c/bin/nix store gc --dry-run -vvvvv --max 0 |& grep "got additional" | wc -l
```

(cherry picked from commit 3a1301cd6d)
2025-05-18 19:46:16 +00:00
Eelco Dolstra
136cc106e7 Restore the hash mismatch activity 2025-05-18 13:10:08 +02:00
Eelco Dolstra
f50117ba4c Revert storeFS to use makeFSSourceAccessor()
Need to investigate why store->getFSAccessor() breaks a test.
2025-05-18 10:01:57 +02:00
Eelco Dolstra
c20642ac7b Merge remote-tracking branch 'origin/2.29-maintenance' into detsys-main 2025-05-16 12:48:44 +02:00
Jörg Thalheim
7f488dc7d3 rename StoreDirConfigItself to StoreDirConfigBase
context: https://github.com/NixOS/nix/pull/13154#discussion_r2081904653
(cherry picked from commit 2dd2142754)
2025-05-15 10:04:22 +00:00
John Ericson
f70796309d
Merge pull request #13193 from xokdvium/lru-cache
libutil: Less unnecessary copying in `LRUCache`
2025-05-14 19:29:53 -04:00
John Ericson
d7481b4b63 Factor out resolveStoreConfig
Leverage #10766 to show how we can now resolve a store configuration
without actually opening the store for that resolved configuration.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2025-05-14 18:30:25 -04:00
Sergei Zimmerman
d955b401a7
libutil: Sprinkle some noexcept on LRUCache::{size,clear}
The underlying containers are already noexcept to destroy and dtors are
noexcept in general.
2025-05-14 22:14:46 +00:00
Sergei Zimmerman
2f2e04142e
libutil: Simplify LRUCache::get by using list splice
Splicing the list element to the back can be done in
a much simpler and concise way without the need for
erasing and re-inserting the element. Doing it this
way is equivalent to just moving node pointers around,
whereas inserting/erasing allocates/deallocates new nodes.
2025-05-14 22:05:53 +00:00
Sergei Zimmerman
cd61e922ff
libutil: Use heterogeneous lookup for LRUCache
This gets rid of some ugly std::string_view -> std::string
conversions, which are an eye-sore and lead to extra copying.
2025-05-14 21:42:35 +00:00
Sergei Zimmerman
90d70aa4c9
libutil: Format lru-cache.hh
Rip off the band-aid for further refactors. The diff is
very small, so it makes to get it out of the way first.
2025-05-14 21:23:13 +00:00
John Ericson
d972f9e2e2 Split out store-open.hh and store-registration.hh
The existing header is a bit too big. Now the following use-cases are
separated, and get their own headers:

- Using or implementing an arbitrary store: remaining `store-api.hh`

  This is closer to just being about the `Store` (and `StoreConfig`)
  classes, as one would expect.

- Opening a store from a textual description: `store-open.hh`

  Opening an aribtrary store implementation like this requires some sort
  of store registration mechanism to exists, but the caller doesn't need
  to know how it works. This just exposes the functions which use such a
  mechanism, without exposing the mechanism itself

- Registering a store implementation: `store-registration.hh`

  This requires understanding how the mechanism actually works, and the
  mechanism in question involves templated machinery in headers we
  rather not expose to things that don't need it, as it would slow down
  compilation for no reason.
2025-05-14 16:07:57 -04:00
Jörg Thalheim
e088ab3eaf
Merge pull request #13154 from obsidiansystems/split-store-config
Stores no longer inherit from their configs
2025-05-14 21:08:40 +02:00
Jörg Thalheim
addb9f8418
Merge pull request #13180 from Jaculabilis/reload-flakes
nix repl: remember :load-flake calls for :reload
2025-05-14 20:35:58 +02:00
Tim Van Baak
fb510a9e50 nix repl: remember :load-flake calls for :reload
Fixes #8753
2025-05-13 20:56:41 -07:00
Sergei Zimmerman
20a724d131
docs: Fix miscellaneous typos and formatting issues 2025-05-13 22:20:11 +00:00
John Ericson
934918ba16 Stores no longer inherit from their configs
Fix #10766

See that ticket for details.

Progress (I hope!) towards #11139.

Co-Authored-By: Sergei Zimmerman <xokdvium@proton.me>
2025-05-13 15:56:35 -04:00
Jörg Thalheim
f0f196cef0
Merge pull request #13175 from xokdvium/optimise-fetchtarball
libutil/tarfile: Create the scratch `std::vector` only once
2025-05-13 14:21:26 +02:00
Sergei Zimmerman
7628155d2b
libutil/tarfile: Create the scratch std::vector only once
I can't find a good way to benchmark in isolation from the
git cache, but common sense dictates that creating (and destroying)
a 131KiB std::vector for each regular file from the archive imposes
quite a significant overhead regardless of the IO bound git cache.

AFAICT there is no reason to keep a copy of the data since
it always gets fed into the sink and there are no coroutines/threads
in sight.
2025-05-13 10:50:46 +00:00
Eelco Dolstra
bdb3f613dd Improve 'cannot read file from tarball' error
It now says e.g.

  error: cannot read file from tarball: Truncated tar archive detected while reading data
2025-05-13 10:32:12 +02:00
Jörg Thalheim
ed521760bc
Merge pull request #13161 from NixOS/remove-final
nix flake prefetch: Remove __final
2025-05-13 08:50:36 +02:00
Jörg Thalheim
0f985fea11
Merge pull request #13138 from NixOS/register-builtin-builders
Register builtin builders
2025-05-13 08:50:19 +02:00
Jörg Thalheim
6fdb170fb3
Merge pull request #13159 from NixOS/ignore-dir
Avoid unnecessarily updating old lock files with 'dir' parameters
2025-05-12 22:34:50 +02:00
Eelco Dolstra
da4efbd2fe Improve 'cannot read file from tarball' error
It now says e.g.

  error: cannot read file from tarball: Truncated tar archive detected while reading data
2025-05-12 22:08:17 +02:00
Eelco Dolstra
4ea5cb3832 Fix emitting narHash in lock files when lazy trees are disabled 2025-05-12 17:34:32 +02:00
Eelco Dolstra
5a84237209 Improve build failure error messages
They're now laid out in a more readable way, and they shows the output
paths (if known).
2025-05-12 15:06:54 +02:00
Eelco Dolstra
c686de6505 nix flake prefetch: Remove __final
This is currently an internal attribute, not intended to be shown to
users.

Fixes #13150.
2025-05-09 16:44:48 +02:00
Graham Christensen
290368169e
Merge pull request #58 from DeterminateSystems/improve-build-failure-error
Improve build failure error messages
2025-05-09 14:03:35 +00:00
Eelco Dolstra
d00682beb2 Backward compatibility hack for dealing with dir in URL-style flakerefs 2025-05-09 10:10:42 +02:00
Eelco Dolstra
8014671210 Improve build failure error messages 2025-05-09 00:32:41 +02:00
Eelco Dolstra
7c9d25cf39
Merge pull request #57 from DeterminateSystems/eelcodolstra/fh-800-assess-impact-of-flakelock-url-change-between-nix-versions
Canonicalize flake input URLs before checking flake.lock file staleness, for dealing with `dir` in URL-style flakerefs
2025-05-08 18:18:20 +00:00
Eelco Dolstra
bf1c0072f6 Backward compatibility hack for dealing with dir in URL-style flakerefs 2025-05-08 19:12:43 +02:00
Eelco Dolstra
6023688c6c printValueAsJSON(): Don't devirtualize
This is already done by consumers of builtins.toJSON (like
builtins.toFile or builtins.derivation), so we can delay this until
it's actually needed.
2025-05-08 15:33:14 +02:00
Eelco Dolstra
2bbf755bee Handle FIXMEs 2025-05-07 21:36:13 +02:00
Eelco Dolstra
0f48a152dd Handle derivation 2025-05-07 20:56:41 +02:00
Eelco Dolstra
8739d35529 Fix tests/NixOS/nix/2.18.1 2025-05-07 19:22:14 +02:00
Eelco Dolstra
2a35d8f800 Add a special type of context for the result of toString
When you apply `builtins.toString` to a path value representing a path
in the Nix store (as is the case with flake inputs), historically you
got a string without context (e.g. `/nix/store/...-source`). This is
broken, since it allows you to pass a store path to a
derivation/toFile without a proper store reference. This is especially
a problem with lazy trees, since the store path is a virtual path that
doesn't exist and can be different every time.

For backwards compatibility, and to warn users about this unsafe use
of `toString`, we now keep track of such strings as a special type of
context.
2025-05-07 18:53:39 +02:00
Eelco Dolstra
df93fa8604
Merge pull request #27 from DeterminateSystems/lazy-trees-v2
Lazy trees v2
2025-05-07 15:03:25 +00:00
Eelco Dolstra
f6ad6291ab nix flake metadata: Show store path if available 2025-05-07 15:56:35 +02:00
Eelco Dolstra
9bab483196 Improve error message
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2025-05-07 14:07:29 +02:00
Eelco Dolstra
91cde8c79d EvalState::mountInput(): Throw an error if there is a NAR hash mismatch 2025-05-07 14:07:29 +02:00
gustavderdrache
fb01b8c5c9 Nits: formatting 2025-05-06 15:30:33 -04:00
gustavderdrache
d4eb6059c9
Update src/nix/upgrade-nix.cc
Co-authored-by: Graham Christensen <graham@grahamc.com>
2025-05-06 15:11:34 -04:00