about summary refs log tree commit diff
path: root/tvix/glue/src/tvix_build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/glue/src/tvix_build.rs')
-rw-r--r--tvix/glue/src/tvix_build.rs39
1 files changed, 16 insertions, 23 deletions
diff --git a/tvix/glue/src/tvix_build.rs b/tvix/glue/src/tvix_build.rs
index a0ebf49e1229..b647c7d40545 100644
--- a/tvix/glue/src/tvix_build.rs
+++ b/tvix/glue/src/tvix_build.rs
@@ -52,22 +52,15 @@ where
     command_args.push(derivation.builder.clone());
     command_args.extend_from_slice(&derivation.arguments);
 
-    // produce output_paths, which is the basename of each output (sorted)
-    // since Derivation is validated, we know output paths can be parsed.
-    // TODO: b/264 will remove the need to parse them here
-    let mut outputs: Vec<String> = derivation
+    // produce output_paths, which is the absolute path of each output (sorted)
+    let mut output_paths: Vec<String> = derivation
         .outputs
         .values()
-        .map(|output| {
-            let output_storepath = StorePathRef::from_absolute_path(output.path.as_bytes())
-                .expect("invalid output storepath");
-
-            output_storepath.to_string()
-        })
+        .map(|e| e.path[1..].to_owned())
         .collect();
 
     // Sort the outputs. We can use sort_unstable, as these are unique strings.
-    outputs.sort_unstable();
+    output_paths.sort_unstable();
 
     // Produce environment_vars. We use a BTreeMap while producing them, so the
     // resulting Vec is sorted by key.
@@ -151,13 +144,13 @@ where
 
     BuildRequest {
         command_args,
-        outputs,
+        outputs: output_paths,
         environment_vars,
         inputs,
+        inputs_dir: nix_compat::store_path::STORE_DIR.into(),
         constraints,
         working_dir: "build".into(),
-        scratch_paths: vec!["build".into()],
-        store_dir: nix_compat::store_path::STORE_DIR.into(),
+        scratch_paths: vec!["build".into(), "nix/store".into()],
     }
 }
 
@@ -245,10 +238,11 @@ mod test {
 
         assert_eq!(
             BuildRequest {
-                command_args: vec![":".to_string()],
-                outputs: vec!["fhaj6gmwns62s6ypkcldbaj2ybvkhx3p-foo".to_string()],
+                command_args: vec![":".into()],
+                outputs: vec!["nix/store/fhaj6gmwns62s6ypkcldbaj2ybvkhx3p-foo".into()],
                 environment_vars: expected_environment_vars,
                 inputs: vec![INPUT_NODE_FOO.clone()],
+                inputs_dir: nix_compat::store_path::STORE_DIR.into(),
                 constraints: Some(BuildConstraints {
                     system: derivation.system.clone(),
                     min_memory: 0,
@@ -256,9 +250,8 @@ mod test {
                     available_ro_paths: vec![],
                     provide_bin_sh: true,
                 }),
-                working_dir: "build".to_string(),
-                scratch_paths: vec!["build".to_string()],
-                store_dir: nix_compat::store_path::STORE_DIR.to_string(),
+                working_dir: "build".into(),
+                scratch_paths: vec!["build".into(), "nix/store".into()],
             },
             build_request
         );
@@ -314,9 +307,10 @@ mod test {
         assert_eq!(
             BuildRequest {
                 command_args: vec![":".to_string()],
-                outputs: vec!["4q0pg5zpfmznxscq3avycvf9xdvx50n3-bar".to_string()],
+                outputs: vec!["nix/store/4q0pg5zpfmznxscq3avycvf9xdvx50n3-bar".into()],
                 environment_vars: expected_environment_vars,
                 inputs: vec![],
+                inputs_dir: nix_compat::store_path::STORE_DIR.into(),
                 constraints: Some(BuildConstraints {
                     system: derivation.system.clone(),
                     min_memory: 0,
@@ -324,9 +318,8 @@ mod test {
                     available_ro_paths: vec![],
                     provide_bin_sh: true,
                 }),
-                working_dir: "build".to_string(),
-                scratch_paths: vec!["build".to_string()],
-                store_dir: nix_compat::store_path::STORE_DIR.to_string(),
+                working_dir: "build".into(),
+                scratch_paths: vec!["build".into(), "nix/store".into()],
             },
             build_request
         );