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

20796 commits

Author SHA1 Message Date
internal-nix-ci[bot]
f9f2f49252
Merge pull request #14195 from NixOS/backport-14189-to-2.31-maintenance
[Backport 2.31-maintenance] exportReferencesGraph: Handle heterogeneous arrays
2025-10-08 23:43:23 +00:00
Eelco Dolstra
2bfc564297 exportReferencesGraph: Handle heterogeneous arrays
This barfed with

   error: [json.exception.type_error.302] type must be string, but is array

on `nix build github:malt3/bazel-env#bazel-env` because it has a `exportReferencesGraph` with a value like `["string",...["string"]]`.

(cherry picked from commit 94f410b628)
2025-10-08 23:13:05 +00:00
internal-nix-ci[bot]
3019db2c87
Merge pull request #14192 from NixOS/backport-13861-to-2.31-maintenance
[Backport 2.31-maintenance] libutil: Try to call std::terminate for panic, use C++20 std::source_location
2025-10-08 20:46:42 +00:00
Sergei Zimmerman
c750f0f630 libutil: Use std::source_location for unreachable
Make unreachable a function instead of a macro, since
C++20 provides a convenience class as a replacement for
older __FILE__, __LINE__ macros.

(cherry picked from commit d59b959c87)
2025-10-08 20:05:50 +00:00
Sergei Zimmerman
a732f0354d libutil: Try to call std::terminate for panic
We now have a terminate handler that prints a
stack trace, which is useful to have when encountering
an unreachable.

(cherry picked from commit 1f607b5def)
2025-10-08 20:05:50 +00:00
internal-nix-ci[bot]
885499ace5
Merge pull request #14183 from NixOS/backport-14156-to-2.31-maintenance
[Backport 2.31-maintenance] treewide: Squash some user-after-free bugs
2025-10-08 00:28:23 +00:00
internal-nix-ci[bot]
e4e41a17e6
Merge pull request #14185 from NixOS/backport-14086-to-2.31-maintenance
[Backport 2.31-maintenance] nix-cli: use pure/restricted eval for help pages
2025-10-08 00:20:41 +00:00
Seth Flynn
451f483ef0 nix-cli: use pure/restricted eval for help pages
This avoids any complications that can arise from the environment
affecting evaluation of the help pages (which don't need to be calling
out to anything external anyways)

A recent example of one of these problems is
https://github.com/NixOS/nix/issues/14085, which would break help pages
by causing them to make invalid calls to the dummy store they're
evaluated with

Fixes: https://github.com/NixOS/nix/issues/14062
Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
(cherry picked from commit ff82de86da)
2025-10-08 00:06:03 +00:00
Sergei Zimmerman
fa8230167d libexpr: Use use-after-move in SampleStack::saveProfile()
(cherry picked from commit be1ade7373)
2025-10-08 00:03:50 +00:00
Sergei Zimmerman
d1cec3d3ed libstore: Fix use-after-move in DerivationGoal::repairClosure
(cherry picked from commit 452ec09fe0)
2025-10-08 00:03:50 +00:00
internal-nix-ci[bot]
66f6ad1292
Merge pull request #14179 from NixOS/backport-14154-to-2.31-maintenance
[Backport 2.31-maintenance] treewide: Remove toView() because it leads to segfaults when compiled…
2025-10-07 22:15:04 +00:00
internal-nix-ci[bot]
e8574843f1
Merge pull request #14178 from NixOS/backport-14150-to-2.31-maintenance
[Backport 2.31-maintenance] libstore: fixup fakeSSH check
2025-10-07 22:12:56 +00:00
internal-nix-ci[bot]
404bc1d93c
Merge pull request #14177 from NixOS/backport-14168-to-2.31-maintenance
[Backport 2.31-maintenance] libutil: Throw if `str("contents")` not found
2025-10-07 22:09:54 +00:00
Sergei Zimmerman
64dbb6f812 treewide: Remove toView() because it leads to segfaults when compiled with newer nixpkgs
Firstly, this is now available on darwin where the default in llvm 19.
Secondly, this leads to very weird segfaults when building with newer nixpkgs for some reason.
(It's UB after all).

This appears when building with the following:

mesonComponentOverrides = finalAttrs: prevAttrs: {
mesonBuildType = "debugoptimized";
dontStrip = true;
doCheck = false;
separateDebugInfo = false;
preConfigure = (prevAttrs.preConfigure or "") + ''
  case "$mesonBuildType" in
  release|minsize|debugoptimized) appendToVar mesonFlags "-Db_lto=true"  ;;
  *)                              appendToVar mesonFlags "-Db_lto=false" ;;
  esac
'';
};

And with the following nixpkgs input:

nix build ".#nix-cli" -L --override-input nixpkgs "https://releases.nixos.org/nixos/unstable/nixos-25.11pre870157.7df7ff7d8e00/nixexprs.tar.xz"

Stacktrace:

 #0  0x00000000006afdc0 in ?? ()
 #1  0x00007ffff71cebb6 in _Unwind_ForcedUnwind_Phase2 () from /nix/store/41ym1jm1b7j3rhglk82gwg9jml26z1km-gcc-14.3.0-lib/lib/libgcc_s.so.1
 #2  0x00007ffff71cf5b5 in _Unwind_Resume () from /nix/store/41ym1jm1b7j3rhglk82gwg9jml26z1km-gcc-14.3.0-lib/lib/libgcc_s.so.1
 #3  0x00007ffff7eac7d8 in std::basic_ios<char, std::char_traits<char> >::~basic_ios (this=<optimized out>, this=<optimized out>)
     at /nix/store/82kmz7r96navanrc2fgckh2bamiqrgsw-gcc-14.3.0/include/c++/14.3.0/bits/basic_ios.h:286
 #4  std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream (this=<optimized out>, this=<optimized out>)
     at /nix/store/82kmz7r96navanrc2fgckh2bamiqrgsw-gcc-14.3.0/include/c++/14.3.0/sstream:806
 #5  nix::SimpleLogger::logEI (this=<optimized out>, ei=...) at ../logging.cc:121
 #6  0x00007ffff7515794 in nix::Logger::logEI (this=0x675450, lvl=nix::lvlError, ei=...) at /nix/store/bkshji3nnxmrmgwa4n2kaxadajkwvn65-nix-util-2.32.0pre-dev/include/nix/util/logging.hh:144
 #7  nix::handleExceptions (programName=..., fun=...) at ../shared.cc:336
 #8  0x000000000047b76b in main (argc=<optimized out>, argv=<optimized out>) at /nix/store/82kmz7r96navanrc2fgckh2bamiqrgsw-gcc-14.3.0/include/c++/14.3.0/bits/new_allocator.h:88

(cherry picked from commit dce1a893d0)
2025-10-07 21:39:12 +00:00
Cole Helbling
823c630b2e libstore: fixup fakeSSH check
This broke invocations like:

    NIX_SSHOPTS='-p2222 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no' nix copy /nix/store/......-foo --to ssh-ng://root@localhost

In Nix 2.30.2, fakeSSH was enabled when the "thing I want to connect to"
was plain old "localhost". Previously, this check was written as:

         , fakeSSH(host == "localhost")

Given the above invocation, `host` would have been `root@localhost`, and
thus `fakeSSH` would be `false` because `root@localhost` != `localhost`.

However, since 49ba06175e, `authority.host`
returned _just_ the host (`localhost`, no user) and erroneously enabled
`fakeSSH` in this case, causing `NIX_SSHOPTS` to be ignored (since,
when `fakeSSH` is `true`, `SSHMaster::startCommand` doesn't call
`addCommonSSHOpts`).

`authority.to_string()` accurately returns the expected `root@localhost`
format (given the above invocation), fixing this.

(cherry picked from commit 7ec1427fc3)
2025-10-07 21:37:07 +00:00
Samuel Connelly
7a05ed9c12 libutil: Throw if str("contents") not found
This was broken in 7aa3e7e3a5 (since 2.25).

(cherry picked from commit 242f362567)
2025-10-07 21:33:19 +00:00
John Ericson
80f2ca4015
Merge pull request #14046 from NixOS/mergify/bp/2.31-maintenance/pr-13929
Remove unused function setChildSignalMask() (backport #13929)
2025-09-22 13:39:43 -04:00
Eelco Dolstra
9f34b6ca73 Remove unused function setChildSignalMask()
(cherry picked from commit a44dcbff13)
2025-09-22 16:32:00 +00:00
Eelco Dolstra
8e7d86d4cf Bump version 2025-09-18 13:38:38 +02:00
mergify[bot]
fdea162417
Merge pull request #14010 from NixOS/mergify/bp/2.31-maintenance/pr-14009
Revert "tests/nixos: Fix daemon store reference in authorization test" (backport #14009)
2025-09-17 20:25:38 +00:00
Sergei Zimmerman
8989350d4e Revert "tests/nixos: Fix daemon store reference in authorization test"
This reverts commit 695f3bc7e3.

(cherry picked from commit 86ad8d49f9)
2025-09-17 19:59:49 +00:00
mergify[bot]
a3df190232
Merge pull request #14004 from NixOS/mergify/bp/2.31-maintenance/pr-13839
don't include derivation name in temporary build directories (backport #13839)
2025-09-16 10:49:56 +00:00
Jörg Thalheim
7c3fd50617 don't include derivation name in temporary build directories
With the migration to /nix/var/nix/builds we now have failing builds
when the derivation name is too long.
This change removes the derivation name from the temporary build to have
a predictable prefix length:

Also see: https://github.com/NixOS/infra/pull/764
for context.

(cherry picked from commit 725a2f379f)
2025-09-16 10:23:44 +00:00
mergify[bot]
8fc22db0e1
Merge pull request #13989 from NixOS/mergify/bp/2.31-maintenance/pr-13985
libstore: Raise default connect-timeout to 15 secs (backport #13985)
2025-09-14 11:50:47 +00:00
dramforever
a1ccb18abf libstore: Raise default connect-timeout to 15 secs
This allows the weird network or DNS server fallback mechanism inside
glibc to work, and prevents a "Resolving timed out after 5000
milliseconds" error. Read on for details.

The DNS request stuff (dns-hosts) in glibc uses this fallback procedure
to minimize network RTT in the ideal case while dealing with
ill-behaving networks and DNS servers gracefully (see resolv.conf(5)):

- Use sendmmsg() to send UDP DNS requests for IPv4 and IPv6 in parallel
- If that times out (meaning that none or only one of the responses have
  been received), send the requests one by one, waiting for the response
  before sending the next request ("single-request")
- If that still times out, try to use a different socket (hence
  different address) for each request ("single-request-reopen")

The default timeout inside glibc is 5 seconds. Therefore, setting
connect-timeout, and therefore CURLOPT_CONNECTTIMEOUT to 5 seconds
prevents the single-request fallback, and setting it to even 10 seconds
prevents the single-request-reopen fallback as well.

The fallback decision is saved by glibc, but only thread-locally, and
libcurl starts a new thread for getaddrinfo() for each connection.
Therefore for every connection the fallback starts from sendmmsg() all
over again. And since these are considered to have timed out by libcurl,
even though getaddrinfo() might return a successful result, it is not
cached in libcurl.

While a user could tweak these with resolv.conf(5) options (e.g. using
networking.resolvconf.extraOptions in NixOS), and indeed that is
probably needed to avoid annoying delays, it still means that the
default connect-timeout of 5 is too low. Raise it to give fallback a
chance.

(cherry picked from commit 7295034362)
2025-09-14 11:19:49 +00:00
Sergei Zimmerman
f55f5dff34
Merge pull request #13974 from NixOS/mergify/bp/2.31-maintenance/pr-13970 2025-09-12 21:58:50 +00:00
Sergei Zimmerman
48eaf35828 Revert "meson: add soversion to libraries (#13960)"
This reverts commit bdbc739d6e.

Such a change needs more thought put into it. By versioning
shared libraries we'd make a false impression that libraries
themselves are actually versioned and have some sort of stable
ABI, which is not the case.

This will be useful when C bindings become stable, but as long
as they are experimental it does not make sense to set SONAME.

Also this change should not have been backported, since it's
severely breaking.

(cherry picked from commit 0db2b8c8fe)
2025-09-12 21:18:42 +00:00
mergify[bot]
6d862484d7
Merge pull request #13968 from NixOS/mergify/bp/2.31-maintenance/pr-13966
meson: add soversion to libraries (#13960) (backport #13966)
2025-09-12 07:00:40 +00:00
Jens Petersen
c2c4ffc164 meson: add soversion to libraries (#13960)
(cherry picked from commit bdbc739d6e)
2025-09-12 06:26:41 +00:00
Sergei Zimmerman
489fad878b
Merge pull request #13952 from NixOS/mergify/bp/2.31-maintenance/pr-13939
Pass `dir` in extraAttrs when overriding the registry (backport #13939)
2025-09-09 19:09:29 +00:00
Cole Helbling
26b862b6d2 Pass dir in extraAttrs when overriding the registry
This is handled similarly in the handler for `--override-flake` in
`MixEvalArgs`.

(cherry picked from commit 38663fb434)
2025-09-09 18:34:37 +00:00
Cole Helbling
3ba8b83f95 Test that using --inputs-from with a flakeref that has a dir works
Will not pass until the next commit.

(cherry picked from commit ed6ef7cdf4)
2025-09-09 18:34:36 +00:00
Eelco Dolstra
c2ef01d26a
Merge pull request #13946 from NixOS/mergify/bp/2.31-maintenance/pr-13934
Fix flake registry ignoring `dir` parameter (backport #13934)
2025-09-09 10:46:18 +02:00
Cole Helbling
7b59cafaed fixup: cached case
I couldn't come up with a test that failed before this, but my existing
test still passes so 🤷

(cherry picked from commit 9c832a08b0)
2025-09-09 07:39:17 +00:00
Cole Helbling
ba46c7d0f2 Fix flake registry ignoring dir parameter
This broke in e3042f10af.

(cherry picked from commit bccdb95a86)
2025-09-09 07:39:17 +00:00
Cole Helbling
766a236014 Test that dir is propagated from registry entry
(cherry picked from commit 258d41bfb6)
2025-09-09 07:39:16 +00:00
mergify[bot]
1676a04197
Merge pull request #13943 from NixOS/mergify/bp/2.31-maintenance/pr-13940
libstore: Reallow unbracketed IPv6 addresses in store references (backport #13940)
2025-09-08 23:47:51 +00:00
Sergei Zimmerman
1ca1882e8c libstore: Reallow unbracketed IPv6 addresses in store references
This implements a special back-compat shim to specifically allow
unbracketed IPv6 addresses in store references. This is something
that is relied upon in the wild and the old parsing logic accepted
both ways (brackets were optional). This patch restores this behavior.
As always, we didn't have any tests for this.

Addresses #13937.

(cherry picked from commit 7cc654afa9)
2025-09-08 23:22:41 +00:00
mergify[bot]
72028d1fa1
Merge pull request #13931 from NixOS/mergify/bp/2.31-maintenance/pr-13911
libstore: Do not normalize daemon -> unix://, local -> local:// (backport #13911)
2025-09-07 20:59:27 +00:00
Sergei Zimmerman
bbbb4ce330
libstore: Do not normalize daemon -> unix://, local -> local://
This is relied upon (specifically the `local` store) by existing
tooling [1] and we broke this in 3e7879e6df (which
was first released in 2.31).

To lessen the scope of the breakage we should not normalize "auto" references
and explicitly specified references like "local" or "daemon". It also makes
sense to canonicalize local://,daemon:// to be more compatible with prior
behavior.

[1]: 05e1b3cba2/lib/NOM/Builds.hs (L60-L64)

(cherry picked from commit 3513ab13dc)
2025-09-07 23:38:14 +03:00
mergify[bot]
8e01f134a1
Merge pull request #13922 from NixOS/mergify/bp/2.31-maintenance/pr-13901
Fix macOS HUP detection using kqueue instead of poll (backport #13901)
2025-09-06 07:50:52 +00:00
Jörg Thalheim
2128753e46 Fix macOS HUP detection using kqueue instead of poll
On macOS, poll() is fundamentally broken for HUP detection. It loses event
subscriptions when EVFILT_READ fires without matching the requested events
in the pollfd. This causes daemon processes to linger after client disconnect.

This commit replaces poll() with kqueue on macOS, which is what poll()
uses internally but without the bugs. The kqueue implementation uses
EVFILT_READ which works for both sockets and pipes, avoiding EVFILT_SOCK
which only works for sockets.

On Linux and other platforms, we continue using poll() with the standard
POSIX behavior where POLLHUP is always reported regardless of requested events.

Based on work from the Lix project (https://git.lix.systems/lix-project/lix)
commit 69ba3c92db3ecca468bcd5ff7849fa8e8e0fc6c0

Fixes: https://github.com/NixOS/nix/issues/13847
Related: https://git.lix.systems/lix-project/lix/issues/729
Apple bugs: rdar://37537852 (poll), FB17447257 (poll)

Co-authored-by: Jade Lovelace <jadel@mercury.com>
(cherry picked from commit 1286d5db78)
2025-09-06 07:21:47 +00:00
John Ericson
f3cb8050b2
Merge pull request #13915 from NixOS/mergify/bp/2.31-maintenance/pr-13900
Fix downstream MinGW build by not looking for Boost Regex (backport #13900)
2025-09-04 21:34:00 -04:00
John Ericson
702112a41c Fix downstream MinGW build by not looking for Boost Regex
(cherry picked from commit 6bdb5e8e09)
2025-09-05 01:07:02 +00:00
Eelco Dolstra
e7540a269b Bump version 2025-09-02 11:22:41 +02:00
Sergei Zimmerman
4006d0fe11
Merge pull request #13882 from NixOS/mergify/bp/2.31-maintenance/pr-13741 2025-09-01 07:52:24 +00:00
Sergei Zimmerman
13d1be04b3 libexpr: Canonicalize TOML timestamps for toml11 > 4.0
This addresses several changes from toml11 4.0 bump in
nixpkgs [1].

1. Added more regression tests for timestamp formats.
   Special attention needs to be paid to the precision
   of the subsecond range for local-time. Prior versions select the closest
   (upwards) multiple of 3 with a hard cap of 9 digits.

2. Normalize local datetime and offset datetime to always
   use the uppercase separator `T`. This is actually the issue
   surfaced in [2]. This canonicalization is basically a requirement
   by (a certain reading) of rfc3339 section 5.6 [3].

3. If using toml11 >= 4.0 also keep the old behavior wrt
   to the number of digits used for subsecond part of the local-time.
   Newer versions cap it at 6 digits unconditionally.

[1]: https://www.github.com/NixOS/nixpkgs/pull/331649
[2]: https://www.github.com/NixOS/nix/issues/11441
[3]: https://datatracker.ietf.org/doc/html/rfc3339

(cherry picked from commit dc769d72cb)
2025-08-31 22:52:24 +00:00
Sergei Zimmerman
e8a54769a1 libexpr: Use table.size() instead of unnecessary loop
(cherry picked from commit d8fc55a46e)
2025-08-31 22:52:24 +00:00
Sergei Zimmerman
1fc4d526a3 libexpr: Use recursive lambda instead of std::function
There's no reason to use a std::function for recursive lambdas
since there are polymorphic lambdas.

(cherry picked from commit a80a5c4dba)
2025-08-31 22:52:23 +00:00
Sergei Zimmerman
c7e35e1ff8 libexpr: Remove extra trailing semicolons (NFC)
This looks really weird after the reformat.

(cherry picked from commit df4e55ffc1)
2025-08-31 22:52:23 +00:00