Commit graph

19 commits

Author SHA1 Message Date
Vova Kryachko
d741ca4bb1 feat(glue): Add hashed_mirrors support to eval fetcher
This change adds basic scaffolding to allow configuring hashed_mirrors that will be used
by fetchurl to download artifacts by their hash, this is useful in case certain URLs are
no longer available but required to bootstrap nixpkgs stdenv.

These urls will have higher priority than the url specified in fetchurl(and friends) and
will be attempted before falling back to the actual url specified in fetchurl.

Change-Id: I589bdef609075f274cbdf6b26af602cafaa7496a
Reviewed-on: https://cl.snix.dev/c/snix/+/30567
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-06-11 09:45:16 +00:00
Florian Klink
bbc1efdb0e test(eval): add test for deep force key order
This tests deep forcing happens in lexicographic key order, by comparing
the returned error from the evaluator. It's not possible to observe this
from inside nixlang, which is why we use one_offs.rs here.

Change-Id: I73085addca3a4df20bc23f9fced458758af5b391
Reviewed-on: https://cl.snix.dev/c/snix/+/30488
Reviewed-by: Bence Nemes <nemes.bence1@gmail.com>
Tested-by: besadii
Autosubmit: Florian Klink <flokli@flokli.de>
2025-05-07 12:34:45 +00:00
Starnick4444
1a84bc0e62 chore(glue): upgrade to 2024 edition
Part of #114
cargo fix wanted to rewrite `if let else` to match statements, but i
reverted them as they dont belong in this cl.
There weren't any warnings about locks (relative drop order changed in
2024)

Change-Id: I9c851ef8e214a481cbe7b4cf9b2634b5d56970d4
Reviewed-on: https://cl.snix.dev/c/snix/+/30369
Autosubmit: Bence Nemes <nemes.bence1@gmail.com>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
2025-05-04 14:30:34 +00:00
Starnick4444
916988a7a2 chore(castore-http): upgrade to 2024 edition
Part of #114

Change-Id: I083ad939c836736b44b36c38e16a04cbaabe9442
Reviewed-on: https://cl.snix.dev/c/snix/+/30377
Autosubmit: Bence Nemes <nemes.bence1@gmail.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-05-04 14:30:03 +00:00
Starnick4444
bf59803f00 chore(tracing): upgrade to 2024 edition
Part of #114

Change-Id: I07f1c861c110cc2e0a3d8122bb6f240391212698
Reviewed-on: https://cl.snix.dev/c/snix/+/30378
Autosubmit: Bence Nemes <nemes.bence1@gmail.com>
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
2025-05-02 22:33:47 +00:00
Starnick4444
950d551fbc chore(serde): upgrade to 2024 edition
Part of #114
Literally nothing changed...

Change-Id: Ide28c82e853d16dd911ce0226ebc2ee0a545d891
Reviewed-on: https://cl.snix.dev/c/snix/+/30379
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
Autosubmit: Bence Nemes <nemes.bence1@gmail.com>
2025-05-02 21:20:10 +00:00
Starnick4444
c501361412 chore(cli): upgrade cli to 2024 edition
Part of #114
cli doesn't contain any unsafe

Change-Id: I65b573be5f9ff5c93b813a930df908d6aea6c799
Reviewed-on: https://cl.snix.dev/c/snix/+/30365
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-05-01 08:01:11 +00:00
Starnick4444
ef53fbfe3f chore(build): upgrade to 2024 edition
Part of #114
doesn't contain any unsafe

Change-Id: Icd1c0609f9a51721bd9a5d717ce71537d0f49702
Reviewed-on: https://cl.snix.dev/c/snix/+/30366
Autosubmit: Bence Nemes <nemes.bence1@gmail.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-05-01 07:39:38 +00:00
Florian Klink
d1990c9a93 refactor(snix/castore-http/cli): ask for root directory digest
Restrict the CLI to only root directories, passing the blake3 digest of
the root directory.

Usually we want to serve a directory, and we now have a `snix-castore
ingest` sucommand, and copying the output from that command is much less
effort than constructing a proto message.

More advanced usecases can still use the get_root_node_contents library
function and pass in other nodes.

Change-Id: I66c2c0a15723b43b5b0cffc1c201391df57dd602
Reviewed-on: https://cl.snix.dev/c/snix/+/30321
Reviewed-by: Stefan Junker <mail@stefanjunker.de>
Tested-by: besadii
2025-04-16 12:04:30 +00:00
Marijan Petričević
6b48bcc1bf feat(snix/castore-http): initial implementation
The castore-http crate provides both a binary and a library interface to
serve a single castore root node over HTTP.

The library function `get_root_node_contents` will return a
`axum::Response` for a requested path in the castore root node
depending on the requested paths type.

If the requested path in the root node is a directory, we return:
- a index file if there is a file matching one of the configurable
  `index_names`
- a directory listing, if no `index_names` were configured and
  `auto_index` was enabled
- the FORBIDDEN status code if no `index_names` were set nor
  `auto_index` was enabled

If the requested path in the root node is a file,
we return the file.

If the requested path in the root node is a symlink,
we figure out wether the target exists and return a REDIRECT.

If the requested path doesn't exist in the root node,
we respond with NOT_FOUND

The binary wraps this functionality and allows one to specify the
desired root node by providing its base-64 encoded representation as
well as the other configuration parameters affecting the behavior of
`get_root_node_contents`.

Change-Id: I737482299f788ec0244c54b52042f9eb655a05c2
Reviewed-on: https://cl.snix.dev/c/snix/+/30245
Autosubmit: Marijan Petričević <marijan.petricevic94@gmail.com>
Reviewed-by: Marijan Petričević <marijan.petricevic94@gmail.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-04-14 14:43:25 +00:00
Vova Kryachko
934b52c136 feat(snix-glue): Propagate build inputs correctly.
We previously used to calculate the transitive input closure of builds
using eval state, i.e. based on known_paths from the drv that is being
built. This caused had 2 issues:

* The build included a lot of unnecessary build time dependencies of drv's that
  the build depends on in addition to runtime dependencies.
* Some runtime dependencies were missing causing the build to fail, see #106

This implementation uses only runtime dependencies of direct
dependencies and makes sure to include any transitive runtime dependencies,
this is achieved by querying path_info_service for "references".

fixed #106

Change-Id: Id734bed7b0cf50e2dac96501a9bc70655ed15054
Reviewed-on: https://cl.snix.dev/c/snix/+/30308
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-04-11 21:48:50 +00:00
Yvan Sraka
ff72278529 feat(cli): add snix-castore utility
This is a small utility that allows ingesting a given path or .tar
file content into the snix-castore and returns the B3Digest of the
root node. Another subcommand takes this hash to mount the content
back as a virtiofs or FUSE drive.

This works as-is, but I discovered issue #107 while working on it.

Change-Id: I11df73e39ab0db6f3868effab9bde4f090eadcb5
Reviewed-on: https://cl.snix.dev/c/snix/+/30293
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-04-10 13:09:50 +00:00
Vova Kryachko
6118142b21 feat(snix-build/oci): Use user's subordinate ids in oci builds.
subuid/subgids used to be hardcoded, which resulted in build failures
if those did not match the ones of the effective user.

fixes #86

Change-Id: I3b0c3e9ef710aa9e3de998891abe10fd1a893189
Reviewed-on: https://cl.snix.dev/c/snix/+/30301
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-04-10 02:56:02 +00:00
edef
479e6ad5c6 fix(snix/castore/import): don't allocate parent repeatedly
We use hashbrown directly (instead of through std::collections::HashMap)
so that we can use HashMap::entry_ref, which only allocates if the entry
is not yet occupied.

This implicitly switches our hash to a less long-term DoS-resistant one
(foldhash rather than SipHash), but we don't usually face HashDoS risks
when ingesting archives.

Change-Id: I3e7fc2cd08d96380cd9fd62bfcfe6cd24698bc9a
Reviewed-on: https://cl.snix.dev/c/snix/+/30277
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
2025-03-24 22:57:42 +00:00
Ilan Joselevich
1859e517da chore(snix/store): edition 2021 -> 2024
Change-Id: I39c11d878139655b8f43eb658a2d795160654d5b
Reviewed-on: https://cl.snix.dev/c/snix/+/30241
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
Reviewed-by: edef . <edef@edef.eu>
2025-03-23 17:53:48 +00:00
Florian Klink
1e0322cce2 chore(snix): bump ring
fixes https://rustsec.org/advisories/RUSTSEC-2025-0009.html

Change-Id: I32896f9b26e3f7e18dd885373c751c5dcf7f3478
Reviewed-on: https://cl.snix.dev/c/snix/+/30258
Reviewed-by: edef . <edef@edef.eu>
Tested-by: besadii
Autosubmit: Florian Klink <flokli@flokli.de>
2025-03-23 15:35:27 +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
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
Florian Klink
36e4d017f5 chore(snix): s/tvix/snix/
Change-Id: Iae961416eea0a38bc57df7b736f6dda5903b0828
2025-03-17 17:15:08 +00:00
Renamed from tvix/Cargo.nix (Browse further)