Commit Graph
19300 Commits
Author SHA1 Message Date
eldritch horrors 64c486e22c libutil/libmain: never mask SIGWINCH
we need to cache the current terminal size for progress bar reasons, but
we don't want to catch SIGWINCH to update the current terminal size from
a dedicated thread for repl reasons. a SIGWINCH handler function is much
easier to square with these requirements than communication with another
thread to have it change its signal mask, and since any races in handler
code affect only progress bar output and only very rarely (if ever) we'd
better chose the simplest approach. the progress bar could set a handler
of its own for this purpose, but we would much rather replace it instead

fixes #1246

Change-Id: I814d9aaf1b6fbb6a8cefc5af675a3aa372549dc8
2026-07-10 16:28:11 +00:00
Qyriad 1a2853bf7b package: restore original curl after cl/5842
Change-Id: I09b5cdd1a91ef471233cfcaf1c7ec1d16a6a6964
2026-07-09 15:09:26 +00:00
QyriadandSergei Zimmerman 81084c7fc9 libstore: Fix libcurl thread wakeup with curl >= 8.21
Since https://github.com/curl/curl/commit/2a2104f3cff44bb28bb570a093be52bbeeed8f23
libcurl sometimes just swallows events in curl_multi_perform, we entirely miss them,
and curl_multi_poll blocks forever.

Fixes #1234.

Based on https://github.com/NixOS/nix/pull/16090.

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
Change-Id: I453dce192de0ea9e92bfb0114020dc9d6a6a6964
2026-07-09 15:09:26 +00:00
rootileandeldritch horrors 41bad096e3 rust: migrate libutil/git.cc
Change-Id: Ic3932fdf3afd3dc09019623516597f1c648f7fc4
2026-07-08 20:03:10 +00:00
eldritch horrors dd8f1843cc lix-rs: allow exposing ord/eq operators from rust
this is a bit of a hack, but since zngur cannot handle multiple trait
implementations per type yet we will have to commit to singles types.

Change-Id: I60e7b96bbeaa9fb87cf43662d4a9a5d44116bf47
2026-07-08 18:04:40 +00:00
Linus Heckemann 9302845601 package: use buildPackages for licxxbridge build
This fixes a regression in cross builds introduced in https://gerrit.lix.systems/c/lix/+/5704.

Change-Id: I3031d7c4daa5554cc16f654d28311f486a6a6964
2026-07-07 10:59:53 +02:00
rootile 523df65fba tests: migrate misc.sh
note: only two of the tests actually needed migrating, as the others
were already covered (e.g. by lang)

Change-Id: I30abb2bd728ae2b144ad76566096a216aed3b8f8
2026-07-06 12:39:47 +00:00
rootile de67d1424d bench: fix outdated nixpkgs reference
Change-Id: I293f4e4c399c192b0fec30aa8554b64641eee0bf
2026-07-05 13:21:25 +00:00
405ff2eb03 nix-eval-jobs: --apply
Based off of https://github.com/NixOS/nix-eval-jobs/pull/332 and
9f292a402a6edf620b872bedaaad5f0a45c23826

closes https://git.lix.systems/lix-project/lix/issues/1214

Co-authored-by: Mic92 <joerg@thalheim.io>
Co-authored-by: Yannik Sander <yannik@floxdev.com>
Change-Id: Ifba7081b384d18fbdc47437de261d30b65a7930a
2026-07-04 14:46:08 +00:00
Seth FlynnandBernardo Meurer Costa c1370bc81c build: use mimalloc
mimalloc is a compact general purpose allocator from Microsoft. It
consistently outperforms glibc's `malloc()` in allocation-heavy
workloads, such as Lix's evaluator

It's currently only linked in the main `nix` executable, as Boehm's GC
uses its own allocator. Other allocations that *do* go through glibc's
`malloc()` are still much faster, though

Benchmarked on x86_64-linux against Nixpkgs `bd07873`:

| attribute         | thunks  | lix@`1396012` | mimalloc | uplift |
|-------------------|---------|---------------|----------|--------|
| hello             | 206444  | 0.726s        | 0.620s   | 1.17x  |
| chromium          | 1177382 | 2.273s        | 2.136s   | 1.06x  |
| firefox-unwrapped | 1394797 | 2.521s        | 2.378s   | 1.06x  |
| texliveFull       | 3186440 | 4.992s        | 4.672s   | 1.07x  |
| nixosTests.gnome  | 7905808 | 6.115s        | 5.723s   | 1.07x  |

Based-on: https://github.com/NixOS/nix/pull/15596
Co-authored-by: Bernardo Meurer Costa <beme@anthropic.com>
Change-Id: I3ad92eacc075efeaf3d9f7730ada7b29835536a4
2026-07-04 10:39:30 +00:00
Raito Bezariusandrootile 12f10fca7e nix/doctor: check ambient search paths
Some issues are caused by users confused about their ambient search
paths, let's analyze the current configuration and make it awfully
obvious what is going on.

Towards #230.

Change-Id: I953ef3feaefc56cee68623c5aaa4d568ba1fd034
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-07-03 20:12:07 +02:00
Raito Bezariusandrootile b62b37296c nix/doctor: check flake registry
We try to access to the Flake registry, if we are failing, it's hosed.
Otherwise, let's record some facts we can reuse later.

Towards #230.

Change-Id: I80dd8272d5c27f7f7ff01052e3487a0496ee29fc
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-07-03 20:02:35 +02:00
Raito Bezariusandrootile abeefa0e4f nix/doctor: print nix related information
Based on `nix-info` and `nix --version` output.

Contributes towards #230.

Change-Id: I13bb9608b733e10037c6816456b5312e712c18ad
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-07-03 19:44:16 +02:00
Raito Bezariusandrootile 4126e671cc nix/doctor: print general system information
Based on `nix-info` output and experience (LOCALE issues).

Change-Id: I350fff9592e7acc8fba0babe67c9fe1bf94a5781
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-07-03 19:44:16 +02:00
Raito Bezariusandrootile ad199c4723 libutil/systemd/hostnamectl: init
This is some code that is specific to systemd to fetch hostnamectl
information via the JSON flag.

This will be used for `nix doctor`.

Errors will show up similar to this:
```
❯ ./build/lix/nix/nix doctor
[INFO] Nix system type: 'x86_64-linux'
warning: could not get host information via hostnamectl: error: Expected JSON value to be of type 'string' but it is of type 'number'
```

and makes them non-fatal.

Change-Id: Idd39f29626e770b1cd3896e8eb8545416c74b041
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-07-03 17:45:26 +02:00
eldritch horrors e9a01a5be6 libfetchers: don't treat empty/zero hashes as valid locks
treating a file with an empty or zero hash as locked is not helpful.
these are placeholdes for "hash is not known", thus treating them as
a valid lock makes them completely useless (and confusing to users).

fixes #1233

Change-Id: If42b47281e6973fc86662b973db69e26f6346f5a
2026-07-03 11:06:57 +00:00
K900 48f7747deb treewide: drop support for mdbook < 0.5
25.11 is dead, and so is mdbook 0.4

Also reenable linkcheck which was doing nothing this whole time lmao

Change-Id: I4a8b9c763b881de840d6ef1b1d85bf19941f4386
2026-07-02 18:06:50 +03:00
Qyriad 2c45e056e9 libstore/curl: std::move is not mem::take; fix correctness
These uses of std::move are taking data out of a repeatedly-used state
object, à la Rust's std::mem::take(). But move-constructing or
move-assigning from an object does not guarantee that the moved-from
object is equivalent to a default-constructed one, or even that the
moved-from object will continue to function like a non-moved-from object
of that type (only that the object remains "valid").

Assuming there's no differing custom allocator shenanigans at play, both
libstdc++ and libc++ do leave moved-from std::map objects (and probably
others) in an empty, well-behaved, default-constructed state, at the
time of this writing. However the correct tool here is std::exchange().


Change-Id: I7cf76762a1b05a542b53fcd74be100646a6a6964
2026-07-01 23:03:27 +02:00
Qyriad d4e445f251 libstore/filetransfer: reörganize includes
Change-Id: I74310683b6e721f3ad0a7b2e2e2aa28c6a6a6964
2026-07-01 23:03:27 +02:00
Qyriad 43c5aa2076 libstore: factor out curlFileTransfer
As part of efforts to make debugging our Curl usage easier


Change-Id: Ib1f8567daa8b3d3d559a164bc85a8b906a6a6964
2026-07-01 23:03:27 +02:00
Qyriad dbf1ef3d42 libstore: factor out CurlMulti
As part of efforts to make debugging our Curl usage easier


Change-Id: I182bb3e968f1dfcd192ecd61103cba376a6a6964
2026-07-01 23:03:27 +02:00
Qyriad 325364fc26 libstore: factor out TransferItem
As part of efforts to make debugging our Curl usage easier


Change-Id: Idb8c32b33b6bfd0eebb9c9fded7b251d6a6a6964
2026-07-01 23:03:27 +02:00
Qyriad cde71e45a1 libstore: fully inline FileTransferError
To avoid template instantiation problems during the incomming
extractions


Change-Id: Ia0179da00bdfa45034559be88a2b923c6a6a6964
2026-07-01 23:03:27 +02:00
Qyriad 1705515e79 libstore/filetransfer: reörganize includes
Change-Id: If1a9c9d45e50af1d06d07a8510ab003e6a6a6964
2026-07-01 23:03:27 +02:00
Raito Bezariusandrootile d26a73bfe6 libmain/shared: factor out nix features
This way, other parts of the codebase can use it.

Change-Id: I58673a6a56362692980426a6c8f70f5c6aff24d4
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-07-01 17:46:00 +02:00
Samuel Dionne-Riel cf1e565a0a devshell: Fix usage with nix-shell
Since d0190cff6f, the `justfile` uses
`$out` from the environment as an argument to `--prefix` in its `meson`
invocation.

The `$out` variable is...  A bit spicy to use since its semantics change
depending on whether `nix develop` or `nix-shell` is used.

In a `nix develop` shell, a directory *relative to PWD* (and not
relative to the Nix expression) is exported. In a `nix-shell`, the
`$out` used comes from the derivation.

The alternative to this change is to make the `justfile` use a variable
name that would not conflict with a `nix-shell` and `nix develop` shell.
Since it wants to use that value for the `outdir` variable, this would
be the name I would pick first.

I chose to instead work around the issue within the `nix-shell` since
this would be breaking the existing interface. As tenuous as it is.

Change-Id: I64cd5fd85345457e14880cb133e9ddafd55a25da
2026-07-01 11:02:38 +00:00
blokyk a92e4b5c42 devshell: fix usage with non-nix rust-analyzer
rust-analyzer binaries that don't come from nix (such as the one
shipped with vscode's rust-analyzer extension by default) need the
`RUST_SRC_PATH` env var to be the path to rustc's sources, but this
wasn't set inside the devshell. this change explicitely adds it to
the environment. (trying to add pkgs.rustLibSrc and rustcSrc to
the shell's packages unfortunately does nothing, because they are
just pure source packages, nothing more.)

(the reason this probably didn't come up for other devs is because
1. a lot of lix devs use other editors that probably just use the
binary from the path, and the devshell installs pkgs.rust-analyzer,
which is patched to always have `RUST_SRC_PATH` set, and 2. because
pkgs.vscode-extensions.rust-lang.rust-analyzer is also patched to use
pkgs.rust-analyzer by default instead of the bundled one, so installing
the extension using nix instead of from the marketplace would also hide
this problem.)

Change-Id: Ia27daf2a88756311ac5485ea0af44aae242241a9
2026-07-01 11:55:10 +02:00
eldritch horrors 418918b599 libstore: derive legacy-tunneled rpc id from package version
this way each git revision trivially gets its own rpc protocol version.

Change-Id: I066c58ebff697e534479db5d02271dac1ea71709
2026-06-30 19:58:17 +00:00
eldritch horrors 6e19a940b1 rpc: transport errors in encoded exception descriptions, not results
results don't allow for streaming or pipelining. transporting errors in
exception texts is *bad*, but it's still better than not having streams
that actually work. this isn't a great situation, but with capnp that's
pretty much the best we can do. still beats the other rpc frameworks :/

Change-Id: I2abf17bc5ea5de2baeea44ff4d7b2f4db33e98dd
2026-06-30 19:56:57 +00:00
eldritch horrors 57c00a20c5 libutil: make exception wrapping accessible outside of TRY_AWAIT
this will be useful for rpc cases, and it reduces macro code expasions.

Change-Id: I47c837fb5efab8eb408fcf9617055ea1562fc422
2026-06-30 19:55:45 +00:00
eldritch horrors d0deb1a150 libutil: add error encoding that survives capnp exception transport
using result types in capnp is fraught. while it makes some sense for
interfaces that need neither streaming nor pipelining and can provide
much better error fidelity there it's also fundamentally incompatible
with those that *do* need streaming or pipelining: streams will never
be stopped early unless an exception flies, and pipelines cannot look
through result types. likely the best thing we can do is to encode an
error for transport in the capnp/kj exception description strings. :(

Change-Id: Icb7d16238fa9a7aaf92c00363f7be4076ac02a61
2026-06-30 19:55:45 +00:00
Qyriad 22e2ecdc43 build: update integer overflow sanitizer handling for fixed meson bugs
Change-Id: I27f33e66e107d4af13abe62257be8c696a6a6964
2026-06-30 18:56:51 +00:00
piegames 5434ddf4cd justfile: Don't require nested escapes on forwarded commands anymore
This is a hack, but this is the best we can do with Just unfortunately.
Maybe rewriting this file into a python script wouldn't be the worst
idea at this point …

Change-Id: I32d089f6b49165faed99fb592d068dbb8a7e48e6
2026-06-30 10:58:58 +00:00
piegamesandeldritch horrors 7ef274600d testlib: default nix fixture to also test all daemon protocols (3/3)
This is the real deal. The new tests have surfaced one bug in the test
suite itself, and one in the RPC legacy protocol wrapper.

Co-authored-by: eldritch horrors <pennae@lix.systems>
Change-Id: Id75b671c10b45655d3627abd88563e2d41719446
2026-06-28 19:09:49 +00:00
K900 12c1132f07 package: revert the breaking curl change on 8.21+
Change-Id: I374b37c5d428c6c7db71341d783b6a1cddf45b19
2026-06-28 17:19:51 +00:00
piegamesandeldritch horrors d5044f0016 testlib: default nix fixture to also test all daemon protocols (2.5/3)
All tests should have been clear here, but alas

Co-authored-by: eldritch horrors <pennae@lix.systems>
Change-Id: Id642be1f6e0fb714b844ee5348dc096866cf3906
2026-06-28 16:52:12 +00:00
eldritch horrors 2605d3eab1 libcmd|rs: use rustyline instead of editline for the repl
Change-Id: Ic414de3cc2435d9615305f05a85aa9c923e82a69
2026-06-28 16:37:46 +00:00
piegamesandeldritch horrors 567348a90c testlib: default nix fixture to also test all daemon protocols (2/3)
This commit enables the parametrization for "legacy-combined" protocol.
All failing tests with that have been either fixed or disabled. Notably:

- A couple of tests (e.g. involving builders) could be made to work with
a non-local store, but this would require some refactoring to testlib in
order to make certain configuration settings generic over local and
remote operations. We've disabled those for now, in order to make
progress
- The store tests all run locally only because of their nature
- The flakes tests also all run locally only because my energy for
fixing them is limited (and it's a *lot* of test failures, with probably
little overall benefit in terms of test coverage)

Change-Id: I56fa249a64f7c17c952f688ec89e9687f2a13f12
2026-06-28 18:17:57 +02:00
eldritch horrors 1c2b5d4b5a libutil: expose loggers to rust
this takes the form of a couple of hideous macros for now to get started
without worrying about semantics of rust logging and tracing crates, all
of which are in some way incompatible with the current lix expectations.
we do want to move to using those eventually, but that will have to be a
task for later. as long as only small amounts of lix code live in crates
we don't have to worry much anyway, and by the time we get around to any
Activity beimg ported we'll hopefully have a better understanding of the
requirements on either side. we'll reëvaluate the log infra around then.

Change-Id: I4aec476a486f56d0972294358cbf0b6810ab9394
2026-06-28 13:02:07 +00:00
eldritch horrors c5bcb9a312 libutil: disable direct access to logger verbosity
that way we can sync it with rust for nearly free.

Change-Id: Ib3f1e0335884e077a0293f4b13c5919297748522
2026-06-28 13:01:45 +00:00
eldritch horrors 91663cca2d libutil|rs: bring back c++ interop with zngur
Change-Id: Ia9e9881f464d5b25110b56fb9d72ed30463eaeee
2026-06-28 12:47:18 +00:00
Qyriad d9ecb5301e build: cargo entrypoint II
This is a second attempt at https://gerrit.lix.systems/c/lix/+/5516

instead of letting meson try to be cargo we'll just have cargo at home.
this requires some contortions to link everything together due to quite
a few meson deficiencies, but at the end we get to pretend that rust is
just c++ painted orange. we'll use cxx to bring real interop back soon.

also fixes #1230
also reverts 10845bfe63

co-authored-by: eldritch horrors <pennae@lix.systems>

Change-Id: Ib1fda843fa80d818705d5a65ec9054216a6a6964
2026-06-28 12:46:20 +00:00
piegamesandeldritch horrors 9e846fbaea testlib: Small feature additions
Change-Id: I8940e66a1fb89cf8024b1e94e328b28a008a1452
2026-06-28 13:45:48 +02:00
84fb93a009 testlib: default nix fixture to also test all daemon protocols (1/3)
This first geralizes the `nix` fixture with `pytest_generate_tests` to
iterate over all protocols (unless they are marked with `no_daemon`),
though for now the list of protocols is set to be empty. The lang tests
are all tagged with `no_daemon` because they are mostly pure and running
them multiple times would be wasteful.

Co-authored-by: rootile <lix@rootile.de>
Co-authored-by: piegames <git@piegames.de>
Change-Id: Ib407edb420ba4bf434cacf9563a71f5ae6fa8eef
2026-06-28 13:45:46 +02:00
Samuel Dionne-Riel 7868f52c2a tests: Add regression test for daemonAuthorizationSettings
Regression test for extra-trusted-users being ignored
  https://git.lix.systems/lix-project/lix/issues/1183

Change-Id: I764a6add0215b535fc4abd21b41d1c23b21fc06b
2026-06-27 18:37:27 +00:00
Samuel Dionne-Riel fc6772a7dd main: Run registerGlobalConfig before loading config
This is a bit of a trip.

Commit 63b0a01d75 moved config
initialization out of static initializers.

In doing so, an oversight was made with the new
`GlobalConfig::registerGlobalConfig` calls. Previously all global
configuration would be handled well before `loadConfFile` was called.

The change placed `registerGlobalConfig` in `main` *after*
`initNix`. The `initNix` function is what calls `initLibStore`, which in
turn callse `loadConfFile`.

So, in effect, the configuration for `daemonAuthorizationSettings` and
`nixDevelopSettings` are not actually loaded.

Change-Id: I10dba2c98e032f910942ee0e0ca6bb39ef60edc2
2026-06-27 18:37:27 +00:00
rootileandeldritch horrors fce63f6dbf parser: improve error message for ill-defined escape sequences
fixes #1169

Change-Id: Ic93e0cb5442b717964de3ae9eb22f4cd48e4ad0a
2026-06-25 21:03:09 +00:00
Qyriad de68de1d11 tests/test_build_fod: fix overly strict pattern
Change-Id: Idd3146f41d527a7263ee61e7a5ce0e836a6a6964
2026-06-25 09:54:50 +00:00
Qyriad 071b810f95 package: override Curl to remove backported patch that breaks our tests
Cherry-picked-from: https://github.com/nixos-cuda/nixpkgs/commit/3f596088797d2e3a62e20cae2d2936e8548a690e
Co-authored-by: Atemu <git@atemu.net>

Change-Id: I5d060872d4d0ae283d73b4268af612326a6a6964
2026-06-24 13:45:53 +00:00
Qyriad 63fb295ad8 build: fix C++ dylibs on Musl by working around Nixpkgs brokenness
Change-Id: Iad30ec38eef8205e2d73553caddbbbc96a6a6964
2026-06-22 21:18:56 +02:00