diff --git a/tvix/derivation/src/derivation.rs b/tvix/derivation/src/derivation.rs index bed2cc74b..a1a05abea 100644 --- a/tvix/derivation/src/derivation.rs +++ b/tvix/derivation/src/derivation.rs @@ -9,13 +9,23 @@ use tvix_store::nixpath::STORE_DIR; #[derive(Serialize, Deserialize)] pub struct Derivation { - pub outputs: BTreeMap, - pub input_sources: Vec, - pub input_derivations: BTreeMap>, - pub platform: String, - pub builder: String, + #[serde(rename = "args")] pub arguments: Vec, + + pub builder: String, + + #[serde(rename = "env")] pub environment: BTreeMap, + + #[serde(rename = "inputDrvs")] + pub input_derivations: BTreeMap>, + + #[serde(rename = "inputSrcs")] + pub input_sources: Vec, + + pub outputs: BTreeMap, + + pub system: String, } impl Derivation { @@ -26,7 +36,7 @@ impl Derivation { write::write_outputs(writer, &self.outputs)?; write::write_input_derivations(writer, &self.input_derivations)?; write::write_input_sources(writer, &self.input_sources)?; - write::write_platfrom(writer, &self.platform)?; + write::write_system(writer, &self.system)?; write::write_builder(writer, &self.builder)?; write::write_arguments(writer, &self.arguments)?; write::write_enviroment(writer, &self.environment)?; diff --git a/tvix/derivation/src/output.rs b/tvix/derivation/src/output.rs index 69ae8167e..0d668c3e9 100644 --- a/tvix/derivation/src/output.rs +++ b/tvix/derivation/src/output.rs @@ -12,7 +12,7 @@ pub struct Output { pub struct Hash { #[serde(rename = "hash")] pub digest: String, - #[serde(rename = "hash_algorithm")] + #[serde(rename = "hashAlgo")] pub algo: String, } diff --git a/tvix/derivation/src/tests/derivation_tests/0hm2f1psjpcwg8fijsmr4wwxrx59s092-bar.drv.json b/tvix/derivation/src/tests/derivation_tests/0hm2f1psjpcwg8fijsmr4wwxrx59s092-bar.drv.json index abaaa8d4a..c8bbc4cbb 100644 --- a/tvix/derivation/src/tests/derivation_tests/0hm2f1psjpcwg8fijsmr4wwxrx59s092-bar.drv.json +++ b/tvix/derivation/src/tests/derivation_tests/0hm2f1psjpcwg8fijsmr4wwxrx59s092-bar.drv.json @@ -1,17 +1,7 @@ - { - "outputs": { - "out": { - "path": "/nix/store/4q0pg5zpfmznxscq3avycvf9xdvx50n3-bar", - "hash_algorithm": "r:sha256", - "hash": "08813cbee9903c62be4c5027726a418a300da4500b2d369d3af9286f4815ceba" - } - }, - "input_sources": [], - "input_derivations": {}, - "platform": ":", +{ + "args": [], "builder": ":", - "arguments": [], - "environment": { + "env": { "builder": ":", "name": "bar", "out": "/nix/store/4q0pg5zpfmznxscq3avycvf9xdvx50n3-bar", @@ -19,5 +9,15 @@ "outputHashAlgo": "sha256", "outputHashMode": "recursive", "system": ":" - } + }, + "inputDrvs": {}, + "inputSrcs": [], + "outputs": { + "out": { + "hash": "08813cbee9903c62be4c5027726a418a300da4500b2d369d3af9286f4815ceba", + "hashAlgo": "r:sha256", + "path": "/nix/store/4q0pg5zpfmznxscq3avycvf9xdvx50n3-bar" + } + }, + "system": ":" } diff --git a/tvix/derivation/src/tests/derivation_tests/292w8yzv5nn7nhdpxcs8b7vby2p27s09-nested-json.drv.json b/tvix/derivation/src/tests/derivation_tests/292w8yzv5nn7nhdpxcs8b7vby2p27s09-nested-json.drv.json index a1b763ec9..9cb0b43b4 100644 --- a/tvix/derivation/src/tests/derivation_tests/292w8yzv5nn7nhdpxcs8b7vby2p27s09-nested-json.drv.json +++ b/tvix/derivation/src/tests/derivation_tests/292w8yzv5nn7nhdpxcs8b7vby2p27s09-nested-json.drv.json @@ -1,19 +1,19 @@ { - "outputs": { - "out": { - "path": "/nix/store/pzr7lsd3q9pqsnb42r9b23jc5sh8irvn-nested-json" - } - }, - "input_sources": [], - "input_derivations": {}, - "platform": ":", + "args": [], "builder": ":", - "arguments": [], - "environment": { + "env": { "builder": ":", "json": "{\"hello\":\"moto\\n\"}", "name": "nested-json", "out": "/nix/store/pzr7lsd3q9pqsnb42r9b23jc5sh8irvn-nested-json", "system": ":" - } + }, + "inputDrvs": {}, + "inputSrcs": [], + "outputs": { + "out": { + "path": "/nix/store/pzr7lsd3q9pqsnb42r9b23jc5sh8irvn-nested-json" + } + }, + "system": ":" } diff --git a/tvix/derivation/src/tests/derivation_tests/4wvvbi4jwn0prsdxb7vs673qa5h9gr7x-foo.drv.json b/tvix/derivation/src/tests/derivation_tests/4wvvbi4jwn0prsdxb7vs673qa5h9gr7x-foo.drv.json index f6bb5be23..957a85cca 100644 --- a/tvix/derivation/src/tests/derivation_tests/4wvvbi4jwn0prsdxb7vs673qa5h9gr7x-foo.drv.json +++ b/tvix/derivation/src/tests/derivation_tests/4wvvbi4jwn0prsdxb7vs673qa5h9gr7x-foo.drv.json @@ -1,23 +1,23 @@ { - "outputs": { - "out": { - "path": "/nix/store/5vyvcwah9l9kf07d52rcgdk70g2f4y13-foo" - } - }, - "input_sources": [], - "input_derivations": { - "/nix/store/0hm2f1psjpcwg8fijsmr4wwxrx59s092-bar.drv": [ - "out" - ] - }, - "platform": ":", + "args": [], "builder": ":", - "arguments": [], - "environment": { + "env": { "bar": "/nix/store/4q0pg5zpfmznxscq3avycvf9xdvx50n3-bar", "builder": ":", "name": "foo", "out": "/nix/store/5vyvcwah9l9kf07d52rcgdk70g2f4y13-foo", "system": ":" - } + }, + "inputDrvs": { + "/nix/store/0hm2f1psjpcwg8fijsmr4wwxrx59s092-bar.drv": [ + "out" + ] + }, + "inputSrcs": [], + "outputs": { + "out": { + "path": "/nix/store/5vyvcwah9l9kf07d52rcgdk70g2f4y13-foo" + } + }, + "system": ":" } diff --git a/tvix/derivation/src/tests/derivation_tests/52a9id8hx688hvlnz4d1n25ml1jdykz0-unicode.drv.json b/tvix/derivation/src/tests/derivation_tests/52a9id8hx688hvlnz4d1n25ml1jdykz0-unicode.drv.json index bf837b3e8..f8f33c1bb 100644 --- a/tvix/derivation/src/tests/derivation_tests/52a9id8hx688hvlnz4d1n25ml1jdykz0-unicode.drv.json +++ b/tvix/derivation/src/tests/derivation_tests/52a9id8hx688hvlnz4d1n25ml1jdykz0-unicode.drv.json @@ -4,12 +4,12 @@ "path": "/nix/store/vgvdj6nf7s8kvfbl2skbpwz9kc7xjazc-unicode" } }, - "input_sources": [], - "input_derivations": {}, - "platform": ":", + "inputSrcs": [], + "inputDrvs": {}, + "system": ":", "builder": ":", - "arguments": [], - "environment": { + "args": [], + "env": { "builder": ":", "letters": "räksmörgås\nrødgrød med fløde\nLübeck\n肥猪\nこんにちは / 今日は\n🌮\n", "name": "unicode", diff --git a/tvix/derivation/src/tests/derivation_tests/9lj1lkjm2ag622mh4h9rpy6j607an8g2-structured-attrs.drv.json b/tvix/derivation/src/tests/derivation_tests/9lj1lkjm2ag622mh4h9rpy6j607an8g2-structured-attrs.drv.json index 97f99acdb..74e3d7df5 100644 --- a/tvix/derivation/src/tests/derivation_tests/9lj1lkjm2ag622mh4h9rpy6j607an8g2-structured-attrs.drv.json +++ b/tvix/derivation/src/tests/derivation_tests/9lj1lkjm2ag622mh4h9rpy6j607an8g2-structured-attrs.drv.json @@ -1,16 +1,16 @@ { + "args": [], + "builder": ":", + "env": { + "__json": "{\"builder\":\":\",\"name\":\"structured-attrs\",\"system\":\":\"}", + "out": "/nix/store/6a39dl014j57bqka7qx25k0vb20vkqm6-structured-attrs" + }, + "inputDrvs": {}, + "inputSrcs": [], "outputs": { "out": { "path": "/nix/store/6a39dl014j57bqka7qx25k0vb20vkqm6-structured-attrs" } }, - "input_sources": [], - "input_derivations": {}, - "platform": ":", - "builder": ":", - "arguments": [], - "environment": { - "__json": "{\"builder\":\":\",\"name\":\"structured-attrs\",\"system\":\":\"}", - "out": "/nix/store/6a39dl014j57bqka7qx25k0vb20vkqm6-structured-attrs" - } + "system": ":" } diff --git a/tvix/derivation/src/tests/derivation_tests/ch49594n9avinrf8ip0aslidkc4lxkqv-foo.drv.json b/tvix/derivation/src/tests/derivation_tests/ch49594n9avinrf8ip0aslidkc4lxkqv-foo.drv.json index 2d7dbeb75..831d27956 100644 --- a/tvix/derivation/src/tests/derivation_tests/ch49594n9avinrf8ip0aslidkc4lxkqv-foo.drv.json +++ b/tvix/derivation/src/tests/derivation_tests/ch49594n9avinrf8ip0aslidkc4lxkqv-foo.drv.json @@ -1,23 +1,23 @@ { - "outputs": { - "out": { - "path": "/nix/store/fhaj6gmwns62s6ypkcldbaj2ybvkhx3p-foo" - } - }, - "input_sources": [], - "input_derivations": { - "/nix/store/ss2p4wmxijn652haqyd7dckxwl4c7hxx-bar.drv": [ - "out" - ] - }, - "platform": ":", + "args": [], "builder": ":", - "arguments": [], - "environment": { + "env": { "bar": "/nix/store/mp57d33657rf34lzvlbpfa1gjfv5gmpg-bar", "builder": ":", "name": "foo", "out": "/nix/store/fhaj6gmwns62s6ypkcldbaj2ybvkhx3p-foo", "system": ":" - } + }, + "inputDrvs": { + "/nix/store/ss2p4wmxijn652haqyd7dckxwl4c7hxx-bar.drv": [ + "out" + ] + }, + "inputSrcs": [], + "outputs": { + "out": { + "path": "/nix/store/fhaj6gmwns62s6ypkcldbaj2ybvkhx3p-foo" + } + }, + "system": ":" } diff --git a/tvix/derivation/src/tests/derivation_tests/h32dahq0bx5rp1krcdx3a53asj21jvhk-has-multi-out.drv.json b/tvix/derivation/src/tests/derivation_tests/h32dahq0bx5rp1krcdx3a53asj21jvhk-has-multi-out.drv.json index 12cb34819..0bd7a2991 100644 --- a/tvix/derivation/src/tests/derivation_tests/h32dahq0bx5rp1krcdx3a53asj21jvhk-has-multi-out.drv.json +++ b/tvix/derivation/src/tests/derivation_tests/h32dahq0bx5rp1krcdx3a53asj21jvhk-has-multi-out.drv.json @@ -1,4 +1,16 @@ { + "args": [], + "builder": ":", + "env": { + "builder": ":", + "lib": "/nix/store/2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out-lib", + "name": "has-multi-out", + "out": "/nix/store/55lwldka5nyxa08wnvlizyqw02ihy8ic-has-multi-out", + "outputs": "out lib", + "system": ":" + }, + "inputDrvs": {}, + "inputSrcs": [], "outputs": { "lib": { "path": "/nix/store/2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out-lib" @@ -7,17 +19,5 @@ "path": "/nix/store/55lwldka5nyxa08wnvlizyqw02ihy8ic-has-multi-out" } }, - "input_sources": [], - "input_derivations": {}, - "platform": ":", - "builder": ":", - "arguments": [], - "environment": { - "builder": ":", - "lib": "/nix/store/2vixb94v0hy2xc6p7mbnxxcyc095yyia-has-multi-out-lib", - "name": "has-multi-out", - "out": "/nix/store/55lwldka5nyxa08wnvlizyqw02ihy8ic-has-multi-out", - "outputs": "out lib", - "system": ":" - } + "system": ":" } diff --git a/tvix/derivation/src/tests/derivation_tests/ss2p4wmxijn652haqyd7dckxwl4c7hxx-bar.drv.json b/tvix/derivation/src/tests/derivation_tests/ss2p4wmxijn652haqyd7dckxwl4c7hxx-bar.drv.json index e159a5d12..e297d2715 100644 --- a/tvix/derivation/src/tests/derivation_tests/ss2p4wmxijn652haqyd7dckxwl4c7hxx-bar.drv.json +++ b/tvix/derivation/src/tests/derivation_tests/ss2p4wmxijn652haqyd7dckxwl4c7hxx-bar.drv.json @@ -1,17 +1,7 @@ { - "outputs": { - "out": { - "path": "/nix/store/mp57d33657rf34lzvlbpfa1gjfv5gmpg-bar", - "hash_algorithm": "r:sha1", - "hash": "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33" - } - }, - "input_sources": [], - "input_derivations": {}, - "platform": ":", + "args": [], "builder": ":", - "arguments": [], - "environment": { + "env": { "builder": ":", "name": "bar", "out": "/nix/store/mp57d33657rf34lzvlbpfa1gjfv5gmpg-bar", @@ -19,5 +9,15 @@ "outputHashAlgo": "sha1", "outputHashMode": "recursive", "system": ":" - } + }, + "inputDrvs": {}, + "inputSrcs": [], + "outputs": { + "out": { + "hash": "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33", + "hashAlgo": "r:sha1", + "path": "/nix/store/mp57d33657rf34lzvlbpfa1gjfv5gmpg-bar" + } + }, + "system": ":" } diff --git a/tvix/derivation/src/write.rs b/tvix/derivation/src/write.rs index 0cbde3c0f..842b2c4ab 100644 --- a/tvix/derivation/src/write.rs +++ b/tvix/derivation/src/write.rs @@ -133,7 +133,7 @@ pub fn write_input_sources( Ok(()) } -pub fn write_platfrom(writer: &mut impl Write, platform: &str) -> Result<(), fmt::Error> { +pub fn write_system(writer: &mut impl Write, platform: &str) -> Result<(), fmt::Error> { writer.write_char(COMMA)?; writer.write_str(escape_string(platform).as_str())?; Ok(())