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

20085 commits

Author SHA1 Message Date
Stefan Boca
1b97d7409a nix-profile{,-daemon}.fish: fix do not source twice
Commit b36637c8f7 set
`__ETC_PROFILE_NIX_SOURCED` globally, but this is not enough to prevent
the script from being run again by child shells, because the
variable was not exported and thus not inherited by any child process.
Exporting the variable also agrees with the bash scripts.

Notably, the old behavior broke `nix develop -c fish` in some cases,
because the profile bin directory got prepended to the path, causing
binaries from the profile to override binareis from the devshell.

(cherry picked from commit b9ed3ae36e)
2025-07-30 12:03:51 +00:00
Stefan Boca
ab95054e64 nix-profile{,-daemon}.fish: format with fish_indent
(cherry picked from commit f627b8c721)
2025-07-30 12:03:50 +00:00
mergify[bot]
0877680b08
Merge pull request #13561 from NixOS/mergify/bp/2.29-maintenance/pr-13558
meson: Fix `nix_system_cpu` for MIPS and 32 bit ARM systems (backport #13558)
2025-07-27 00:10:00 +00:00
Sergei Zimmerman
e37fce3899 meson: Fix nix_system_cpu for MIPS and 32 bit ARM systems
Prior patches in 54dc5314e8
and 6db6190002 fixed the default
system double for i686 and ppc/ppc64. This also patch also covers
32 bit arm and mips. ARM cpu names are taken from host_machine.cpu()
for a lack of a better option, but host_machine.cpu_family() is
preferred, since that is supposed to be somewhat standard for cross
files. Endianness is handled correctly by looking at host_machine.endian().

This also updates the documentation to be up to date to how system cpu
is translated from the host_machine specification.

(cherry picked from commit 60d124b36e)
2025-07-26 23:29:28 +00:00
Eelco Dolstra
c1f54da018
Merge pull request #13540 from NixOS/mergify/bp/2.29-maintenance/pr-13535
Fix nix_system_cpu on i686-linux (backport #13535)
2025-07-25 02:08:52 +02:00
Eelco Dolstra
a1efe99f5b
Fix nix_system_cpu on i686-linux
Fixes #13532.

(cherry picked from commit 54dc5314e8)
2025-07-25 02:53:50 +03:00
Sergei Zimmerman
359227ad14
meson: Correctly handle endianness for PowerPC CPU families
I've missed this while reviewing 6db6190002.
I only built big endian ppc64, so that didn't occur to me.

From meson manual:

> Those porting from autotools should note that Meson does not add
> endianness to the name of the cpu_family. For example, autotools will
> call little endian PPC64 "ppc64le", Meson will not, you must also check
> the .endian() value of the machine for this information.

This code should handle that correctly.

(cherry picked from commit ebd311b7b7)
2025-07-25 02:53:49 +03:00
Sergei Zimmerman
e0d2cf5a89
Merge pull request #13548 from NixOS/mergify/bp/2.29-maintenance/pr-13546
ci: Make it actually possible to disable dogfooding (backport #13546)
2025-07-25 02:53:03 +03:00
Sergei Zimmerman
da770a89e6
ci: Roll back default nix to 2.29.1 in install-nix-action
Daemon tests are broken in 2.30.1 Darwin sandbox and there's
no point release with the fix yet.
2025-07-25 02:22:07 +03:00
Sergei Zimmerman
58c71ed812 ci: Make it actually possible to disable dogfooding
Github composite actions are a real treat. Boolean inputs
are not actually booleans but rather strings [1].

[1]: https://www.github.com/actions/runner/issues/2238

(cherry picked from commit f0695e177f)
2025-07-24 23:18:36 +00:00
Sergei Zimmerman
c972f66475
Merge pull request #13537 from NixOS/mergify/bp/2.29-maintenance/pr-13473
ci: Dogfood Nix from master (backport #13473)
2025-07-25 02:17:29 +03:00
Sergei Zimmerman
bfc5678471
ci: Don't dogfood installer from master
CI on release branches should be stable, otherwise backporting
might become flaky and unreliable. Dogfooding only really makes
sense for CI on master branch, where failures are not as tedious
to work around.
2025-07-25 01:56:12 +03:00
Sergei Zimmerman
a5684b2c83
ci: Dogfood nix from master for vm_tests and flake_regressions
This should provide more coverage for the build from master that
is being dogfooded.

(cherry picked from commit 3b3c02160d)
2025-07-25 01:14:39 +03:00
Sergei Zimmerman
c17e66af6f
ci: Dogfood Nix from master
(cherry picked from commit 04f6974d2c)

# Conflicts:
#	.github/workflows/ci.yml
2025-07-25 01:14:38 +03:00
mergify[bot]
661caad5bb
Merge pull request #13517 from NixOS/mergify/bp/2.29-maintenance/pr-13514
treewide: Fix Meson CPU names for powerpc CPUs (backport #13514)
2025-07-21 23:33:35 +00:00
OPNA2608
281e3b0247 treewide: Fix Meson CPU names for powerpc CPUs
(cherry picked from commit 6db6190002)
2025-07-21 22:49:14 +00:00
Jörg Thalheim
af342d8b2b
Merge pull request #13505 from NixOS/mergify/bp/2.29-maintenance/pr-13108
Rip off the bandaid: Format the codebase with clang-format (backport #13108)
2025-07-18 22:31:35 +02:00
Sergei Zimmerman
7c2b240ded
Update .git-blame-ignore-revs to ignore the mass reformatting
Co-authored-by: Graham Christensen <graham@grahamc.com>
2025-07-18 22:50:11 +03:00
Sergei Zimmerman
0e35cd6f3e
Apply clang-format universally.
* It is tough to contribute to a project that doesn't use a formatter,
* It is extra hard to contribute to a project which has configured the formatter, but ignores it for some files
* Code formatting makes it harder to hide obscure / weird bugs by accident or on purpose,

Let's rip the bandaid off?

Note that PRs currently in flight should be able to be merged relatively easily by applying `clang-format` to their tip prior to merge.

Co-authored-by: Graham Christensen <graham@grahamc.com>
2025-07-18 22:49:40 +03:00
Graham Christensen
a5cfab671b Update clang-format with fixing namespace coments, and separate definition blocks
(cherry picked from commit 41bf87ec70)
2025-07-18 22:47:54 +03:00
Graham Christensen
bd1ff9f254 Drop a ton of files that should just get formatted
(cherry picked from commit e7af2e6566)
2025-07-18 22:47:48 +03:00
Graham Christensen
036cd2a408 Add sed
(cherry picked from commit 6896761d79)
2025-07-18 19:42:21 +00:00
Graham Christensen
82bf098fbe format.sh: support looping until it is happy
(cherry picked from commit ee9b57cbf5)
2025-07-18 19:42:21 +00:00
Sergei Zimmerman
4b3bbf8511
Merge pull request #13452 from NixOS/mergify/bp/2.29-maintenance/pr-13450
libexpr: Fix invalid handling of errors for imported functions (backport #13450)
2025-07-12 00:12:25 +03:00
Sergei Zimmerman
8736cb537d
libexpr: Fix invalid handling of errors for imported functions
c39cc00404 has added assertions for
all Value accesses and the following case has started failing with
an `unreachable`:

(/tmp/fun.nix):

```nix
{a}: a
```

```
$ nix eval --impure --expr 'import /tmp/fun.nix {a="a";b="b";}'
```

This would crash:

```
terminating due to unexpected unrecoverable internal error: Unexpected condition in getStorage at ../include/nix/expr/value.hh:844
```

This is not a regression, but rather surfaces an existing problem, which previously
was left undiagnosed. In the case of an import `fun` is the `import` primOp, so that read is invalid
and previously this resulted in an access into an inactive union member, which is UB.
The correct thing to use is `vCur`. Identical problem also affected the case of a missing argument.

Add previously failing test cases to the functional/lang test suite.

Fixes #13448.

(cherry picked from commit 6e78cc90d3)
2025-07-11 22:51:09 +03:00
Eelco Dolstra
d4d0853fee
Merge pull request #13415 from NixOS/mergify/bp/2.29-maintenance/pr-13412
libutil: Use caching `directory_entry` API in `PosixSourceAccessor::r… (backport #13412)
2025-07-01 17:48:23 +02:00
Sergei Zimmerman
aaffbc2209 libutil: Use caching directory_entry API in PosixSourceAccessor::readDirectory
Previous use of symlink_status() always translated into a stat call, leading
to huge performance penalties for by-name-overlay in nixpkgs. The comment
below references the possible caching, but that seemed to be erroneous, since
the correct way to make use of the caching API is by calling a bunch of `is_*`
functions [1]. For example, here's how libstdc++ does that [2], [3].

This translates to great nixpkgs eval performance improvements:

```
Benchmark 1: GC_INITIAL_HEAP_SIZE=4G result/bin/nix-instantiate ../nixpkgs -A hello --readonly-mode
  Time (mean ± σ):     186.7 ms ±   6.7 ms    [User: 121.3 ms, System: 64.9 ms]
  Range (min … max):   179.4 ms … 201.6 ms    16 runs

Benchmark 2: GC_INITIAL_HEAP_SIZE=4G nix-instantiate ../nixpkgs -A hello --readonly-mode
  Time (mean ± σ):     230.6 ms ±   5.0 ms    [User: 126.9 ms, System: 103.1 ms]
  Range (min … max):   225.1 ms … 241.4 ms    13 runs
```

[1]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0317r1.html
[2]: 8ea555b7b4/libstdc%2B%2B-v3/include/bits/fs_dir.h (L341-L348)
[3]: 8ea555b7b4/libstdc%2B%2B-v3/include/bits/fs_dir.h (L161-L163)

(cherry picked from commit 8708e9a526)
2025-07-01 15:00:31 +00:00
mergify[bot]
8f6c5d088a
Merge pull request #13404 from NixOS/mergify/bp/2.29-maintenance/pr-13170
Use correct parent `outPath` for relative path inputs (backport #13170)
2025-06-27 12:34:04 +00:00
Matt Sturgeon
d0290d342d Add release note for non-flake inputs having sourceInfo
(cherry picked from commit 2922e3082e)
2025-06-27 11:59:53 +00:00
Matt Sturgeon
7b050cec80 tests/functional/flakes/non-flake-inputs: Test non-flake inputs having sourceInfo
(cherry picked from commit 72232bc28a)
2025-06-27 11:59:53 +00:00
Robert Hensing
82dcbe0510 tests/function/flakes/relative-paths: Test #13164
(cherry picked from commit eaee0b4740)
2025-06-27 11:59:52 +00:00
Matt Sturgeon
31e19b0a28 Use correct parent outPath for relative path inputs
Ensure relative path inputs are relative to the parent node's _actual_
`outPath`, instead of the subtly different `sourceInfo.outPath`.

Additionally, non-flake inputs now also have a `sourceInfo` attribute.

This fixes the relationship between `self.outPath` and
`self.sourceInfo.outPath` in some edge cases.

Fixes #13164

(cherry picked from commit 46beb9af76)
2025-06-27 11:59:52 +00:00
Eelco Dolstra
7bb2001997 Bump version 2025-06-24 17:02:40 +02:00
Eelco Dolstra
5d78f74fe4 Merge remote-tracking branch 'cve/fod-cves-2.29' into 2.29-maintenance 2025-06-24 16:05:12 +02:00
mergify[bot]
b3b137ec4a
Merge pull request #13392 from NixOS/mergify/bp/2.29-maintenance/pr-13348
Make the repl test more robust (backport #13348)
2025-06-22 19:41:08 +00:00
Eelco Dolstra
833406121c Make the repl test more robust
Seen in https://github.com/DeterminateSystems/nix-src/actions/runs/15590867877/job/43909540271:

  nix-functional-tests> grep: repl_output: No such file or directory
  nix-functional-tests> +(repl.sh:174) cat repl_output

This is because there is a small possibility that the `nix repl` child
process hasn't created `repl_output` yet. So make sure it exists.

(cherry picked from commit 9eb46e9cc0)
2025-06-22 19:09:38 +00:00
Eelco Dolstra
01619fbe2d Fixes for GHSA-g948-229j-48j3
Squashed commit of the following:

commit 04fff3a637d455cbb1d75937a235950e43008db9
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Thu Jun 12 12:30:32 2025 +0200

    Chown structured attr files safely

commit 5417ad445e414c649d0cfc71a05661c7bf8f3ef5
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Thu Jun 12 12:14:04 2025 +0200

    Replace 'bool sync' with an enum for clarity

    And drop writeFileAndSync().

commit 7ae0141f328d8e8e1094be24665789c05f974ba6
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Thu Jun 12 11:35:28 2025 +0200

    Drop guessOrInventPathFromFD()

    No need to do hacky stuff like that when we already know the original path.

commit 45b05098bd019da7c57cd4227a89bfd0fa65bb08
Author: Eelco Dolstra <edolstra@gmail.com>
Date:   Thu Jun 12 11:15:58 2025 +0200

    Tweak comment

commit 0af15b31209d1b7ec8addfae9a1a6b60d8f35848
Author: Raito Bezarius <raito@lix.systems>
Date:   Thu Mar 27 12:22:26 2025 +0100

    libstore: ensure that temporary directory is always 0o000 before deletion

    In the case the deletion fails, we should ensure that the temporary
    directory cannot be used for nefarious purposes.

    Change-Id: I498a2dd0999a74195d13642f44a5de1e69d46120
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit 2c20fa37b15cfa03ac6a1a6a47cdb2ed66c0827e
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 12:42:55 2025 +0100

    libutil: ensure that `_deletePath` does NOT use absolute paths with dirfds

    When calling `_deletePath` with a parent file descriptor, `openat` is
    made effective by using relative paths to the directory file descriptor.

    To avoid the problem, the signature is changed to resist misuse with an
    assert in the prologue of the function.

    Change-Id: I6b3fc766bad2afe54dc27d47d1df3873e188de96
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit d3c370bbcae48bb825ce19fd0f73bb4eefd2c9ea
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:07:47 2025 +0100

    libstore: ensure that `passAsFile` is created in the original temp dir

    This ensures that `passAsFile` data is created inside the expected
    temporary build directory by `openat()` from the parent directory file
    descriptor.

    This avoids a TOCTOU which is part of the attack chain of CVE-????.

    Change-Id: Ie5273446c4a19403088d0389ae8e3f473af8879a
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit 45d3598724f932d024ef6bc2ffb00c1bb90e6018
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:06:03 2025 +0100

    libutil: writeFile variant for file descriptors

    `writeFile` lose its `sync` boolean flag to make things simpler.

    A new `writeFileAndSync` function is created and all call sites are
    converted to it.

    Change-Id: Ib871a5283a9c047db1e4fe48a241506e4aab9192
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit 732bd9b98cabf4aaf95a01fd318923de303f9996
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:05:34 2025 +0100

    libstore: chown to builder variant for file descriptors

    We use it immediately for the build temporary directory.

    Change-Id: I180193c63a2b98721f5fb8e542c4e39c099bb947
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit 962c65f8dcd5570dd92c72370a862c7b38942e0d
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:04:59 2025 +0100

    libstore: open build directory as a dirfd as well

    We now keep around a proper AutoCloseFD around the temporary directory
    which we plan to use for openat operations and avoiding the build
    directory being swapped out while we are doing something else.

    Change-Id: I18d387b0f123ebf2d20c6405cd47ebadc5505f2a
    Signed-off-by: Raito Bezarius <raito@lix.systems>

commit c9b42462b75b5a37ee6564c2b53cff186c8323da
Author: Raito Bezarius <raito@lix.systems>
Date:   Wed Mar 26 01:04:12 2025 +0100

    libutil: guess or invent a path from file descriptors

    This is useful for certain error recovery paths (no pun intended) that
    does not thread through the original path name.

    Change-Id: I2d800740cb4f9912e64c923120d3f977c58ccb7e
    Signed-off-by: Raito Bezarius <raito@lix.systems>
2025-06-19 16:29:59 +02:00
mergify[bot]
075df0b446
Merge pull request #13380 from NixOS/mergify/bp/2.29-maintenance/pr-13376
Revert "Drop magic-nix-cache" (backport #13376)
2025-06-19 12:44:08 +00:00
Eelco Dolstra
2f6c758d3d Revert "Drop magic-nix-cache"
This reverts commit 9cc8be2674 since
magic-nix-cache works again (thanks @jchv).

(cherry picked from commit 9b57573bae)
2025-06-19 12:12:28 +00:00
mergify[bot]
4c7e5ce7a8
Merge pull request #13375 from NixOS/mergify/bp/2.29-maintenance/pr-13371
tests: fixup with jq-1.8.0 (backport #13371)
2025-06-18 15:51:12 +00:00
Vladimír Čunát
86fbaf3b14 tests: fixup with jq-1.8.0
(cherry picked from commit 77f6b6532f)
2025-06-18 15:18:06 +00:00
mergify[bot]
5c3aed3e88
Merge pull request #13330 from NixOS/mergify/bp/2.29-maintenance/pr-13284
lockFlake(): Allow registry lookups for overridden inputs (backport #13284)
2025-06-06 08:47:04 +00:00
Seth Flynn
fcdffffa37 lockFlake(): Allow registry lookups for overridden inputs
Fixes #13144

(cherry picked from commit d0a2323829)
2025-06-06 08:12:20 +00:00
mergify[bot]
aeb627bebf
Merge pull request #13316 from NixOS/mergify/bp/2.29-maintenance/pr-13296
Clear `displayPrefix` in `makeEmptySourceAccessor` (backport #13296)
2025-06-03 18:08:59 +00:00
Sergei Zimmerman
a2567f6d7a Clear displayPrefix in makeEmptySourceAccessor
Judging by the comment for `makeEmptySourceAccessor` the prefix has
to be empty:

> Return a source accessor that contains only an empty root directory.

Fixes #13295.

(cherry picked from commit fba1bb0c13)
2025-06-03 19:27:15 +02:00
mergify[bot]
c1e272b47d
Merge pull request #13319 from NixOS/mergify/bp/2.29-maintenance/pr-13274
Drop magic-nix-cache (backport #13274)
2025-06-03 14:52:47 +00:00
Eelco Dolstra
cfba4b3bf4 Drop magic-nix-cache
This no longer works, see https://determinate.systems/posts/magic-nix-cache-free-tier-eol/.

(cherry picked from commit 9cc8be2674)
2025-06-03 14:18:54 +00:00
mergify[bot]
d761dad79c
Merge pull request #13259 from NixOS/mergify/bp/2.29-maintenance/pr-13256
Fix nlohmann error in fromStructuredAttrs() (backport #13256)
2025-05-25 06:35:47 +00:00
Eelco Dolstra
d068b82c2f Add test
(cherry picked from commit c66eb9cef7)
2025-05-25 05:55:28 +00:00
Eelco Dolstra
8ca4d2ef08 fromStructuredAttrs(): Don't crash if exportReferencesGraph is a string
Fixes

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

and other crashes.

Fixes #13254.

(cherry picked from commit d877b0c0cc)
2025-05-25 05:55:27 +00:00