Commit graph

23 commits

Author SHA1 Message Date
Paul Meyer
bfd948c6e2 fix(treewide): remove trailing whitespace
Change-Id: I3116d3f397ba309be2418e188327143c7187b789
Reviewed-on: https://cl.snix.dev/c/snix/+/30235
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
Reviewed-by: Paul Meyer <katexochen0@gmail.com>
Autosubmit: Paul Meyer <katexochen0@gmail.com>
2025-03-22 17:29:59 +00:00
Vova Kryachko
2bedbfdb18 fix(snix/build): Don't enable cgroup namespace in oci build.
While we want it long term, disabing it for now as it causes runc
startup failure when it runs inside nested cgroup namespaces.

Change-Id: I121f1d79c6a02e68e7883e0edeba7f57627c20ed
Reviewed-on: https://cl.snix.dev/c/snix/+/30236
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
2025-03-21 22:25:17 +00:00
Márton Boros
357004b20d fix(cli): use logging infra instead of print(ln), do not mess up progress bars
Fixes #84

Change-Id: I3ae21bb5353d5d9ad592831526a48ae391f9843d
Reviewed-on: https://cl.snix.dev/c/snix/+/30234
Tested-by: besadii
Autosubmit: Márton Boros <martonboros@gmail.com>
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-03-21 17:45:39 +00:00
Ilan Joselevich
fd9c9572e9 chore(snix/castore): edition 2021 -> 2024
Change-Id: I7c5998f720e3c8216a93e7274a78e5352aeffbca
Reviewed-on: https://cl.snix.dev/c/snix/+/30135
Reviewed-by: edef . <edef@edef.eu>
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2025-03-21 17:35:07 +00:00
Domen Kožar
1621ae21e7 chore(glue/tests): pretty print the errors
Previously we'd print out raw error structure, now it's pretty printed:

thread 'tests::eval_okay::code_path_04_src_tests_snix_tests_eval_okay_fetchgit_nix' panicked at glue/src/tests/mod.rs:79:9:
/home/domen/dev/snix/snix/glue/src/tests/snix_tests/eval-okay-fetchgit.nix: evaluation of eval-okay test should succeed, but failed with:
note: while evaluating this as native code (final_deep_force)
  --> /home/domen/dev/snix/snix/glue/src/tests/snix_tests/eval-okay-fetchgit.nix:1:1
   |
1  | / let
2  | | assertTimestamps = result:
3  | |   let
4  | |     requiredAttrs = ["lastModified" "lastModifiedDate"];
...  |
27 | |       #}))
28 | |     ]
   | |_____^
note: while evaluating this as native code (deep_force)
  --> /home/domen/dev/snix/snix/glue/src/tests/snix_tests/eval-okay-fetchgit.nix:11:5
   |
11 |     builtins.removeAttrs result requiredAttrs;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this as native code (force)
  --> /home/domen/dev/snix/snix/glue/src/tests/snix_tests/eval-okay-fetchgit.nix:14:26
   |
14 |         (assertTimestamps (builtins.fetchGit {
   |  __________________________^
15 | |         url = "https://git.snix.dev/snix/snix.git";
16 | |         ref = "canon";
17 | |         rev = "75d788b0f2";
18 | |       }))
   | |_______^
error[E997]: error from producer: clone fetch error: An IO error occurred when talking to the server
  --> /home/domen/dev/snix/snix/glue/src/tests/snix_tests/eval-okay-fetchgit.nix:14:26
   |
14 |         (assertTimestamps (builtins.fetchGit {
   |  __________________________^
15 | |         url = "https://git.snix.dev/snix/snix.git";
16 | |         ref = "canon";
17 | |         rev = "75d788b0f2";
18 | |       }))
   | |_______^

Change-Id: I451714d682e42bf5ef8df3e80299807ca37683b7
Reviewed-on: https://cl.snix.dev/c/snix/+/30184
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
2025-03-21 17:34:54 +00:00
Florian Klink
7ba2cd9f52 fix(snix/eval/value): drop into_bstring
We have a `impl From<NixString> for BString` already.

Change-Id: I278b62ac06ffaf47b2b0ecf394f0bc67213b5c40
Reviewed-on: https://cl.snix.dev/c/snix/+/30226
Autosubmit: Florian Klink <flokli@flokli.de>
Tested-by: besadii
Reviewed-by: Ryan Lahfa <masterancpp@gmail.com>
2025-03-21 13:46:35 +00:00
Paul Meyer
df802d93df fix(treewide): add missing final newlines
Change-Id: Ib20d37803d56a2d1b7b6ddfc0d5a80b65eff29ed
Reviewed-on: https://cl.snix.dev/c/snix/+/30232
Autosubmit: Paul Meyer <katexochen0@gmail.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-03-21 13:33:32 +00:00
Sander
be949fb122 refactor(snix/glue): reduce string allocations in the flake ref parser
Change-Id: Id6818976b651b6d6ffa51cf7e2066cce0cb01055
Reviewed-on: https://cl.snix.dev/c/snix/+/30203
Reviewed-by: Florian Klink <flokli@flokli.de>
Autosubmit: Sander Melnikov <hey@sandydoo.me>
Tested-by: besadii
2025-03-21 01:13:14 +00:00
Florian Klink
d07107d688 fix(snix/build): use try_into_name_and_node()
The BuildRequest trait currently still uses the proto Build struct
as a response type, and that one uses nodes with names, causing
.try_into_anonymous_node() to panic.

Use try_into_name_and_node(), and discard the name for now. We should
update the trait to use a stricter type for this.

Change-Id: Ib183a163e885443c58c42808e464d0611eaae324
Reviewed-on: https://cl.snix.dev/c/snix/+/30169
Reviewed-by: Vova Kryachko <v.kryachko@gmail.com>
Tested-by: besadii
Autosubmit: Florian Klink <flokli@flokli.de>
2025-03-20 12:25:15 +00:00
Florian Klink
9caae9114e chore: update OWNERS
- Update OWNERS in the root directory
 - drop OWNERS in contrib/, snix/ and nix/ subdirectories

Change-Id: I5badfb950e3207e9a24cde7725bb4d9331f17ae4
Reviewed-on: https://cl.snix.dev/c/snix/+/30164
Tested-by: besadii
Autosubmit: Florian Klink <flokli@flokli.de>
Reviewed-by: Ryan Lahfa <masterancpp@gmail.com>
2025-03-20 12:21:43 +00:00
Domen Kožar
882bbbd206 feat(glue/builtins): add builtins.parseFlakeRef
Change-Id: I9ab1a9dd50ba3befb43065300d810177b6a23afb
Reviewed-on: https://cl.snix.dev/c/snix/+/30099
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-03-19 23:31:04 +00:00
Ilan Joselevich
dd1ba855e2 chore(third_party/sources): Update
- Apply new clippy lints

Change-Id: I4beb7c0b4d92a2cdcfcb6fa89d24cade2379a5b7
Reviewed-on: https://cl.snix.dev/c/snix/+/30121
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2025-03-18 23:23:16 +00:00
Sander
426ad05c99 fix(tvix/shell): simplify darwin-specific overrides
The new apple-sdk pattern no longer requires manually specifying
frameworks.

Change-Id: I70995f2353f540c1d5b6fc71e009860c1a20e551
Reviewed-on: https://cl.snix.dev/c/snix/+/30116
Tested-by: besadii
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
2025-03-18 23:07:01 +00:00
Florian Klink
ebc924d492 tests(tvix/nix-daemon): add a test suite for tvix nix-daemon
This uses runInLinuxVM to seed tvix-store with a path/closure, then sets
up a local-overlay store mount config using the following setup:

/tmp/tvix exposes everything seeded into tvix
/tmp/scratch represents an empty "local" nix store

This is overlayed to /tmp/merged/nix/store
(using /tmp/work as an overlayfs work dir).

Nix is configured with the local-overlay feature:
 - setting /tmp/merged as root
 - configuring a unix:///tmp/tvix-daemon.sock as lower store,
   with lower-store.real set to /tmp/tvix
 - configuring /tmp/scratch as an upper layer

For some reasons, check-mount needs to be set to false, as Nix doesn't
seem happy with the way we set up the mountpoints.

Change-Id: I03e1cf1d3aaa021a63dcb30ae482a6c3977851ba
Reviewed-on: https://cl.snix.dev/c/snix/+/30087
Reviewed-by: Vova Kryachko <v.kryachko@gmail.com>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: besadii
2025-03-18 21:50:22 +00:00
vkryachko
a04c73ca83 feat(readTree): Add special here argument.
It's convenient for depending on sub-tree members of the current file as
well as gives access to siblings.

Change-Id: I74234cec6566177d88d3bc8507fa3f6ec789adb8
Reviewed-on: https://cl.snix.dev/c/snix/+/30098
Reviewed-by: adis bladis <adisbladis@gmail.com>
Tested-by: besadii
2025-03-18 20:48:29 +00:00
Ilan Joselevich
0314f052ed feat(tvix/cli): Include nixos docs in installer tests
With https://cl.snix.dev/c/snix/+/30108 it is now possible to also test
the complete nixos installer ISO with the generated nixos docs.

Change-Id: Id9f43bbbac45a110d06d955df53b21d2300dcd68
Reviewed-on: https://cl.snix.dev/c/snix/+/30110
Tested-by: besadii
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-03-18 17:55:11 +00:00
Florian Klink
f8bdafd3f2 fix(snix/utils): use filterRustCrateSrc for nix-daemon
Change-Id: I61d39b1a9704f35efc41c920513f683b04215dcb
Reviewed-on: https://cl.snix.dev/c/snix/+/30086
Tested-by: besadii
Autosubmit: Florian Klink <flokli@flokli.de>
Reviewed-by: Vova Kryachko <v.kryachko@gmail.com>
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-03-18 15:29:28 +00:00
Florian Klink
0b7d0e7989 refactor(snix/utils): use filterRustCrateSrc directly
Move this into a let binding and reuse it further down in
defaultCrateOverridesForPkgs, rather than going through the fixpoint.

Change-Id: I9df86189ee788adbecfabf64a09463103e4a626f
Reviewed-on: https://cl.snix.dev/c/snix/+/30103
Autosubmit: Florian Klink <flokli@flokli.de>
Tested-by: besadii
Reviewed-by: Vova Kryachko <v.kryachko@gmail.com>
2025-03-18 15:05:21 +00:00
Florian Klink
518999cdd7 fix(snix/utils): fix eval on MacOS, switch to new sdk pattern
nixpkgs has merged their sdks together, and it doesn't need to be
specified anymore at all, as it's added to stdenv by default.

Explicitly configuring a specific version is only needed if we want to
override the version.

Change-Id: Iff7f2da43733eb48f16d2483587518f00761fb91
Reviewed-on: https://cl.snix.dev/c/snix/+/30096
Tested-by: besadii
Reviewed-by: Vova Kryachko <v.kryachko@gmail.com>
2025-03-18 14:49:52 +00:00
Florian Klink
64f8cb1400 fix(nix_oracle): update thunked_formals_fallback_name_resolution_literal
This was using a constant, which is fine to eagerly evaluate (as it
is constant, saves thunking and won't cause any observable side-effects).

Nix probably started eagerly evaluating these at some point, and after
some discussion with Robert and Raito, it looks like this is fine and
Lix (where it still is lazy right now) might be open to backport it.

Change the testcase to be a bit more complicated (using `12 + 1`
instead of `12`), which still tests what the test wants to primarily
test, without failing on these (irrelevant) changes in laziness.

This means we don't need to pull in a specific version of Nix in our
shell.
This fixes seeing nix build logs while in the tvix-shell, which was
broken on machines not running Nix 2.3.

Fixes: https://git.snix.dev/snix/snix/issues/18
See-Also: https://github.com/NixOS/nix/issues/12666
Change-Id: Ib7f53bc7ddd8b9f474aecd5315bbfd0599285752
Reviewed-on: https://cl.snix.dev/c/snix/+/30090
Reviewed-by: Ryan Lahfa <masterancpp@gmail.com>
Autosubmit: Florian Klink <flokli@flokli.de>
Tested-by: besadii
2025-03-18 12:06:33 +00:00
Vova Kryachko
bca46bf1cf chore(snix/nix-daemon): Fix queryValidPaths operation.
Query valid paths is supposed to return List<StorePath> while our
nix-daemon is returning List<UnkeyedValidPathInfo> which crashes nix.

Change-Id: Ibd2d984b6d0d37fd77ecd612bd7acfb4ca69c048
Reviewed-on: https://cl.snix.dev/c/snix/+/30072
Autosubmit: Vova Kryachko <v.kryachko@gmail.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-03-18 00:32:51 +00:00
Ilan Joselevich
fe85b813a9
chore(snix/eval): Remove refrences of Tvix in docs
Change-Id: I4e522c386c0d1b4b3492562d5525b583ef194293
2025-03-17 18:18:01 +00:00
Florian Klink
36e4d017f5 chore(snix): s/tvix/snix/
Change-Id: Iae961416eea0a38bc57df7b736f6dda5903b0828
2025-03-17 17:15:08 +00:00