about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-03-15T12·24+0300
committertazjin <tazjin@tvl.su>2023-03-15T13·05+0000
commit4d465249eff7488e712586bf693668d513211632 (patch)
treec8c0792fd05c9c272880a2fab685b0632354445b /tvix
parentb55d1f97ce8762711ff44f9b5695452cc8083c44 (diff)
fix(tvix/cli): populate output configuration after walking args r/6010
Walking the arguments might encounter an `outputs` output, which might
explicitly (for whatever reason) specify the `out` output.

To prevent dropping FOD settings in this case, we have to populate
that part of the configuration after walking the other attributes.

Change-Id: Iee6a7f0a71e9c9699e79d35e6cb19e1ddb49395d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8312
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r--tvix/cli/src/derivation.rs29
1 files changed, 14 insertions, 15 deletions
diff --git a/tvix/cli/src/derivation.rs b/tvix/cli/src/derivation.rs
index 1508e3e6d935..5a04c2a11bb2 100644
--- a/tvix/cli/src/derivation.rs
+++ b/tvix/cli/src/derivation.rs
@@ -175,7 +175,6 @@ async fn handle_derivation_parameters(
                 .to_list()
                 .context("looking at the `outputs` parameter of the derivation")?;
 
-            drv.outputs.clear();
             populate_outputs(co, drv, outputs).await?;
         }
 
@@ -264,20 +263,7 @@ mod derivation_builtins {
             Ok(None)
         }
 
-        populate_output_configuration(
-            &mut drv,
-            select_string(&co, &input, "outputHash")
-                .await
-                .context("evaluating the `outputHash` parameter")?,
-            select_string(&co, &input, "outputHashAlgo")
-                .await
-                .context("evaluating the `outputHashAlgo` parameter")?,
-            select_string(&co, &input, "outputHashMode")
-                .await
-                .context("evaluating the `outputHashMode` parameter")?,
-        )?;
-
-        for (name, value) in input.into_iter_sorted() {
+        for (name, value) in input.clone().into_iter_sorted() {
             let value = generators::request_force(&co, value).await;
             if ignore_nulls && matches!(value, Value::Null) {
                 continue;
@@ -303,6 +289,19 @@ mod derivation_builtins {
             }
         }
 
+        populate_output_configuration(
+            &mut drv,
+            select_string(&co, &input, "outputHash")
+                .await
+                .context("evaluating the `outputHash` parameter")?,
+            select_string(&co, &input, "outputHashAlgo")
+                .await
+                .context("evaluating the `outputHashAlgo` parameter")?,
+            select_string(&co, &input, "outputHashMode")
+                .await
+                .context("evaluating the `outputHashMode` parameter")?,
+        )?;
+
         // Scan references in relevant attributes to detect any build-references.
         let references = {
             let state = state.borrow();