Commit Graph
2332 Commits
Author SHA1 Message Date
eldritch horrors fca0a30470 libstore: remove pre-2.18 protocols
the old protocols are largely untested, mostly unused, and have design
problems that make the RPC transition a lot harder, if not impossible.
in theory we could ship a transparent protocol-converting proxy that'd
isolate the daemon itself from old protocol versions, but that's a lot
of code to maintain for presumably little gain or even no gain at all.

Change-Id: I4c3f3bb34d39044f6aeb07c10caaf13b8340a220
2025-06-02 22:43:24 +00:00
Linus Heckemann e753fcb414 gc: delay throwing error until cleanup is complete
Previously, paths not being deleted by gcDeleteSpecific would result in
(a) hardlinks not being cleaned up, and
(b) statistics not being reported correctly.

By throwing the error later, we fix both of these problems.

Change-Id: I8019f3e10d9f22e81ea87bb26b77f04ebc888a19
2025-06-02 20:05:32 +02:00
Victor Fuentes ab1e58e948 feat(nix store ls): support reading nar listings from binary cache
Remote binary caches support `write-nar-listing` options where they create a `HASH.ls` file for quick indexing without having to download the nar.
This commit makes experimental `nix store ls` attempt to read these files instead of downloading the full nar.

The difference is very obvious with large packages like stellarium:

nix store ls --store "https://cache.nixos.org" /nix/store/ijpvwgs9zamqaax5dy2cd0kxgz7lr7an-stellarium-25.1 -R

Change-Id: I6a37e0788b3a91c319331a8de69c51daf3efa955
2025-06-01 22:47:11 -07:00
0c2ced0224 feat(nix-instantiate): add --raw flag
The experimental `nix eval` command already supports a `--raw` flag.
This commit implements the same flag for the stable nix-instantiate command.

Until now instructions and scripts that didn't want to rely on experimental
features had to use workarounds such as:

    nix-instantiate --eval <something> | tr -d \"

(which also undesirably also removes double quotation marks within the string), or

    nix-instantiate --eval <something> | jq -j

(which undesirably depends on another package).

Co-authored-by: Raito Bezarius <raito@lix.systems>
Co-authored-by: Silvan Mosberger <silvan.mosberger@tweag.io>
Change-Id: Iced9a80ee7edd60af2385c5193485f1774175339
2025-05-29 15:25:12 +02:00
Raito BezariusandLix Systems Gerrit 316aa591ac Merge "libexpr: coerce integers under the XP feature coerce-integers" into main 2025-05-28 19:39:59 +00:00
Raito Bezarius 1e40171ea4 libexpr: coerce integers under the XP feature coerce-integers
This introduces a new (demanded?) feature for coercing integers in
interpolation arguments under the experimental feature
`coerce-integers`.

This feature is being introduced behind an *experimental feature flag*
due to the cautious approach we're taking. The codebase has a track
record of revealing unexpected behaviors, often in subtle ways, so we
want to give this sufficient time and exposure before making it stable.

To remove the experimental flag, we want to see **at least two releases
or six months of real-world usage -- whichever is longer** -- that
demonstrate strong confidence the feature doesn't introduce regressions
or unintended side effects. If that level of confidence is reached,
we'll proceed to stabilize it.

Change-Id: I825904719eeba8f0e2a93cd6b93cfe6cebd7d827
Signed-off-by: Raito Bezarius <raito@lix.systems>
2025-05-27 11:42:53 +02:00
71rdandLix Systems Gerrit fb084e30c5 Merge "docs: add missing setup step for building in shell" into main 2025-05-26 18:15:50 +00:00
Linus HeckemannandLix Systems Gerrit 6c773375c2 Merge "doc: explain runtime and indirect roots, merge roots section into GC section" into main 2025-05-26 15:34:25 +00:00
git@71rd.net aa8e07d8b6 docs: add missing setup step for building in shell
Change-Id: Ia02e4c994b13defbefb46b0cf21e1254d13166d9
2025-05-25 20:49:24 +00:00
eldritch horrors 03da670021 libutil: remove ca-derivations experimental features
also remove all the documentation referencing it, or rewrite the docs
to make sense in the non-floating-content-addressed world we live in.

Change-Id: I724e67839f44cc9f1cfc7d6f1c05252b62752b42
2025-05-20 17:43:46 +00:00
Linus Heckemann 498e828efe doc: explain runtime and indirect roots, merge roots section into GC section
Change-Id: Ib2547c04c938af8fc7346f49616085f514c81749
2025-05-20 12:52:51 +02:00
Raito BezariusandLix Systems Gerrit cfaeed469b Merge "libstore/ssh: remove echo started check" into main 2025-05-18 19:51:20 +00:00
Raito Bezarius 0dd8bf6c1c libstore/ssh: remove echo started check
The pre-flight `echo started` check over SSH was originally added in
577ebeaefb. As it is usual with these old
commits, understanding why is there a need for something is difficult.

The closest thing would be
> Fix a race starting the SSH master. We now wait synchronously for
> the SSH master to finish starting. This prevents the SSH clients
> from starting their own connections.

But, we removed SSH connection sharing, so this does not apply anymore.

Nonetheless, we believed this check was meant as a way to catch obvious
misconfigurations or SSH failures early, before handing off to
`nix-store`. However, this approach was not fruitful: it assumes the
remote has a `bash`-compatible shell, `echo` behaves in a standard way,
and no `ForceCommand` interferes—all of which are unreliable assumptions
in practice.

While the intent was to provide slightly better diagnostics (e.g. in
case of SSH hanging or returning an interactive shell), in practice it
does not meaningfully catch or improve real failure cases. The
underlying protocol or engine can and should handle those errors more
robustly anyway.

In contrast, this check *does* break several legitimate workflows,
including:

* remote builders using `ForceCommand` wrappers (e.g.
`nix-remote-build`-style setups), see
<https://discourse.nixos.org/t/wrapper-to-restrict-builder-access-through-ssh-worth-upstreaming/25834/15>,

* SSHing into minimal environments lacking `bash` (e.g. initrd,
busybox-based systems),

* configurations that don’t default to POSIX-like shells, e.g., nushell
enthusiasts.

As such, we’re removing this code. Protocol mismatch errors and SSH
failures can be rethought and handled more structurally elsewhere in the
engine.

Change-Id: I187f6881375d42ef83987a13a350c97964bbdb30
Signed-off-by: Raito Bezarius <raito@lix.systems>
2025-05-18 18:45:26 +02:00
Linus HeckemannandLix Systems Gerrit a7634f87aa Merge "libstore/local-derivation-goal: better debuggability for FOD mismatches" into main 2025-05-16 15:18:11 +00:00
Lily BallardandLix Systems Gerrit 6237c50161 Merge "libutil: handle OSC escapes in filterANSIEscapes()" into main 2025-05-14 02:02:08 +00:00
Lily Ballard 207b5d81bf libutil: handle OSC escapes in filterANSIEscapes()
This teaches `filterANSIEscapes()` how to find the end of an OSC
sequence. It also keeps OSC 8 (hyperlinks) when not instructed to filter
out all escapes, just as it keeps colors.

This also relaxes the parsing of CSI escapes to find the end of the
sequence for invalid sequences, and handles better escapes that don't
start CSI or OSC.

This fixes the repl output for `:doc builtins.fetchGit`.

Fixes: https://git.lix.systems/lix-project/lix/issues/160
Change-Id: Id0000000f2a6956c042c883a4545edf347fa1799
2025-05-13 18:59:08 -07:00
eldritch horrors a490e2d946 libstore: remove ability to read or write dyn-drvs
as with impure derivations it is still possible to garbage-collect
existing xp-dyn-drv derivations. we once again don't introduce any
new kinds of errors, we only change the dynamic type of exceptions
from MissingExperimentalFeature to UnimplementedError (although we
do throw FormatError when reading xp-dyn-drv derivations now, that
seems to make a little more sense than "feature not implemented").

Change-Id: Ic26e5b6c9c9e2533093e27f6cf901dc9db57c83e
2025-05-12 13:37:54 +02:00
eldritch horrors 540071dd77 cli: disallow dynamic derivations
with impure derivations gone we move on to dynamic derivations. this too
is not done in a single commit because dynamic derivations are invasive,
modifying semantics of all references to derivation output paths and all
derivation dependency calculations. removing dynamic derivations cleanly
is made significantly harder by the multiple did-you-mean-sum types, aka
"wrappers for std::variant", holding all derivation outpath information.

Change-Id: Ice7a7700c7b54c6a6061d4beb322b4175923d27a
2025-05-12 13:37:54 +02:00
Linus Heckemann d19593d00b libstore/local-derivation-goal: better debuggability for FOD mismatches
The expected and the obtained path are now printed as part of the
error message, making comparing them easier when they're both at hand.

The extra rethrow for the hash-mismatch exception in the bmCheck case
has been removed, allowing the path to be registered as in the
non-check case. This makes having both paths at hand a lot more likely!

The determinism check logic was incorrect for content-addressed paths,
since it only ever tried to compare the path produced, even if this
was not the path expected (in the case of fixed-output derivations) or
the path previously produced (in the case of non-fixed CA
derivations). This made little sense, because that would always be the
same path if it exists! The determinism check is therefore now
bypassed for CA paths. Having a correct determinism check for
non-fixed CA derivations and running the diff hook for fixed-output
derivations would be nice, but feels out of scope and bypassing the
inapplicable logic isn't a regression from the previous behaviour.

Change-Id: I5fc14fb477c8c7d2f5bdedad5591af916f72b128
2025-05-11 21:22:52 +02:00
eldritch horrors 6599be1a9f cli: disallow impure derivations
we don't remove the entire feature in one go to make review easier.
impure derivations are rather unintrusive on their own, at least if
we compare them to dynamic or ca derivations in general, so we will
be done with this soon. as it stands impure derivations cannot work
without ca derivations, and those we *really* want to leave behind.

Change-Id: I4f01d8d758b2c85dcd6c3078304b5ee1b52f65b0
2025-05-11 17:26:55 +02:00
eldritch horrors d8e2f53d07 deprecate CA, dynamic, and impure derivations
ca derivations are what we're really after, but dynamic derivations
must also go because they depend on ca derivations. we can't easily
implement dynamic derivations any other way, so we remove them too.
impure derivations build on the content-addressed infrastructure in
ways we cannot easily detangle, so they too must go for time being.

see #815

Change-Id: If61371736dfd89cc71a1b2ae5a005757c3cb9484
2025-05-10 17:15:26 +00:00
Rebecca Turner bb0cdf110e release: release notes for 2.93.0
Release created with releng/create_release.xsh

Change-Id: I5a793e632dae1b6fdd4f743c383aca937b048dfc
2025-05-09 14:47:55 -07:00
Tom HubrechtandLix Systems Gerrit 885dde9c3d Merge "libstore: Show illegal path references in fixed-outputs derivations" into main 2025-05-08 20:19:15 +00:00
a8da0df671 libstore: Show illegal path references in fixed-outputs derivations
This allows debugging the errors by pinpointing the offenders, instead
of trying to blindly guess what could have possibly gone wrong.

The wording has been improved to better explain the failure.

Closes #530

Co-authored-by: Ben Millwood <thebenmachine+git@gmail.com>
Change-Id: I84ba5d2d81e5d1867f53bd3bc80e615cab9fe274
2025-05-08 20:23:12 +02:00
Linus Heckemann 08d7ddd6ca release notes: name SSH options that are no longer used
When I read the note, I wasn't sure what was meant by connection
sharing. This adds a reference to SSH documentation for clarity.

Change-Id: I1d6e5c53fb6a6fac8380210967f56d86f0333e55
2025-05-07 10:53:12 +02:00
vringar dbdf7c76e6 fix(rl-2.92): fix fmt shim script
Change-Id: I38aed40b3f6916fa7a6991ee0bb056be98d98497
2025-05-05 14:10:57 +00:00
helleandLix Systems Gerrit 4e84fd9a00 Merge "Fix various links to anchors in documentation." into main 2025-05-02 11:45:29 +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
jadeandLix Systems Gerrit fde4121334 Merge "manual: link directly to gerrit for proposing changes" into main 2025-04-30 04:59:41 +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
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
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
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
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
jadeandLix Systems Gerrit 9c2dba4ee2 Merge "Revert "libstore: don't use curl decompression support"" into main 2025-04-09 16:01:37 +00:00
eldritch horrorsandLix Systems Gerrit 350bf7e42d Revert "libstore: don't use curl decompression support"
This reverts commit bba678e5c5.

Reason for revert: didn't fix the bug and created new ones (fj#794)

Change-Id: I0450205d3041b6c876737151a4051081c1366f1d
2025-04-09 11:28:50 +00:00
Jade Lovelace cbaf1bb446 manual: link directly to gerrit for proposing changes
This is, well, interesting. It's the same "edit" button you see on
Gitiles, and upon clicking it, without confirmation, it makes a new CL
and dumps you directly into the editor for the file in question.

I guess if you click it by accident you can just abandon or delete the
CL so it's like, fine. A bit of fascinating UX design here.

Change-Id: I765a1f1fc6d94b171878dde7b01fc621adc00180
2025-04-01 20:28:06 -07:00
Maximilian BoschandLix Systems Gerrit d169c092fc Merge "fetchers: don't consider a path locked if a rev is specified" into main 2025-03-29 18:51:45 +00:00
eldritch horrors 0d47773d76 treewide: handle JSON parse errors
or more accurately, wrap them in a nix::Error subclass so we can display
them properly without crashing, and add some error context if available.

fixes #642
fixes #753
fixes #759
fixes #769

Change-Id: I1aad0c0501fea83f9de3a1335eaa6adc20721616
2025-03-27 08:56:14 +00:00
jadeandLix Systems Gerrit f270d3ebe0 Merge changes Ib81a5db1,Ib6d68594,Id91e1fd4 into main
* changes:
  docs: document the cursed file syntax for new CLI
  docs: document the cursed file syntax for old cli
  doc preprocessor: support indent directives
2025-03-26 16:05:26 +00:00
Stanislav AlekseevandLix Systems Gerrit 21dac7513c Merge "Revert "fix: allow access to ca-certs in FODs on darwin"" into main 2025-03-26 13:00:59 +00:00
Stanislav AlekseevandLix Systems Gerrit 5a4da16094 Revert "fix: allow access to ca-certs in FODs on darwin"
This reverts commit 692de16113.

Reason for revert: it's wrong at it doesn't actually work

Change-Id: I495eed65bb7547ceffe98f979633c080e83ac154
2025-03-26 10:27:58 +00:00
QyriadandJade Lovelace 11225f435d docs: document the cursed file syntax for old cli
This documents the fact that nix-build, nix-env, nix-instantiate, and
nix-shell accept an extended syntax for their file arguments, including
some well-known (but not well documented) aspects, like being able to
specify `<nixpkgs>`, but also https:// tarball URLs, `flake:` prefixed
flakerefs, and the cursed `channel:` prefixed hardcoded URLs

Same thing for the new CLI incoming :)

Change-Id: Ib6d68594a16132805ba5d97526e16f7b3633117e
2025-03-25 17:06:53 -07:00
Jade Lovelace 989498407b doc preprocessor: support indent directives
Janky Python makes the world go around. In repentance I removed some
jank from it.

Change-Id: Id91e1fd40cb73049cb64deab6f81a7193132fa82
2025-03-25 17:06:53 -07:00
eldritch horrors c3929c78f3 libutil: disallow enum serialization by default
allow opting in to serialization as integers via a trait type instead,
and add string-list serializers for the feature flag set enumerations.

fixes #738

Change-Id: I2746eb5ef1f15c01b4e681f9ba1615b6c6e64f44
2025-03-25 10:44:52 +01:00
jadeandLix Systems Gerrit 4181796ed2 Merge changes I0f5d9912,I442f16c7 into main
* changes:
  observability: add the first USDT probe
  tree-wide: put in more keep-sorted
2025-03-24 16:37:28 +00:00
Stanislav AlekseevandLix Systems Gerrit f0fd789f68 Merge "fix: allow access to ca-certs in FODs on darwin" into main 2025-03-24 07:32:12 +00:00
WeetHetandJade Lovelace 692de16113 fix: allow access to ca-certs in FODs on darwin
Change-Id: Id955be88eb5d419d57262d5983841a1e6accee9f
2025-03-23 19:13:44 -07:00