diff options
-rw-r--r-- | default.nix | 28 | ||||
-rw-r--r-- | hello/Cargo.lock | 81 | ||||
-rw-r--r-- | hello/Cargo.nix | 45 | ||||
-rw-r--r-- | hello/Cargo.toml | 3 | ||||
-rw-r--r-- | hello/crates-io.nix | 251 | ||||
-rw-r--r-- | hello/src/main.rs | 14 |
6 files changed, 414 insertions, 8 deletions
diff --git a/default.nix b/default.nix index 76c11cf..12a4ba5 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,26 @@ -let +with import ./nixpkgs.nix; +rec { + rust = rustChannelOf { + channel = "stable"; + date = "2018-08-02"; + }; + + target = "x86_64-unknown-linux-musl"; + + buildRustCrateWithFlags = flags: args: (buildRustCrate.override { + rustc = rust.rust.override { + targets = [ "x86_64-unknown-linux-gnu" target ]; + }; + + defaultCrateOverrides = defaultCrateOverrides // { + messages = attrs: { + nativeBuildInputs = [ capnproto ]; + }; + }; + }) (args // { + extraRustcOpts = (args.extraRustcOpts or []) ++ flags; + }); + overlay = self: super: rec { buildRustCrateHelpers = self.callPackage ./buildRustCrateHelpers.nix {}; @@ -12,8 +34,4 @@ let nixpkgs = import (builtins.fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) { overlays = [ overlay ]; }; -in { - inherit (nixpkgs.pkgsCross.aarch64-multiplatform) - hello - rustHello; } diff --git a/hello/Cargo.lock b/hello/Cargo.lock index 15b9446..614185b 100644 --- a/hello/Cargo.lock +++ b/hello/Cargo.lock @@ -1,4 +1,85 @@ [[package]] name = "hello" version = "0.1.0" +dependencies = [ + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", +] +[[package]] +name = "itoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_derive" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901" +"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" +"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" +"checksum serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9" +"checksum serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "31569d901045afbff7a9479f793177fe9259819aff10ab4f89ef69bbc5f567fe" +"checksum serde_json 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "7f60a296fed15c3edbbe9aa83b646531459e565c525b0ab628deb1a4b28e4180" +"checksum syn 0.15.6 (registry+https://github.com/rust-lang/crates.io-index)" = "854b08a640fc8f54728fb95321e3ec485b365a97fe47609797c671addd1dde69" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" diff --git a/hello/Cargo.nix b/hello/Cargo.nix index 4db6737..c881da6 100644 --- a/hello/Cargo.nix +++ b/hello/Cargo.nix @@ -10,10 +10,22 @@ let crates = cratesIO // rec { version = "0.1.0"; authors = [ "till" ]; src = ./.; + dependencies = mapFeatures features ([ + (cratesIO.crates."serde"."${deps."hello"."0.1.0"."serde"}" deps) + (cratesIO.crates."serde_derive"."${deps."hello"."0.1.0"."serde_derive"}" deps) + (cratesIO.crates."serde_json"."${deps."hello"."0.1.0"."serde_json"}" deps) + ]); }; features_.hello."0.1.0" = deps: f: updateFeatures f (rec { hello."0.1.0".default = (f.hello."0.1.0".default or true); - }) []; + serde."${deps.hello."0.1.0".serde}".default = true; + serde_derive."${deps.hello."0.1.0".serde_derive}".default = true; + serde_json."${deps.hello."0.1.0".serde_json}".default = true; + }) [ + (cratesIO.features_.serde."${deps."hello"."0.1.0"."serde"}" deps) + (cratesIO.features_.serde_derive."${deps."hello"."0.1.0"."serde_derive"}" deps) + (cratesIO.features_.serde_json."${deps."hello"."0.1.0"."serde_json"}" deps) + ]; @@ -22,5 +34,34 @@ let crates = cratesIO // rec { rec { hello = crates.crates.hello."0.1.0" deps; __all = [ (hello {}) ]; - deps.hello."0.1.0" = {}; + deps.hello."0.1.0" = { + serde = "1.0.79"; + serde_derive = "1.0.79"; + serde_json = "1.0.30"; + }; + deps.itoa."0.4.3" = {}; + deps.proc_macro2."0.4.19" = { + unicode_xid = "0.1.0"; + }; + deps.quote."0.6.8" = { + proc_macro2 = "0.4.19"; + }; + deps.ryu."0.2.6" = {}; + deps.serde."1.0.79" = {}; + deps.serde_derive."1.0.79" = { + proc_macro2 = "0.4.19"; + quote = "0.6.8"; + syn = "0.15.6"; + }; + deps.serde_json."1.0.30" = { + itoa = "0.4.3"; + ryu = "0.2.6"; + serde = "1.0.79"; + }; + deps.syn."0.15.6" = { + proc_macro2 = "0.4.19"; + quote = "0.6.8"; + unicode_xid = "0.1.0"; + }; + deps.unicode_xid."0.1.0" = {}; } diff --git a/hello/Cargo.toml b/hello/Cargo.toml index e968470..7ba3f94 100644 --- a/hello/Cargo.toml +++ b/hello/Cargo.toml @@ -4,3 +4,6 @@ version = "0.1.0" authors = ["till"] [dependencies] +serde = "1.0.79" +serde_derive = "1.0.79" +serde_json = "1.0.30" diff --git a/hello/crates-io.nix b/hello/crates-io.nix index 7a0e584..8c2de4c 100644 --- a/hello/crates-io.nix +++ b/hello/crates-io.nix @@ -5,4 +5,255 @@ let inherit (lib.lists) fold; in rec { + crates.itoa."0.4.3" = deps: { features?(features_.itoa."0.4.3" deps {}) }: buildRustCrate { + crateName = "itoa"; + version = "0.4.3"; + authors = [ "David Tolnay <dtolnay@gmail.com>" ]; + sha256 = "0zadimmdgvili3gdwxqg7ljv3r4wcdg1kkdfp9nl15vnm23vrhy1"; + features = mkFeatures (features.itoa."0.4.3" or {}); + }; + features_.itoa."0.4.3" = deps: f: updateFeatures f (rec { + itoa = fold recursiveUpdate {} [ + { "0.4.3".default = (f.itoa."0.4.3".default or true); } + { "0.4.3".std = + (f.itoa."0.4.3".std or false) || + (f.itoa."0.4.3".default or false) || + (itoa."0.4.3"."default" or false); } + ]; + }) []; + + + crates.proc_macro2."0.4.19" = deps: { features?(features_.proc_macro2."0.4.19" deps {}) }: buildRustCrate { + crateName = "proc-macro2"; + version = "0.4.19"; + authors = [ "Alex Crichton <alex@alexcrichton.com>" ]; + sha256 = "1k76q9qfgyhqv0w80f0r4hv4dfm0sk751pm9bc1v40qq1sp6jypn"; + build = "build.rs"; + dependencies = mapFeatures features ([ + (crates."unicode_xid"."${deps."proc_macro2"."0.4.19"."unicode_xid"}" deps) + ]); + features = mkFeatures (features.proc_macro2."0.4.19" or {}); + }; + features_.proc_macro2."0.4.19" = deps: f: updateFeatures f (rec { + proc_macro2 = fold recursiveUpdate {} [ + { "0.4.19".default = (f.proc_macro2."0.4.19".default or true); } + { "0.4.19".proc-macro = + (f.proc_macro2."0.4.19".proc-macro or false) || + (f.proc_macro2."0.4.19".default or false) || + (proc_macro2."0.4.19"."default" or false) || + (f.proc_macro2."0.4.19".nightly or false) || + (proc_macro2."0.4.19"."nightly" or false); } + ]; + unicode_xid."${deps.proc_macro2."0.4.19".unicode_xid}".default = true; + }) [ + (features_.unicode_xid."${deps."proc_macro2"."0.4.19"."unicode_xid"}" deps) + ]; + + + crates.quote."0.6.8" = deps: { features?(features_.quote."0.6.8" deps {}) }: buildRustCrate { + crateName = "quote"; + version = "0.6.8"; + authors = [ "David Tolnay <dtolnay@gmail.com>" ]; + sha256 = "0dq6j23w6pmc4l6v490arixdwypy0b82z76nrzaingqhqri4p3mh"; + dependencies = mapFeatures features ([ + (crates."proc_macro2"."${deps."quote"."0.6.8"."proc_macro2"}" deps) + ]); + features = mkFeatures (features.quote."0.6.8" or {}); + }; + features_.quote."0.6.8" = deps: f: updateFeatures f (rec { + proc_macro2 = fold recursiveUpdate {} [ + { "${deps.quote."0.6.8".proc_macro2}".default = (f.proc_macro2."${deps.quote."0.6.8".proc_macro2}".default or false); } + { "0.4.19".proc-macro = + (f.proc_macro2."0.4.19".proc-macro or false) || + (quote."0.6.8"."proc-macro" or false) || + (f."quote"."0.6.8"."proc-macro" or false); } + ]; + quote = fold recursiveUpdate {} [ + { "0.6.8".default = (f.quote."0.6.8".default or true); } + { "0.6.8".proc-macro = + (f.quote."0.6.8".proc-macro or false) || + (f.quote."0.6.8".default or false) || + (quote."0.6.8"."default" or false); } + ]; + }) [ + (features_.proc_macro2."${deps."quote"."0.6.8"."proc_macro2"}" deps) + ]; + + + crates.ryu."0.2.6" = deps: { features?(features_.ryu."0.2.6" deps {}) }: buildRustCrate { + crateName = "ryu"; + version = "0.2.6"; + authors = [ "David Tolnay <dtolnay@gmail.com>" ]; + sha256 = "1vdh6z4aysc9kiiqhl7vxkqz3fykcnp24kgfizshlwfsz2j0p9dr"; + build = "build.rs"; + dependencies = mapFeatures features ([ +]); + features = mkFeatures (features.ryu."0.2.6" or {}); + }; + features_.ryu."0.2.6" = deps: f: updateFeatures f (rec { + ryu."0.2.6".default = (f.ryu."0.2.6".default or true); + }) []; + + + crates.serde."1.0.79" = deps: { features?(features_.serde."1.0.79" deps {}) }: buildRustCrate { + crateName = "serde"; + version = "1.0.79"; + authors = [ "Erick Tryzelaar <erick.tryzelaar@gmail.com>" "David Tolnay <dtolnay@gmail.com>" ]; + sha256 = "123jh1h8a7r1qk61n97arm1rwkzfg35a0j5a9nbmcy6y7xc4rbsc"; + build = "build.rs"; + dependencies = mapFeatures features ([ +]); + features = mkFeatures (features.serde."1.0.79" or {}); + }; + features_.serde."1.0.79" = deps: f: updateFeatures f (rec { + serde = fold recursiveUpdate {} [ + { "1.0.79".default = (f.serde."1.0.79".default or true); } + { "1.0.79".serde_derive = + (f.serde."1.0.79".serde_derive or false) || + (f.serde."1.0.79".derive or false) || + (serde."1.0.79"."derive" or false); } + { "1.0.79".std = + (f.serde."1.0.79".std or false) || + (f.serde."1.0.79".default or false) || + (serde."1.0.79"."default" or false); } + { "1.0.79".unstable = + (f.serde."1.0.79".unstable or false) || + (f.serde."1.0.79".alloc or false) || + (serde."1.0.79"."alloc" or false); } + ]; + }) []; + + + crates.serde_derive."1.0.79" = deps: { features?(features_.serde_derive."1.0.79" deps {}) }: buildRustCrate { + crateName = "serde_derive"; + version = "1.0.79"; + authors = [ "Erick Tryzelaar <erick.tryzelaar@gmail.com>" "David Tolnay <dtolnay@gmail.com>" ]; + sha256 = "1waika12l2ibqyak53xq46rvh70zk9ql3m84aa4vkvjbl0z93qab"; + procMacro = true; + dependencies = mapFeatures features ([ + (crates."proc_macro2"."${deps."serde_derive"."1.0.79"."proc_macro2"}" deps) + (crates."quote"."${deps."serde_derive"."1.0.79"."quote"}" deps) + (crates."syn"."${deps."serde_derive"."1.0.79"."syn"}" deps) + ]); + features = mkFeatures (features.serde_derive."1.0.79" or {}); + }; + features_.serde_derive."1.0.79" = deps: f: updateFeatures f (rec { + proc_macro2."${deps.serde_derive."1.0.79".proc_macro2}".default = true; + quote."${deps.serde_derive."1.0.79".quote}".default = true; + serde_derive."1.0.79".default = (f.serde_derive."1.0.79".default or true); + syn = fold recursiveUpdate {} [ + { "${deps.serde_derive."1.0.79".syn}"."visit" = true; } + { "${deps.serde_derive."1.0.79".syn}".default = true; } + ]; + }) [ + (features_.proc_macro2."${deps."serde_derive"."1.0.79"."proc_macro2"}" deps) + (features_.quote."${deps."serde_derive"."1.0.79"."quote"}" deps) + (features_.syn."${deps."serde_derive"."1.0.79"."syn"}" deps) + ]; + + + crates.serde_json."1.0.30" = deps: { features?(features_.serde_json."1.0.30" deps {}) }: buildRustCrate { + crateName = "serde_json"; + version = "1.0.30"; + authors = [ "Erick Tryzelaar <erick.tryzelaar@gmail.com>" "David Tolnay <dtolnay@gmail.com>" ]; + sha256 = "0hqgfzwk0xiakxm3q5g012s9i437b1z24i8snw8gph5p49bgqb1a"; + dependencies = mapFeatures features ([ + (crates."itoa"."${deps."serde_json"."1.0.30"."itoa"}" deps) + (crates."ryu"."${deps."serde_json"."1.0.30"."ryu"}" deps) + (crates."serde"."${deps."serde_json"."1.0.30"."serde"}" deps) + ]); + features = mkFeatures (features.serde_json."1.0.30" or {}); + }; + features_.serde_json."1.0.30" = deps: f: updateFeatures f (rec { + itoa."${deps.serde_json."1.0.30".itoa}".default = true; + ryu."${deps.serde_json."1.0.30".ryu}".default = true; + serde."${deps.serde_json."1.0.30".serde}".default = true; + serde_json = fold recursiveUpdate {} [ + { "1.0.30".default = (f.serde_json."1.0.30".default or true); } + { "1.0.30".indexmap = + (f.serde_json."1.0.30".indexmap or false) || + (f.serde_json."1.0.30".preserve_order or false) || + (serde_json."1.0.30"."preserve_order" or false); } + ]; + }) [ + (features_.itoa."${deps."serde_json"."1.0.30"."itoa"}" deps) + (features_.ryu."${deps."serde_json"."1.0.30"."ryu"}" deps) + (features_.serde."${deps."serde_json"."1.0.30"."serde"}" deps) + ]; + + + crates.syn."0.15.6" = deps: { features?(features_.syn."0.15.6" deps {}) }: buildRustCrate { + crateName = "syn"; + version = "0.15.6"; + authors = [ "David Tolnay <dtolnay@gmail.com>" ]; + sha256 = "0my8dlp8mfvj98cp2a57r129k9vjr8n3as8gbxcwsl98z429qhy7"; + dependencies = mapFeatures features ([ + (crates."proc_macro2"."${deps."syn"."0.15.6"."proc_macro2"}" deps) + (crates."unicode_xid"."${deps."syn"."0.15.6"."unicode_xid"}" deps) + ] + ++ (if features.syn."0.15.6".quote or false then [ (crates.quote."0.6.8" deps) ] else [])); + features = mkFeatures (features.syn."0.15.6" or {}); + }; + features_.syn."0.15.6" = deps: f: updateFeatures f (rec { + proc_macro2 = fold recursiveUpdate {} [ + { "${deps.syn."0.15.6".proc_macro2}".default = (f.proc_macro2."${deps.syn."0.15.6".proc_macro2}".default or false); } + { "0.4.19".proc-macro = + (f.proc_macro2."0.4.19".proc-macro or false) || + (syn."0.15.6"."proc-macro" or false) || + (f."syn"."0.15.6"."proc-macro" or false); } + ]; + quote = fold recursiveUpdate {} [ + { "${deps.syn."0.15.6".quote}".default = (f.quote."${deps.syn."0.15.6".quote}".default or false); } + { "0.6.8".proc-macro = + (f.quote."0.6.8".proc-macro or false) || + (syn."0.15.6"."proc-macro" or false) || + (f."syn"."0.15.6"."proc-macro" or false); } + ]; + syn = fold recursiveUpdate {} [ + { "0.15.6".clone-impls = + (f.syn."0.15.6".clone-impls or false) || + (f.syn."0.15.6".default or false) || + (syn."0.15.6"."default" or false); } + { "0.15.6".default = (f.syn."0.15.6".default or true); } + { "0.15.6".derive = + (f.syn."0.15.6".derive or false) || + (f.syn."0.15.6".default or false) || + (syn."0.15.6"."default" or false); } + { "0.15.6".parsing = + (f.syn."0.15.6".parsing or false) || + (f.syn."0.15.6".default or false) || + (syn."0.15.6"."default" or false); } + { "0.15.6".printing = + (f.syn."0.15.6".printing or false) || + (f.syn."0.15.6".default or false) || + (syn."0.15.6"."default" or false); } + { "0.15.6".proc-macro = + (f.syn."0.15.6".proc-macro or false) || + (f.syn."0.15.6".default or false) || + (syn."0.15.6"."default" or false); } + { "0.15.6".quote = + (f.syn."0.15.6".quote or false) || + (f.syn."0.15.6".printing or false) || + (syn."0.15.6"."printing" or false); } + ]; + unicode_xid."${deps.syn."0.15.6".unicode_xid}".default = true; + }) [ + (features_.proc_macro2."${deps."syn"."0.15.6"."proc_macro2"}" deps) + (features_.quote."${deps."syn"."0.15.6"."quote"}" deps) + (features_.unicode_xid."${deps."syn"."0.15.6"."unicode_xid"}" deps) + ]; + + + crates.unicode_xid."0.1.0" = deps: { features?(features_.unicode_xid."0.1.0" deps {}) }: buildRustCrate { + crateName = "unicode-xid"; + version = "0.1.0"; + authors = [ "erick.tryzelaar <erick.tryzelaar@gmail.com>" "kwantam <kwantam@gmail.com>" ]; + sha256 = "05wdmwlfzxhq3nhsxn6wx4q8dhxzzfb9szsz6wiw092m1rjj01zj"; + features = mkFeatures (features.unicode_xid."0.1.0" or {}); + }; + features_.unicode_xid."0.1.0" = deps: f: updateFeatures f (rec { + unicode_xid."0.1.0".default = (f.unicode_xid."0.1.0".default or true); + }) []; + + } diff --git a/hello/src/main.rs b/hello/src/main.rs index e7a11a9..e5ad212 100644 --- a/hello/src/main.rs +++ b/hello/src/main.rs @@ -1,3 +1,15 @@ +extern crate serde; +#[macro_use] +extern crate serde_derive; +extern crate serde_json; + +#[derive(Serialize)] +struct Foo { + bar: i32 +} + fn main() { - println!("Hello, world!"); + let s = serde_json::to_string(&Foo { bar: 42 }) + .expect("Unable to serialize foo"); + println!("{}", s); } |