Commit Graph
19207 Commits
Author SHA1 Message Date
eldritch horrors 4f0214b4bc tidy: add a lint for std::fs exceptions
Change-Id: Iba3c6ed858a7c4304c8c8825aaf5df3ec60b91df
2026-06-05 18:43:08 +00:00
eldritch horrors 6cd8fcd9d8 libutil: handle all rename errors in moveFile
what the actual fuck. swallowing all errors *except* EXDEV is not okay.
renames do not do this, so moves should not do it either. luckily we do
not use moveFile anywhere except the store path registration code. this
may or may not have caused problems in the past. probably nobody knows.

Change-Id: I2b0255a5703983cbd129abc3219c11ac7171fd12
2026-06-05 18:26:21 +00:00
eldritch horrors e108432cb7 libutil: catch std::filesystem errors
catch and rewrap std::fs errors in some meaningful way, otherwise lix
can crash with foreign exception aborts if filesystem failures happen
that aren't already being caught. renames in particular can fail with
incomprehensible errors in even pretty normal circumstances elsewise.

fixes #1219, fixes #995

Change-Id: I0b1e5696d300aac3422e43cffc17a2426803d64e
2026-06-05 17:17:18 +00:00
Maximilian Bosch c13ca9adcf nix-support/build/outputs: don't expose rl-next.user
I'm not sure why this wasn't an issue before, but the generation of
jobset constituents in Hydra trips over this. The Hydra-convention is to
have the `system`-attribute last anyways, not in-between.

Since this is a single attribute, get rid of it for the sake of
simplicity.

Change-Id: I80ef1b92ed158c8712ee899534ce82130614f338
2026-06-04 16:26:04 +02:00
Maximilian Bosch 82d23e8f1b release.nix: init
This is a Hydra jobset definition to be used to warm up a cache with Lix
versions built against several nixpkgs versions. This is only happening
after a bunch of tests have passed.

Change-Id: Id0b0e50c08581f3f377c7c793d2fd83a6007999d
2026-06-04 16:26:04 +02:00
Maximilian Bosch 1c70995b25 flake: remove release job
This is Hydra-specific and will be re-added in the commit adding a
release.nix.

Change-Id: I13900821b02fe268356932f612734187188832b8
2026-06-04 15:41:13 +02:00
Maximilian Bosch 4931a5f10c nix-supports/outputs: only build packages on platforms that are available
If e.g. i686-linux is not in the list of systems and thus no attribute in `nixpkgsFor`
exists (e.g. on hydra.afnix.fr), don't try to instantiate it.

Change-Id: I118e2af5289ad7bd95ce7f1e6b0728afb6f0321f
2026-06-04 15:40:48 +02:00
Maximilian Bosch 9b2a19530c flake: split off common CI artifacts
...expect for the dev-shell: while it doesn't seem reasonable to me to
even build dev-shells in post-merge CI, this should still remain part of
the pre-merge checks.

Change-Id: I5cb9b4cf53484f884d694770ed94d0dc0862117e
2026-06-04 15:38:58 +02:00
Maximilian Bosch 9fe22f4e5e flake: split off tests
Change-Id: Ic7957eb2928bc66e9213051d9de7447d96e55fe6
2026-06-04 15:30:46 +02:00
Maximilian Bosch 52449f3f8e flake: split off packages attribute
Change-Id: Ic1e0ab81cb034f6468edfc03b7a716bbf157146f
2026-06-04 15:30:45 +02:00
Maximilian Bosch eb4997592d nix-support/build/inputs: init from flake bindings
Change-Id: I84b462d8fa18f656d4a19d2def6d69ecfb90c156
2026-06-04 15:30:45 +02:00
Maximilian Bosch 8d581f42d9 flake: turn variables into a scope
Step II to move the code out of flake.nix. Done in a second intermediate
commit to make it easier to review.

Change-Id: I13fb386f2e9b87b1d28c366e9b7f0d2dbe03315c
2026-06-04 15:30:45 +02:00
Maximilian Bosch 79d6056d26 flake: import nix_2_18 as path
That way we can use it in non-flake contexts down the chain.

We don't override the `nixpkgs` anyways since this is a test artifact
that needs an old nixpkgs input, so this isn't a concern here anyways.

Change-Id: If2aa8f7171a445e8321ef449026e206cc5a0fe3c
2026-06-04 15:30:45 +02:00
Maximilian Bosch 13bcd07385 flake: don't use self in let block
The upcoming change factors out a lot of code to make it reusable for a
"legacy" Hydra project that we use to build a matrix of (Lix x nixpkgs)
to have a warm cache for everyone.

The Hydra project will not use flakes to have some inputs overridable,
so the change is needed. In non-flake mode we don't have a notion of
"self", so rename it to `lixSrc` such that the next commit is purely
about moving stuff without changing any aspect.

Current stock Hydra doesn't expose `lastModified` though, so right now
that is a cache-miss. There's a pending Hydra PR fixing that[1].

[1] https://git.lix.systems/lix-project/hydra/pulls/82

Change-Id: I59d70b8b874f576c782217e7bca099eda4c7add9
2026-06-04 15:30:20 +02:00
Maximilian Bosch 1b9570162e tests/nixos: don't pass in self
The reference to the flake is used in a single place only to get the
`doc` output of Lix. Remove it so that we can also instantiate the tests
in a legacy Hydra jobset (happening further down the chain).

Change-Id: Ie3eccf42d67c81fcf991342097783e5067d512bc
2026-06-04 15:30:08 +02:00
Maximilian Bosch 003946f062 tests.container: fix for 26.05
Noticed on my quest to make Lix buildable against multiple nixpkgs' to
provide pre-warmed caches for the flake on AFNix's Hydra.

`pkgs.systemd` has a new patch policy[1] that only allows patches for
hotfixes and fundamental incompatibilities. As such, the patch that
allows nspawn workloads to start without a `/usr/bin` was removed with the
recommendation to create that stub yourself.

[1] https://github.com/NixOS/nixpkgs/pull/488508

Change-Id: Iaa35ae3b8971867f12daeac5f94958c20a7d9233
2026-05-31 12:27:17 +02:00
rootile c64fbcbdb2 f2/command: allow piping stderr to stdout
Change-Id: I280d4888e9dc11cce93bacfddd9b4383a11525e1
2026-05-27 11:49:49 +00:00
Erik Jensen eef57410d7 Fix nix-copy-closure --include-outputs
The option has been broken since Nix 2.4. The flag was accepted, but not
used. This change plumbs it through to computeFSClosure.

Change-Id: Id6adee8ea8a6a4f457b24b650660f319e3daa2b2
2026-05-26 19:40:07 +00:00
Linus Heckemann 8edb857248 libfetchers: lock inputs before fetching them
Fixes #1122

Change-Id: I9243e692779a795066417a15c6315dd56a6a6964
2026-05-26 15:14:13 +00:00
Qyriad b113be5f13 flake: provide devshells for static cross systems too
Change-Id: I27ec97eaac88236a0958953a81d09ee16a6a6964
2026-05-23 21:14:54 +02:00
Qyriad 720306b693 package: deduplicate python environment packages
Change-Id: I2653d2db71a40d763d4cd3b5c4ef05306a6a6964
2026-05-23 21:14:54 +02:00
Qyriad f6cfd6b3ea package: deduplicate pyxattr override
Change-Id: I4c8f34cef4d09f2ccb2df23e0679addd6a6a6964
2026-05-23 21:14:53 +02:00
Qyriad 839ae964fb justfile: clean build and outputs contents, not directories
This makes it easier to build lix on a different file system from the
source repo, e.g. symlinking ./build to a directory in /tmp.

The ./outputs directory is included for completeness as another
significant source of generated artifacts.

Change-Id: I1bb4c21c700beacb4882a1be473dd31353edd177
2026-05-23 21:14:53 +02:00
blokyk e5ca862ea9 libfetchers/tarball,git: log when unpacking tarballs
this logs unpackTarfile calls as an `actUnknown` activity, which
unfortunately doesn't report any progress for now. for the reasoning
behind this choice, see the previous iterations of this CL (cl/5590)
as well as the attached comments (the crux of the conversion is in DMs,
unfortunately). in short:
- i could't make a new ActivityType because that would be a breaking
  change to the daemon protocol, including with previous lix versions
- i can't use actFileTransfer because that would show up as a download,
  which would be confusing for both users and tools
- i can't use actCopyPath /or/ actCopyPaths because that would break
  NAR/substitution accounting when doing remote builds

also, ArchiveDecompressionSource, which is apparently used for
decompressing logs etc, does its own custom decompression without using
unpackTarfile, so it is not affected by this. from what i can tell,
unpackTarfile is only used for:
- fetchtarball fetcher
- git fetcher
- channel unpacking
- nix-prefetch-url

Fixes #1213

Change-Id: I68f3be520681d8889292353dd41ab19a60c5eeea
2026-05-23 05:21:56 +00:00
Linus Heckemann 1f100371d7 doc/hacking: switch buildkite sso url to afnix
Change-Id: I7f7e65fe2dc52b40d4771e59198dd66a6a6a6964
2026-05-18 18:13:47 +02:00
K900 b118785864 nix-eval-jobs: fix nested list in inputs
Change-Id: I08b02ecb85512288b24a02a500348eaf78f030be
2026-05-18 11:55:30 +00:00
rootile 1c81bd926d tests/f2: improve error message for failed in assertions
By default, when one uses `in` assertions, upon failure newlines in any
of the two strings is escaped, and everything is printed in a single
line.

This commit allows one to pass `-vv` to print out the left and righthand
side unescaped, with each line of the output being its own line,
improving readability a lot when dealing with multiline outputs.

Change-Id: Iaf67a20fce57d375e2c62a8e8a0957b14eec26ef
2026-05-18 10:47:00 +00:00
rootile b34f4d7b17 OWNERS: Do not inherit parent owners for f2/testlib
see [lix-weekly of
2026-04-22](https://wiki.lix.systems/link/153#bkmrk-code-ownership-of-f2)

Change-Id: I3e3df0d864a5614bb66a2d756df42c63305a7c8f
2026-05-13 22:32:30 +02:00
rootile 1971824580 OWNERS: remove Helle from test codeowners.
See [lix-weekly of
2026-04-22](https://wiki.lix.systems/link/153#bkmrk-code-ownership-of-f2)

Change-Id: Ic4345dd70e2cf5f7dd4509b32543c1f61d76cf07
2026-05-13 22:32:30 +02:00
Qyriad 7831c98a4d package: remove no-op deprecated 'pie' hardeningDisable
PIE was enabled by default in GCC Nixpkgs 25.11¹, and the hardening flag
was subsequently removed² and has no effect. This commit thus fixes a
warning about it.

[1]: https://github.com/NixOS/nixpkgs/pull/439314
[2]: https://github.com/NixOS/nixpkgs/pull/442510


Change-Id: I27850f947b1888c01045af9bbd5e737f6a6a6964
2026-05-07 11:45:08 +02:00
Qyriad cc271148b0 treewide: fix sys/poll.h -> poll.h
poll() and pollfd are defined in poll.h per POSIX¹, and musl complains²
about it.

[1]: https://man.archlinux.org/man/poll.h.0p
[2]: https://github.com/kraj/musl/blob/8cb84492b0245d70b2cd0edd523e2b55c7ad67a9/include/sys/poll.h#L1


Change-Id: I4fff447394903cbf55e330f07ed82b906a6a6964
2026-05-06 20:51:25 +02:00
skye 2b409ad322 meson.build: Warn on deprecated declarations
Can finally do this after fixing all Value based deprecations.
Resolves #744

Change-Id: Ic050b42a5af140c6dc74dd1545e3f1d76a6a6964
2026-05-06 12:08:03 -04:00
piegames 7cdda9c5fa flakes: checkOverlay: Don't check the second argument
It's software archaeology time.

- In 2019 (Nix 2.4), Eelco added `checkOverlays`, which strictly checked
that the overlay must be a function of two arguments, one called `final`
and the other `prev`. (dc3f52a144,
gh#3573)
- In 2024, NofairKing opened an issue about checking the exact name
being a silly idea (gh#10516). Instead of trying to make the check more
sensible, the first fix attempt simply expanded the check to allow
`previous` instead of `prev` (the author's preferred name for the
attribute, supposedly; gh#10553). After some discussion, instead a PR
got merged which simply removed the `prev` check altogether, while
leaving the `final` argument check intact for some reason
(ad65a50a94a97bf1f1a1902f43542d28a2e8206b, gh#10572).
- In 2025, over at Lix and oblivious to the latest change over at
CppNix, I came across this stupid check while trying to improve the
abstractions of the AST in Nixexpr. I spent (wasted, retrospect)
considerable amounts of time removing the exact name checks while also
improving the check overall (making it check for more than two
arguments, and also generally improved error message).
(0928d4d87a,
Id4244171123dd8a228be71ce9f04d8e9f647c111)
- Fast forward to 2026, where I run into this becursed piece of code
once again, and once again during some Lixexpr cleanups. Now that I have
seen how carlessly the issue was handled at CppNix, I can't be arsed to
give a flying fuck anymore. Out the code goes. Bye.

With this commit, all casts on `Expr` subclasses outside of libexpr
itself have been removed. No more violation of abstraction boundaries.
Good riddance.

Change-Id: I939968bb01d461764cfa0f4ea7152b4fcf1acf93
2026-05-06 17:22:19 +02:00
piegames 481fc30ae7 libexpr/flakes: Replace the AST checks with maxCallDepth = 0
Change-Id: I7130cc941b4b7432df76a3995d298edfb28e6a01
2026-05-06 17:22:19 +02:00
eldritch horrorsandpiegames d0a4b55a0e treewide: pour the rpc foundations
pour the foundations for rpc, and let them set. this is very much
unstable and must be opted into with explicit store uris (e.g. by
setting `NIX_REMOTE=daemon?protocol=any`). the daemon sockets are
not enabled by default and must be enabled with the `rpc-sockets`
experimental feature. we will not advertise this just yet because
in the current state it one has to be *very* dedicated to the rpc
cause to deploy this, but once we have some more bits migrated we
may want to add release notes and officially as for beta testing.

Co-Authored-By: piegames <git@piegames.de>
Change-Id: I85a96ccb700b91190c1eb37154bcc6ae1c03401a
2026-05-06 10:55:08 +00:00
eldritch horrors b2c95d41c9 libstore: prepare meson for more rpc definitions
Change-Id: I4c495d574acdaa976bdd4ab51bf543aae63903af
2026-05-05 12:03:34 +00:00
eldritch horrors 010d062926 libstore: move legacy request handler loop to new function
splitting it off lets us reuse it (and all the legacy protocol handling
it encapsulates) in the rpc world as well by just tunneling wire bytes.
doing this allows incremental migration of to a new rpc protocol, until
we are finally ready to call the rpc protocol ready and remove the link
to the legacy protocol altogether (and maybe merge this function back).

Change-Id: I8f2a8795c4a9d713ebbbbfd02e9eec5271a2b7a9
2026-05-05 12:03:26 +00:00
eldritch horrors af4d064be7 libstore: processConnection -> processLegacyConnection
Change-Id: I608085c845cce05f4186f83b9ef0d84e8e4a776e
2026-05-05 12:02:47 +00:00
eldritch horrors 7edb421e1b treewide: generalize socket handling
this adds the protocol registry. we also extend the systemd unit setup
to allow adding new protocols without much fussing, and we move deamon
instances into protocol-dependent scopes. this will make monitoring or
resource limiting of individual protocol daemon instances much easier.

Change-Id: Ic9da08eb074868b6e57385075c5502b081e8461f
2026-05-05 12:02:16 +00:00
eldritch horrors de3a2451eb libstore: move daemon protocol struct out of Settings
we'll use this to create a registry of protocols the system understands.
also use this struct during connection setup to make that simpler later.

Change-Id: Ifa481fea7ea2efa2a1f1be4d81076a9e022d24f9
2026-05-05 12:02:07 +00:00
eldritch horrors 4da9a53b66 f2: add test for daemon socket connection
tests both order of sockets tried and that all sockets work as expected.

Change-Id: I5aeb506e159564a0b14b6fbbe5df1e5ccdb437d5
2026-05-05 12:01:58 +00:00
skye 8ab7547a74 libexpr/json-to-value: Refactor json-to-value.cc from linked list of
inherited classes to stack of variants

Previously the code represented the stack of unclosed arrays and
objects as a linked list of virtual objects which seemed unnecessary.
There is a closed very small (3) number of possibilities, and one of
them only exists at the top level. A vector of variants seems a lot
simpler, and as a bonus, more performant.

Change-Id: I6bc429d682d22f69ca91dc0518e6be646a6a6964
2026-05-04 15:42:55 -04:00
eldritch horrorsandRaito Bezarius 2f7d7444f1 libutil: fix nar parser buffer overflow
string data shares a buffer with the binary string length field. size
calculations for string read buffers always include the length field;
sufficiently large length fields can cause these calculations to wrap.
a malicious nar could use this for OOB writes in the daemon (as root).

since we use strings only as tags for archive members and for symlinks
with their OS-dependent length limits we can simply limit string size.
1 MiB should be sufficient for all symlinks, and tags are always tiny.

Change-Id: I89fb05f73c1dbeda45d91244aba4cd526a3d83e1
2026-05-04 19:00:19 +02:00
Raito Bezarius c595477002 releng/keys: update the way to receive the ephemeral key
Change-Id: I791f3f3f49ecd5884c9e86b5d3b617fc139e031f
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-05-04 18:57:20 +02:00
Raito Bezarius c71d2ebace releng/environment: update staging parameters
These parameters are now created on https://s3.afnix.fr.

Change-Id: I96b6fd913429ee46d04c412cb141edd288665ced
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-05-04 18:57:20 +02:00
eldritch horrors 65346101a2 libstore: rename openConnectionWrapper to something more meaningful
Change-Id: I46c57476ef73c6a8b851ab34ba67872c8f6b826b
2026-05-04 09:44:10 +00:00
eldritch horrors 0d2c48a797 libstore: remove RemoteStore::failed
this is not read in code paths that are called repeatedly, and the only
reader can never see it being false. we also question the wisdom of the
flag in the first place; why should opening a connection fail because a
previous connection did? conditions may have improved a lot since then!

Change-Id: Ib7c219e6239432d99a22b10024847218469f1cd4
2026-05-04 09:44:10 +00:00
piegames 078bbe6171 libexpr/eval: Fix off by one in maxCallDepth calculation
This isn't really relevant for a setting of 10k, but now that we want to
set it to 0 for Flakes it makes a difference as to whether or not one
top-level function call is allowed or not. (It shouldn't be)

Change-Id: I6bbf99826af0289c232b9d45d172a378b81abe4b
2026-05-03 13:05:46 +02:00
Lunaphied cd573beb0a docs/hacking: fix to respect changes in justfile
We no longer have setup-custom, just use setup

Change-Id: I2a151d04dc3d90a98b79859b05c4e6706a6a6964
2026-05-01 11:12:54 +00:00
Jade Lovelace d94bb49cf4 fix: structured build logs: bad field types no longer fail builds
Caught by edef's harness. I rewrote the structured build log tests in
f2 and added a test for this one.

Before: it failed the build altogether:
```
building '/tmp/jade/pytest-of-jade/pytest-77/test_invalid_fields_files0_0/nix/store/skhjs5zs082nqiakj69qz32gyywz0v1a-unusual-loggi
ng.drv'...
error: unsupported JSON type 7
```

Now the output is as expected:

```
warning: Unable to handle a JSON message from the derivation builder: error: unsupported log field type number
@nix {"action": "start", "fields": [1.5], "id": 2, "type": 1, "level": 1, "text": "abc"}
```

Change-Id: Idbd28c5a4d4cf15f27207f83b730e7946a6a6964
2026-04-30 17:28:55 +00:00