1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 04:26:01 +01:00
Commit graph

20700 commits

Author SHA1 Message Date
Alexander V. Nikolaev
4bfc007a7b
Improve base-32 hash decoding performance with reverse map
The changes include:

* Defining nix32Chars as a constexpr char[].
* Adding a constexpr std::array<unsigned char, 256> (reverseNix32Map) to map characters to their base-32 digit values at compile time.
* Replacing the slow character search loop with a direct lookup using reverseNix32Map.
* Removing std::once_flag/isBase32 logic in references.cc in favor of reverseNix32Map

Signed-off-by: Alexander V. Nikolaev <avn@avnik.info>
2025-08-03 19:00:56 +03:00
John Ericson
51a32e4645
Merge pull request #13679 from xokdvium/build-benchmarks-in-ci
libstore-tests: Build benchmarks in GHA CI
2025-08-02 19:44:04 -04:00
John Ericson
dbccfc277f
Merge pull request #13678 from xokdvium/pch-disable-gcc
meson: Disable PCH for GCC
2025-08-02 19:42:17 -04:00
Sergei Zimmerman
ea1f67393d
libstore-tests: Build and run benchmarks in CI
This changes our GHA CI and nix-store-tests packaging
to build and run the benchmarks. This does not affect
the default packaging - the overrides apply only for the
GHA CI.
2025-08-03 01:09:04 +03:00
Sergei Zimmerman
b2b2f2dc53
libstore-tests: Split bench-main into a separate file
This makes it easier to add new benchmarks.
2025-08-03 01:03:40 +03:00
Sergei Zimmerman
b8301b2c25
libstore-tests: Add nix-store-benchmarks as a meson benchmark 2025-08-03 01:03:37 +03:00
Sergei Zimmerman
5db50e3f77
meson: Disable PCH for GCC
GCC doesn't really benefit as much as Clang does from
using precompiled headers. Another aspect to consider is that
clangd doesn't really like GCC's PCH flags in the compilation database,
so GCC based devshells would continue to work with clangd.

This also has the slight advantage of ensuring that our includes are in
order, since we build with both Clang and GCC.
2025-08-03 00:08:40 +03:00
Oleksandr Knyshuk
6e8f76482e
Add functional test for no-url-literals experimental feature
Closes: #13533
2025-07-31 15:34:49 +02:00
John Ericson
bbd14173b5
Merge pull request #13263 from NixOS/structured-attrs-in-drv
Store `StructuredAttrs` directly in `Derivation`
2025-07-30 16:14:14 -04:00
John Ericson
8652b6b417 Store StructuredAttrs directly in Derivation
Instead of parsing a structured attrs at some later point, we parsed it
right away when parsing the A-Term format, and likewise serialize it to
`__json = <JSON dump>` when serializing a derivation to A-Term.

The JSON format can directly contain the JSON structured attrs without
so encoding it, so we just do that.
2025-07-29 17:28:16 -04:00
John Ericson
b062730665
Merge pull request #13569 from Mic92/benchmark
add derivation parser benchmark
2025-07-29 14:41:10 -04:00
Robert Hensing
c85a014ef9
Merge pull request #13489 from k1gen/add-warn-short-path-literals
Add warn-short-path-literals setting
2025-07-29 20:32:56 +02:00
Robert Hensing
6365cf1446
Merge pull request #13572 from xokdvium/nixos-tests-parametrize
tests/nixos: Parametrize on the system
2025-07-29 20:29:24 +02:00
Jörg Thalheim
1989dd7bf9 add derivation parser benchmark
the current identified bottlenecks are parseString in derivations.cc and dirOf (because of std::filessystem creation).
2025-07-29 16:51:55 +02:00
Oleksandr Knyshuk
6d46dc9f6a
Add warn-short-path-literals setting
Add a new setting to warn about path literals that don't start with "." or "/". When enabled,
expressions like `foo/bar` will emit a warning suggesting to use `./foo/bar` instead.

A functional test is included.

The setting defaults to false for backward compatibility but could eventually default to true in
the future.

Closes: #13374

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2025-07-29 15:47:58 +02:00
Sergei Zimmerman
1c9e11a11f
tests/nixos: Parametrize on the system
All of the existing tests only run on x86_64-linux and
the whole `nixpkgsFor` makes it hard to reuse those for
e.g. running the nixos tests with a sanitizer build of nix.
This rips off the bandaid and removes the `nixpkgsFor` parameter
in favor of a single instance of nixpkgs with a separate `nixComponents`.
2025-07-29 01:24:03 +03:00
John Ericson
47f5e5fbef
Merge pull request #13567 from xokdvium/split-sanitizers-ci
ci: Run sanitizer tests in a separate job
2025-07-28 17:21:19 -04:00
Sergei Zimmerman
413f782176
ci: Run sanitizer tests in a separate job
This should speed up the CI somewhat by parallelizing
the work across the matrix of configurations.
2025-07-28 23:37:04 +03:00
Jörg Thalheim
9c9473aa9b
Merge pull request #13566 from xokdvium/refactor-ci-tests
flake: Factor out checks into ci/gha/tests for reusability
2025-07-28 21:11:13 +02:00
Robert Hensing
5bd68f24aa
Merge pull request #13543 from obsidiansystems/git-256
Implement support for Git hashing with SHA-256
2025-07-28 21:00:32 +02:00
Sergei Zimmerman
9913ec55ba
flake: Factor out checks into ci/gha/tests for reusability
This moves out the checks that get run in GHA CI into ci/gha/tests
folder and splits those into `topLevel` and `componentTests` attributes.
The idea behind this is to make it easier to parametrize tests that can
be run with sanitizers in order to run those as a matrix of jobs. The same
can be said for static builds.

Existing stdenv selection infrastructure via `lib.makeComponents` would
also allow us to switch over to using `clangStdenv` to significantly speed
up pre-merge CI (though the default stdenv would still be used for non-overridable
topLevel checks, like installer artifacts).
2025-07-28 03:26:48 +03:00
Sergei Zimmerman
cff021898d
Merge pull request #13525 from alurm/patch-1
doc/advanced-attributes.md: remove stray backslashes in the rendered output
2025-07-28 01:34:58 +03:00
John Ericson
44a8f8d02b
Merge pull request #13558 from xokdvium/nix-cpu-system-fix
meson: Fix `nix_system_cpu` for MIPS and 32 bit ARM systems
2025-07-26 19:18:57 -04:00
Sergei Zimmerman
a2561b853a
Merge pull request #13557 from Jayman2000/sometimes-build-manual-when-cross-compiling
Sometimes build `nix-manual` when cross compiling
2025-07-27 01:28:34 +03:00
Sergei Zimmerman
60d124b36e
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.
2025-07-27 00:50:53 +03:00
Jason Yundt
5e407e6abb 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>
2025-07-26 15:00:02 -04:00
John Ericson
d21e3f88ec Implement support for Git hashing with SHA-256
SHA-256 is Git's next hash algorithm. The world is still basically stuck
on SHA-1 with git, but shouldn't be. We can at least do our part to get
ready.

On the C++ implementation side, only a little bit of generalization was
needed, and that was fairly straight-forward. The tests (unit and
system) were actually bigger, and care was taken to make sure they were
all cover both algorithms equally.
2025-07-25 10:19:08 -04:00
Jörg Thalheim
7f4acb9f10
Merge pull request #13553 from roberth/fix-url
Fix documentation link
2025-07-25 11:37:58 +02:00
Robert Hensing
49f411c08c Update developer facing links to nix.dev
Not broken, but it's a tiny bit quicker
2025-07-25 10:59:44 +02:00
Robert Hensing
b7782809cb docs, messages: Resolve nixos.org/manual/nix/stable redirect
Loads a bit quicker
2025-07-25 10:18:13 +02:00
Robert Hensing
35835e0644 Fix documentation link
The file was renamed. We've also moved to nix.dev, but that was
redirected properly.
Closes #13488
2025-07-25 10:18:11 +02:00
Sergei Zimmerman
d4c562c6ff
Merge pull request #13546 from xokdvium/dogfood-ci-boolean
ci: Make it actually possible to disable dogfooding
2025-07-25 02:18:00 +03:00
Sergei Zimmerman
f0695e177f
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
2025-07-25 00:31:04 +03:00
Eelco Dolstra
2b22871ea2
Merge pull request #13535 from NixOS/fix-i686
Fix nix_system_cpu on i686-linux
2025-07-24 19:13:06 +02:00
Eelco Dolstra
54dc5314e8 Fix nix_system_cpu on i686-linux
Fixes #13532.
2025-07-24 18:06:06 +02:00
John Ericson
f0485520cc
Merge pull request #13530 from KAction/contrib/0/nar-format/out
Fix documentation of the NAR archive structure
2025-07-24 11:17:33 -04:00
Eelco Dolstra
cbdb497c79
Merge pull request #13478 from NixOS/posix-source-accessor-concurrent-map
PosixSourceAccessor: Use concurrent_flat_map
2025-07-24 11:19:37 +02:00
Robert Hensing
3543a73195
Merge pull request #13456 from fzakaria/git-pack-ref-cache
Add a test case where fetchGit is failing to cache due to packed-refs
2025-07-23 23:04:29 +02:00
Robert Hensing
eed1d370d0
Merge pull request #13521 from fzakaria/fzakaria/issue-11266
Unpeel reference for git+file
2025-07-23 22:36:44 +02:00
Jörg Thalheim
a3f6508761
Merge pull request #13520 from xokdvium/ppc-meson-endian
meson: Correctly handle endianness for PowerPC CPU families
2025-07-23 22:35:58 +02:00
Jörg Thalheim
7ff426627d
Merge pull request #13506 from xokdvium/simplify-installer-tests
ci: Simplify installer tests
2025-07-23 22:25:38 +02:00
Sergei Zimmerman
c6d0d33e4d ci: Simplify installer tests 2025-07-23 21:52:23 +02:00
Eelco Dolstra
3a67cafa0d Merge branch 'master' (reformat) 2025-07-23 21:22:27 +02:00
Eelco Dolstra
72e8f7cd35 Merge branch 'master' (pre-reformat) 2025-07-23 21:22:19 +02:00
Alan Urmancheev
bd29dc67b7
doc/advanced-attributes.md: remove stray backslashes in the rendered output
They have appeared literally because the was an empty line after them.
2025-07-23 17:32:52 +04:00
Dmitry Bogatov
143b87c1a9 Fix documentation of the NAR archive structure
For regular, non-executable files, there is no str("") between str("regular")
and str("contents"). Note that str("") is exactly 8 zero bytes, while just ""
is actual empty string (0 bytes).
2025-07-22 20:00:00 -04:00
Sergei Zimmerman
9671275198
Merge pull request #13522 from juhp/patch-1
meson: libfetchers needs libgit2 1.9+
2025-07-22 21:45:17 +03:00
Jens Petersen
ff6ab3b213
meson: libfetchers needs libgit2 1.9+
libfetchers uses `git_mempack_write_thin_pack` which was introduced in libgit2-1.9.0

This avoids error like:

../src/libfetchers/git-utils.cc: In member function ‘virtual void nix::GitRepoImpl::flush()’:
../src/libfetchers/git-utils.cc:270:13: error: ‘git_mempack_write_thin_pack’ was not declared in this scope
  270 |             git_mempack_write_thin_pack(mempack_backend, packBuilder.get())
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

on older libgit2 (like 1.7.2 in Centos Stream 10)
2025-07-22 22:58:55 +08:00
Farid Zakaria
aadfb682d4 Fix fetchGit functional tests to peel as well 2025-07-21 22:01:05 -07:00
Farid Zakaria
98858148dc Add unit test 2025-07-21 21:56:11 -07:00