diff options
Diffstat (limited to 'Cargo.nix')
-rw-r--r-- | Cargo.nix | 2008 |
1 files changed, 2008 insertions, 0 deletions
diff --git a/Cargo.nix b/Cargo.nix new file mode 100644 index 0000000..35f5a3c --- /dev/null +++ b/Cargo.nix @@ -0,0 +1,2008 @@ + +# This file was @generated by crate2nix 0.8.0 with the command: +# "generate" +# See https://github.com/kolloch/crate2nix for more info. + +{ nixpkgs ? <nixpkgs> +, pkgs ? import nixpkgs { config = {}; } +, lib ? pkgs.lib +, stdenv ? pkgs.stdenv +, buildRustCrate ? pkgs.buildRustCrate + # This is used as the `crateOverrides` argument for `buildRustCrate`. +, defaultCrateOverrides ? pkgs.defaultCrateOverrides + # The features to enable for the root_crate or the workspace_members. +, rootFeatures ? [ "default" ] + # If true, throw errors instead of issueing deprecation warnings. +, strictDeprecation ? false + # Whether to perform release builds: longer compile times, faster binaries. +, release ? true +}: + +rec { + # + # "public" attributes that we attempt to keep stable with new versions of crate2nix. + # + + + # Refer your crate build derivation by name here. + # You can override the features with + # workspaceMembers."${crateName}".build.override { features = [ "default" "feature1" ... ]; }. + workspaceMembers = { + "advent_01" = rec { + packageId = "advent_01"; + build = internal.buildRustCrateWithFeatures { + packageId = "advent_01"; + }; + + # Debug support which might change between releases. + # File a bug if you depend on any for non-debug work! + debug = internal.debugCrate { inherit packageId; }; + }; + "advent_lib" = rec { + packageId = "advent_lib"; + build = internal.buildRustCrateWithFeatures { + packageId = "advent_lib"; + }; + + # Debug support which might change between releases. + # File a bug if you depend on any for non-debug work! + debug = internal.debugCrate { inherit packageId; }; + }; + }; + workspace_members = + internal.deprecationWarning + "workspace_members is deprecated in crate2nix 0.4. Please use workspaceMembers instead." + lib.mapAttrs (n: v: v.build) workspaceMembers; + + # + # "internal" ("private") attributes that may change in every new version of crate2nix. + # + + internal = rec { + # Build and dependency information for crates. + # Many of the fields are passed one-to-one to buildRustCrate. + # + # Noteworthy: + # * `dependencies`/`buildDependencies`: similar to the corresponding fields for buildRustCrate. + # but with additional information which is used during dependency/feature resolution. + # * `resolvedDependencies`: the selected default features reported by cargo - only included for debugging. + # * `devDependencies` as of now not used by `buildRustCrate` but used to + # inject test dependencies into the build + + crates = { + "advent_01" = rec { + crateName = "advent_01"; + version = "0.1.0"; + edition = "2018"; + crateBin = [ + { name = "advent_01"; path = "src/main.rs"; } + ]; + src = (builtins.filterSource sourceFilter ./01); + authors = [ + "Irene Knapp <ireneista@gmail.com>" + ]; + dependencies = [ + { + name = "advent_lib"; + packageId = "advent_lib"; + } + ]; + devDependencies = [ + { + name = "assert_cmd"; + packageId = "assert_cmd"; + } + ]; + + }; + "advent_lib" = rec { + crateName = "advent_lib"; + version = "0.1.0"; + edition = "2018"; + src = (builtins.filterSource sourceFilter ./lib); + authors = [ + "Irene Knapp <ireneista@gmail.com>" + ]; + dependencies = [ + { + name = "lalrpop-util"; + packageId = "lalrpop-util"; + } + ]; + buildDependencies = [ + { + name = "lalrpop"; + packageId = "lalrpop"; + features = [ "lexer" ]; + } + ]; + + }; + "aho-corasick" = rec { + crateName = "aho-corasick"; + version = "0.7.18"; + edition = "2018"; + sha256 = "0vv50b3nvkhyy7x7ip19qnsq11bqlnffkmj2yx2xlyk5wzawydqy"; + libName = "aho_corasick"; + authors = [ + "Andrew Gallant <jamslam@gmail.com>" + ]; + dependencies = [ + { + name = "memchr"; + packageId = "memchr"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "std" ]; + "std" = [ "memchr/std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "ascii-canvas" = rec { + crateName = "ascii-canvas"; + version = "3.0.0"; + edition = "2018"; + sha256 = "1in38ziqn4kh9sw89ys4naaqzvvjscfs0m4djqbfq7455v5fq948"; + authors = [ + "Niko Matsakis <niko@alum.mit.edu>" + ]; + dependencies = [ + { + name = "term"; + packageId = "term"; + } + ]; + + }; + "assert_cmd" = rec { + crateName = "assert_cmd"; + version = "0.10.2"; + edition = "2015"; + crateBin = []; + sha256 = "0rfc8mc13bd7zl3ha6klnqzcpjyfxpk2nd5phyxf9r3m1wk5rb5p"; + authors = [ + "Pascal Hertleif <killercup@gmail.com>" + "Ed Page <eopage@gmail.com>" + ]; + dependencies = [ + { + name = "escargot"; + packageId = "escargot"; + } + { + name = "predicates"; + packageId = "predicates"; + usesDefaultFeatures = false; + features = [ "difference" ]; + } + { + name = "predicates-core"; + packageId = "predicates-core"; + } + { + name = "predicates-tree"; + packageId = "predicates-tree"; + } + ]; + + }; + "atty" = rec { + crateName = "atty"; + version = "0.2.14"; + edition = "2015"; + sha256 = "1s7yslcs6a28c5vz7jwj63lkfgyx8mx99fdirlhi9lbhhzhrpcyr"; + authors = [ + "softprops <d.tangren@gmail.com>" + ]; + dependencies = [ + { + name = "hermit-abi"; + packageId = "hermit-abi"; + target = { target, features }: (target."os" == "hermit"); + } + { + name = "libc"; + packageId = "libc"; + usesDefaultFeatures = false; + target = { target, features }: target."unix"; + } + { + name = "winapi"; + packageId = "winapi"; + target = { target, features }: target."windows"; + features = [ "consoleapi" "processenv" "minwinbase" "minwindef" "winbase" ]; + } + ]; + + }; + "autocfg" = rec { + crateName = "autocfg"; + version = "1.0.1"; + edition = "2015"; + sha256 = "0jj6i9zn4gjl03kjvziqdji6rwx8ykz8zk2ngpc331z2g3fk3c6d"; + authors = [ + "Josh Stone <cuviper@gmail.com>" + ]; + + }; + "bit-set" = rec { + crateName = "bit-set"; + version = "0.5.2"; + edition = "2015"; + sha256 = "1pjrmpsnad5ipwjsv8ppi0qrhqvgpyn3wfbvk7jy8dga6mhf24bf"; + authors = [ + "Alexis Beingessner <a.beingessner@gmail.com>" + ]; + dependencies = [ + { + name = "bit-vec"; + packageId = "bit-vec"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "std" ]; + "std" = [ "bit-vec/std" ]; + }; + }; + "bit-vec" = rec { + crateName = "bit-vec"; + version = "0.6.3"; + edition = "2015"; + sha256 = "1ywqjnv60cdh1slhz67psnp422md6jdliji6alq0gmly2xm9p7rl"; + authors = [ + "Alexis Beingessner <a.beingessner@gmail.com>" + ]; + features = { + "default" = [ "std" ]; + "serde_no_std" = [ "serde/alloc" ]; + "serde_std" = [ "std" "serde/std" ]; + }; + }; + "bitflags" = rec { + crateName = "bitflags"; + version = "1.3.2"; + edition = "2018"; + sha256 = "12ki6w8gn1ldq7yz9y680llwk5gmrhrzszaa17g1sbrw2r2qvwxy"; + authors = [ + "The Rust Project Developers" + ]; + features = { + "rustc-dep-of-std" = [ "core" "compiler_builtins" ]; + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "cfg-if" = rec { + crateName = "cfg-if"; + version = "1.0.0"; + edition = "2018"; + sha256 = "1za0vb97n4brpzpv8lsbnzmq5r8f2b0cpqqr0sy8h5bn751xxwds"; + authors = [ + "Alex Crichton <alex@alexcrichton.com>" + ]; + features = { + "rustc-dep-of-std" = [ "core" "compiler_builtins" ]; + }; + }; + "crunchy" = rec { + crateName = "crunchy"; + version = "0.2.2"; + edition = "2015"; + sha256 = "1dx9mypwd5mpfbbajm78xcrg5lirqk7934ik980mmaffg3hdm0bs"; + authors = [ + "Vurich <jackefransham@hotmail.co.uk>" + ]; + features = { + "default" = [ "limit_128" ]; + }; + resolvedDefaultFeatures = [ "default" "limit_128" ]; + }; + "diff" = rec { + crateName = "diff"; + version = "0.1.12"; + edition = "2015"; + sha256 = "16b40bhsa2qgvgvxs983l625pkxyp6m0mzmpwg2605cvj53yl98f"; + authors = [ + "Utkarsh Kukreti <utkarshkukreti@gmail.com>" + ]; + + }; + "difference" = rec { + crateName = "difference"; + version = "2.0.0"; + edition = "2015"; + crateBin = []; + sha256 = "1621wx4k8h452p6xzmzzvm7mz87kxh4yqz0kzxfjj9xmjxlbyk2j"; + authors = [ + "Johann Hofmann <mail@johann-hofmann.com>" + ]; + features = { + "bin" = [ "getopts" ]; + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "dirs-next" = rec { + crateName = "dirs-next"; + version = "2.0.0"; + edition = "2018"; + sha256 = "1q9kr151h9681wwp6is18750ssghz6j9j7qm7qi1ngcwy7mzi35r"; + authors = [ + "The @xdg-rs members" + ]; + dependencies = [ + { + name = "cfg-if"; + packageId = "cfg-if"; + } + { + name = "dirs-sys-next"; + packageId = "dirs-sys-next"; + } + ]; + + }; + "dirs-sys-next" = rec { + crateName = "dirs-sys-next"; + version = "0.1.2"; + edition = "2018"; + sha256 = "0kavhavdxv4phzj4l0psvh55hszwnr0rcz8sxbvx20pyqi2a3gaf"; + authors = [ + "The @xdg-rs members" + ]; + dependencies = [ + { + name = "libc"; + packageId = "libc"; + target = { target, features }: target."unix"; + } + { + name = "redox_users"; + packageId = "redox_users"; + usesDefaultFeatures = false; + target = { target, features }: (target."os" == "redox"); + } + { + name = "winapi"; + packageId = "winapi"; + target = { target, features }: target."windows"; + features = [ "knownfolders" "objbase" "shlobj" "winbase" "winerror" ]; + } + ]; + + }; + "either" = rec { + crateName = "either"; + version = "1.6.1"; + edition = "2015"; + sha256 = "0mwl9vngqf5jvrhmhn9x60kr5hivxyjxbmby2pybncxfqhf4z3g7"; + authors = [ + "bluss" + ]; + features = { + "default" = [ "use_std" ]; + }; + }; + "ena" = rec { + crateName = "ena"; + version = "0.14.0"; + edition = "2015"; + sha256 = "1hrnkx2swbczn0jzpscxxipx7jcxhg6sf9vk911ff91wm6a2nh6p"; + authors = [ + "Niko Matsakis <niko@alum.mit.edu>" + ]; + dependencies = [ + { + name = "log"; + packageId = "log"; + } + ]; + features = { + "congruence-closure" = [ "petgraph" ]; + "persistent" = [ "dogged" ]; + }; + }; + "escargot" = rec { + crateName = "escargot"; + version = "0.3.1"; + edition = "2015"; + crateBin = []; + sha256 = "19fmn7bz1h6nlqy0mp825xwjwnrjn4xjdpwc06jl51j3fiz1znqr"; + authors = [ + "Ed Page <eopage@gmail.com>" + ]; + dependencies = [ + { + name = "serde"; + packageId = "serde"; + features = [ "derive" ]; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + ]; + + }; + "fixedbitset" = rec { + crateName = "fixedbitset"; + version = "0.2.0"; + edition = "2015"; + sha256 = "0kg03p777wc0dajd9pvlcnsyrwa8dhqwf0sd9r4dw0p82rs39arp"; + authors = [ + "bluss" + ]; + features = { + "default" = [ "std" ]; + }; + }; + "getrandom" = rec { + crateName = "getrandom"; + version = "0.2.3"; + edition = "2018"; + sha256 = "0lr7mnkvnzdh1xxmwmhhbm4gwg29k3m2rzhpjmjm4k2jcfa9kkbz"; + authors = [ + "The Rand Project Developers" + ]; + dependencies = [ + { + name = "cfg-if"; + packageId = "cfg-if"; + } + { + name = "libc"; + packageId = "libc"; + usesDefaultFeatures = false; + target = { target, features }: target."unix"; + } + { + name = "wasi"; + packageId = "wasi"; + target = { target, features }: (target."os" == "wasi"); + } + ]; + features = { + "js" = [ "wasm-bindgen" "js-sys" ]; + "rustc-dep-of-std" = [ "compiler_builtins" "core" "libc/rustc-dep-of-std" "wasi/rustc-dep-of-std" ]; + }; + resolvedDefaultFeatures = [ "std" ]; + }; + "hashbrown" = rec { + crateName = "hashbrown"; + version = "0.11.2"; + edition = "2018"; + sha256 = "0vkjsf5nzs7qcia5ya79j9sq2p1caz4crrncr1675wwyj3ag0pmb"; + authors = [ + "Amanieu d'Antras <amanieu@gmail.com>" + ]; + features = { + "ahash-compile-time-rng" = [ "ahash/compile-time-rng" ]; + "default" = [ "ahash" "inline-more" ]; + "rustc-dep-of-std" = [ "nightly" "core" "compiler_builtins" "alloc" "rustc-internal-api" ]; + }; + resolvedDefaultFeatures = [ "raw" ]; + }; + "hermit-abi" = rec { + crateName = "hermit-abi"; + version = "0.1.19"; + edition = "2018"; + sha256 = "0cxcm8093nf5fyn114w8vxbrbcyvv91d4015rdnlgfll7cs6gd32"; + authors = [ + "Stefan Lankes" + ]; + dependencies = [ + { + name = "libc"; + packageId = "libc"; + usesDefaultFeatures = false; + } + ]; + features = { + "rustc-dep-of-std" = [ "core" "compiler_builtins/rustc-dep-of-std" "libc/rustc-dep-of-std" ]; + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "indexmap" = rec { + crateName = "indexmap"; + version = "1.7.0"; + edition = "2018"; + sha256 = "19b2zwfajhsfcgny0clv8y4jppy704znfhv8nv2dw9a18l2kcqxw"; + authors = [ + "bluss" + "Josh Stone <cuviper@gmail.com>" + ]; + dependencies = [ + { + name = "hashbrown"; + packageId = "hashbrown"; + usesDefaultFeatures = false; + features = [ "raw" ]; + } + ]; + buildDependencies = [ + { + name = "autocfg"; + packageId = "autocfg"; + } + ]; + features = { + "serde-1" = [ "serde" ]; + }; + }; + "instant" = rec { + crateName = "instant"; + version = "0.1.12"; + edition = "2018"; + sha256 = "0b2bx5qdlwayriidhrag8vhy10kdfimfhmb3jnjmsz2h9j1bwnvs"; + authors = [ + "sebcrozet <developer@crozet.re>" + ]; + dependencies = [ + { + name = "cfg-if"; + packageId = "cfg-if"; + } + ]; + features = { + "wasm-bindgen" = [ "js-sys" "wasm-bindgen_rs" "web-sys" ]; + }; + }; + "itertools" = rec { + crateName = "itertools"; + version = "0.10.1"; + edition = "2018"; + sha256 = "1bsyxnm20x05rwc5qskrqy4cfswrcadzlwc26dkqml6hz64vipb9"; + authors = [ + "bluss" + ]; + dependencies = [ + { + name = "either"; + packageId = "either"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "use_std" ]; + "use_std" = [ "use_alloc" ]; + }; + resolvedDefaultFeatures = [ "use_alloc" "use_std" ]; + }; + "itoa" = rec { + crateName = "itoa"; + version = "0.4.8"; + edition = "2015"; + sha256 = "1m1dairwyx8kfxi7ab3b5jc71z1vigh9w4shnhiajji9avzr26dp"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + features = { + "default" = [ "std" ]; + }; + }; + "lalrpop" = rec { + crateName = "lalrpop"; + version = "0.19.6"; + edition = "2015"; + crateBin = []; + sha256 = "1249rwimx8mjza4rbxsnf6k87d36h82w0frw53qmpbr9qpqp8ldi"; + authors = [ + "Niko Matsakis <niko@alum.mit.edu>" + ]; + dependencies = [ + { + name = "ascii-canvas"; + packageId = "ascii-canvas"; + usesDefaultFeatures = false; + } + { + name = "atty"; + packageId = "atty"; + usesDefaultFeatures = false; + } + { + name = "bit-set"; + packageId = "bit-set"; + usesDefaultFeatures = false; + } + { + name = "diff"; + packageId = "diff"; + usesDefaultFeatures = false; + } + { + name = "ena"; + packageId = "ena"; + usesDefaultFeatures = false; + } + { + name = "itertools"; + packageId = "itertools"; + usesDefaultFeatures = false; + features = [ "use_std" ]; + } + { + name = "lalrpop-util"; + packageId = "lalrpop-util"; + } + { + name = "petgraph"; + packageId = "petgraph"; + usesDefaultFeatures = false; + } + { + name = "pico-args"; + packageId = "pico-args"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "regex"; + packageId = "regex"; + usesDefaultFeatures = false; + features = [ "std" ]; + } + { + name = "regex-syntax"; + packageId = "regex-syntax"; + usesDefaultFeatures = false; + } + { + name = "string_cache"; + packageId = "string_cache"; + usesDefaultFeatures = false; + } + { + name = "term"; + packageId = "term"; + usesDefaultFeatures = false; + } + { + name = "tiny-keccak"; + packageId = "tiny-keccak"; + features = [ "sha3" ]; + } + { + name = "unicode-xid"; + packageId = "unicode-xid"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "lexer" "pico-args" ]; + "lexer" = [ "lalrpop-util/lexer" ]; + }; + resolvedDefaultFeatures = [ "default" "lexer" "pico-args" ]; + }; + "lalrpop-util" = rec { + crateName = "lalrpop-util"; + version = "0.19.6"; + edition = "2018"; + sha256 = "0y6jvibyj4l4k5db2ns90fv8dzs1qy1gk9d0m05wkz0y6v78rrfk"; + authors = [ + "Niko Matsakis <niko@alum.mit.edu>" + ]; + dependencies = [ + { + name = "regex"; + packageId = "regex"; + optional = true; + } + ]; + features = { + "default" = [ "std" ]; + "lexer" = [ "regex" ]; + }; + resolvedDefaultFeatures = [ "default" "lexer" "regex" "std" ]; + }; + "lazy_static" = rec { + crateName = "lazy_static"; + version = "1.4.0"; + edition = "2015"; + sha256 = "0in6ikhw8mgl33wjv6q6xfrb5b9jr16q8ygjy803fay4zcisvaz2"; + authors = [ + "Marvin Löbel <loebel.marvin@gmail.com>" + ]; + features = { + "spin_no_std" = [ "spin" ]; + }; + }; + "libc" = rec { + crateName = "libc"; + version = "0.2.108"; + edition = "2015"; + sha256 = "06finl0p44lvqyw7s0qgc7bgmdz771gfg6bmmxlyrcbngsss28c5"; + authors = [ + "The Rust Project Developers" + ]; + features = { + "default" = [ "std" ]; + "rustc-dep-of-std" = [ "align" "rustc-std-workspace-core" ]; + "use_std" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "lock_api" = rec { + crateName = "lock_api"; + version = "0.4.5"; + edition = "2018"; + sha256 = "028izfyraynijd9h9x5miv1vmg6sjnw1v95wgm7f4xlr7h4lsaki"; + authors = [ + "Amanieu d'Antras <amanieu@gmail.com>" + ]; + dependencies = [ + { + name = "scopeguard"; + packageId = "scopeguard"; + usesDefaultFeatures = false; + } + ]; + features = { + }; + }; + "log" = rec { + crateName = "log"; + version = "0.4.14"; + edition = "2015"; + sha256 = "04175hv0v62shd82qydq58a48k3bjijmk54v38zgqlbxqkkbpfai"; + authors = [ + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "cfg-if"; + packageId = "cfg-if"; + } + ]; + features = { + "kv_unstable" = [ "value-bag" ]; + "kv_unstable_serde" = [ "kv_unstable_std" "value-bag/serde" "serde" ]; + "kv_unstable_std" = [ "std" "kv_unstable" "value-bag/error" ]; + "kv_unstable_sval" = [ "kv_unstable" "value-bag/sval" "sval" ]; + }; + }; + "memchr" = rec { + crateName = "memchr"; + version = "2.4.1"; + edition = "2018"; + sha256 = "0smq8xzd40njqpfzv5mghigj91fzlfrfg842iz8x0wqvw2dw731h"; + authors = [ + "Andrew Gallant <jamslam@gmail.com>" + "bluss" + ]; + features = { + "default" = [ "std" ]; + "rustc-dep-of-std" = [ "core" "compiler_builtins" ]; + "use_std" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "new_debug_unreachable" = rec { + crateName = "new_debug_unreachable"; + version = "1.0.4"; + edition = "2018"; + sha256 = "0m1bg3wz3nvxdryg78x4i8hh9fys4wp2bi0zg821dhvf44v4g8p4"; + libName = "debug_unreachable"; + authors = [ + "Matt Brubeck <mbrubeck@limpet.net>" + "Jonathan Reem <jonathan.reem@gmail.com>" + ]; + + }; + "parking_lot" = rec { + crateName = "parking_lot"; + version = "0.11.2"; + edition = "2018"; + sha256 = "16gzf41bxmm10x82bla8d6wfppy9ym3fxsmdjyvn61m66s0bf5vx"; + authors = [ + "Amanieu d'Antras <amanieu@gmail.com>" + ]; + dependencies = [ + { + name = "instant"; + packageId = "instant"; + } + { + name = "lock_api"; + packageId = "lock_api"; + } + { + name = "parking_lot_core"; + packageId = "parking_lot_core"; + } + ]; + features = { + "arc_lock" = [ "lock_api/arc_lock" ]; + "deadlock_detection" = [ "parking_lot_core/deadlock_detection" ]; + "nightly" = [ "parking_lot_core/nightly" "lock_api/nightly" ]; + "owning_ref" = [ "lock_api/owning_ref" ]; + "serde" = [ "lock_api/serde" ]; + "stdweb" = [ "instant/stdweb" ]; + "wasm-bindgen" = [ "instant/wasm-bindgen" ]; + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "parking_lot_core" = rec { + crateName = "parking_lot_core"; + version = "0.8.5"; + edition = "2018"; + sha256 = "05ij4zxsylx99srbq8qd1k2wiwaq8krkf9y4cqkhvb5wjca8wvnp"; + authors = [ + "Amanieu d'Antras <amanieu@gmail.com>" + ]; + dependencies = [ + { + name = "cfg-if"; + packageId = "cfg-if"; + } + { + name = "instant"; + packageId = "instant"; + } + { + name = "libc"; + packageId = "libc"; + target = { target, features }: target."unix"; + } + { + name = "redox_syscall"; + packageId = "redox_syscall"; + target = { target, features }: (target."os" == "redox"); + } + { + name = "smallvec"; + packageId = "smallvec"; + } + { + name = "winapi"; + packageId = "winapi"; + target = { target, features }: target."windows"; + features = [ "winnt" "ntstatus" "minwindef" "winerror" "winbase" "errhandlingapi" "handleapi" ]; + } + ]; + features = { + "deadlock_detection" = [ "petgraph" "thread-id" "backtrace" ]; + }; + }; + "petgraph" = rec { + crateName = "petgraph"; + version = "0.5.1"; + edition = "2018"; + sha256 = "1dzxda6z17sfxly11m8ja3iargh73pw0s1sdgjyp0qp5dm51cza6"; + authors = [ + "bluss" + "mitchmindtree" + ]; + dependencies = [ + { + name = "fixedbitset"; + packageId = "fixedbitset"; + usesDefaultFeatures = false; + } + { + name = "indexmap"; + packageId = "indexmap"; + } + ]; + features = { + "all" = [ "unstable" "quickcheck" "matrix_graph" "stable_graph" "graphmap" ]; + "default" = [ "graphmap" "stable_graph" "matrix_graph" ]; + "serde-1" = [ "serde" "serde_derive" ]; + "unstable" = [ "generate" ]; + }; + }; + "phf_shared" = rec { + crateName = "phf_shared"; + version = "0.8.0"; + edition = "2018"; + sha256 = "1xssnqrrcn0nr9ayqrnm8xm37ac4xvwcx8pax7jxss7yxawzh360"; + authors = [ + "Steven Fackler <sfackler@gmail.com>" + ]; + dependencies = [ + { + name = "siphasher"; + packageId = "siphasher"; + } + ]; + features = { + "default" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "pico-args" = rec { + crateName = "pico-args"; + version = "0.4.2"; + edition = "2018"; + sha256 = "0s646i0pbcck300rqldb21m151zxp66m3mdskha063blrfbcv2yv"; + authors = [ + "Evgeniy Reizner <razrfalcon@gmail.com>" + ]; + features = { + "default" = [ "eq-separator" ]; + }; + }; + "precomputed-hash" = rec { + crateName = "precomputed-hash"; + version = "0.1.1"; + edition = "2015"; + sha256 = "075k9bfy39jhs53cb2fpb9klfakx2glxnf28zdw08ws6lgpq6lwj"; + authors = [ + "Emilio Cobos Álvarez <emilio@crisal.io>" + ]; + + }; + "predicates" = rec { + crateName = "predicates"; + version = "1.0.8"; + edition = "2018"; + sha256 = "1pr1h0gqak6zc7vdrzaw98spi20lcm70brx3dz6glfxazpvzm77l"; + authors = [ + "Nick Stevens <nick@bitcurry.com>" + ]; + dependencies = [ + { + name = "difference"; + packageId = "difference"; + optional = true; + } + { + name = "predicates-core"; + packageId = "predicates-core"; + } + ]; + features = { + "default" = [ "difference" "regex" "float-cmp" "normalize-line-endings" ]; + }; + resolvedDefaultFeatures = [ "difference" ]; + }; + "predicates-core" = rec { + crateName = "predicates-core"; + version = "1.0.2"; + edition = "2018"; + sha256 = "0l947jviipblyaqsp3p5mvsqq421bg0nxp7mhnm4jpmp4qrmmqsp"; + authors = [ + "Nick Stevens <nick@bitcurry.com>" + ]; + + }; + "predicates-tree" = rec { + crateName = "predicates-tree"; + version = "1.0.4"; + edition = "2018"; + sha256 = "1xsx8j9x2s2dgmn1hnshaa7zv52y5c1l0bsak3ijlwsvj3i7p31k"; + authors = [ + "Nick Stevens <nick@bitcurry.com>" + ]; + dependencies = [ + { + name = "predicates-core"; + packageId = "predicates-core"; + } + { + name = "termtree"; + packageId = "termtree"; + } + ]; + + }; + "proc-macro2" = rec { + crateName = "proc-macro2"; + version = "1.0.32"; + edition = "2018"; + sha256 = "0hqbxlvhiaybakl1gai3mgps1dxsmxricxsr2rfdrh222z0qql5s"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + "Alex Crichton <alex@alexcrichton.com>" + ]; + dependencies = [ + { + name = "unicode-xid"; + packageId = "unicode-xid"; + } + ]; + features = { + "default" = [ "proc-macro" ]; + }; + resolvedDefaultFeatures = [ "default" "proc-macro" ]; + }; + "quote" = rec { + crateName = "quote"; + version = "1.0.10"; + edition = "2018"; + sha256 = "01ff7a76f871ggnby57iagw6499vci4bihcr11g6bqzjlp38rg1q"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "proc-macro" ]; + "proc-macro" = [ "proc-macro2/proc-macro" ]; + }; + resolvedDefaultFeatures = [ "default" "proc-macro" ]; + }; + "redox_syscall" = rec { + crateName = "redox_syscall"; + version = "0.2.10"; + edition = "2018"; + sha256 = "1zq36bhw4c6xig340ja1jmr36iy0d3djp8smsabxx71676bg70w3"; + libName = "syscall"; + authors = [ + "Jeremy Soller <jackpot51@gmail.com>" + ]; + dependencies = [ + { + name = "bitflags"; + packageId = "bitflags"; + } + ]; + + }; + "redox_users" = rec { + crateName = "redox_users"; + version = "0.4.0"; + edition = "2018"; + sha256 = "0r5y1a26flkn6gkayi558jg5dzh2m2fdsapgkpn7mj01v3rk51aj"; + authors = [ + "Jose Narvaez <goyox86@gmail.com>" + "Wesley Hershberger <mggmugginsmc@gmail.com>" + ]; + dependencies = [ + { + name = "getrandom"; + packageId = "getrandom"; + features = [ "std" ]; + } + { + name = "redox_syscall"; + packageId = "redox_syscall"; + } + ]; + features = { + "auth" = [ "rust-argon2" ]; + "default" = [ "auth" ]; + }; + }; + "regex" = rec { + crateName = "regex"; + version = "1.5.4"; + edition = "2018"; + sha256 = "0qf479kjbmb582h4d1d6gfl75h0j8aq2nrdi5wg6zdcy6llqcynh"; + authors = [ + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "aho-corasick"; + packageId = "aho-corasick"; + optional = true; + } + { + name = "memchr"; + packageId = "memchr"; + optional = true; + } + { + name = "regex-syntax"; + packageId = "regex-syntax"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "std" "perf" "unicode" "regex-syntax/default" ]; + "perf" = [ "perf-cache" "perf-dfa" "perf-inline" "perf-literal" ]; + "perf-literal" = [ "aho-corasick" "memchr" ]; + "unicode" = [ "unicode-age" "unicode-bool" "unicode-case" "unicode-gencat" "unicode-perl" "unicode-script" "unicode-segment" "regex-syntax/unicode" ]; + "unicode-age" = [ "regex-syntax/unicode-age" ]; + "unicode-bool" = [ "regex-syntax/unicode-bool" ]; + "unicode-case" = [ "regex-syntax/unicode-case" ]; + "unicode-gencat" = [ "regex-syntax/unicode-gencat" ]; + "unicode-perl" = [ "regex-syntax/unicode-perl" ]; + "unicode-script" = [ "regex-syntax/unicode-script" ]; + "unicode-segment" = [ "regex-syntax/unicode-segment" ]; + "unstable" = [ "pattern" ]; + "use_std" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "aho-corasick" "default" "memchr" "perf" "perf-cache" "perf-dfa" "perf-inline" "perf-literal" "std" "unicode" "unicode-age" "unicode-bool" "unicode-case" "unicode-gencat" "unicode-perl" "unicode-script" "unicode-segment" ]; + }; + "regex-syntax" = rec { + crateName = "regex-syntax"; + version = "0.6.25"; + edition = "2018"; + sha256 = "16y87hz1bxmmz6kk360cxwfm3jnbsxb3x4zw9x1gzz7khic2i5zl"; + authors = [ + "The Rust Project Developers" + ]; + features = { + "default" = [ "unicode" ]; + "unicode" = [ "unicode-age" "unicode-bool" "unicode-case" "unicode-gencat" "unicode-perl" "unicode-script" "unicode-segment" ]; + }; + resolvedDefaultFeatures = [ "default" "unicode" "unicode-age" "unicode-bool" "unicode-case" "unicode-gencat" "unicode-perl" "unicode-script" "unicode-segment" ]; + }; + "rustversion" = rec { + crateName = "rustversion"; + version = "1.0.5"; + edition = "2018"; + sha256 = "1250m7ymrhp3c5xfmliskmknhf23r7x3cirxy9wmrdwbfnfr1cv1"; + procMacro = true; + build = "build/build.rs"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + + }; + "ryu" = rec { + crateName = "ryu"; + version = "1.0.6"; + edition = "2018"; + sha256 = "0s35bwagycbzwmbj0fngm4jljnan272cz12i84kbmfbalssi75iw"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + features = { + }; + }; + "scopeguard" = rec { + crateName = "scopeguard"; + version = "1.1.0"; + edition = "2015"; + sha256 = "1kbqm85v43rq92vx7hfiay6pmcga03vrjbbfwqpyj3pwsg3b16nj"; + authors = [ + "bluss" + ]; + features = { + "default" = [ "use_std" ]; + }; + }; + "serde" = rec { + crateName = "serde"; + version = "1.0.130"; + edition = "2015"; + sha256 = "04y9s1mxcxakg9bhfdiff9w4zzprk6m6dazcpmpi8nfg6zg0cbgi"; + authors = [ + "Erick Tryzelaar <erick.tryzelaar@gmail.com>" + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "serde_derive"; + packageId = "serde_derive"; + optional = true; + } + ]; + devDependencies = [ + { + name = "serde_derive"; + packageId = "serde_derive"; + } + ]; + features = { + "default" = [ "std" ]; + "derive" = [ "serde_derive" ]; + }; + resolvedDefaultFeatures = [ "default" "derive" "serde_derive" "std" ]; + }; + "serde_derive" = rec { + crateName = "serde_derive"; + version = "1.0.130"; + edition = "2015"; + sha256 = "12shxhi47db54i4j44ic2nl299x5p89ngna0w3m6854nn4d1mg6p"; + procMacro = true; + authors = [ + "Erick Tryzelaar <erick.tryzelaar@gmail.com>" + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn"; + } + ]; + features = { + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "serde_json" = rec { + crateName = "serde_json"; + version = "1.0.72"; + edition = "2018"; + sha256 = "09xmy9iycl8r8bkrgbbxbwbjwj5dii3bbhk812wnzyidgy1s1zyh"; + authors = [ + "Erick Tryzelaar <erick.tryzelaar@gmail.com>" + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "itoa"; + packageId = "itoa"; + usesDefaultFeatures = false; + } + { + name = "ryu"; + packageId = "ryu"; + } + { + name = "serde"; + packageId = "serde"; + usesDefaultFeatures = false; + } + ]; + features = { + "alloc" = [ "serde/alloc" ]; + "default" = [ "std" ]; + "preserve_order" = [ "indexmap" ]; + "std" = [ "serde/std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "siphasher" = rec { + crateName = "siphasher"; + version = "0.3.7"; + edition = "2018"; + sha256 = "12wkdsvxq8ljckpsh92ri52w8z0gh32cclxb4lvd695pz6l98d2k"; + authors = [ + "Frank Denis <github@pureftpd.org>" + ]; + features = { + "default" = [ "std" ]; + "serde_no_std" = [ "serde/alloc" ]; + "serde_std" = [ "std" "serde/std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "smallvec" = rec { + crateName = "smallvec"; + version = "1.7.0"; + edition = "2018"; + sha256 = "02gka690j8l12gl50ifg7axqnx1m6v6d1byaq0wl3fx66p3vdjhy"; + authors = [ + "The Servo Project Developers" + ]; + features = { + "const_new" = [ "const_generics" ]; + }; + }; + "string_cache" = rec { + crateName = "string_cache"; + version = "0.8.2"; + edition = "2018"; + sha256 = "1in0va6rj884r795swff18jln4q2aqiyf6p77k93fz96nqwhygwj"; + authors = [ + "The Servo Project Developers" + ]; + dependencies = [ + { + name = "lazy_static"; + packageId = "lazy_static"; + } + { + name = "new_debug_unreachable"; + packageId = "new_debug_unreachable"; + } + { + name = "parking_lot"; + packageId = "parking_lot"; + } + { + name = "phf_shared"; + packageId = "phf_shared"; + } + { + name = "precomputed-hash"; + packageId = "precomputed-hash"; + } + ]; + features = { + "default" = [ "serde_support" ]; + "serde_support" = [ "serde" ]; + }; + }; + "syn" = rec { + crateName = "syn"; + version = "1.0.82"; + edition = "2018"; + sha256 = "0ncx7gg5mvd16q5xf77hgk09nwmfq0ppsn0vgc9x9jv0pg85vbwd"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + usesDefaultFeatures = false; + } + { + name = "quote"; + packageId = "quote"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "unicode-xid"; + packageId = "unicode-xid"; + } + ]; + features = { + "default" = [ "derive" "parsing" "printing" "clone-impls" "proc-macro" ]; + "printing" = [ "quote" ]; + "proc-macro" = [ "proc-macro2/proc-macro" "quote/proc-macro" ]; + "test" = [ "syn-test-suite/all-features" ]; + }; + resolvedDefaultFeatures = [ "clone-impls" "default" "derive" "parsing" "printing" "proc-macro" "quote" ]; + }; + "term" = rec { + crateName = "term"; + version = "0.7.0"; + edition = "2018"; + sha256 = "07xzxmg7dbhlirpyfq09v7cfb9gxn0077sqqvszgjvyrjnngi7f5"; + authors = [ + "The Rust Project Developers" + "Steven Allen" + ]; + dependencies = [ + { + name = "dirs-next"; + packageId = "dirs-next"; + } + { + name = "rustversion"; + packageId = "rustversion"; + target = { target, features }: target."windows"; + } + { + name = "winapi"; + packageId = "winapi"; + target = { target, features }: target."windows"; + features = [ "consoleapi" "wincon" "handleapi" "fileapi" ]; + } + ]; + features = { + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "termtree" = rec { + crateName = "termtree"; + version = "0.2.3"; + edition = "2018"; + sha256 = "05jchbaqqy88zac8fwrp4yqqkxv7v7xcq1278dbrpr9d18cfr90k"; + + }; + "tiny-keccak" = rec { + crateName = "tiny-keccak"; + version = "2.0.2"; + edition = "2018"; + sha256 = "0dq2x0hjffmixgyf6xv9wgsbcxkd65ld0wrfqmagji8a829kg79c"; + authors = [ + "debris <marek.kotewicz@gmail.com>" + ]; + dependencies = [ + { + name = "crunchy"; + packageId = "crunchy"; + } + ]; + features = { + "fips202" = [ "keccak" "shake" "sha3" ]; + "kmac" = [ "cshake" ]; + "parallel_hash" = [ "cshake" ]; + "sp800" = [ "cshake" "kmac" "tuple_hash" ]; + "tuple_hash" = [ "cshake" ]; + }; + resolvedDefaultFeatures = [ "default" "sha3" ]; + }; + "unicode-xid" = rec { + crateName = "unicode-xid"; + version = "0.2.2"; + edition = "2015"; + sha256 = "1wrkgcw557v311dkdb6n2hrix9dm2qdsb1zpw7pn79l03zb85jwc"; + authors = [ + "erick.tryzelaar <erick.tryzelaar@gmail.com>" + "kwantam <kwantam@gmail.com>" + "Manish Goregaokar <manishsmail@gmail.com>" + ]; + features = { + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "wasi" = rec { + crateName = "wasi"; + version = "0.10.2+wasi-snapshot-preview1"; + edition = "2018"; + sha256 = "1ii7nff4y1mpcrxzzvbpgxm7a1nn3szjf1n21jnx37c2g6dbsvzx"; + authors = [ + "The Cranelift Project Developers" + ]; + features = { + "default" = [ "std" ]; + "rustc-dep-of-std" = [ "compiler_builtins" "core" "rustc-std-workspace-alloc" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "winapi" = rec { + crateName = "winapi"; + version = "0.3.9"; + edition = "2015"; + sha256 = "06gl025x418lchw1wxj64ycr7gha83m44cjr5sarhynd9xkrm0sw"; + authors = [ + "Peter Atashian <retep998@gmail.com>" + ]; + dependencies = [ + { + name = "winapi-i686-pc-windows-gnu"; + packageId = "winapi-i686-pc-windows-gnu"; + target = { target, features }: (stdenv.hostPlatform.config == "i686-pc-windows-gnu"); + } + { + name = "winapi-x86_64-pc-windows-gnu"; + packageId = "winapi-x86_64-pc-windows-gnu"; + target = { target, features }: (stdenv.hostPlatform.config == "x86_64-pc-windows-gnu"); + } + ]; + features = { + "debug" = [ "impl-debug" ]; + }; + resolvedDefaultFeatures = [ "consoleapi" "errhandlingapi" "fileapi" "handleapi" "knownfolders" "minwinbase" "minwindef" "ntstatus" "objbase" "processenv" "shlobj" "winbase" "wincon" "winerror" "winnt" ]; + }; + "winapi-i686-pc-windows-gnu" = rec { + crateName = "winapi-i686-pc-windows-gnu"; + version = "0.4.0"; + edition = "2015"; + sha256 = "1dmpa6mvcvzz16zg6d5vrfy4bxgg541wxrcip7cnshi06v38ffxc"; + authors = [ + "Peter Atashian <retep998@gmail.com>" + ]; + + }; + "winapi-x86_64-pc-windows-gnu" = rec { + crateName = "winapi-x86_64-pc-windows-gnu"; + version = "0.4.0"; + edition = "2015"; + sha256 = "0gqq64czqb64kskjryj8isp62m2sgvx25yyj3kpc2myh85w24bki"; + authors = [ + "Peter Atashian <retep998@gmail.com>" + ]; + + }; + }; + + # +# crate2nix/default.nix (excerpt start) +# + + /* Target (platform) data for conditional dependencies. + This corresponds roughly to what buildRustCrate is setting. + */ + defaultTarget = { + unix = true; + windows = false; + fuchsia = true; + test = false; + + # This doesn't appear to be officially documented anywhere yet. + # See https://github.com/rust-lang-nursery/rust-forge/issues/101. + os = if stdenv.hostPlatform.isDarwin + then "macos" + else stdenv.hostPlatform.parsed.kernel.name; + arch = stdenv.hostPlatform.parsed.cpu.name; + family = "unix"; + env = "gnu"; + endian = + if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian" + then "little" else "big"; + pointer_width = toString stdenv.hostPlatform.parsed.cpu.bits; + vendor = stdenv.hostPlatform.parsed.vendor.name; + debug_assertions = false; + }; + + /* Filters common temp files and build files. */ + # TODO(pkolloch): Substitute with gitignore filter + sourceFilter = name: type: + let + baseName = builtins.baseNameOf (builtins.toString name); + in + ! ( + # Filter out git + baseName == ".gitignore" + || (type == "directory" && baseName == ".git") + + # Filter out build results + || ( + type == "directory" && ( + baseName == "target" + || baseName == "_site" + || baseName == ".sass-cache" + || baseName == ".jekyll-metadata" + || baseName == "build-artifacts" + ) + ) + + # Filter out nix-build result symlinks + || ( + type == "symlink" && lib.hasPrefix "result" baseName + ) + + # Filter out IDE config + || ( + type == "directory" && ( + baseName == ".idea" || baseName == ".vscode" + ) + ) || lib.hasSuffix ".iml" baseName + + # Filter out nix build files + || baseName == "Cargo.nix" + + # Filter out editor backup / swap files. + || lib.hasSuffix "~" baseName + || builtins.match "^\\.sw[a-z]$$" baseName != null + || builtins.match "^\\..*\\.sw[a-z]$$" baseName != null + || lib.hasSuffix ".tmp" baseName + || lib.hasSuffix ".bak" baseName + || baseName == "tests.nix" + ); + + /* Returns a crate which depends on successful test execution + of crate given as the second argument. + + testCrateFlags: list of flags to pass to the test exectuable + testInputs: list of packages that should be available during test execution + */ + crateWithTest = { crate, testCrate, testCrateFlags, testInputs }: + assert builtins.typeOf testCrateFlags == "list"; + assert builtins.typeOf testInputs == "list"; + let + # override the `crate` so that it will build and execute tests instead of + # building the actual lib and bin targets We just have to pass `--test` + # to rustc and it will do the right thing. We execute the tests and copy + # their log and the test executables to $out for later inspection. + test = let + drv = testCrate.override ( + _: { + buildTests = true; + } + ); + in + pkgs.runCommand "run-tests-${testCrate.name}" { + inherit testCrateFlags; + buildInputs = testInputs; + } '' + set -ex + cd ${crate.src} + for file in ${drv}/tests/*; do + $file $testCrateFlags 2>&1 | tee -a $out + done + ''; + in + crate.overrideAttrs ( + old: { + checkPhase = '' + test -e ${test} + ''; + passthru = (old.passthru or {}) // { + inherit test; + }; + } + ); + + /* A restricted overridable version of builtRustCratesWithFeatures. */ + buildRustCrateWithFeatures = + { packageId + , features ? rootFeatures + , crateOverrides ? defaultCrateOverrides + , buildRustCrateFunc ? ( + if crateOverrides == pkgs.defaultCrateOverrides + then buildRustCrate + else buildRustCrate.override { + defaultCrateOverrides = crateOverrides; + } + ) + , runTests ? false + , testCrateFlags ? [] + , testInputs ? [] + }: + lib.makeOverridable + ( + { features, crateOverrides, runTests, testCrateFlags, testInputs }: + let + builtRustCrates = builtRustCratesWithFeatures { + inherit packageId features buildRustCrateFunc; + runTests = false; + }; + builtTestRustCrates = builtRustCratesWithFeatures { + inherit packageId features buildRustCrateFunc; + runTests = true; + }; + drv = builtRustCrates.${packageId}; + testDrv = builtTestRustCrates.${packageId}; + in + if runTests then + crateWithTest { + crate = drv; + testCrate = testDrv; + inherit testCrateFlags testInputs; + } + else drv + ) + { inherit features crateOverrides runTests testCrateFlags testInputs; }; + + /* Returns an attr set with packageId mapped to the result of buildRustCrateFunc + for the corresponding crate. + */ + builtRustCratesWithFeatures = + { packageId + , features + , crateConfigs ? crates + , buildRustCrateFunc + , runTests + , target ? defaultTarget + } @ args: + assert (builtins.isAttrs crateConfigs); + assert (builtins.isString packageId); + assert (builtins.isList features); + assert (builtins.isAttrs target); + assert (builtins.isBool runTests); + let + rootPackageId = packageId; + mergedFeatures = mergePackageFeatures ( + args // { + inherit rootPackageId; + target = target // { test = runTests; }; + } + ); + + buildByPackageId = packageId: buildByPackageIdImpl packageId; + + # Memoize built packages so that reappearing packages are only built once. + builtByPackageId = + lib.mapAttrs (packageId: value: buildByPackageId packageId) crateConfigs; + + buildByPackageIdImpl = packageId: + let + features = mergedFeatures."${packageId}" or []; + crateConfig' = crateConfigs."${packageId}"; + crateConfig = + builtins.removeAttrs crateConfig' [ "resolvedDefaultFeatures" "devDependencies" ]; + devDependencies = + lib.optionals + (runTests && packageId == rootPackageId) + (crateConfig'.devDependencies or []); + dependencies = + dependencyDerivations { + inherit builtByPackageId features target; + dependencies = + (crateConfig.dependencies or []) + ++ devDependencies; + }; + buildDependencies = + dependencyDerivations { + inherit builtByPackageId features target; + dependencies = crateConfig.buildDependencies or []; + }; + + filterEnabledDependenciesForThis = dependencies: filterEnabledDependencies { + inherit dependencies features target; + }; + + dependenciesWithRenames = + lib.filter (d: d ? "rename") ( + filterEnabledDependenciesForThis + ( + (crateConfig.buildDependencies or []) + ++ (crateConfig.dependencies or []) + ++ devDependencies + ) + ); + + crateRenames = + builtins.listToAttrs + (map (d: { name = d.name; value = d.rename; }) dependenciesWithRenames); + in + buildRustCrateFunc ( + crateConfig // { + src = crateConfig.src or ( + pkgs.fetchurl { + name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz"; + url = "https://crates.io/api/v1/crates/${crateConfig.crateName}/${crateConfig.version}/download"; + sha256 = crateConfig.sha256; + } + ); + inherit features dependencies buildDependencies crateRenames release; + } + ); + in + builtByPackageId; + + /* Returns the actual derivations for the given dependencies. */ + dependencyDerivations = + { builtByPackageId + , features + , dependencies + , target + }: + assert (builtins.isAttrs builtByPackageId); + assert (builtins.isList features); + assert (builtins.isList dependencies); + assert (builtins.isAttrs target); + let + enabledDependencies = filterEnabledDependencies { + inherit dependencies features target; + }; + depDerivation = dependency: builtByPackageId.${dependency.packageId}; + in + map depDerivation enabledDependencies; + + /* Returns a sanitized version of val with all values substituted that cannot + be serialized as JSON. + */ + sanitizeForJson = val: + if builtins.isAttrs val + then lib.mapAttrs (n: v: sanitizeForJson v) val + else if builtins.isList val + then builtins.map sanitizeForJson val + else if builtins.isFunction val + then "function" + else val; + + /* Returns various tools to debug a crate. */ + debugCrate = { packageId, target ? defaultTarget }: + assert (builtins.isString packageId); + let + debug = rec { + # The built tree as passed to buildRustCrate. + buildTree = buildRustCrateWithFeatures { + buildRustCrateFunc = lib.id; + inherit packageId; + }; + sanitizedBuildTree = sanitizeForJson buildTree; + dependencyTree = sanitizeForJson ( + buildRustCrateWithFeatures { + buildRustCrateFunc = crate: { + "01_crateName" = crate.crateName or false; + "02_features" = crate.features or []; + "03_dependencies" = crate.dependencies or []; + }; + inherit packageId; + } + ); + mergedPackageFeatures = mergePackageFeatures { + features = rootFeatures; + inherit packageId target; + }; + diffedDefaultPackageFeatures = diffDefaultPackageFeatures { + inherit packageId target; + }; + }; + in + { internal = debug; }; + + /* Returns differences between cargo default features and crate2nix default + features. + + This is useful for verifying the feature resolution in crate2nix. + */ + diffDefaultPackageFeatures = + { crateConfigs ? crates + , packageId + , target + }: + assert (builtins.isAttrs crateConfigs); + let + prefixValues = prefix: lib.mapAttrs (n: v: { "${prefix}" = v; }); + mergedFeatures = + prefixValues + "crate2nix" + (mergePackageFeatures { inherit crateConfigs packageId target; features = [ "default" ]; }); + configs = prefixValues "cargo" crateConfigs; + combined = lib.foldAttrs (a: b: a // b) {} [ mergedFeatures configs ]; + onlyInCargo = + builtins.attrNames + (lib.filterAttrs (n: v: !(v ? "crate2nix") && (v ? "cargo")) combined); + onlyInCrate2Nix = + builtins.attrNames + (lib.filterAttrs (n: v: (v ? "crate2nix") && !(v ? "cargo")) combined); + differentFeatures = lib.filterAttrs + ( + n: v: + (v ? "crate2nix") + && (v ? "cargo") + && (v.crate2nix.features or []) != (v."cargo".resolved_default_features or []) + ) + combined; + in + builtins.toJSON { + inherit onlyInCargo onlyInCrate2Nix differentFeatures; + }; + + /* Returns an attrset mapping packageId to the list of enabled features. + + If multiple paths to a dependency enable different features, the + corresponding feature sets are merged. Features in rust are additive. + */ + mergePackageFeatures = + { crateConfigs ? crates + , packageId + , rootPackageId ? packageId + , features ? rootFeatures + , dependencyPath ? [ crates.${packageId}.crateName ] + , featuresByPackageId ? {} + , target + # Adds devDependencies to the crate with rootPackageId. + , runTests ? false + , ... + } @ args: + assert (builtins.isAttrs crateConfigs); + assert (builtins.isString packageId); + assert (builtins.isString rootPackageId); + assert (builtins.isList features); + assert (builtins.isList dependencyPath); + assert (builtins.isAttrs featuresByPackageId); + assert (builtins.isAttrs target); + assert (builtins.isBool runTests); + let + crateConfig = crateConfigs."${packageId}" or (builtins.throw "Package not found: ${packageId}"); + expandedFeatures = expandFeatures (crateConfig.features or {}) features; + + depWithResolvedFeatures = dependency: + let + packageId = dependency.packageId; + features = dependencyFeatures expandedFeatures dependency; + in + { inherit packageId features; }; + + resolveDependencies = cache: path: dependencies: + assert (builtins.isAttrs cache); + assert (builtins.isList dependencies); + let + enabledDependencies = filterEnabledDependencies { + inherit dependencies target; + features = expandedFeatures; + }; + directDependencies = map depWithResolvedFeatures enabledDependencies; + foldOverCache = op: lib.foldl op cache directDependencies; + in + foldOverCache + ( + cache: { packageId, features }: + let + cacheFeatures = cache.${packageId} or []; + combinedFeatures = sortedUnique (cacheFeatures ++ features); + in + if cache ? ${packageId} && cache.${packageId} == combinedFeatures + then cache + else mergePackageFeatures { + features = combinedFeatures; + featuresByPackageId = cache; + inherit crateConfigs packageId target runTests rootPackageId; + } + ); + + cacheWithSelf = + let + cacheFeatures = featuresByPackageId.${packageId} or []; + combinedFeatures = sortedUnique (cacheFeatures ++ expandedFeatures); + in + featuresByPackageId // { + "${packageId}" = combinedFeatures; + }; + + cacheWithDependencies = + resolveDependencies cacheWithSelf "dep" ( + crateConfig.dependencies or [] + ++ lib.optionals + (runTests && packageId == rootPackageId) + (crateConfig.devDependencies or []) + ); + + cacheWithAll = + resolveDependencies + cacheWithDependencies "build" + (crateConfig.buildDependencies or []); + in + cacheWithAll; + + /* Returns the enabled dependencies given the enabled features. */ + filterEnabledDependencies = { dependencies, features, target }: + assert (builtins.isList dependencies); + assert (builtins.isList features); + assert (builtins.isAttrs target); + + lib.filter + ( + dep: + let + targetFunc = dep.target or (features: true); + in + targetFunc { inherit features target; } + && ( + !(dep.optional or false) + || builtins.any (doesFeatureEnableDependency dep) features + ) + ) + dependencies; + + /* Returns whether the given feature should enable the given dependency. */ + doesFeatureEnableDependency = { name, rename ? null, ... }: feature: + let + prefix = "${name}/"; + len = builtins.stringLength prefix; + startsWithPrefix = builtins.substring 0 len feature == prefix; + in + (rename == null && feature == name) + || (rename != null && rename == feature) + || startsWithPrefix; + + /* Returns the expanded features for the given inputFeatures by applying the + rules in featureMap. + + featureMap is an attribute set which maps feature names to lists of further + feature names to enable in case this feature is selected. + */ + expandFeatures = featureMap: inputFeatures: + assert (builtins.isAttrs featureMap); + assert (builtins.isList inputFeatures); + let + expandFeature = feature: + assert (builtins.isString feature); + [ feature ] ++ (expandFeatures featureMap (featureMap."${feature}" or [])); + outFeatures = builtins.concatMap expandFeature inputFeatures; + in + sortedUnique outFeatures; + + /* + Returns the actual features for the given dependency. + + features: The features of the crate that refers this dependency. + */ + dependencyFeatures = features: dependency: + assert (builtins.isList features); + assert (builtins.isAttrs dependency); + let + defaultOrNil = if dependency.usesDefaultFeatures or true + then [ "default" ] + else []; + explicitFeatures = dependency.features or []; + additionalDependencyFeatures = + let + dependencyPrefix = (dependency.rename or dependency.name) + "/"; + dependencyFeatures = + builtins.filter (f: lib.hasPrefix dependencyPrefix f) features; + in + builtins.map (lib.removePrefix dependencyPrefix) dependencyFeatures; + in + defaultOrNil ++ explicitFeatures ++ additionalDependencyFeatures; + + /* Sorts and removes duplicates from a list of strings. */ + sortedUnique = features: + assert (builtins.isList features); + assert (builtins.all builtins.isString features); + let + outFeaturesSet = lib.foldl (set: feature: set // { "${feature}" = 1; }) {} features; + outFeaturesUnique = builtins.attrNames outFeaturesSet; + in + builtins.sort (a: b: a < b) outFeaturesUnique; + + deprecationWarning = message: value: + if strictDeprecation + then builtins.throw "strictDeprecation enabled, aborting: ${message}" + else builtins.trace message value; + + # + # crate2nix/default.nix (excerpt end) + # + + }; +} |