Commit Graph
100 Commits
Author SHA1 Message Date
eldritch horrors ced825791a libstore: add capnp build request parameter struct to builders
there's nothing in here yet, we'll add that piece by piece.

Change-Id: Ib276d9e8281bb08013197db0f2bbfd8eec76b5ce
2026-02-02 18:26:56 +01:00
eldritch horrors f09ed729b5 libstore: generate darwin sandbox profile outside of sandbox process
Change-Id: I1a82e1dfa3709e1513d7acbdff50dc594cbc2323
2026-02-02 14:20:54 +00:00
eldritch horrors 9a31cc7da0 libutil, libstore: move closeExtraFDs to derivation goal
it's only used there.

Change-Id: I61ee47d37214c59c073cc9ed671ac1c82430227c
2026-02-02 14:20:54 +00:00
eldritch horrors 52590089df libutil, libstore: move bindPath to libstore linux platform bits
it's only used for linux sandbox setup, and can't be used elsewhere anyway.

Change-Id: I3560e141e5250cf9e72dc1576f87384a8e01f446
2026-02-02 14:20:54 +00:00
eldritch horrors dd54f45bc7 libstore: fix linux sandbox parent death signal handling
setting the signal is not enough, we must also check that the process we
expect to be parent to actually *is* our parent, not another process (eg
init if the daemon exited). we also have to set the death signal *after*
all set[ug]id calls, otherwise it will be cleared again by such changes.

Change-Id: I4e8c9102ea407576ed85b3203c8bb9bfb56762de
2026-02-02 14:20:54 +00:00
eldritch horrors 61e57329eb libstore: inline setupSyscallFilter
it's only used this once, and it accesses a (cached) global variable for
the filter. we want to move all sandbox setup state into a single object
soon, moving filter setup will make it a little bit easier to deal with.

Change-Id: I234d92d5ca044a16644b70bd303bfb7956c120f0
2026-02-02 14:20:54 +00:00
eldritch horrors ab6d8f513b libstore: always unmask all signals when launching build processes
when starting builders we want the inner processes to run with a blank
slate. if some signals are masked for any reason the builder processes
may attempt to send signals to each other that are never delivered; we
avoid this by unmasking all singals. since every build tree also has a
session and process group of its own we are not in danger of sending a
signal to a builder by accident from any source, so unmasking is okay.

Change-Id: I90720ed2bd44502ffb6d2bb848c05369809abeba
2026-02-02 14:20:54 +00:00
eldritch horrors 9ad8136825 libutil: always restore mounts from restoreProcessContext
daemons only need to restore the signal mask anyway, nothing else.

Change-Id: Id2a91f33ccf68f4d1af1bc526973a4bee066ff0b
2026-02-02 14:20:54 +00:00
eldritch horrors b908f9135c *: only increase stack size if evaluations are done
we don't need to mess with this rlimit for e.g. the daemon. increasing
the limit later should always be safe since we don't allocate (or map)
much before constructing the eval states that ultimately fill our heap
and could thus make stack expansion impossible after some time passes.

Change-Id: Ieafda537fbc99a6a7f83a093a981e7df947da437
2026-02-02 14:20:54 +00:00
eldritch horrors c20aaf6ca7 libstore: inline commonExecveingChildInit into single user
Change-Id: Ia389ec8c5e375b8386949c5fb031a52f27e76d37
2026-02-02 14:20:54 +00:00
eldritch horrors 1d227cbe07 libstore: extract capability raising into raiseAmbientCaps
this will be needed in other places in the future, and splitting it out
also clarifies the surrounding code. the keep-caps dance launchPasta is
doing doesn't have to be moved since it is only needed to allow setuid.

Change-Id: I6baaa138c2b1bca9626971ed3266c1a971a63acc
2026-02-02 14:20:54 +00:00
eldritch horrors 576ff2f598 update nixpkgs, pre-commit-hooks
the devshell no longer worked for us due to the recent deprecations :D
let's update pre-commit too because while it doesn't fail it does warn

Change-Id: Ic2060c82e4e97bb7a96cebd29097abefabdfe733
2026-02-02 15:08:49 +01:00
eldritch horrors 1042d26c31 libstore: remove impersonate-linux-26 setting
it's ancient, it does not do what it was added for (improving
determinism), and it probably hasn't been needed for anything
in a very long time. we can probably get away with killing it

Change-Id: I66f5c841964d9ad62726cb2dae8d6fc42095399f
2026-01-31 20:05:45 +00:00
eldritch horrors cf9735f82e libstore: don't modify pathsInSandbox while mounting stuff
mostly because this will make it easier to change the data source for
them, and especially to change to data source to something immutable.

Change-Id: Ic5f1a55d02d4c2cc928c3f8b308d07167efb467b
2026-01-31 20:05:45 +00:00
eldritch horrors f5a2251966 libstore: move rewriteResolvConf to LinuxLocalDerivationGoal
it's only used there.

Change-Id: I9e267ce8b178ef3996d55b5980475a7e914ba0aa
2026-01-31 20:05:45 +00:00
eldritch horrors b41af64d1e libstore: compile linux syscall filter in prepareSandbox
this is literally part of preparing the sandbox.

Change-Id: Ic1a574bdaa68b5f39326b91c10198b774f7b2f7e
2026-01-31 20:05:45 +00:00
eldritch horrors 0d4baa5528 libstore: don't keep tempdirs open after we need them
closing them as soon as we're done ensure that the fd table doesn't
balloon in size, which in turn lets us build larger graphs. it also
makes forking processes cheaper due to less fd table copy overhead.

Change-Id: I233d1b7358ffe1b05680f845cd99de38b179f449
2026-01-31 20:05:45 +00:00
eldritch horrors 279926d215 meson: merge libs
lix, where modularity is made up and the patterns don't matter. merging
everything to match actual behavior of the system makes using rust much
easier because we'll have only *one* library to link, not half a dozen.

Change-Id: Ie3cb1db659798511128716402497697320bd0484
2026-01-30 17:29:51 +00:00
eldritch horrors 2e0cc67ec8 libstore: start pasta much earlier
starting pasta as soon as we have all namespaces it must be in available
lets it start up while we finish creating the sandbox. this may speed up
sandbox launches somewhat, but likely not enough to show up in practice.

Change-Id: Id6724cbdc48b99284cd7ba7b56c98829d74557c5
2026-01-30 00:29:27 +00:00
eldritch horrors a2500db977 libstore: remove unnecessary linux-specific RunOptions
Change-Id: I07303c2aea78cf9f17b89b5cea922271ce26f029
2026-01-30 00:29:27 +00:00
eldritch horrors d43c6dd100 libstore: use raw syscall for inVFork setgroups
Change-Id: Ia656d2697b883d2b058984787556915b34f44211
2026-01-30 00:29:27 +00:00
eldritch horrors ab4f8718f9 libstore: start pasta from a vfork child
mostly as a prototype for other process launching optimizations, but
also to move linux-only bits out of runProgram2. we want to stop the
fork+exec dance we do now and migrate to posix_spawn, but linux will
always need an amount special handling for launching build children.

Change-Id: Ied55dc0de95c05b52aaca923be2e3c1d101f47e0
2026-01-30 00:29:05 +00:00
eldritch horrors b6c8f412a2 libstore: generalize linux vfork infra to also allow exec'ing
we'll use this to run programs from a vforked child instead of using
runProgram. ideally we would like to have runProgram be as efficient
as possible, but our mount namespace handling makes this harder than
is worth dealing with right now. the linux derivation goal is a good
place to prototype functionality like this, especially since we need
fine control over credentials and file descriptor tables of children

Change-Id: Ibc356613ae10b06ea81de9575611948f5ee353b6
2026-01-29 19:00:56 +01:00
eldritch horrors 05fed0687d libstore: add processes to cgroups earlier
this was racy previously; a builder may have spawned processes before we
added it to a cgroup. these processes would not be registered correctly.

Change-Id: If60a64a798ee806d5701590a83d1015f55d7b867
2026-01-28 18:49:02 +01:00
eldritch horrors b23bbd5b19 libstore: fix personality setting for unsandboxed linux builds
oops. this was supposed to always happen on function exit.

Change-Id: I25465b4248c33389ca7e70b2a0b52dcc10d86a38
2026-01-28 18:49:02 +01:00
eldritch horrors 56988d8605 libstore: use vfork for linux sandbox launch wrappers
this halves sandbox launch overhead, reducing the build time for 3000
trivial runCommand derivations on our machine from 80 seconds to 44s.
as a nice side effect we also get better error message propagation in
some cases, most notably setgroups failing when run in lix sandboxes.

Change-Id: Ia7c50a844915d9b8a20475b90b2d0179fd2fff34
2026-01-28 15:01:13 +00:00
eldritch horrors bf3d4e8721 libstore: simplify user/net namespace setup
creating user namespaces early means we don't need pipes to signal that
a namespace has been created and set up. we'll also create the netns at
the same time because they're privilege-bound to the userns, and having
both available will let us launch pasta earlier to have it ready sooner

Change-Id: Ie66fe2ab7f50a520fb81dd90944384e168d94476
2026-01-28 15:00:55 +00:00
eldritch horrors c9fe3befc1 libstore: add vfork infra to linux platform bits
vfork can be a lot faster than fork on linux, and we want to use it.

Change-Id: If1665d3c49e525f2722b1e040cd7058f376bd20e
2026-01-28 15:00:43 +00:00
eldritch horrors 7e8f7d0e66 libstore: set up linux sandbox /etc earlier
permissions and ownership will be the same since the sandbox process
will not have changed uid/gid or umask by the time it gets around to
writing these files. all of these files contain some information the
host must provide, be it contents or configuration info of some kind

Change-Id: I0b57cb0699fd29e798ccf330dff99f571f3c0692
2026-01-28 12:41:26 +01:00
eldritch horrors 7d3dde851a libstore: make runPasta a function of LinuxLocalDerivationGoal
this way we can use it anywhere without fear of it being uninitialized.
only the linux platform bit uses this anyway, so we will move it there.

Change-Id: I35e207eec91daa8aa327c4f8b36c0dc8e703a7c4
2026-01-28 12:41:26 +01:00
eldritch horrors bd458f9f89 libstore: make privateNetwork a function of LinuxLocalDerivationGoal
it's only used there, and this avoids using it uninitialized.

Change-Id: I6bd84e3c441dc6750e8ab07822f896136586cd66
2026-01-28 12:41:26 +01:00
eldritch horrors 986191534e libstore: allow config loading without a home dir set
we can already handle this case (by forbidding any ~/... paths in option
values), and since builtin builders are now run via exec we may not have
a home dir set, or even available, for them to resolve. loading a config
file in this situation will fail with an error even if the config is ok.

fixes #1109

Change-Id: I3491b31558871faa34766462747e3c15d1eccc64
2026-01-27 17:13:07 +01:00
eldritch horrors ef8a6cc5f5 libutil: add tryGetHome that doesn't throw on errors
Change-Id: Ib5bcb277e39093b303fe4a66a8903a7c5692f305
2026-01-27 17:13:07 +01:00
eldritch horrors cfabc37828 libstore: add unix:// uri protocol argument
Change-Id: I7fc27926aa1d89e2190b1deb0252ad33f2b364a5
2026-01-26 18:17:07 +00:00
eldritch horrors bdc220b8ec libstore: allow for multiple daemon sockets with preference
this will let us configure more than one socket to connect/bind to,
which in turn lets us use posix acls on sockets for access control.
we will also need something like this for the final rpc transition.

Change-Id: I9c39f14906e9bf809055ab5c94bf687745b4f69e
2026-01-26 18:17:07 +00:00
eldritch horrors f4458b8e46 libstore: simplify netrc, cafile loading for builtin builders
Change-Id: I8370a1434729c7ff2e44ddbaf173d7068e8ace9f
2026-01-25 19:47:24 +01:00
eldritch horrors 99d674b785 libstore: despecialize sandbox launching
now that builtin builders are regular executables we no longer need to
treat them specially during sandbox launch itself, only while we build
the command line and environment for the sandboxed process. we are not
far from being able to extract platform-dependent sandbox launch code,
ideally moving all of it into (much more replaceable) libexec helpers.

Change-Id: I9b7041314683c56cd70eec9b1b4eae6de228883f
2026-01-25 19:43:13 +01:00
eldritch horrors 049c7b3369 libstore: move the builtin builders to our new executable
this means that builtinFetchurl runs in a real process now, and thus we
no longer need its workarounds for running in a forked process. forking
dropped the signal handler thread and broke the curl state via sharing,
neither of which happens any more now. we can run fetchurl builtins and
their actions straight from the main thread of our builder now, and the
temporary files and settings overrides we did are now also unnecessary.

Change-Id: I738171bc120ffcd541b7ff1424fed7924c2cdc1d
2026-01-25 19:31:38 +01:00
eldritch horrors 58c3ee4c8e builtin-builder: remove unescapeNul that snuck back in
fuck

Change-Id: I5d203fc36c4a2eb2aefde9208d6cefd3619cdf03
2026-01-25 19:30:10 +01:00
eldritch horrors 5abf26a19f add a builtin-builder command for ... builtin builders
this will let us migrate the fork+do_stuff combo of builtin builders we
have today to fork+exec of this new command. we use a subcommand rather
than a simple libexec helper because we would like to avoid linking all
of lix into the simple libexec helpers if possible. this is only hookup
for the builders, none of the buiders are migrated here to ease review.

Change-Id: I9358f1f3fee6ca640c81a7bd865128ae0d0e35a5
2026-01-25 17:26:39 +00:00
eldritch horrors c50a3a426f libutil: add simple NUL escaping/unescaping functions
Change-Id: Ia4cc7b8f1058439f312066422eebfaff1c2c0c6c
2026-01-25 17:29:32 +01:00
eldritch horrors ed6a1e58ea libstore: don't call builtin builders with derivations
call them with their individual parameters instead. this will make it
much easier to turn them into executables we can exec in the sandbox.

Change-Id: Ib49cf44715b2a480fecadabd21216c69cd730ef5
2026-01-25 15:34:59 +01:00
eldritch horrors 21e8347bb6 libstore: make netrc/cafile child args plain strings again
not having the optionals set when the builder runs (e.g. because FOD
hashes were not configured correctly) could cause assertion failures
in the builder process. while this should usually not happen we *do*
want to print a useful error message here instead of a crash report.

Change-Id: I81fb1d45fcbf660d0d9a7f0c0a12c38379ecd4c6
2026-01-25 15:34:59 +01:00
eldritch horrors 0453be06b6 libutil: remove unused RunOptions::{chdir, createSession}
Change-Id: Ib2b9f5c094233661a01ad8cea30a44e11931c941
2026-01-22 16:59:39 +01:00
eldritch horrors b5a25f0fb6 libstore: move build hook launching to libexec helper
like diff hooks before the build hooks also use runProgram features that
aren't present in posix_spawn. just like diff hooks we do not expect the
build hook processes to be so fast that launch overhead matters somehow.

Change-Id: If3c33dbd7d2ac20c95886e06d24feda312946c78
2026-01-22 16:59:37 +01:00
eldritch horrors a7f4a675b6 libutil: remove Pid::setSeparatePG
use a wrapper type instead. whether something should be treated as a
single process or a group is a type decision more than a runtime one

Change-Id: I966e998c19e74be64ddd72ab11af809d001f61b5
2026-01-22 16:57:26 +01:00
eldritch horrors 0b03ae1a13 libutil: remove unused Pid::{killSignal, setKillSignal}
Change-Id: Ic7cceef2d82a98cf8fe23260603b1262c097cad4
2026-01-22 15:23:38 +00:00
eldritch horrors 5351518c75 libstore: add a diff hook helper libexec binary
diff hooks use uid/gid switch functionality that is otherwise only
needed for linux sandbox setup and unsupported by posix_spawn. not
doing these switches inside lix core code may let us move to using
posix_spawn for most process launching in the future, and for diff
hooks the added overhead of a wrapper program really does not hurt
at all. diff hooks are expected to be expensive in terms of output
size, process launch overhead is not likely to even be noticeable.

Change-Id: Ifa4b3eedef237632db3eb88d10e6469acae01f9e
2026-01-22 15:23:38 +00:00
eldritch horrors d7b0d322f7 libstore: make diff-hooks work for non-root users
it's kind of weird to not allow diff-hooks in single user mode unless
that user is root. maybe that's why we have no tests for them? we can
at least add a test that diff hooks are run at all when we expect it.

Change-Id: I54d623b5416acda1c205cc062b0f3a33c9f4aaa7
2026-01-22 15:23:38 +00:00
eldritch horrors 36168de584 libutil: remove {Process,Run}Options::dieWithParent
nothing except the linux sandbox actually *needs* this for correctness.
the linux sandbox only uses it to ensure that builder uids are freed up
when the sandbox is torn down, and even *then* it only works as we need
it to with PID namespaces enabled since the parent death signals is not
inherited across fork, but when pid1 of a pid namespace dies the kernel
also kills all namespace members. in all other cases this flag does not
help us that much because it actively prevents child processes cleaning
up after themselves, possibly leaving more trash around than otherwise.

Change-Id: I9ae0a9e91833a91d1011375dda402ac6c0a7ef6f
2026-01-22 15:23:38 +00:00
eldritch horrors 7068cbf010 libstore: extract env and args rewriting from child
this really doesn't have to be here, it doesn't help very much. doing it
in the parent is cheap enough to not care and sandbox setup is not async
yet *anyway*, so we would not even notice if the old way was any faster.

Change-Id: I5a3a99af0fa5928e9a42f9c6589d98ff38b8c775
2026-01-21 15:59:30 +01:00
eldritch horrors 6da0389d0f libstore: move netrc/ca init outside of the build child process
this will make it easier to turn build sandbox processes into helpers.
the point they were at was effectivly unsandboxed except for a few fds
that were redirected by commonExecveingChildInit, which only made logs
of any errors that much harder to convey from the child to the parent.

Change-Id: I67006eb33e1e13311bb8d14e6a0c3d5e6baf0c13
2026-01-21 15:59:30 +01:00
eldritch horrors 5ba9a3961c libstore: move setupSyscallFilter to linux platform bits
setting them that little bit later really doesn't hurt us at all.

Change-Id: I6b50fbe0b58d037de729748cb4f87dd628bd111b
2026-01-21 15:59:30 +01:00
eldritch horrors 95c65ce637 libstore: move setPersonality to linux platform
it doesn't do anything anywhere else, and personality setup is not a
critical operation (all it does is change which arch uname returns).

Change-Id: I39d7fcc4916e6882e49191d2294f9b7ee0dbbcd0
2026-01-21 15:59:30 +01:00
eldritch horrors 6edbef7338 libstore: move some macos-specific bits to platform
Change-Id: I9236ffb8e098d09215067b872b5da5e210557815
2026-01-21 15:59:30 +01:00
eldritch horrors c39488d2a4 libstore: move some linux-specific child setup to platform code
best viewed with --color-moved --color-moved-ws=all

Change-Id: I3738f07fd0b39498abf253967906270dc0b215f4
2026-01-21 15:59:30 +01:00
eldritch horrors 113c6fd618 libstore: reformat bits of LocalDerivationGoal
mathbb overbar sigh

Change-Id: I9b5361ba03ff11a89773f7da2262d38fbf39b7af
2026-01-21 15:59:30 +01:00
eldritch horrors 3937eb9ecc libstore: open builder log pty in parent
there's no need to do it in the fork, we're not changing security
domains before opening the pty anyway. we do change who owns this
pty device, but since we change it via chown we can just *not* do
that before we have an open fd to the pty. in practice this isn't
even necessary because the daemon runs as root, but if we ever do
run the daemon as an unprivileged user we'd need this to be split

Change-Id: I35264ab2954c7ba2c9c24c927366d64acada6772
2026-01-21 15:59:30 +01:00
eldritch horrors 697a86c4af libutil/libstore: move namespace support checks to libexec
this also requires moving namespace support information into Worker and
out of function-scope static variables, otherwise we can't use async IO
for the libexec helper output. we could set the fd to blocking for just
one CL and extract the Worker changes into another that the reverts the
blocking fd usage, but that seems not warranted for the scope of these.

Change-Id: I6996fab1ae74693d50cefb6a6a9c21d61dada1d9
2026-01-20 22:42:53 +00:00
eldritch horrors be27e9696b libutil: move unix chdir+bind/connect to libexec
Change-Id: Ie07ece701454153d3d5c6c34e5613c0d1d5fae03
2026-01-20 22:42:53 +00:00
eldritch horrors 761f8ab6eb libutil: fix libexec helper args span calculation
fucking hate C

Change-Id: I678c9eda32911ce7ea5e76c4274b71e45e7f3790
2026-01-20 19:16:00 +01:00
eldritch horrors 8039d69818 libutil: move killUser innards to libexec
Change-Id: Iddd3099c31c91b18c946f7ba2db79c221e7686fe
2026-01-20 16:43:23 +01:00
eldritch horrors d9187b4ee0 libmain: run pagers with a libexec helper
this is mostly a test and example for the libexec helper infrastructure,
but it also lets us simplify pager launching until we we can more easily
handle executable-not-found errors the launch fallbacks would cause when
using runProgram2 instead of fork. ideally we'd use `posix_spawn` later.

fixes #1104

Change-Id: Ia33cc12e8a9d60ffad6f5c055bb1b8b596810e64
2026-01-20 14:02:12 +00:00
eldritch horrors 9921615410 libutil: add libexec helper infrastructure
the new libexec directory is not available as a setting like other
directories (e.g. binDir) are since we consider libexec helpers to
be very internal. repointing them is like repointing a .so file we
dynamically link to; it can work, but needs much more preparation.

Change-Id: I40e64be0b32276f2864c0f2eb0b998d4c8ce7c88
2026-01-20 13:53:44 +00:00
eldritch horrors 9b334faa81 meson: use escaping functions for config.h defines
Change-Id: If7677d8040e0da0b72fc9498f2c920a0f1bb25f7
2026-01-20 13:53:44 +00:00
eldritch horrors d5bdc1c240 tests: remove outdated comment in test-session
we *are* using runProgram2, just not its builtin stdout stream.

Change-Id: I1766a9e443f539979f1f780a6d32294d103fb10f
2026-01-19 20:31:30 +00:00
eldritch horrors e2991e1245 libstore: use runProgram2 to launch build hooks
we don't need the full sandbox setup helpers for this: mount namespaces
do not need to be kept, loggers are not needed, and redirections can be
done by runProgram2. once the build hook is removed we will not run the
communication bits from a different process anyway, this prepares that.

Change-Id: I95d28f7c2c25e43ccd82b448d270403ce4f28852
2026-01-19 19:46:29 +00:00
eldritch horrors f2432be62d libstore: use runProgram2 for ssh connections
we do not need explict redirection management now, and dieWithParent
doesn't need an override either. we'd much prefer to kill ssh if the
process in charge exits; even ssh multiplexers are not fazed by this

Change-Id: I81e28b7605df73c887878ea4716228c7ad0f5c6f
2026-01-19 19:45:28 +00:00
eldritch horrors 39869c8b35 libutil: add setsid support to runProgram2
Change-Id: I9c023f2497cab12f1a7bfafd0baa82ffb5912d3e
2026-01-19 19:28:46 +01:00
eldritch horrors 6c7a80e449 libutil: reformat runProgram2
yeah. sorry about that.

Change-Id: I33d55d0014a53346a5c0ce07091a086374172b30
2026-01-19 19:28:46 +01:00
eldritch horrors a28dc8f77f tests: use runProgram2 for repl tests
the redirections the tests did were once not possible with runProgram2,
but they have been for a while now. we should use them instead of fork.

Change-Id: Ia422c8941ed04a9403dee68bfe938d68952253da
2026-01-19 19:28:46 +01:00
eldritch horrors 1719d60531 libutil: return pid object from RunningProgram::release
returning the pid as a pid_t instead of as a Pid raii wrapper is only
convenient for daemon use (where it'll eventually go away). using the
released pid correctly in other places is harder without the wrapper.

Change-Id: Ib42a2f357d2f0849beabd015b321bfff31334eda
2026-01-19 19:28:46 +01:00
eldritch horrors 54180f4c35 libmain: remove RunPager
it's no longer needed now that withPager exists. also fix a
logger-never-resumed bug that never showed up in the world.

Change-Id: I7311a50896f5291364320ec4c88506dc3bb11d4c
2026-01-18 19:17:14 +00:00
eldritch horrors a7bc1be03f commands: RunPager RAII -> withPager wrapper
RunPager is weird and confusing in that it replaces what stdout *is*
depending on environmental conditions. this has not caused problems,
but it's easy to imagine situations in which it would (eg if the stl
decided to capture the stdout fd by duplicating it). using a wrapper
for this also makes clear *what* actually goes into the pager; while
the previous contract was semi-reasonable it was also very implicit,
and with the proliferation of functions we had that printed directly
to stdout it would have been easy to send wrong output to the pager.

using a wrapper also makes process management much easier because we
do not have to rely on destructors to always produce correct output.

Change-Id: Ifd3760940af1ec719fe856158c913cbb9a5bf270
2026-01-18 19:17:11 +00:00
eldritch horrors 46b86ffa49 nix-store, nix-env: reformat some bits
this will make the next commit a lot more readable.

Change-Id: I74ffad9b9f635c35d51861982558a5e020ab4687
2026-01-18 19:17:09 +00:00
eldritch horrors efd8e7cb8d nix-env: don't print to stdout from printTable
return a string instead, and write that to stdout explicitly.

Change-Id: I4a8da8ad860994f4ec05997fb226041e4da302ea
2026-01-18 19:17:06 +00:00
eldritch horrors 3194e3b6f4 nix-store: don't print to stdout from printTree
print into a provided stream instead.

Change-Id: I52495154163e40d05b6897aa129eb9b3d81348dc
2026-01-18 19:17:04 +00:00
eldritch horrors 98cb3014e8 legacycmd: don't print to stdout from printDotGraph
return a string instead, and write that to stdout explicitly.

Change-Id: I21e7a1eb22f2772e31b754823f64f941be080c56
2026-01-18 19:16:45 +00:00
eldritch horrors 49c698cf7f legacycmd: don't print to stdout from printGraphML
return a string instead, and write that to stdout explicitly.

Change-Id: Ia2d2019064da16fd35630217c445b4bcc4cdf2c2
2026-01-18 19:16:39 +00:00
eldritch horrors 7be922b3c8 libutil: remove unused blockInt
this has been unused since ab3ce1cc13,
which is now almost ten years ago. surely it was just forgotten then

Change-Id: Ib93b52d4ce5f19629432c5f91ff426582c57f99b
2026-01-18 19:16:33 +00:00
eldritch horrors 8b114520a2 libstore: make Pool::get fully cancel-safe
cancelling a get() promise could leave the pool with allegedly in use
resource handles that do not actually exist. this would cause asserts
in ~Pool to fire (and crash the entire program due to bad accounting)

probably fixes #1041

Change-Id: Ic61ab9b658f02f71e8be7577b8a1115600846f86
2026-01-18 17:22:41 +00:00
eldritch horrors 48d5e9f07d meson: remove prelinking
the issues it was solving are fixed now :)

Change-Id: I4f38d3ada22f454b57ea8245eadede0500e29451
2026-01-18 15:04:22 +00:00
eldritch horrors cef9572c24 meson: use combined library as dependency for executables
Change-Id: I1b6be3edff83c24d1c3ba3f7b4bfeb0e240039bb
2026-01-16 16:52:03 +00:00
eldritch horrors dbdc3ee28c meson: unify pkgconfig files
merge all pkgconfig-found libraries into a single one and redirect all
existing lib files to the merged variant. the clean separation between
libraries is largely fictional anyway because the main config block is
in libstore and cannot reasonably be moved out, or because libutil has
assumptions built into its behavior that libmain later establishes, or
because libexpr messes with global boehmgc configuration. nearly every
kind of layering violation imaginable can be found *some*where in lix,
and not pretending that this is not the case will let us clean up some
of them. this will also allow us to merge these libraries at the meson
level which is itself necessary to make rust code easier to integrate.

Change-Id: I172f8a08d5d90ded0a0a99fd9e0fa5d804db00a7
2026-01-15 21:50:40 +00:00
eldritch horrors 60dec3eeed meson: don't install repl-overlays.nix header
it's only included in a single .cc file.

Change-Id: If8ed9b1043e40ac070776470a5b49a44d181b793
2026-01-15 14:09:17 +00:00
eldritch horrors 9183c5b182 meson: move cpp_args up one level
these defines may apply to any part of lix, not just libstore.

Change-Id: Ic75098a7aab01b101f22d9c7d94ad9c5db45ab88
2026-01-15 13:55:18 +00:00
eldritch horrors 63b0a01d75 *: remove GlobalConfig static initializers
Change-Id: I23f8d24eb586fb4756e60a8bd5b76966a9febd31
2026-01-14 22:43:29 +00:00
eldritch horrors 8285288540 libexpr: fix app chain extension
during the value rewrite we accidentally broke extension of incomplete
primop application. this only shows up when binding on incomplete call
to a primop to a name, binding an incomplete call to *that* to another
name, and then finally calling the second binding with enough args for
a complete primop application. since this only shows up when calling a
primop with three or more args it took a while to surface. we have few
builtins that match this: foldl', replaceStrings, and substring. these
are not used incompletely in this manner very often, so this lingered.

fixes #1102

Change-Id: I218dffc14ae876efc86a86c7eb6c895e2405201c
2026-01-14 22:05:16 +00:00
eldritch horrors 6cc2ef7c6d libexpr: remove RegisterPrimOp static initializer helper
Change-Id: I0cc6d54fca26c66b13f930303086b08b2afb4d54
2026-01-14 16:22:08 +00:00
eldritch horrors 14de5fa627 *: fix non-local-dir includes
these ended up referring to different directories and would break during
source reorganization (or even just including them in different places).

Change-Id: I91e8db04e3d3565efd5920982ed5bc59d2c27058
2026-01-14 16:22:08 +00:00
eldritch horrors e0d6271fc1 libstore: fix incorrect docs for plugin-files
RegisterCommand was renamed in b30556f8f1
and de-static-ified in 4d9fe67430. adding
new settings was never possible with static instances since settings do
need an existing Config instance during construction; GlobalConfig must
be used to add settings. it is not possible to change existing configs.

Change-Id: I26af8abc375ba5883fce060ffefc710d6dfbca4c
2026-01-14 16:22:08 +00:00
eldritch horrors 56d6ac3114 *: wrap nlohmann exceptions at the source
nlohmann has customization points for exception throws. we can use these
instead and wrap json exceptions at the source instead of playing a game
of whack-a-mole with json errors all over the tree. since nlohmann needs
macros set to achieve this we can no longer precompile its headers *and*
must forbid including it anywhere without the proper defines or ordering
of include directives will break lix with ODR violations, if we see them
at all before we get another json-related bug report. a new lint will be
in charge of ensuring this doesn't happen. we also re-allow direct calls
to nlohmann json parsing since error handling is no longer a problem. we
will keep the wrapper for more convenient error context handling though.

fixes #1092

Change-Id: I54ecc14f5bec5e2177729b41c3703216e76cc6a3
2026-01-04 16:25:06 +00:00
eldritch horrors 7dff4efc4a testing: migrate build-remote-trustless-*
Change-Id: I3edc3fe5babc93833bfe1e7c4bdeb02dc6ac17cd
2026-01-02 15:37:09 +01:00
eldritch horrors cc5c62ad72 testing: migrate daemon-trust test
Change-Id: I65fcdbe8f9d2f5ca4654341ed4a8878ef67b841a
2026-01-02 15:37:09 +01:00
eldritch horrors 7cf17f56f4 tests/f2: add marker for tests requiring a full sandbox
Change-Id: Ia96651273510867524814c0ce10b08aa8d655181
2026-01-02 15:37:09 +01:00
eldritch horrors 8984fddeae tests/f2: add a daemon context manager to Nix
Change-Id: I9047ac8b2ab3d0ea03b245e86aab71ad0aa888a1
2026-01-02 15:37:09 +01:00
eldritch horrors f580444348 tests/f2: add async command execution
running commands in the background like this lets us test daemons.

Change-Id: I8bf687d62f084344e59f7f5a94aedde069f7f66a
2026-01-02 15:20:39 +01:00
eldritch horrors 02a9c784d5 tests/f2: make all nix.conf setting settable
Change-Id: I5a2401c961b4328b681f6f8efb708017c756dab0
2026-01-02 13:01:14 +00:00
eldritch horrors a7bd1a8a80 tests/f2: allow string lists as config values
not all values are sets. the search path for example is definitely ordered.

Change-Id: Ice94fe324319731ae3a83c757768c48576ba8b36
2026-01-02 13:01:14 +00:00
eldritch horrors 25d8495451 packaging: fix a bunch of old-nixos leftovers
remove compatibility junk we no longer need from our packaging.

Change-Id: I4642cb354ba6c4a4b64e4730c98c2c68b03040f7
2026-01-01 18:50:19 +00:00