feat(tvix/glue): Implement builtins.storePath

This one's relatively simple - we just check if the store path exists,
and if it does we make a new contextful string containing the store path
as its only context element.

Automatic testing seems tricky for this (I think?) so I tested it
manually:

tvix-repl> builtins.storePath /nix/store/yn46i4xx5alh7gs6fpkxk430i34rp2q9-hello-2.12.1
=> "/nix/store/yn46i4xx5alh7gs6fpkxk430i34rp2q9-hello-2.12.1" :: string

Change-Id: I8a0d9726e4102ab872c53c2419679c2c855a5a18
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11696
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Aspen Smith 2024-05-19 20:43:46 -04:00 committed by clbot
parent c3572048d5
commit 72b9a126b8
7 changed files with 62 additions and 2 deletions

View file

@ -54,6 +54,12 @@ impl From<HashSet<NixContextElement>> for NixContext {
}
}
impl<const N: usize> From<[NixContextElement; N]> for NixContext {
fn from(value: [NixContextElement; N]) -> Self {
Self(HashSet::from(value))
}
}
impl NixContext {
/// Creates an empty context that can be populated
/// and passed to form a contextful [NixString], albeit