Commit Graph
17828 Commits
Author SHA1 Message Date
Yureka 5d0213ac55 lix-doc: remove meson pre-1.5 hacks
Change-Id: I9786d59fc849ae93643d6128ebd598d9de8637f6
Signed-off-by: Yureka <yureka@cyberchaos.dev>
2025-05-08 17:40:38 +02:00
vringar dbdf7c76e6 fix(rl-2.92): fix fmt shim script
Change-Id: I38aed40b3f6916fa7a6991ee0bb056be98d98497
2025-05-05 14:10:57 +00:00
Katalin Rebhan ca8d738df4 Add Boost and libarchive to libutil's public dependencies
Fixes missing include compilation errors.

Boost is included from lix/libutil/result.hh,
libarchive is included from lix/libutil/tarfile.hh

Change-Id: Id0000000e01fc695545d7ef83589ab7c41a92b61
2025-05-03 23:16:48 +02:00
Katalin Rebhan 643b9f3c62 Add missing includes
Change-Id: Id0000000da37acce2438e2a2a3937ffafe6fe90a
2025-05-03 23:16:48 +02:00
helleandLix Systems Gerrit 4e84fd9a00 Merge "Fix various links to anchors in documentation." into main 2025-05-02 11:45:29 +00:00
eldritch horrors c88ce60e25 libexpr: remove unnecessary position parameters
all of these are noPos in all call sites.

Change-Id: I2b74942483cd68dab8cc7c30f582a45a69598c4a
2025-05-02 10:57:15 +00:00
eldritch horrors 2059ccaad3 libexpr: remove positions from primops
they're always noPos and have caused quite some confusion.

fixes #781

Change-Id: I15d4210b1aab6ef5d1caabe2e10b45cf98cc4d47
2025-05-02 10:57:15 +00:00
jadeandLix Systems Gerrit 9a489c5e78 Merge "fix: Terminate daemons properly on Ctrl-C on macOS" into main 2025-05-02 00:09:43 +00:00
helleandjade f659a1e638 Fix various links to anchors in documentation.
These are updates to several links in the documentation that are not
currently pointing to existing anchors in the documentation, these were
found using the unfinished version of the mdbook-linkchecker we are
working on.

Fixes include pointing them to the correct anchor, inserting anchors (in
updated html5 style, though debatable) and in the case of the historical
release notes, removing them, fixing #809.

Change-Id: If4ef89dc89506aa131a764312d97a86179ccd6f5
2025-05-01 21:35:52 +00:00
Jade Lovelace 69ba3c92db fix: Terminate daemons properly on Ctrl-C on macOS
This was an absolute nightmare to diagnose. It turns out there's a
kernel bug: poll with events = POLLHUP will receive an event for NOT
POLLHUP internally in the kernel, delete their event subscription, and
then not receive events for any HUP later. lol! lmao!!

We choose to use plain old EVFILT_READ because the watched fd can be
either a socket or a pipe and it's preferable to eat some spurious
wakeups than have separate paths for those. The alternative is using
EVFILT_SOCK, a private API that's existed for years and which netty
uses for its sockets, but that doesn't work on pipes.

Fixes: https://git.lix.systems/lix-project/lix/issues/729
Change-Id: If72b5d7a39f00320a9acccdbe81121cdb1a04c45
2025-05-01 12:22:27 -07:00
eldritch horrors 6bd6a2416b libexpr: turn debug frames into exprs
this way we don't have to even check whether we need a debug frame when
the debugger isn't enabled. not doing this gives us an eval performance
improvement of roughly 7% on nixos system eval and 2% for `nix search`.

Change-Id: I1cdad3de61f865ea54d6e09d63a281688e828768
2025-05-01 14:28:05 +00:00
eldritch horrors dd2c54d9ad libexpr: generate debug info from a new visitor
Change-Id: I757a9e49dee99b27b0f153ca520c71ee3ecd347f
2025-05-01 14:28:05 +00:00
eldritch horrors 8145c2f5fe libexpr: implement bindVars with a visitor
we can now move debug info generation out of bindVars itself.

Change-Id: I54c88e14d030d2a19f16b57099990f2c3b4334aa
2025-05-01 14:28:05 +00:00
eldritch horrors a91efd63aa libexpr: add an expression visitor
we'll use this to implement bindVars better.

Change-Id: I620d9d1972acdeeee6e345c3128813e53d2074c6
2025-05-01 14:28:05 +00:00
eldritch horrors 8b619b134d libexpr: store inherit source exprs in a list, not vec
it's a surprise tool that will help us later!

Change-Id: Ieac785b00b3d14e5937c03fb2c97c918f4646e56
2025-05-01 14:28:05 +00:00
eldritch horrors 558d921dac libexpr: don't dynamic_cast Exprs after parsing is done
we'll want to wrap some exprs for debug purposes, and dynamic casts
cannot look through such wrappers. dedicated casting functions can.

Change-Id: I1fba0ec52d281a1b8de85a62e4948bfae536bcfc
2025-05-01 14:28:05 +00:00
eldritch horrors 2b4ef8dc11 libexpr: deduplicate set and let recursive env calculation
Change-Id: Ia7f066e1c02f99f071d10e00020869fac9a13db7
2025-05-01 14:28:05 +00:00
eldritch horrors 811542bb5f libexpr: remove COMMON_METHODS macro
it just pollutes the namespace.

Change-Id: Ib191f139916a03e5a56a07638cc5da6c80a87043
2025-05-01 14:28:05 +00:00
eldritch horrors 275b95c873 libexpr: make ExprInheritFrom not be an ExprVar
this was only a convenient fiction when it was introduced, but it is no longer.

Change-Id: I72c50e7774c75408c1a40aee7da22059474ba01d
2025-05-01 14:28:05 +00:00
alois31andLix Systems Gerrit a66c91e101 Merge "repl: only send overridden settings to nix subprocesses" into main 2025-04-30 06:22:14 +00:00
jadeandLix Systems Gerrit fde4121334 Merge "manual: link directly to gerrit for proposing changes" into main 2025-04-30 04:59:41 +00:00
Alois Wohlschlager f7c5cf6c62 repl: only send overridden settings to nix subprocesses
The nix-shell and nix-env subprocess spawned by :sh and :i respectively should
use the same settings as the nix repl they were launched from. Previously, this
was accomplished by sending them the entire configuration explicitly, causing
warnings like the following:

   warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled

In addition, if connected to the daemon, all other settings would be forwarded
to the daemon, further causing large quantities of warnings like the following
if the user is not trusted:

   warning: Ignoring the client-specified setting 'allow-symlinked-store', because it is a restricted setting and you are not a trusted user

Similarly to ece99fee23 (for the build hook) and
523965697d (for the post-build-hook), we will now
only send overridden settings to the subprocess. The resulting configuration is
the same, and all warnings are avoided because the client was already smart
enough to not send unchanged defaults to the daemon.

Fixes: https://git.lix.systems/lix-project/lix/issues/811

Change-Id: Icbe923cbe166aa3f462916f2b164285882564abd
2025-04-29 19:30:17 +02:00
eldritch horrors dad17a54f7 libexpr: remove Value::determinePos
it was mostly useless, and now it's entirely unused.

Change-Id: I015c83779a7f860e325796684639f05083a50676
2025-04-27 17:38:57 +00:00
eldritch horrors c068aeaf61 treewide: don't determinePos in autoCallFunction
add a position parameter to the autocaller instead, and pass it much
more accurate position information where we have it easily available

Change-Id: If2f1c3006ca3f2b413492842905d079a8b752542
2025-04-27 17:38:57 +00:00
eldritch horrors db738ddb14 libexpr: don't determinePos in derivationStrictInternal
errors for individual attrs should report the position of the attribute,
not the position of the set they were taken from (which we'll assume was
the intent here). this is already the case for most attributes, only the
the extra-special __structuredAttrs and __ignoreNulls weren't annotated.

this includes not calling atPos(v) on errors builders since the position
of v is always invalid. error messages are unchanged by this part of the
patch (and the caller adds a trace pointing to the derivation name too).

Change-Id: Ia3540f9ce1f2505275e49dd4e4336b2a59d5b336
2025-04-27 17:38:57 +00:00
eldritch horrors abc26ca0d2 libexpr: don't determinePos in ExprBlackHole::eval
`v` is invalid, its position (if it exists at all) will be stale.

Change-Id: I79147c92fe6b2b077a9aa4783231b7aac05ef9d2
2025-04-27 17:38:57 +00:00
eldritch horrors 859c8caae2 libcmd: don't determinePos in repl
replInitFilesFunction is always valid, but pointing to it is misleading
because the source is inaccessible. every replInit is better identified
by its path if it isn't a lambda; determinePos will return noPos anyway

Change-Id: I0b6fcd2f95f121a802c87cb1085d3a0b1c585aeb
2025-04-27 17:38:57 +00:00
eldritch horrors ff776f5091 libexpr: don't determinePos for primop calls
it's pointless, they don't have position information.

Change-Id: I21f49e4d26f9ed7bc3772157882c84447f8e6387
2025-04-27 17:38:57 +00:00
eldritch horrors bdebc3797b cmd/libexpr: don't determinePos in value-to-json
it's not useful. nix-instantiate will always point to the wrong location
because "at the toplevel" is not a position we can point to. all nesting
conversions will point to strange places: the *original* definition of a
lambda value (or partial applications thereof), or nowhere at all (since
only lambda values can have their positions determined in the formatter)

Change-Id: I56bd9e1cf3cae11b4198f148a141ca758e4fe8ac
2025-04-27 17:38:57 +00:00
eldritch horrors eb0280f715 libexpr: add set-to-string error frame
this is much more useful than a frame pointing to the set but claiming
it as a function being called. if the function is actually at fault we
will now point to its attribute, although the position may be slightly
wrong if __toString was defined from set updates or builtin functions.

Change-Id: Ib3eb237a276d94426d9c6fc0e26eea72382d34a2
2025-04-27 11:01:22 +00:00
eldritch horrors 9d761ed5c1 nix: don't determinePos in flake check
by the time enumerateOutputs is called we've already established that
vFlake will evaluate to an attrset (as a locked flake it can't be any
other kind of value). the outputs attribute is likewise already a set
because the nix code that builds it says so. adding positions here is
merely an unnecessary debugging aid for developers working on flakes.

Change-Id: I2a10ddf1400f7650c6e303433f9fee8813f0188d
2025-04-26 22:14:05 +02:00
eldritch horrors 8a1b86631c treewide: don't determinePos for forcing
only attrsets, lambdas, and app nodes can have positions determined, and
none of these three types are incomplete. calling determinePos before we
force a value is thus only a convoluted copy operation for its argument.

Change-Id: I7e647aacca1fc8250f7bb11bb0071a4f7186047f
2025-04-26 22:14:05 +02:00
Raito BezariusandLix Systems Gerrit 9cc0cda16f Merge "libstore/ssh: fix the SSH connectivity check with non-POSIXy shells" into main 2025-04-26 11:06:49 +00:00
K900andeldritch horrors 227e4d349f libstore/ssh: fix the SSH connectivity check with non-POSIXy shells
SSH runs the command provided to it in the user's login shell.
That's a feature and is impossible to bypass (trust me, we tried).

The previous implementation of `echo started; nix-store --stdio`
broke with shells that treat `;` differently, e.g. nushell,
which eats the output of everything but the last command in a chain.

In the more general case, this means that a sufficiently weird shell
can do _anything_ it wants to the command we pass via SSH, so
we're forced to rely on as little functionality as possible.

The subset we're hereby settling on is just "running `bash` runs bash".
We then run bash, in non-interactive mode, which gives us a somewhat
consistent environment do to things in.

This whole thing is extremely cursed, but fixing it _correctly_
requires pretty much entirely rewriting how remote stores work,
and I'm not doing that right now.

Fixes #805.

Change-Id: Icac846e8cd821cbca91860ddaa0f657b4317dbf8
Co-authored-by: eldritch horrors <pennae@lix.systems>
2025-04-26 13:46:16 +03:00
Raito Bezarius 5ca168f6f2 chore: drop experimental feature recursive-nix
This was discussed as part of https://git.lix.systems/lix-project/lix/issues/767
with a one month long comment period.

This commit removes the recursive-nix feature from Lix. It has seen
limited usage and is difficult to stabilize, especially on non-Linux
systems where its behavior is underspecified.

Maintaining this feature complicates core work on the store, as we must
account for the potential presence of the daemon in the sandbox, adding
unnecessary complexity. Additionally, its inclusion in the
platform-independent local store creates risks for non-Linux platforms.

For more details on this removal, refer to the release note entry or the
issue entry.

Change-Id: I9137202f563c0a317f9c5da79cd9fd07d801427a
Signed-off-by: Raito Bezarius <raito@lix.systems>
2025-04-25 17:09:01 +02:00
Tom Hubrecht 834133c1d5 chore(docker.nix): Replace mapAttrsFlatten by mapAttrsToList
The former is deprecated

Change-Id: I9e2a7656e257afe321183b7f6c30deab47ebb61a
2025-04-25 11:13:11 +02:00
Raito BezariusandLix Systems Gerrit a133633ecc Merge "lixexpr: Declutter error traces" into main 2025-04-24 19:07:06 +00:00
2b22dae1ba lixexpr: Declutter error traces
Now that we can correctly point to all expressions, we can remove
redundant intermediate traces to reduce clutter.

Co-authored-by: eldritch horrors <pennae@lix.systems>
Co-authored-by: Raito Bezarius <raito@lix.systems>
Change-Id: I3e9d7c1c7a6599a8e68302448bbb961d051002b7
2025-04-24 20:44:57 +02:00
Raito BezariusandLix Systems Gerrit c36c83c4c6 Merge "dtrace: fix on macOS (except in the package)" into main 2025-04-24 16:33:48 +00:00
eldritch horrors feebecd60b treewide: wrap std::regex_error
otherwise lix may crash when e.g. nix search receives invalid regex.
we now also give better error messages for regex errors during eval.

fixes #803

Change-Id: Icc7c578ff488ba520efac5d898572ccf4486e9a8
2025-04-24 13:48:15 +00:00
Qyriad 7dbdd5bd0c build: set XDG_CONFIG_HOME to /dummy too
This prevents the user's nix.conf from being mistakenly used during docs
generation.

Fixes #802

Change-Id: I23336b49a8aa2ddf92e803e573321383ea2e5e81
2025-04-22 16:45:44 +00:00
Linus HeckemannandLix Systems Gerrit 14055866dc Merge "libexpr/get-drvs: improve error messages on bad outputsToInstall" into main 2025-04-22 15:35:54 +00:00
piegames abb8ad29c0 repl: Always use parser, allow trailing ; in assignments
We now properly shell out to the parser instead of hacking stuff
together with a regex. Stuff we get for free by doing this:

- Optional trailing semicolon
- Declaring nested attribute sets
- String identifiers, and future proofing for eventual grammar
improvements to identifiers
- Dynamic attributes

Change-Id: Ibf1ad815e5e27caf162df05ea5ba5b1b4955d9c9
2025-04-21 20:19:25 +02:00
giliceandLix Systems Gerrit 930ac12346 Merge "libutil: canonPath: error instead of panic on empty path" into main 2025-04-21 15:35:54 +00:00
eldritch horrors 9bb24a5cdb libstore: SSHMaster master -> SSH ssh
we no longer explicitly configure these ssh options, so we now
have *even less* reason to stick to old and awful terminology.

Change-Id: I8f38f5486e6918f69c61ddc2d6882b6bb50554c6
2025-04-21 13:43:44 +00:00
eldritch horrors f92235e1d2 libstore: stop using ssh connection sharing
our implementation is mostly unused, completely untested, and simply
breaks when users configure connection sharing independently. we can
safely delete this "feature" and inherit user configuration instead.

also have the remote build test check that connection sharing works.

fixes #304, fixes #644

Change-Id: Iea44cc0f8e51a1d231ad186a95c7e310bbfeb303
2025-04-21 13:43:44 +00:00
helle 2238f7a8ab Replace existing external command/custom sub command tests with functional2 tests
This removes the bash dependency issue that the previous test had, the
tests are translated roughly 1 to 1 and do not address any of the TOD
list items.

Closes #800, also superceeds I81817b9fe4a5eeb019f7e04b5a60e091bbde26b2

Change-Id: Ie440cd0a602d4ca4a48edcaf517b7358ec572710
2025-04-19 20:09:44 +02:00
Linus Heckemann aeb27b2e25 libexpr/get-drvs: improve error messages on bad outputsToInstall
Change-Id: I6540f4e77c0d98f357f6f3960bfe3ce4d1c3c6fb
2025-04-16 11:20:48 +02:00
gilice 341e6049a7 libutil: canonPath: error instead of panic on empty path
This could previously crash lix:

Before:
$ nix eval -E '{type="derivation"; drvPath="";}'
nix: lix/libutil/file-system.cc:45: Path nix::canonPath(PathView, bool): Assertion `path != ""' failed.
Aborted (core dumped)

After:
$ nix eval -E '{type="derivation"; drvPath="";}'
error:
       … while evaluating the drvPath of a derivation
         at «string»:1:21:
            1| {type="derivation"; drvPath="";}
             |                     ^

       error: path '' is not in the Nix store

Fixes #536

Change-Id: I406dc9e58047be8f263cf2e4bc3ed5da75a46602
2025-04-12 16:31:28 +02:00
jadeandLix Systems Gerrit 81d4769849 Merge "fix: make test/ headers compliant with styleguide" into main 2025-04-10 16:25:52 +00:00