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

19829 commits

Author SHA1 Message Date
Jade Lynn Masker
b320aa50fe add documentation of tarball-ttl to nix-channel
(cherry picked from commit 6badd21b6a)
2025-07-30 12:35:30 +00:00
Farid Zakaria
59da02def5 Overriding gtest with gmock
How did this work before...

* Added .direnv/ to gitignore

(cherry picked from commit 58e34a2d27)
2025-07-30 12:35:11 +00:00
Sergei Zimmerman
8f5e9b38f1 tests/functional: Add more language tests for builtins.match
These tests have been collected from nixpkgs f870c6ccc8951fc48aeb293cf3e98ade6ac42668
usage of builtins.match for x86_64-linux eval system. At most 2 matching and
non-matching cases are included for each encountered regex. This should
hopefully add more confidence when possibly trying to switch the regex implementation
in the future.

(cherry picked from commit d555d6b404)
2025-07-30 12:26:17 +00:00
zimbatm
e04004ebc2 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:08 +00:00
Tristan Ross
f56f6e9e14 Remove propagated-build-inputs when static
(cherry picked from commit d07852b5f3)
2025-07-30 12:19:48 +00:00
Sergei Zimmerman
354d4c4a32 export/meson: Don't require -std=c++2a for -c libraries in .pc files
(cherry picked from commit d8da8f0cd6)
2025-07-30 12:11:06 +00:00
Stefan Boca
3a3ee4a692 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:54 +00:00
Gwenn Le Bihan
7126d57220 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:02 +00:00
Jörg Thalheim
c0a1e07bca libutil-tests/json-utils: fix -Werror=sign-compare error
I am on a newer different nixpkgs branch, so I am getting this error

(cherry picked from commit 1290b7e53d)
2025-07-30 11:58:01 +00:00
Robert Hensing
4a1e3ad48b doc: Render verbatim @docroot@ on contributing page
In rendered form:

```diff
-Add references to the manual using ..
+Add references to the manual using [links like this](@docroot@/example.md)
```

(cherry picked from commit 147a34c573)
2025-07-30 11:56:00 +00:00
Peder Bergebakken Sundt
1e371c4a49 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:56 +00:00
John Ericson
0560581a48 Document more references concepts
(cherry picked from commit b287438476)
2025-07-30 11:40:09 +00:00
Sergei Zimmerman
3eb5a7cf30 libutil/tarfile: Create the scratch std::vector only once
I can't find a good way to benchmark in isolation from the
git cache, but common sense dictates that creating (and destroying)
a 131KiB std::vector for each regular file from the archive imposes
quite a significant overhead regardless of the IO bound git cache.

AFAICT there is no reason to keep a copy of the data since
it always gets fed into the sink and there are no coroutines/threads
in sight.

(cherry picked from commit 7628155d2b)
2025-07-30 11:32:13 +00:00
mergify[bot]
bab4e58a5e
Merge pull request #13560 from NixOS/mergify/bp/2.28-maintenance/pr-13558
meson: Fix `nix_system_cpu` for MIPS and 32 bit ARM systems (backport #13558)
2025-07-27 00:09:15 +00:00
Sergei Zimmerman
08f7ddbee5 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
Sergei Zimmerman
6c0cc04ce4
Merge pull request #13559 from NixOS/mergify/bp/2.28-maintenance/pr-13557
Sometimes build `nix-manual` when cross compiling (backport #13557)
2025-07-27 01:54:35 +03:00
Jason Yundt
c78676a1de Sometimes build nix-manual when cross compiling
Before this change, if you were cross compiling Nix, then the nix-manual
subproject would never get built. In some situations, it makes sense to
not build the nix-manual subproject when cross compiling. For example,
if the build system is x86_64 and the host system is riscv64, then it
makes sense to not build the manual. Building the manual requires
executing certain build artifacts, and you can’t run x86_64 executables
on riscv64 systems.

That being said, there are some situations where it does make sense to
build the nix-manual subproject when cross compiling. For example, if
the build system is x86_64 and the host system is i686, then it doesn’t
make sense to not build the manual. You can run i686 executables on
x86_64 systems just fine.

This change makes it so that the nix-manual subproject will sometimes
get built when cross compiling. Specifically, the nix-manual subproject
will get built as long as the doc-gen option is enabled and the build
system is capable of running host binaries.

---

The main motivation behind this change is to fix this Nixpkgs issue [1].
Building pkgs.nixStatic counts as cross compiling Nix, and
pkgs.nixStatic is supposed to produce a man output. Building
pkgs.nixStatic currently fails because it isn’t actually producing a man
output. That issue will go away once this commit gets backported to Nix
2.28.x.

[1]: <https://github.com/NixOS/nixpkgs/issues/426410>

(cherry picked from commit 5e407e6abb)
2025-07-26 22:29:20 +00:00
Sergei Zimmerman
8a1b7377cf
Merge pull request #13547 from NixOS/mergify/bp/2.28-maintenance/pr-13546
ci: Make it actually possible to disable dogfooding (backport #13546)
2025-07-25 02:52:56 +03:00
Sergei Zimmerman
5ae4ee99d3
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:21:00 +03:00
Sergei Zimmerman
aa9d588891 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:33 +00:00
mergify[bot]
ec4707df91
Merge pull request #13536 from NixOS/mergify/bp/2.28-maintenance/pr-13473
ci: Dogfood Nix from master (backport #13473)
2025-07-24 20:53:37 +00:00
Sergei Zimmerman
c56833e941
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-24 23:15:14 +03:00
Sergei Zimmerman
13a8fe7580
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-24 23:13:43 +03:00
Sergei Zimmerman
a0a94b9027
ci: Dogfood Nix from master
(cherry picked from commit 04f6974d2c)
2025-07-24 23:13:36 +03:00
Eelco Dolstra
5763c356a9
Merge pull request #13539 from NixOS/mergify/bp/2.28-maintenance/pr-13535
Fix nix_system_cpu on i686-linux (backport #13535)
2025-07-24 20:13:38 +02:00
Eelco Dolstra
23ecb1067c Fix nix_system_cpu on i686-linux
Fixes #13532.

(cherry picked from commit 54dc5314e8)
2025-07-24 17:13:51 +00:00
mergify[bot]
70439b4174
Merge pull request #13527 from NixOS/mergify/bp/2.28-maintenance/pr-13520
meson: Correctly handle endianness for PowerPC CPU families (backport #13520)
2025-07-23 21:29:43 +00:00
Sergei Zimmerman
14a5e2a4a3 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-23 20:36:39 +00:00
mergify[bot]
f5dfd9a4a4
Merge pull request #13516 from NixOS/mergify/bp/2.28-maintenance/pr-13514
treewide: Fix Meson CPU names for powerpc CPUs (backport #13514)
2025-07-21 23:28:52 +00:00
OPNA2608
6151c36a0b treewide: Fix Meson CPU names for powerpc CPUs
(cherry picked from commit 6db6190002)
2025-07-21 22:49:09 +00:00
Jörg Thalheim
13206c132d
Merge pull request #13503 from NixOS/mergify/bp/2.28-maintenance/pr-13108
Rip off the bandaid: Format the codebase with clang-format (backport #13108)
2025-07-18 22:17:01 +02:00
Sergei Zimmerman
448c5d912c
Update .git-blame-ignore-revs to ignore the mass reformatting
Co-authored-by: Graham Christensen <graham@grahamc.com>
2025-07-18 22:37:35 +03:00
Sergei Zimmerman
a5264aa46e
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:36:36 +03:00
Graham Christensen
7b97377ac3 Update clang-format with fixing namespace coments, and separate definition blocks
(cherry picked from commit 41bf87ec70)
2025-07-18 22:33:26 +03:00
Graham Christensen
91141aa76d Drop a ton of files that should just get formatted
(cherry picked from commit e7af2e6566)
2025-07-18 22:33:16 +03:00
Graham Christensen
bd8cd3c15d Add sed
(cherry picked from commit 6896761d79)
2025-07-18 18:31:09 +00:00
Graham Christensen
3fd8523af7 format.sh: support looping until it is happy
(cherry picked from commit ee9b57cbf5)
2025-07-18 18:31:09 +00:00
mergify[bot]
65f435708a
Merge pull request #13499 from NixOS/mergify/bp/2.28-maintenance/pr-13496
Fix `nix help shell` by properly handling command aliases (backport #13496)
2025-07-17 18:26:33 +00:00
Oleksandr Knyshuk
be0e78ae23 Make nix help shell work by handling aliases properly
Previously, `nix help shell` failed with "Nix has no subcommand 'shell'" despite `nix shell --help`
working correctly. This happened because the `shell` command is actually an alias for `env shell`,
and the help system wasn't resolving aliases when looking up documentation.

This patch modifies the `showHelp` function to check for and resolve aliases before generating the
manpage name, ensuring that shorthand commands like `shell` get proper help documentation.

Closes: #13431
(cherry picked from commit d678b071d6)
2025-07-17 17:42:29 +00:00
mergify[bot]
5ebe8b8536
Merge pull request #13317 from NixOS/mergify/bp/2.28-maintenance/pr-13296
Clear `displayPrefix` in `makeEmptySourceAccessor` (backport #13296)
2025-07-11 21:53:33 +00:00
Sergei Zimmerman
8f8877417c 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-07-12 00:12:58 +03:00
Sergei Zimmerman
faaf5b86c6
Merge pull request #13451 from NixOS/mergify/bp/2.28-maintenance/pr-13450
libexpr: Fix invalid handling of errors for imported functions (backport #13450)
2025-07-11 23:34:01 +03:00
Sergei Zimmerman
34f06900aa
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:47:36 +03:00
Eelco Dolstra
7a98e1b7c4
Merge pull request #13414 from NixOS/mergify/bp/2.28-maintenance/pr-13412
libutil: Use caching `directory_entry` API in `PosixSourceAccessor::r… (backport #13412)
2025-07-01 17:48:22 +02:00
Sergei Zimmerman
814822ba43 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]
d08a448596
Merge pull request #13403 from NixOS/mergify/bp/2.28-maintenance/pr-13170
Use correct parent `outPath` for relative path inputs (backport #13170)
2025-06-27 12:32:50 +00:00
Matt Sturgeon
3206585a74 Add release note for non-flake inputs having sourceInfo
(cherry picked from commit 2922e3082e)
2025-06-27 11:59:11 +00:00
Matt Sturgeon
beb845981b tests/functional/flakes/non-flake-inputs: Test non-flake inputs having sourceInfo
(cherry picked from commit 72232bc28a)
2025-06-27 11:59:11 +00:00
Robert Hensing
a2941dc574 tests/function/flakes/relative-paths: Test #13164
(cherry picked from commit eaee0b4740)
2025-06-27 11:59:11 +00:00
Matt Sturgeon
a98ff409fa 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:11 +00:00