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

20531 commits

Author SHA1 Message Date
Sergei Zimmerman
385e2c3542
meson: Apply formatting universally
Now that we have applied the [1] patch, the diff is much
nicer and less noisy.

[1]: https://www.github.com/mesonbuild/meson/pull/14861
2025-08-07 02:58:29 +03:00
Sergei Zimmerman
bf80696ed9
meson: Get rid of multiline array formatting hack 2025-08-07 02:57:02 +03:00
Sergei Zimmerman
da028aa454
maintainers: Fetch patch for multiline formatting in meson 2025-08-07 02:56:59 +03:00
John Ericson
9ff4c446df
Merge pull request #3425 from mkg20001/pr
Add user@address:port support
2025-08-06 17:16:58 -04:00
Maciej Krüger
49ba06175e
Add user@address:port support
This patch allows users to specify the connection port
in the store URLS like so:

```
nix store info --store "ssh-ng://localhost:22" --json
```

Previously this failed with: `error: failed to start SSH connection to 'localhost:22'`,
because the code did not distinguish the port from the hostname. This
patch remedies that problem by introducing a ParsedURL::Authority type
for working with parsed authority components of URIs.

Now that the URL parsing code is less ad-hoc we can
add more long-awaited fixes for specifying SSH connection
ports in store URIs.

Builds upon the work from bd1d2d1041.

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2025-08-06 23:48:14 +03:00
tomberek
55f6ff36c2
Merge pull request #13526 from philiptaron/issue-12786/canonicaliseTimestampAndPermissions-on-dir-better
libstore: always canonicalize directory permissions
2025-08-06 16:30:13 -04:00
Jörg Thalheim
1376e27156
Merge pull request #13702 from h0nIg/revert-13351-push-rrzylpqynznw
Revert "docker: make sure `nix config check` works"
2025-08-06 20:49:11 +02:00
h0nIg
02cc215221
Revert "docker: make sure nix config check works" 2025-08-06 20:33:44 +02:00
Jörg Thalheim
c76222e87e
Merge pull request #13694 from NaN-git/opt-parseString
speedup derivation parsing by optimizing `parseString`
2025-08-06 20:23:27 +02:00
John Ericson
c98af65da6
Merge pull request #13697 from obsidiansystems/base64-trailing-test
Base64 trailing test (from Snix, thanks)
2025-08-06 13:13:17 -04:00
John Ericson
e25ab029ae
Merge pull request #13693 from obsidiansystems/more-base-files
Clean up Base* code
2025-08-06 13:02:01 -04:00
Philip Taron
c38987e04a libstore: always canonicalize directory permissions
Prior to this patch, mode 0444 is not updated to 0555 for directories.
That means for instance 0554 is canonicalized, but not 0444.

We don't believe this has any implications for backwards compatibility,
because directories do not have permissions in NAR format and so are
always 0555 after deserialization, and store paths with wrong
permissions can’t be copied to another host.

Co-authored-by: Robert Hensing <robert@roberthensing.nl>
2025-08-06 10:58:46 -05:00
John Ericson
ead795404d Base64 trailing test (from Snix, thanks) 2025-08-06 11:52:11 -04:00
John Ericson
991831227e Clean up Base* code
Make it separate from Hash, since other things can be base-encoded too.

This isn't really needed for Nix, but it makes the code easier to read
e.g. for someone reimplementing this stuff in a different language. (Of
course, Base16/Base64 should be gotten off-the-shelf, but now the hash
code, which is more bespoke, is less cluttered with the parts that would
be from some library.)

Many reimplementations of "Nix32" and our hash type already exist, so
this cleanup is coming years too late, but I say better late than never
/ it is always good to nudge the code in the direction of being a
"living spec".

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
2025-08-06 11:51:44 -04:00
Sergei Zimmerman
664f06c94c
Merge pull request #13699 from xokdvium/fix-dev-shell-build
nix/profile.cc: Fix header include path
2025-08-06 13:31:06 +03:00
Sergei Zimmerman
53492c0ecd
Merge pull request #13555 from k1gen/no-url-literals-test
Add functional test for no-url-literals experimental feature
2025-08-06 11:29:08 +03:00
Sergei Zimmerman
68f61d3fcf
nix/profile.cc: Fix header include path
This wasn't caught by CI for aea312dae3
due to weird componentized build reasons.
2025-08-06 11:01:39 +03:00
Philipp Otterbein
5e94fe5693 speedup derivation parsing 2025-08-05 22:00:30 +02:00
Jörg Thalheim
fd6e383a63
Merge pull request #13689 from xokdvium/dead-code
libstore: Remove dead variable
2025-08-05 14:16:00 +02:00
Jörg Thalheim
55ff55fefa
Merge pull request #13684 from the-sun-will-rise-tomorrow/identity-compression
Recognize "identity" compression method
2025-08-05 14:07:01 +02:00
Jörg Thalheim
cb84ac203b
Merge pull request #13687 from xokdvium/move-nix2-sources
nix-cli: Move nix2 binaries sources properly into nix subproject
2025-08-05 14:06:29 +02:00
Jörg Thalheim
4a7285c649
Merge pull request #13688 from xokdvium/odr-toplevel-types
treewide: Move private types and code into anonymous namespaces
2025-08-05 14:05:16 +02:00
Sergei Zimmerman
e3d7f20afe libstore: Remove dead variable 2025-08-05 14:03:38 +02:00
Sergei Zimmerman
866d5e6cf4
treewide: Sprinkle more anonymous namespace for classes private to TUs
This code should be private to the corresponding translation units.
2025-08-05 02:25:40 +03:00
Sergei Zimmerman
0118e5ea5d
libutil: Move Ctx type from the nix namespace to Hash class
Same as previous commit. This really should not be a part of
the `nix` namespace. Otherwise the doxygen documentation is
really confusing.
2025-08-05 02:20:28 +03:00
Sergei Zimmerman
5ee0d5669e
libstore: Move State to an anonymous namespace
Having a State class in the nix namespace is asking
for ODR trouble. This class is already private to the
translation unit, let's move it into an anonymous namespace.
2025-08-05 02:15:21 +03:00
Sergei Zimmerman
aea312dae3
nix-cli: Move nix2 binaries sources properly into nix subproject
There have been prior concerns about reogranizing the repo, but
this seems like a trivial simplification which will not interfere
with either our packaging or the modular builds in nixpkgs.
2025-08-05 02:10:21 +03:00
Sergei Zimmerman
e5a8ee45b7
Merge pull request #13686 from xokdvium/ci-coverage
ci: Collect code coverage in tests
2025-08-05 00:41:41 +03:00
Sergei Zimmerman
4333a9d5a8
ci: Collect code coverage in tests
This adds the necessary infrastructure to collect
code coverage in CI, which could be useful to look
at munually or track consistently via something like
codecov.

Co-authored-by: Jade Lovelace <lix@jade.fyi>
2025-08-04 23:50:02 +03:00
John Ericson
0889960869
Merge pull request #13685 from obsidiansystems/hash-sentinal-encapsulation
Encapsulate `invalidBase32`, avoid 0xFF magic number
2025-08-04 16:01:16 -04:00
John Ericson
23c87d8a21 Encapsulate invalidBase32, avoid 0xFF magic number
This keeps things fast by making the function inline, but also prevents
people from having to know about the `0xFF` implementation detail
directly, instead making one go through a `std::optional` (which could be
fused away with a sufficiently smart compiler).

Additionally, the base "nix32" implementation is moved to its own header
file pair, as it is logically distinct and prior to the `Hash` data
type. It would probably be nice to do this with all the hash format
implementations.
2025-08-04 15:32:38 -04:00
John Ericson
6ab8cbe31a
Merge pull request #13680 from avnik/avnik/fast-base32
Improve base-32 hash decoding performance with reverse map
2025-08-04 14:22:59 -04:00
Jörg Thalheim
c7af923865
Merge pull request #13445 from xokdvium/simplify-util-url
libutil: Use Boost.URL for URI parsing
2025-08-04 19:46:58 +02:00
WxNzEMof
0a96b7e627 Recognize "identity" compression method
Some binary caches (incorrectly) use this header to indicate lack of
compression, inspired by the valid "identity" token in the
"Accept-Encoding" header.
2025-08-04 17:00:38 +00:00
John Ericson
7abfc9b92a
Merge pull request #13682 from xokdvium/refscan-benchmark
libstore-tests: Add reference scanning benchmark
2025-08-03 23:29:40 -04:00
Sergei Zimmerman
20df0e5fa7
libstore-tests: Add reference scanning benchmark
This benchmark should provide a relatively realistic
scenario for reference scanning.

As shown by the following results, reference scanning code
is already plenty fast and is definitely not a bottleneck:

```
BM_RefScanSinkRandom/10000               1672 ns         1682 ns       413354 bytes_per_second=5.53691Gi/s
BM_RefScanSinkRandom/100000             11217 ns        11124 ns        64341 bytes_per_second=8.37231Gi/s
BM_RefScanSinkRandom/1000000           205745 ns       204421 ns         3360 bytes_per_second=4.55591Gi/s
BM_RefScanSinkRandom/5000000          1208407 ns      1201046 ns          597 bytes_per_second=3.87713Gi/s
BM_RefScanSinkRandom/10000000         2534397 ns      2523344 ns          273 bytes_per_second=3.69083Gi/s
```

(Measurements on Ryzen 5900X via `nix build --file ci/gha/tests componentTests.nix-store-tests-run -L`)
2025-08-04 02:11:14 +03:00
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