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

20101 commits

Author SHA1 Message Date
mergify[bot]
1dcd12b819
Merge pull request #13592 from NixOS/mergify/bp/2.29-maintenance/pr-13245
nix-profile{,-daemon}.fish: check for profile in XDG_DATA_HOME (backport #13245)
2025-07-31 01:49:33 +00:00
mergify[bot]
2298df294b
Merge pull request #13602 from NixOS/mergify/bp/2.29-maintenance/pr-13277
nix flake archive: add --no-check-sigs option (backport #13277)
2025-07-31 01:49:30 +00:00
mergify[bot]
b4cd61900b
Merge pull request #13586 from NixOS/mergify/bp/2.29-maintenance/pr-13232
docs: add another equivalence for the implication operator (backport #13232)
2025-07-30 19:32:55 +00:00
mergify[bot]
2c258dd275
Merge pull request #13594 from NixOS/mergify/bp/2.29-maintenance/pr-13253
export/meson: Don't require `-std=c++2a` for -c libraries in `.pc` files (backport #13253)
2025-07-30 19:13:31 +00:00
mergify[bot]
75bece800d
Merge pull request #13599 from NixOS/mergify/bp/2.29-maintenance/pr-13275
Remove propagated-build-inputs when static (backport #13275)
2025-07-30 19:11:57 +00:00
mergify[bot]
582caa9d8f
Merge pull request #13580 from NixOS/mergify/bp/2.29-maintenance/pr-13211
libexpr: Actually cache line information in PosTable (backport #13211)
2025-07-30 19:11:53 +00:00
mergify[bot]
8a3d3b2dce
Merge pull request #13590 from NixOS/mergify/bp/2.29-maintenance/pr-13244
nix-profile{,-daemon}.fish: fix do not source twice (backport #13244)
2025-07-30 19:06:05 +00:00
mergify[bot]
56069a968b
Merge pull request #13582 from NixOS/mergify/bp/2.29-maintenance/pr-13213
docs: fix duplicate anchor (backport #13213)
2025-07-30 13:44:44 +00:00
zimbatm
ee39380c12 nix flake archive: add --no-check-sigs option
Allows to copy the archive to a remote host and not get

    error: cannot add path '/nix/store/01x2k4nlxcpyd85nnr0b9gm89rm8ff4x-source' because it lacks a signature by a trusted key

(cherry picked from commit 80a4293486)
2025-07-30 12:24:10 +00:00
Tristan Ross
47ce401222 Remove propagated-build-inputs when static
(cherry picked from commit d07852b5f3)
2025-07-30 12:20:06 +00:00
Sergei Zimmerman
709349b118 export/meson: Don't require -std=c++2a for -c libraries in .pc files
(cherry picked from commit d8da8f0cd6)
2025-07-30 12:11:58 +00:00
Stefan Boca
9106a0b73a nix-profile{,-daemon}.fish: check for profile in XDG_DATA_HOME
...and also NIX_STATE_HOME in nix-profile.fish. This is directly
translated from the bash scripts and makes the fish scripts equivalent
in functionality to the bash scripts.

Note that nix-profile.fish checks for NIX_STATE_HOME and
nix-profile-daemon.fish does not, so the two scripts are no longer
identical.

(cherry picked from commit 751f50f4ad)
2025-07-30 12:04:56 +00:00
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
Gwenn Le Bihan
a5deed32f7 docs: add another equivalence for the implication operator
the second equivalence, using a if-else expression, aligns much closer to how most humans think about implication, adding it might help some people :)

(cherry picked from commit 51151c2c28)
2025-07-30 12:00:08 +00:00
Peder Bergebakken Sundt
94723d5b72 docs: fix duplicate anchor
`#deriving-path-encoding` is defined in two places, I _think_ this is the correct one to change.

(cherry picked from commit 4c50cf798e)
2025-07-30 11:53:57 +00:00
Sergei Zimmerman
ef8dc34bd0 libexpr: Actually cache line information in PosTable
Previous code had a sneaky bug due to which no caching
actually happened:

```cpp
auto linesForInput = (*lines)[origin->offset];
```

That should have been:
```cpp
auto & linesForInput = (*lines)[origin->offset];
```

See [1].

Now that it also makes sense to make the cache bound in side
in order not to memoize all the sources without freeing any memory.
The default cache size has been chosen somewhat arbitrarily to be ~64k
origins. For reference, 25.05 nixpkgs has ~50k .nix files.

Simple benchmark:

```nix
let
  pkgs = import <nixpkgs> { };
in
builtins.foldl' (acc: el: acc + el.line) 0 (
  builtins.genList (x: builtins.unsafeGetAttrPos "gcc" pkgs) 10000
)
```

(After)

```
$ hyperfine "result/bin/nix eval -f ./test.nix"
Benchmark 1: result/bin/nix eval -f ./test.nix
  Time (mean ± σ):     292.7 ms ±   3.9 ms    [User: 131.0 ms, System: 120.5 ms]
  Range (min … max):   288.1 ms … 300.5 ms    10 runs
```

(Before)

```
hyperfine "nix eval -f ./test.nix"
Benchmark 1: nix eval -f ./test.nix
  Time (mean ± σ):     666.7 ms ±   6.4 ms    [User: 428.3 ms, System: 191.2 ms]
  Range (min … max):   659.7 ms … 681.3 ms    10 runs
```

If the origin happens to be a `all-packages.nix` or similar in size then the
difference is much more dramatic.

[1]: 22e3f0e987

(cherry picked from commit 5ea81f5b8f)
2025-07-30 11:51:53 +00:00
Sergei Zimmerman
bb8b50e4f3 libutil: Add LRUCache::getOrNullptr
For heavier objects it doesn't make sense to return
a std::optional with the copy of the data, when it
can be used by const reference.

(cherry picked from commit 4711720efe)
2025-07-30 11:51:53 +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