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:
parent
c3572048d5
commit
72b9a126b8
7 changed files with 62 additions and 2 deletions
0
tvix/glue/src/tests/empty-file
Normal file
0
tvix/glue/src/tests/empty-file
Normal file
1
tvix/glue/src/tests/tvix_tests/eval-okay-storePath.exp
Normal file
1
tvix/glue/src/tests/tvix_tests/eval-okay-storePath.exp
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ contextMatches = true; hasContext = true; }
|
||||
9
tvix/glue/src/tests/tvix_tests/eval-okay-storePath.nix
Normal file
9
tvix/glue/src/tests/tvix_tests/eval-okay-storePath.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
let
|
||||
path = builtins.unsafeDiscardStringContext "${../empty-file}";
|
||||
storePath = builtins.storePath path;
|
||||
context = builtins.getContext storePath;
|
||||
in
|
||||
{
|
||||
hasContext = builtins.hasContext storePath;
|
||||
contextMatches = context == { "${path}" = { path = true; }; };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue