Commit Graph
18779 Commits
Author SHA1 Message Date
Commentator2.0 042a147aff f2/lang: rename the test functions to be selectable using their expected names
one would expect the lang tests to be selectable (using `-k`) using
`eval_okay` `eval_fail` etc though this was not the case so far.

This commit renames the functions to reflect the expected names

Change-Id: I4cd340c093d774feeb4d96820d28e49c665b159f
2026-01-15 15:30:34 +01: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
Raito Bezarius 40b5f53755 package: pass our own lix to perl-bindings
I don't know how this was missed or no one really complained about it,
but perl-bindings was using CppNix if nix was not overlaid to our own
Lix.

If you overlay Lix manually, the resulting Lix's perl-bindings cannot
really refer to Lix itself, therefore, it's CppNix.

Change-Id: Ie5ce95564cb7fb5444acbea6124619c5121e1576
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-15 11:54:20 +00:00
Commentator2.0 455724d9dc tests/functional2: rename binary cache directory for easier debugging which (cache) cache is being used
Change-Id: Id5a446422a8e1535ada723115bb2d8a10b0f2b8a
2026-01-15 11:37:02 +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
K900 543bc5cf6b package: more specific warning conditions
Avoids warning spam if overridden with nixos-unstable as an input.

Change-Id: I7cc4da757371c582366bc13adcbce742e312b5c7
2026-01-14 18:09:13 +03:00
Alois Wohlschlager 58ffd67704 packaging: adjust pkg-config files after the rust-monocrate changes
Since lix-doc is no longer a separate library, the pkg-config files were broken
for static builds. Adjust them to refer to the new monocrate library instead.

Actually, since the monocrate library is static in all cases it needs to be
linked explicitly even when everything else is linked dynamically. I assume
this only doesn't break the dynamic nix-eval-jobs because it doesn't actually
use anything from it.

Change-Id: Icf29938688f4fa87425ff346a3105ef56a6a6964
2026-01-13 14:22:01 +00:00
Tom Hubrecht f431464382 libutil/hash: Simplify some parts
Use a span representing the underlying hash, this allows comparing based
on those spans. Other minor tweaks to the header file.

Change-Id: Ie05960439e60500109083c06d347d6cdf41bfda8
2026-01-12 15:56:05 +01:00
Raito Bezarius 45783a0435 lix/nix-shell: partial revert shebang mitigations for macOS
I54d04a770b8e78484815db88a8bc88776a6a6964 introduced shebangs in many
places to satisfy macOS needs.

Unfortunately, our rc shell logic is non-trivial and is exploited by
external piece of code such as
https://github.com/chisui/zsh-nix-shell/blob/master/nix-shell.plugin.zsh#L78
to keep shells intact while nix-shell-ing.

We go for a partial revert because there's no obvious fix on the short
term. This reintroduces macOS random bugs during builds until we figure
out a proper fix.

Related discussion:
https://zulip.lix.systems/#narrow/channel/7-Infra/topic/.60macos-builder02.60.20DISABLED/near/4538

Change-Id: I8245f89c10302c2b13da691e441b1c4d5c797e9a
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-11 12:50:47 +00:00
Tom Hubrecht e29263b638 libutil/hash: Add default values for Hash::to_string
The sane default is to print in SRI format, and include the hash type

Change-Id: I7efcb5dcfbe56c82dbf1928e2bb35cdd3ff089c6
2026-01-10 18:26:15 +00:00
Tom Hubrecht 16d884bd1f fix(log-format): Apply the required setting with the nix2 cli
Fixes #1099

Change-Id: I658743aae7ec7a7f295c849079166a5940d93e82
2026-01-10 18:12:01 +00:00
Raito Bezarius e9cccd47e2 libstore/build: report better error messages for --check
When --check is ran with no output, this is seen as having *SOME*
invalid outputs, actually, ALL of them are invalid here.

Instead of reporting a confusing error, let's consider ALL of outputs
being invalid to be no output at all available and advise the user to
rerun the build without --check.

If there's *some* (>0) invalid outputs, let's print them exactly to give
a chance to the user to remediate this.

Fixes #485.

Change-Id: I00955ef9ea4f129e2c98d68c73b1e981f90278a0
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-10 12:42:50 +01:00
Commentator2.0 8f9ed687da code-generation: run ruff
Change-Id: I591247ed56f89feba5daf3cbb94211d72a3ba99c
2026-01-10 00:07:33 +00:00
Qyriad 0d3fdbdb54 Exorcise MORE Darwin test demons because functional1 is /awful/
Yeah uh, I don't think `$shell` is ever set in the functional1
environment. Pretty sure this has been expanding to `''` THIS WHOLE
TIME.

Also `SHELL` is `/sbin/nologin` in that builder. idk why so I'm just
passing `shell` unconditionally in functional's `mkDerivation` helper.

Maybe next we should put `set -euo pipefail` into all these test
builders?

Change-Id: Ie5fb85305932c03a901ba84ffcce48f16a6a6964
2026-01-09 18:13:29 +01:00
Qyriad 68a72d2bdf Finally exorcise Darwin Demons causing flakey functional tests
macos-builder02 in particular has been having problems for a while now
that no one could reproduce. We believe we have finally found the cause:
missing shebangs, not just in the tests themselves but *also* in the
inline scripts `nix-shell` itself writes.

Fixes #1042.
I believe this will also fix #1093.

See also: https://github.com/NixOS/nix/pull/14778

Change-Id: I54d04a770b8e78484815db88a8bc88776a6a6964
2026-01-09 12:28:19 +01:00
Qyriad 0800b1588e add release notes for the repl load fixes
Change-Id: I09bc11de2779b6a5f0372a70ba3abb716a6a6964
2026-01-08 18:35:13 +01:00
Raito BezariusandQyriad 6cbbe19b5c libcmd/repl: :load failure clean up loaded files
When `:load`-ing a file that doesn't result in a successful outcome, the
"loaded" file is removed again from the list of loaded files.

This avoids having it be used as part of `:reload` which will probably
not result in a positive outcome.

Instead, the user is expected to retry `:load` before issuing a
`:reload`.

Fixes #50.

Change-Id: I85d025cf39f79e8e02117628bffa20c81917dc3f
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-08 18:35:13 +01:00
Raito BezariusandQyriad f4be01b4be libcmd/repl: do not clear the environment on empty reloads
If `:reload` is used with no file loaded, the environment is completely
cleared.

That's a surprising behavior and one of the root cause behind #50.

Environment clear is only performed if there's files to reload.

Change-Id: Icb014f490a83aaa4d758dbf37822db16d5bb65c1
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-08 18:35:13 +01:00
Raito BezariusandQyriad 0f1208c406 libcmd/repl: reload flake references
Change-Id: I87beaf92c7fa4238452d0c82051b42f0e3ca19a5
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-08 18:35:13 +01:00
Qyriad 7be72ca667 libcmd/repl: refactor to preserve order across :l/:lf
Change-Id: I109bdd21a69aa5e6d7a8cc86350662cd6a6a6964
2026-01-08 18:19:04 +01:00
Qyriad 851c4e372e add log-format setting to release notes (oops)
This was mistakenly left out of b97b2e858bab¹. oopsie, soz

[1]: b97b2e858b

Change-Id: I1b7210143d66480b6a8a044f0db5f0cd6a6a6964
2026-01-08 11:21:48 +01:00
Tom Hubrecht 1bd381654c libutil/hash: Drop printHash16or32 function
Its only use is in nix prefetch, inline it there instead

Change-Id: Ibb60df41a205cde2a4f383e8cff05dc6d4c032b8
2026-01-07 16:04:52 +00:00
Raito BezariusandQyriad 43434d675e libcmd/repl: track loaded flake references
Only successful loads counts towards the list of loaded flake
references.

Change-Id: I04128f90e57ef8352183d72dc6def7a09d52173a
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-07 16:28:30 +01:00
Qyriad 1ae5610a4e libutil: cleanup abstract-config.{cc,hh} a little
Change-Id: I472682ece81718c63cb7c9053b6249836a6a6964
2026-01-06 16:35:49 +01:00
Qyriad ed16987d47 libutil: extract out AbstractConfig
libutil config.{hh,cc} and libstore/globals.{hh,cc} contain so many
interrelated things. Hopefully we can separate them out a little bit for
clarity.


Change-Id: Ib78fc46fe305d13aada8886e2e168d446a6a6964
2026-01-06 16:35:49 +01:00
Qyriad 03780ad850 remove unused includes in libstore/globals.hh
Change-Id: I14e31b32458b5caa20cbfa9b116c08316a6a6964
2026-01-06 16:35:49 +01:00
Qyriad b97b2e858b feat: make log-format a setting
Vaguely one half of #186.
Fixes #827.

Change-Id: Ie6a296465beb089bf812ea27091648ca6a6a6964
2026-01-06 16:35:49 +01:00
Qyriad c3b70a8968 CI: -Ddefault_library=both
This makes that the default for all builds... which I'm not sure is the
right option, but it is also very cheap to do so, and adding an entire
other Lix build just for static libraries (not to be confused with
static Lix) would be prohibitively expensive.

Change-Id: Id173c77cfa62886724378ca599d21c8c6a6a6964
2026-01-06 16:35:49 +01:00
Qyriad 03dc13a314 rust support in libutil via rust-monocrate
Co-authored-by: Jade Lovelace <jadel@mercury.com>

Change-Id: I026f271b07c9e27012f9ee1c16a2a1f4ba7f6ba3
2026-01-06 16:35:49 +01:00
Qyriad 357ee01002 build: attempt to normalize Rust handling to support static linking
Co-authored-by: Jade Lovelance <jade@lix.systems>

Change-Id: Icfd3cabaa6abc0a39f501b4b6c6b73df4cb66e6a
2026-01-06 16:35:49 +01:00
Tom Hubrecht b482ebbbc8 treewide: Rename Base to HashFormat
Co-authored-by: Yueh-Shun Li <shamrocklee@posteo.net>

`base` is ambiguous, since it's not about the digital bases, but about
the format of hashes. Base16, Base32 and Base64 are all character maps
for binary encoding.

Documentation of the format is also added.

Cherry-pick of:
https://github.com/NixOS/nix/pull/7708/commits/838c70f62116328ce01cb41a01886e4f1b9a727f
https://github.com/NixOS/nix/pull/7708/commits/5043e6cf4ea537dfe599470797c5b310ab0e94b9

Change-Id: Ief5425f3c2056a4cca75838091e4dfa5cca88872
2026-01-06 11:22:06 +00:00
Raito Bezarius b730fab286 f2/testlib/env: build initial path via build_env
`build_env` is assumed to be a certain trivial environment, e.g. a
singleton search path.

An environment in general is either empty, contain one or more search
paths separated by a colon.

It seems that the intent was to set the `build_shell` first as a
prepended path in the managed environment then extend via the
`build_env` parts.

This fixes a usecase when the `BUILD_TEST_ENV` is non-trivial.

Change-Id: If5b8ab976d867a57ce0b8d29255f64695e30a8b2
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-06 10:13:01 +00:00
piegames 9588b1ad1b libexpr/eval: Split out expression evaluation
In an attempt to slowly split up and clean up `eval.cc`

The `Expr::eval` functions contain the most important logic when needing
to touch something on the evaluator, and having them spread across the
3kloc eval.cc file was really annoying. This should help, though more
cleanups are yet to come

Change-Id: I2c2d15a024ab1ec3fc5591f628d6768341a1c8ab
2026-01-05 23:54:34 +01:00
Tom Hubrecht 7b8947ea63 tests/evalNixpkgs: Split out into its own file and set NIX_CONFIG
This adds a way to control the deprecated features that need to be
enable while evaluating the specific nixpkgs version

Change-Id: Ia2b9a29f1966d4d5f32239a36ba8270330007da9
2026-01-04 23:00:24 +00:00
Tom Hubrecht cfedc951b6 tests/nixpkgsLib: Split out into its own file and set NIX_CONFIG
This avoids rebuilding Lix each time we need to modify the lib tests
(as flake.nix stays unchanged), and adds a way to control the deprecated
features that need to be enable while evaluating the nixpkgs lib
testsuite

Change-Id: I2baa1cf90effcaf9d53337c6a7a5b24d6297178c
2026-01-04 22:52:32 +00:00
Raito Bezarius f683332bb3 f2/testlib/fixtures/nix: support flags on nix.eval
Certain evaluation requires to pass impurity arguments, add `flags`
to add more arguments to the instantiation.

Change-Id: I538ca2ff12c07cc66e845b42f81baa87f11b8f0f
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-04 22:09:39 +00:00
Raito Bezarius f981162bf3 f2/testlib/fixtures/env: test_root cannot be None
`test_root` can never be `None`.

Change-Id: I9ed344b55a733ad92ffa79e6799e44d97285109f
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-04 22:09:33 +00:00
Raito Bezarius 8b5c085aca f2/testlib/fixtures/env: home cannot be None
Is there a situation where `home` can be None? This hinders the ability
to use it quickly without type gating in the test code itself.

Change-Id: Idd739ddad67e10d6f7a6aad283c0e3b7cd08106a
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-04 20:40:18 +00:00
Raito Bezarius 5ae8f62146 lix/libutil/cgroup: remove trailing \n in cgroup.controllers
Otherwise, this result in debug traces with a \n cutting the list of
controllers.

Change-Id: I8aba6379d335c4edab9d9ddb3fb411813d8dc426
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-04 18:23:32 +00:00
Raito Bezarius 63871751ce linux/cgroups: rename cgroups to nix-build@$drvHash-$uid
The prior use of the UID is uninteresting in general for consumers who
wants to learn things about _what_ the build is, not what is the UID of
the build user running it.

Achieving this with a place where a mapping between cgroup names and
build requests are maintained is non trivial because there's no "global"
daemon that keeps track of this information and such a daemon would
require a persistent location to track this.

Rather than solving that, we will just encode the derivation hash inside
the cgroup name. Userspace can simply pull this apart and query Nix to
obtain the original corresponding derivation for more information.

This provides userspace with a way to map cgroup names to pnames for
example. Going further, if you have a map between attribute paths and
derivation hashes, you can power a database of cgroup metrics per
attribute paths by combining all of that.

In addition to this rename, we adopt a systemd-ish convention for
template units (`@`).

As a result, userspace tooling that will scrape cgroup metrics will
discover a consistent path as long as they filter out the UID part,
especially in context of Id6c458aad30eaa08c3609ac8280a7dde8e8f3cf9
change.

This problem is tracked under #1073.

Change-Id: I238d0568a3e4b1ff3057781c0639528d666b4d37
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-04 18:23:32 +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
Commentator2.0 8798cdcd30 tests/functional2: migrate compression-levels.sh
Change-Id: I4a0257f6c0dd7df9b0ec82d0164a3bae7e978c9c
2026-01-04 15:57:36 +01:00
Raito Bezarius e1f5a981ef libcmd/repl: rework command handler
It's 2026 and the command handler was entirely manual!

We introduce a basic command handler framework for the REPL that handles
all the previous (implicit) features reasonably well.

This also builds up the infrastructure for nicer features.

Most important feature is that now we can let external plugins adds
commands to the REPL.

There's slight REPL changes:

- errors for debugger commands are more explicit.
- short-hand have a long-hand version.
- help shows command sorted by std::map natural key sorting (based on aliases)
  while keeping the special syntaxes for the REPL language at the top.
- sections were introduced for Flakes commands.
- :st was merged into one command with an optional argument marker.

Change-Id: Ibd24f994491bf5d45d4b218fd84c0944ae5050fd
Signed-off-by: Raito Bezarius <raito@lix.systems>
2026-01-04 14:12:23 +01:00
piegames ee608784dd libexpr/eval: Refactor force* and eval*, introduce check*
Status quo: We have `force$Type` and `eval$Type`, both which first
produce a value and then do a type check. The type checking logic is not
consistently implemented, with lots of code duplication.
This change does:

- Introduce new `check*` functions which unify the logic (the error
handling unfortunately still needs some duplication for now)
- Make both `force*` and `eval*` use the `check*` function for the
actual type checking
- Inline and dismantle the `eval*` functions for being of little use and
little used. This makes the `ExprOp*::eval` implementations for binary
logic operators more verbose, but IMO that's a good thing: The
implementation now needs to be a lot more explicit about the
short-circuiting semantics, something which was previously hidden behind
the short-circuiting semantics of the C++ language, in a way that could
easily be overlooked and lead to confusion, which is something that
happened to me twice in a year.
- Changes `forceAttrs` and `forceList` to include the context in case
`forceValue` fails (compared to only when the type check fails). This
was done for code consistency, because I could not find any reason why
list and attrs had different semantics here than int, float and bool. So
far the visible change is minimal (see the diff on the err.exp), however
this needs vetting for potential performance regressions.

Change-Id: I33e5c706d46850c9e1126293ee01dab85ba07587
2026-01-03 22:37:20 +01:00
piegames d387c9113c libexpr: Replace StaticSymbols with NixSymbolTable
That struct has been annoying me since I've encountered it. There is no
reason for having to track all these symbols out of band in the state.

Change-Id: I5c2c0d8174af0a51f9b456cc3651d8203a406d09
2026-01-03 13:19:55 +01:00