Compare commits

...

10 commits

Author SHA1 Message Date
Florian Klink
6b75eb0f2c docs(ops/machines/snix-cache): document hostName
Change-Id: Ic07983938174277a1bef765a4b14a3f22bd08c76
Reviewed-on: https://cl.snix.dev/c/snix/+/30679
Tested-by: besadii
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: Florian Klink <flokli@flokli.de>
2025-08-11 19:23:55 +00:00
Florian Klink
0beb9f6d5c refactor(ops/nixos): rename nixosSnixCacheSystem to snixCacheSystem
This is defined at the `ops.machines.snix-cache`, let's keep the naming
consistent and short.

Change-Id: Ifb6f0779ee098b7a5c65d3e3989cbf98323e16d0
Reviewed-on: https://cl.snix.dev/c/snix/+/30678
Autosubmit: Florian Klink <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: besadii
2025-08-11 19:23:55 +00:00
Ilan Joselevich
189cb17e34 feat(snix/{castore,store}): Upgrade all redb file formats
In version 2.6.0 of redb a new file format was released. It will end up
being the only supported format in version 3.0.0. With this change we
prepare for v3 by migrating all databases to the new format.

Change-Id: I297a7d70e00e872d9354d1fc7acb277c83d76c71
Reviewed-on: https://cl.snix.dev/c/snix/+/30661
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-08-11 19:21:24 +00:00
Ilan Joselevich
bd4c4bb5f0 chore(snix): Upgrade redb to 2.6.2
In a follow-up CL I will update to use the new database file format.

Change-Id: I7b228546eed9194601de57ffb7d3b2c94c5c2803
Reviewed-on: https://cl.snix.dev/c/snix/+/30659
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-08-11 19:21:24 +00:00
Ilan Joselevich
974a705e6b feat(ops/nixos): Add nixosSnixCacheSystem CI target
Change-Id: Icaa5717fb9eafacebe0fce238f636e7ae40d9aa5
Reviewed-on: https://cl.snix.dev/c/snix/+/30667
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2025-08-11 10:52:27 +00:00
Ilan Joselevich
b62838cc75 fix(ops/nixos): Include in CI
Machines created with third_party.nixos would not be added to the
buildkite pipeline because they are not derivations.

Closes: https://git.snix.dev/snix/snix/issues/80
Change-Id: I1e107b83e352244b229e498adc00df373742fb1a
Reviewed-on: https://cl.snix.dev/c/snix/+/30666
Reviewed-by: Florian Klink <flokli@flokli.de>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: besadii
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2025-08-11 10:52:08 +00:00
Ilan Joselevich
370c63fadb chore: Update .git-blame-ignore-revs
Adds the nixpkgs-fmt -> nixfmt commit

Change-Id: Ic3630fa5c274d5f333a2ceecde5a85b3ae809b92
Reviewed-on: https://cl.snix.dev/c/snix/+/30672
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
2025-08-11 10:51:28 +00:00
Florian Klink
c23d7b011e chore(3p/sources/nix-gerrit): bump nix-gerrit
The current bazel fetcher doesn't work if run on a machine without any
IPv4 addresses (v4 connectivity provided by 6to4 and NAT64).

Change-Id: I2418ef35efcf6629cbd3a4b0d988c1a3c4add8f0
Reviewed-on: https://cl.snix.dev/c/snix/+/30673
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
Reviewed-by: Ryan Lahfa <ryan@lahfa.xyz>
2025-08-10 23:21:45 +00:00
Oleksandr Knyshuk
bd6cfb1e33 docs(eval): update compile_if_else docstring for JumpIfCatchable opcode
Reflects control flow changes after cl/10288, documenting the new
JumpIfCatchable instruction and updated branching logic for catchable
defaults in conditional expressions.

Change-Id: I6a6a6964b84ae42e35ccb84851c7993619516d0b
Reviewed-on: https://cl.snix.dev/c/snix/+/30656
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
Reviewed-by: Oleksandr Knyshuk <olk@disr.it>
Autosubmit: Oleksandr Knyshuk <olk@disr.it>
2025-08-10 18:48:32 +00:00
rszyma
3475e61487 fix(snix/boot/tests): fix comment
Change-Id: I342e81b04445b6122e71b563964e452f6bad537a
Reviewed-on: https://cl.snix.dev/c/snix/+/30676
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
2025-08-10 17:31:53 +00:00
12 changed files with 62 additions and 32 deletions

View file

@ -24,3 +24,6 @@ c758de9d22506eb279c5abe61f621e5c8f61af95
# style: format entire depot with nixpkgs-fmt
aa122cbae78ce97d60c0c98ba14df753d97e40b1
# style: Switch to nixfmt from nixpkgs-fmt
91d02d8c845d4ffbeefc7d99ef36b2234d87813b

View file

@ -49,6 +49,7 @@ in
nixpkgs.hostPlatform = lib.mkForce "x86_64-linux";
# kept as-is because we don't want to relabel historical metrics
networking.hostName = "tvix-cache";
systemd.network.networks."10-uplink".networkConfig.Address = "2a01:4f9:3071:1091::2/64";

View file

@ -53,18 +53,19 @@ rec {
) (throw "${hostname} is not a known NixOS host") (map nixosFor depot.ops.machines.all-systems));
# Systems that should be built in CI
archivistEC2System = nixosFor depot.ops.machines.archivist-ec2;
gerrit01System = nixosFor depot.ops.machines.gerrit01;
public01System = nixosFor depot.ops.machines.public01;
build01System = nixosFor depot.ops.machines.build01;
meta01System = nixosFor depot.ops.machines.meta01;
nixosSnixCacheSystem = nixosFor depot.ops.machines.snix-cache;
archivistEC2System = (nixosFor depot.ops.machines.archivist-ec2).system;
build01System = (nixosFor depot.ops.machines.build01).system;
gerrit01System = (nixosFor depot.ops.machines.gerrit01).system;
meta01System = (nixosFor depot.ops.machines.meta01).system;
public01System = (nixosFor depot.ops.machines.public01).system;
snixCacheSystem = (nixosFor depot.ops.machines.snix-cache).system;
meta.ci.targets = [
"archivistEC2System"
"gerrit01System"
"public01System"
"build01System"
"gerrit01System"
"meta01System"
"public01System"
"snixCacheSystem"
];
}

4
snix/Cargo.lock generated
View file

@ -3473,9 +3473,9 @@ dependencies = [
[[package]]
name = "redb"
version = "2.4.0"
version = "2.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0a72cd7140de9fc3e318823b883abf819c20d478ec89ce880466dc2ef263c6"
checksum = "59b38b05028f398f08bea4691640503ec25fcb60b82fb61ce1f8fd1f4fccd3f7"
dependencies = [
"libc",
"log",

View file

@ -14092,9 +14092,9 @@ rec {
};
"redb" = rec {
crateName = "redb";
version = "2.4.0";
edition = "2021";
sha256 = "1ik3y8pdqrh4i378kv3qshh9r0dz7a43p0hqwg1rzpj0f76p42pa";
version = "2.6.2";
edition = "2024";
sha256 = "1xykri7izzgqw4fbcbxqc35mzhiya101csd4pq48yfcg082qpcsr";
type = [
"cdylib"
"rlib"

View file

@ -100,7 +100,7 @@ proptest = { version = "1.5.0", default-features = false }
prost = "0.13.1"
prost-build = "0.13.1"
quote = "1.0.37"
redb = "2.1.2"
redb = "2.6.2"
regex = "1.10.6"
reqwest = { version = "0.12.7", default-features = false }
reqwest-middleware = { version = "0.4.1", default-features = false }

View file

@ -120,7 +120,7 @@ let
}
# Upload all NAR files (with some parallelism).
# As mkBinaryCache produces them xz-compressed, unpack them on the fly.
# As mkBinaryCache produces them zstd-compressed, unpack them on the fly.
# nar-bridge doesn't care about the path we upload *to*, but a
# subsequent .narinfo upload need to refer to its contents (by narhash).
echo -e "Uploading NARs "

View file

@ -3,7 +3,7 @@ use prost::Message;
use redb::{Database, TableDefinition};
use std::{path::PathBuf, sync::Arc};
use tonic::async_trait;
use tracing::{instrument, warn};
use tracing::{info, instrument, warn};
use super::{
Directory, DirectoryGraph, DirectoryPutter, DirectoryService, LeavesToRootValidator,
@ -41,7 +41,15 @@ impl RedbDirectoryService {
}
let db = tokio::task::spawn_blocking(|| -> Result<_, redb::Error> {
let db = redb::Database::create(path)?;
let mut db = redb::Database::builder()
.create_with_file_format_v3(true)
.create(path)?;
// Upgrade redb database file format.
if db.upgrade()? {
info!("Upgraded database format");
};
create_schema(&db)?;
Ok(db)
})
@ -55,8 +63,9 @@ impl RedbDirectoryService {
/// Constructs a new instance using the in-memory backend.
pub fn new_temporary() -> Result<Self, Error> {
let db =
redb::Database::builder().create_with_backend(redb::backends::InMemoryBackend::new())?;
let db = redb::Database::builder()
.create_with_file_format_v3(true)
.create_with_backend(redb::backends::InMemoryBackend::new())?;
create_schema(&db)?;

View file

@ -125,6 +125,12 @@ impl From<redb::CommitError> for Error {
}
}
impl From<redb::UpgradeError> for Error {
fn from(value: redb::UpgradeError) -> Self {
Error::StorageError(value.to_string())
}
}
impl From<std::io::Error> for Error {
fn from(value: std::io::Error) -> Self {
if value.kind() == std::io::ErrorKind::InvalidInput {

View file

@ -906,14 +906,15 @@ impl Compiler<'_, '_> {
/// Compile conditional expressions using jumping instructions in the VM.
///
/// ```notrust
/// ┌────────────────────┐
/// │ 0 [ conditional ] │
/// │ 1 JUMP_IF_FALSE →┼─┐
/// │ 2 [ main body ] │ │ Jump to else body if
/// ┌┼─3─← JUMP │ │ condition is false.
/// Jump over else body ││ 4 [ else body ]←┼─┘
/// if condition is true.└┼─5─→ ... │
/// └────────────────────┘
/// ┌─────────────────────┐
/// │ 0 [ conditional ] │
/// │ 1 JUMP_IF_CATCH →┼───┐ Jump over else body
/// │ 2 JUMP_IF_FALSE →┼─┐ │ if condition is catchable.
/// │ 3 [ main body ] │ │ ← Jump to else body if
/// ┌┼─4─← JUMP │ │ ← condition is false.
/// Jump over else body ││ 5 [ else body ] ←┼─┘ │
/// if condition is true.└┼─6─→ ... ←┼───┘
/// └─────────────────────┘
/// ```
fn compile_if_else(&mut self, slot: LocalIdx, node: &ast::IfElse) {
self.compile(slot, node.condition().unwrap());

View file

@ -11,7 +11,7 @@ use snix_castore::{
use std::{path::PathBuf, sync::Arc};
use tokio_stream::wrappers::ReceiverStream;
use tonic::async_trait;
use tracing::{instrument, warn};
use tracing::{info, instrument, warn};
const PATHINFO_TABLE: TableDefinition<[u8; 20], Vec<u8>> = TableDefinition::new("pathinfo");
@ -40,7 +40,15 @@ impl RedbPathInfoService {
}
let db = tokio::task::spawn_blocking(|| -> Result<_, redb::Error> {
let db = redb::Database::create(path)?;
let mut db = redb::Database::builder()
.create_with_file_format_v3(true)
.create(path)?;
// Upgrade redb database file format.
if db.upgrade()? {
info!("Upgraded database format");
};
create_schema(&db)?;
Ok(db)
})
@ -54,8 +62,9 @@ impl RedbPathInfoService {
/// Constructs a new instance using the in-memory backend.
pub fn new_temporary(instance_name: String) -> Result<Self, Error> {
let db =
redb::Database::builder().create_with_backend(redb::backends::InMemoryBackend::new())?;
let db = redb::Database::builder()
.create_with_file_format_v3(true)
.create_with_backend(redb::backends::InMemoryBackend::new())?;
create_schema(&db)?;

View file

@ -87,7 +87,7 @@
"nix-gerrit": {
"branch": "main",
"repo": "https://git.lix.systems/the-distro/nix-gerrit.git",
"rev": "b730594c169cf14dd9c258902d58e8bb7709501f",
"rev": "1fdef9c8c8c876f410b75b0c4220ad8221572ef8",
"type": "git"
},
"nixpkgs": {