1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00
Commit graph

20818 commits

Author SHA1 Message Date
Eelco Dolstra
fe711b2f4c Don't crash on flakerefs containing newlines
Fixes #14311.

(cherry picked from commit c1317017e9)
2025-11-06 19:18:12 +00:00
internal-nix-ci[bot]
bb375a0bcc
Merge pull request #14460 from NixOS/backport-14450-to-2.31-maintenance
[Backport 2.31-maintenance] flake: Update, nixos-25.05-small -> nixos-25.05
2025-11-03 17:42:15 +00:00
Robert Hensing
c3e5510622 Apply updated nixfmt
(cherry picked from commit 81a2809a52)
2025-11-03 17:08:27 +00:00
Robert Hensing
72a4832b66 flake: Update, nixos-25.05-small -> nixos-25.05
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/d98ce345cdab58477ca61855540999c86577d19d?narHash=sha256-O2CIn7HjZwEGqBrwu9EU76zlmA5dbmna7jL1XUmAId8%3D' (2025-08-26)
  → 'github:NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55?narHash=sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8%2BON/0Yy8%2Ba5vsDU%3D' (2025-10-27)

(cherry picked from commit 233bd250d1)
2025-11-03 17:08:27 +00:00
internal-nix-ci[bot]
ce97fa9f05
Merge pull request #14437 from NixOS/backport-14434-to-2.31-maintenance
[Backport 2.31-maintenance] libstore: Improve store-reference back-compat with IPv6 ZoneId literals
2025-11-01 00:17:48 +00:00
Sergei Zimmerman
43f7704edc libstore: Improve store-reference back-compat with IPv6 ZoneId literals
This restores the pre-2.31 handling of ZoneID identifiers in store references.
It's the only place we reasonably care about this back-compat.

(cherry picked from commit 8dbc2475f7)
2025-10-31 23:50:19 +00:00
Sergei Zimmerman
60e906a535
Merge pull request #14433 from jonhermansen/backport-14134-to-2.31-maintenance 2025-11-01 00:57:54 +03:00
Jami Kettunen
9259a07e23 libstore: Include missing header to fix compile with libc++ 20
https://en.cppreference.com/w/cpp/thread.html

src/libstore/gc.cc:121:39: error: no member named 'sleep_for' in namespace 'std::this_thread'
  121 |                     std::this_thread::sleep_for(std::chrono::milliseconds(100));
      |                     ~~~~~~~~~~~~~~~~~~^

(cherry picked from commit 140b08ae3e)
2025-10-31 17:20:52 -04:00
internal-nix-ci[bot]
264cc2e2b2
Merge pull request #14381 from NixOS/backport-14364-to-2.31-maintenance
[Backport 2.31-maintenance] diff-closures: print sizes with dynamic unit
2025-10-27 20:37:15 +00:00
Marcel
6275de367f treewide: replace manual MiB calculations with renderSize
(cherry picked from commit 584a8e8a00)
2025-10-27 19:43:37 +00:00
Marcel
0c6585707a refactor(libutil): remove showBytes() in favor of renderSize()
The `showBytes()` function was redundant with `renderSize()` as the
latter automatically selects the appropriate unit (KiB, MiB, GiB, etc.)
based on the value, whereas `showBytes()` always formatted as MiB
regardless of size.

Co-authored-by: Bernardo Meurer Costa <beme@anthropic.com>
(cherry picked from commit f234633e27)
2025-10-27 19:43:37 +00:00
Marcel
1a22674806 diff-closures: print sizes with dynamic unit
(cherry picked from commit 9d4d10954a)
2025-10-27 19:43:37 +00:00
internal-nix-ci[bot]
3cca112d79
Merge pull request #14353 from NixOS/backport-14343-to-2.31-maintenance
[Backport 2.31-maintenance] Revert "libmain: Catch logger exceptions in `handleExceptions`"
2025-10-24 23:59:16 +00:00
Sergei Zimmerman
993a58e2f6 Revert "libmain: Catch logger exceptions in handleExceptions"
This reverts commit 90d1ff4805.

The initial issue with EPIPE was solved in 9f680874c5.
Now this patch does move bad than good by eating up boost::io::format_error that are
bugs.

(cherry picked from commit 4f5af471fb)
2025-10-24 23:28:48 +00:00
internal-nix-ci[bot]
61f09a36f8
Merge pull request #14258 from NixOS/backport-14253-to-2.31-maintenance
[Backport 2.31-maintenance] libfetchers/git-utils: Be more correct about validating refnames
2025-10-15 20:33:35 +00:00
Sergei Zimmerman
1e5a389a2f libfetchers/git-utils: Be more correct about validating refnames
Turns out there's a much better API for this that doesn't have the
footguns of the previous method.

isLegalRefName is somewhat of a misnomer, since it's mainly used to
validate user inputs that can be either references, branch names,
psedorefs or tags.

(cherry picked from commit 5d1178b817)
2025-10-15 20:08:39 +00:00
internal-nix-ci[bot]
71fe367e8c
Merge pull request #14248 from NixOS/backport-13976-to-2.31-maintenance
[Backport 2.31-maintenance] packaging: Drop legacy apple sdk pattern
2025-10-14 21:35:37 +00:00
Sergei Zimmerman
421f650bb1 packaging: Drop legacy apple sdk pattern
This has been dropped on unstable an nix no longer
compiled with overridden nixpkgs input. On 25.05 these
overrides already do nothing.

Tested with:

nix build .#packages.x86_64-darwin.nix-cli -L --override-input nixpkgs https://releases.nixos.org/nixos/unstable/nixos-25.11pre859555.ab0f3607a6c7/nixexprs.tar.xz

Default deployment target on 25.05 is 11.3, so 10.13
sdk override doesn't have to be updated at all as evident
from the fact that we didn't observe any issues with it.

(cherry picked from commit 20b532eab0)
2025-10-14 21:15:28 +00:00
John Ericson
dc87ed5eab
Merge pull request #14240 from NixOS/2.31-maintenance-backport-13975
Fix hash error message
2025-10-13 18:07:16 -04:00
John Ericson
56751b1cd2
Fix hash error message
Wrong number of arguments was causing a format assertion.

(cherry picked from commit c6d06ce486)
2025-10-14 00:30:26 +03:00
internal-nix-ci[bot]
a042b379fa
Merge pull request #14211 from NixOS/backport-14210-to-2.31-maintenance
[Backport 2.31-maintenance] libstore: Fix double-quoting of paths in logs
2025-10-10 23:27:12 +00:00
Sergei Zimmerman
ba38e59304 libstore: Fix double-quoting of paths in logs
std::filesystem::path is already quoted by boost::format with double quotes (").
(cherry picked from commit f30cb8667b)
2025-10-10 22:54:18 +00:00
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