refactor(tvix/derivation): remove DOT_FILE_EXT const

This is used in few enough places to just inline it. It felt a bit alien
in the ATerm construction aswell.

write.rs now pleasantly only includes tokens that occur in the ATerm
representation.

Change-Id: I524f8d6c1ce9057ff7fd16c6c3efd98467040a44
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7911
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-01-23 14:46:40 +01:00 committed by flokli
parent fc177af0c1
commit b0d6e748ac
3 changed files with 3 additions and 13 deletions

View file

@ -64,15 +64,7 @@ fn build_store_path(
};
let compressed = compress_hash(&digest, 20);
if is_derivation {
StorePath::from_string(
format!(
"{}-{}{}",
NIXBASE32.encode(&compressed),
name,
write::DOT_FILE_EXT,
)
.as_str(),
)
StorePath::from_string(format!("{}-{}.drv", NIXBASE32.encode(&compressed), name).as_str())
} else {
StorePath::from_string(format!("{}-{}", NIXBASE32.encode(&compressed), name,).as_str())
}

View file

@ -1,4 +1,4 @@
use crate::{derivation::Derivation, write::DOT_FILE_EXT, DerivationError};
use crate::{derivation::Derivation, DerivationError};
use tvix_store::store_path::StorePath;
impl Derivation {
@ -60,7 +60,7 @@ impl Derivation {
));
}
if !input_derivation_path.ends_with(DOT_FILE_EXT) {
if !input_derivation_path.ends_with(".drv") {
return Err(DerivationError::InvalidInputDerivationPrefix(
input_derivation_path.to_string(),
));

View file

@ -16,8 +16,6 @@ pub const BRACKET_CLOSE: char = ']';
pub const COMMA: char = ',';
pub const QUOTE: char = '"';
pub const DOT_FILE_EXT: &str = ".drv";
fn write_array_elements(
writer: &mut impl Write,
quote: bool,