1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-23 17:31:08 +01:00
Commit graph

22384 commits

Author SHA1 Message Date
Jörg Thalheim
3c3e5cbcdb
Merge pull request #14792 from Enzime/push-roqmwvnknzqw
Fix `curl` with `c-ares` failing to resolve DNS inside sandbox on macOS
2025-12-23 09:07:29 +00:00
Sergei Zimmerman
130a656330
Merge pull request #14846 from roberth/issue-14816
Fix empty input path segfault (#14816)
2025-12-22 21:27:26 +00:00
Jörg Thalheim
d85e5dfa60
Merge pull request #14843 from mdaniels5757/document-old-let-expression-syntax
docs: document older let expression syntax
2025-12-21 18:16:01 +00:00
Sergei Zimmerman
96204ea6bd
Merge pull request #14785 from YawKar/master
libstore: include path in the world-writable error
2025-12-21 17:49:24 +00:00
Michael Daniels
c6ac52da70 docs: document older let expression syntax
I learned of this from reading Eelco Dolstra's PhD thesis (pp. 69, 73-74).

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2025-12-21 17:28:16 +00:00
John Ericson
b168ec2277
Merge pull request #14842 from mdaniels5757/docs-add-let-semicolon
docs: add missing semicolon to let-in grammar
2025-12-21 15:43:52 +00:00
Robert Hensing
cc88e1aa82 libflake-c: improve input override error message clarity
Make the C API error message more explicit about what went wrong and
why it's invalid. The new message explains that a zero-length path was
passed and clarifies that it would refer to the flake itself.

Updates the unit test to match the new error message.
2025-12-21 13:08:29 +01:00
John Ericson
f457245a9a
Merge pull request #14844 from corngood/cygwin-cross
packaging: disable LTO on cygwin
2025-12-21 05:30:54 +00:00
David McFarland
ce16d6fdd3 packaging: disable LTO on cygwin
This was already done for windows, and it fails in the same way.
2025-12-20 22:52:44 -04:00
Sergei Zimmerman
b6dd17d6f2
Merge pull request #14841 from mdaniels5757/syntax-doc-fix-link
docs: fix string interpolation links on syntax page
2025-12-20 22:04:14 +00:00
Robert Hensing
b1a230de75 libcmd: improve --override-input error message clarity
Make the error message more explicit about what went wrong and why
it's invalid. The new message explains that a zero-length path was
passed and clarifies that it would refer to the flake itself.
2025-12-20 04:26:20 +01:00
Robert Hensing
bec436c0b1 libflake: reject empty paths in inputUpdates
An empty path refers to the flake itself, not an input. Apply the same
type safety to inputUpdates as inputOverrides.

The deprecated --update-input flag (deprecated since Nix 2.4) and the
modern 'nix flake update' command now properly reject empty paths.

Includes functional tests for both commands.
2025-12-20 04:26:20 +01:00
Robert Hensing
f7fc24c973 libflake: introduce NonEmptyInputAttrPath type
Wraps InputAttrPath with compile-time guarantee of non-emptiness.
Replaces obscure .back() calls with domain-specific inputName() method.

An empty path refers to the flake itself, making it nonsensical for
input override operations. The type system now prevents this.
2025-12-20 04:23:45 +01:00
Robert Hensing
63cfefd6cb libflake-c: reject empty input override paths
An empty attribute path refers to the flake itself, contradicting
the purpose of input overrides, which are for overriding inputs.

Related: #14816
2025-12-20 00:37:11 +01:00
Robert Hensing
fefcc4c7cc libcmd: reject empty --override-input paths
An empty attribute path refers to the flake itself, contradicting
the purpose of --override-input, which is for overriding inputs.

Fixes: #14816
2025-12-20 00:36:42 +01:00
Michael Daniels
a720cb0656
docs: add missing semicolon to let-in grammar 2025-12-19 17:57:48 -05:00
Michael Daniels
32a79fcbbf
docs: fix string interpolation links on syntax page 2025-12-19 17:25:04 -05:00
Sergei Zimmerman
132a93625b
Merge pull request #14827 from Zaczero/zaczero/libexpr
libexpr: add nix-expr-benchmarks, add regex optimizations
2025-12-19 21:24:05 +00:00
John Ericson
5cf1c0ebca
Merge pull request #14837 from NixOS/fix-query-substitutable
libstore/store-api: Do not query all substituters for substitutable p…
2025-12-19 14:00:35 +00:00
Eelco Dolstra
6b52fa8360
Merge pull request #12087 from DeterminateSystems/multithreaded-git-sink
Make GitFileSystemObjectSink multi-threaded
2025-12-19 12:20:22 +00:00
Eelco Dolstra
19a2493132 Fix random missing re-throw 2025-12-19 12:14:29 +01:00
Eelco Dolstra
6bea8e0e08 GitFileSystemObjectSink: Fix crash during interrupt 2025-12-19 12:06:55 +01:00
Sergei Zimmerman
f1f99b6598
Merge pull request #14835 from Zaczero/zaczero/reserve-perf
Fix reserve pitfall in printString
2025-12-19 02:06:07 +00:00
Sergei Zimmerman
2308f200c8
libstore/store-api: Do not query all substituters for substitutable path infos
This was broken in 11d7c80370.
2025-12-19 04:52:53 +03:00
Kamil Monicz
048d0b6781
libexpr: avoid regex engine in getDerivations attr filtering
- getDerivations() filters attribute names with std::regex_match, which runs the regex engine for every attribute visited during nixpkgs scanning.
- BM_GetDerivationsAttrScan/10000_mean: 3.338 ms → 1.506 ms (≈ -54.9%)
2025-12-19 02:10:11 +01:00
Kamil Monicz
0c8751d3f4
libexpr: avoid std::regex copies on RegexCache hits
- RegexCache::get() returned std::regex by value, copying the compiled regex on every cache hit.
- Store the compiled regex behind std::shared_ptr<const std::regex> and return the shared pointer instead, so callers reuse the same compiled object.
- BM_EvalManyBuiltinsMatchSameRegex_mean improved about 8%
2025-12-19 02:10:11 +01:00
Kamil Monicz
723c47550e
libexpr-tests: add nix-expr-benchmarks
Provides focused microbenchmarks for expression evaluation hot paths (dynamic attrs, getDerivations attr scanning, and repeated builtins.match).
2025-12-19 02:10:05 +01:00
Kamil Monicz
66c867395f
Fix reserve pitfall in printString
Remove the per-call reserve() inside printString to avoid linear-growth reallocations when called in loops (e.g. printStrings). Derivation::unparse already pre-reserves a large buffer, so this remains efficient while preserving amortized growth behavior when the initial estimate is exceeded.
2025-12-19 01:03:30 +00:00
Sergei Zimmerman
27006cc8a9
Merge pull request #14832 from NixOS/o-tmpfile-fallback
libutil: Gracefully fall back from unsupported O_TMPFILE
2025-12-18 20:39:56 +00:00
Sergei Zimmerman
06f21596a0
libutil: Gracefully fall back from unsupported O_TMPFILE
Some filesystems, notably most FUSE-based ones and some top-level overlaysfs
ones do not support this and we need a graceful fallback.
2025-12-18 22:12:14 +03:00
Jörg Thalheim
9254fab407
Merge pull request #14828 from Zaczero/zaczero/libstore-registerValidPaths
libstore: reuse parsed derivations in registerValidPaths
2025-12-18 12:59:43 +00:00
Michael Hoang
7541129f04 Fix curl with c-ares failing to resolve DNS inside sandbox on macOS 2025-12-18 11:45:18 +01:00
Jörg Thalheim
994324feda libstore-tests: reduce registerValidPaths benchmark to single test case
Testing with 10 derivations is sufficient to verify performance
characteristics. The larger test cases (50, 200) don't provide
additional insight and slow down the benchmark unnecessarily.
2025-12-18 09:46:03 +01:00
Jörg Thalheim
1f739961e5 libstore: simplify registerValidPaths by removing redundant checkInvariants loop
The separate checkInvariants loop after addValidPath was added in 2014
(d210cdc43) to work around an assertion failure:

  nix-store: derivations.cc:242: Assertion 'store.isValidPath(i->first)' failed.

At that time, hashDerivationModulo() contained assert(store.isValidPath(...))
which required input derivations to be registered as valid in the database
before computing their hash. The workaround was to:
1. Call addValidPath with checkOutputs=false
2. Add all references to the database
3. Run checkInvariants in a separate loop after paths were valid

In 2020 (bccff827d), the isValidPath assertion was removed to fix a
deadlock in IFD through the daemon (issue #4235). The fix changed
hashDerivationModulo to use readInvalidDerivation, which reads directly
from the filesystem without requiring database validity.

This made the separate checkInvariants loop unnecessary, but nobody
noticed the code could be simplified. The comment "We can't do this in
addValidPath() above, because the references might not be valid yet"
became stale.

Now we simply call addValidPath() with the default checkOutputs=true,
which runs checkInvariants internally using the already-parsed
derivation. This commit eliminates the separate loop over derivations.
2025-12-18 09:34:17 +01:00
Kamil Monicz
cccfa385e6
libstore: reuse parsed derivations in registerValidPaths
- LocalStore::registerValidPaths() parsed derivations twice: once in addValidPath() and again when calling checkInvariants(), despite already having loaded the derivation.
- Plumb the parsed Derivation out of addValidPath() and reuse it for the invariant check pass, falling back to re-parsing only when a derivation wasn’t newly registered in this call.
- BM_RegisterValidPathsDerivations/200_mean runs 32% faster
2025-12-18 06:00:38 +01:00
Kamil Monicz
9d2100a165
libstore-tests: benchmark registerValidPaths on derivations
- Add a focused nix-store-benchmarks benchmark that registers many derivation paths into a temporary local store root
2025-12-18 06:00:31 +01:00
John Ericson
4769f3c0b2
Merge pull request #14824 from roberth/issue-14776
doc: drop rsync dependency from manual build
2025-12-18 03:18:45 +00:00
Robert Hensing
ab354dc8f6 doc: drop rsync dependency from manual build
rsync was only used to copy source files while following symlinks.
Replace with tar --dereference, which serves the same purpose.
Tried plain cp but couldn't get it to work reliably. tar is already
a test dependency.

Add tests/functional/derivation to fileset to include the symlink
targets.

Fixes #14776
2025-12-18 03:41:45 +01:00
John Ericson
188cb798ad
Merge pull request #14817 from NixOS/fix-socket-mingw
Windows fixes
2025-12-18 00:30:19 +00:00
John Ericson
1aa7ab0dcf
Merge pull request #14819 from NixOS/mingw-fixes-more
Assorted windows fixes for libutil, HANDLEs and path handling
2025-12-17 22:28:27 +00:00
John Ericson
208ed3c538 Fix select / fdset usage on Windows
These functions use `SOCKET` not `int`, despite them being unix
functions.
2025-12-17 16:55:04 -05:00
John Ericson
b6add8dcc6
Merge pull request #14818 from NixOS/fix-windows-dev-shell
Fix up dev shell in a few ways
2025-12-17 21:52:56 +00:00
John Ericson
79750a3ccc Split out socket.hh from unix-domain-socket.hh
There are other types of sockets.
2025-12-17 16:51:01 -05:00
John Ericson
30cd9e43e1 Fix windows build of new source accessor test
We don't have the dirFd on window at this time.
2025-12-17 16:51:01 -05:00
Sergei Zimmerman
0695630eb5
libutil: Fix FdSource::read on Windows
We need to signal the EOF condition, otherwise the read never terminates.
2025-12-18 00:30:07 +03:00
Sergei Zimmerman
89dc57f6aa
libutil: Implement HANDLE-based lseek for Windows
For windows we should live fully in the HANDLE land instead
of converting back-n-forth (which sometimes is destructive).
Using native API is much better for this.
2025-12-18 00:30:06 +03:00
Sergei Zimmerman
f274a7273a
libutil: Implement deletePath on windows via std::filesystem::remove_all
It doesn't track the number of bytes deleted, but since this code is
security critical also we can split unix and windows implementations.
If the need arises we can implement a smarter recursive deletion function
ourselves in the future.

Review with --color-moved.
2025-12-18 00:30:05 +03:00
Sergei Zimmerman
675656ffba
libutil: Fix canonPath, makeTempPath and createTempDir on windows
This at least makes canonPath not consider the drive letter as a path
component. There still some issues with it on windows, but at least
this gets us through some of the libutil-tests.

Also since we don't want to change which env variables nix considers
we don't use std::filesystem::temp_directory_path and implement the
windows version directly.
2025-12-18 00:30:04 +03:00
John Ericson
a5edc2d921 Fix up dev shell in a few ways
- Skip packages that don't build for Windows when building for windows
- Automatically disable kaitai / json schema, fixing todo
- Skip native build of Nix for manual
2025-12-17 15:41:47 -05:00
Eelco Dolstra
97e3816b24 Remove assertion 2025-12-17 12:54:29 +01:00