refactor(tvix): introduce nix-compat crate

Move nixbase32 and store_path into this.

This allows //tvix/cli to not pull in //tvix/store for now.

Change-Id: Id3a32867205d95794bc0d33b21d4cb3d9bafd02a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7964
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Florian Klink 2023-01-31 12:18:03 +01:00 committed by flokli
parent 8ea93bb646
commit c27bacd905
20 changed files with 109 additions and 27 deletions

View file

@ -1,12 +1,12 @@
use crate::output::{Hash, Output};
use crate::write;
use crate::DerivationError;
use nix_compat::nixbase32;
use nix_compat::store_path::{StorePath, STORE_DIR};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::collections::BTreeSet;
use std::{collections::BTreeMap, fmt, fmt::Write};
use tvix_store::nixbase32;
use tvix_store::store_path::{StorePath, STORE_DIR};
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct Derivation {

View file

@ -1,5 +1,5 @@
use nix_compat::{nixbase32::Nixbase32DecodeError, store_path::ParseStorePathError};
use thiserror::Error;
use tvix_store::{nixbase32::Nixbase32DecodeError, store_path::ParseStorePathError};
/// Errors that can occur during the validation of Derivation structs.
#[derive(Debug, Error, PartialEq)]

View file

@ -1,5 +1,5 @@
use nix_compat::{nixbase32, store_path::StorePath};
use serde::{Deserialize, Serialize};
use tvix_store::{nixbase32, store_path::StorePath};
use crate::OutputError;

View file

@ -1,12 +1,12 @@
use crate::derivation::Derivation;
use crate::output::{Hash, Output};
use nix_compat::store_path::StorePath;
use std::collections::BTreeSet;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use test_case::test_case;
use test_generator::test_resources;
use tvix_store::store_path::StorePath;
const RESOURCES_PATHS: &str = "src/tests/derivation_tests";

View file

@ -1,5 +1,5 @@
use crate::{derivation::Derivation, DerivationError};
use tvix_store::store_path::StorePath;
use nix_compat::store_path::StorePath;
impl Derivation {
/// validate ensures a Derivation struct is properly populated,