garbage/Cargo.nix

2189 lines
67 KiB
Nix
Raw Permalink Normal View History

2021-09-05 09:13:41 +00:00
# This file was @generated by crate2nix 0.10.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
, buildRustCrateForPkgs ? if buildRustCrate != null
then lib.warn "crate2nix: Passing `buildRustCrate` as argument to Cargo.nix is deprecated. If you don't customize `buildRustCrate`, replace `callPackage ./Cargo.nix {}` by `import ./Cargo.nix { inherit pkgs; }`, and if you need to customize `buildRustCrate`, use `buildRustCrateForPkgs` instead." (_: buildRustCrate)
else pkgs: pkgs.buildRustCrate
# Deprecated
, buildRustCrate ? null
# 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
# Used for conditional compilation based on CPU feature detection.
, targetFeatures ? []
# Whether to perform release builds: longer compile times, faster binaries.
, release ? true
# Additional crate2nix configuration if it exists.
, crateConfig
? if builtins.pathExists ./crate-config.nix
then pkgs.callPackage ./crate-config.nix {}
else {}
}:
rec {
#
# "public" attributes that we attempt to keep stable with new versions of crate2nix.
#
rootCrate = rec {
packageId = "garbage";
# Use this attribute to refer to the derivation building your root crate package.
# You can override the features with rootCrate.build.override { features = [ "default" "feature1" ... ]; }.
build = internal.buildRustCrateWithFeatures {
inherit packageId;
};
# Debug support which might change between releases.
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
# Refer your crate build derivation by name here.
# You can override the features with
# workspaceMembers."${crateName}".build.override { features = [ "default" "feature1" ... ]; }.
workspaceMembers = {
"garbage" = rec {
packageId = "garbage";
build = internal.buildRustCrateWithFeatures {
packageId = "garbage";
};
# Debug support which might change between releases.
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
};
# A derivation that joins the outputs of all workspace members together.
allWorkspaceMembers = pkgs.symlinkJoin {
name = "all-workspace-members";
paths =
let members = builtins.attrValues workspaceMembers;
in builtins.map (m: m.build) members;
};
#
# "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 = {
"ansi_term" = rec {
crateName = "ansi_term";
version = "0.11.0";
edition = "2015";
sha256 = "16wpvrghvd0353584i1idnsgm0r3vchg8fyrm0x8ayv1rgvbljgf";
authors = [
"ogham@bsago.me"
"Ryan Scheel (Havvy) <ryan.havvy@gmail.com>"
"Josh Triplett <josh@joshtriplett.org>"
];
dependencies = [
{
name = "winapi";
packageId = "winapi";
target = { target, features }: (target."os" == "windows");
features = [ "errhandlingapi" "consoleapi" "processenv" ];
}
];
};
"arrayref" = rec {
crateName = "arrayref";
version = "0.3.6";
edition = "2015";
sha256 = "0i6m1l3f73i0lf0cjdf5rh3xpvxydyhfbakq7xx7bkrp5qajgid4";
authors = [
"David Roundy <roundyd@physics.oregonstate.edu>"
];
};
"arrayvec" = rec {
crateName = "arrayvec";
version = "0.5.2";
edition = "2018";
sha256 = "12q6hn01x5435bprwlb7w9m7817dyfq55yrl4psygr78bp32zdi3";
authors = [
"bluss"
];
features = {
"default" = [ "std" ];
};
};
"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" or false);
}
{
name = "winapi";
packageId = "winapi";
target = { target, features }: (target."windows" or false);
features = [ "consoleapi" "processenv" "minwinbase" "minwindef" "winbase" ];
}
];
};
"autocfg" = rec {
crateName = "autocfg";
version = "1.0.1";
edition = "2015";
sha256 = "0jj6i9zn4gjl03kjvziqdji6rwx8ykz8zk2ngpc331z2g3fk3c6d";
authors = [
"Josh Stone <cuviper@gmail.com>"
];
};
"base64" = rec {
crateName = "base64";
version = "0.13.0";
edition = "2018";
sha256 = "1z82g23mbzjgijkpcrilc7nljpxpvpf7zxf6iyiapkgka2ngwkch";
authors = [
"Alice Maz <alice@alicemaz.com>"
"Marshall Pierce <marshall@mpierce.org>"
];
features = {
"default" = [ "std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"bitflags" = rec {
crateName = "bitflags";
version = "1.2.1";
edition = "2015";
sha256 = "14qnd5nq8p2almk79m4m8ydqhd413yaxsyjp5xd19g3mikzf47fg";
authors = [
"The Rust Project Developers"
];
features = {
};
resolvedDefaultFeatures = [ "default" ];
};
"blake2b_simd" = rec {
crateName = "blake2b_simd";
version = "0.5.11";
edition = "2018";
sha256 = "11y5nm06lpypz65dbxgncs12ckx24i5i4a777ckfhfxd93ili9xg";
authors = [
"Jack O'Connor"
];
dependencies = [
{
name = "arrayref";
packageId = "arrayref";
}
{
name = "arrayvec";
packageId = "arrayvec";
usesDefaultFeatures = false;
}
{
name = "constant_time_eq";
packageId = "constant_time_eq";
}
];
features = {
"default" = [ "std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"byteorder" = rec {
crateName = "byteorder";
version = "1.4.3";
edition = "2018";
sha256 = "0456lv9xi1a5bcm32arknf33ikv76p3fr9yzki4lb2897p2qkh8l";
authors = [
"Andrew Gallant <jamslam@gmail.com>"
];
features = {
"default" = [ "std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"cc" = rec {
crateName = "cc";
version = "1.0.68";
edition = "2018";
crateBin = [];
sha256 = "11ypa8b7iwhjf5fg5j3hvbn2116h9g8v67vyd9s7ljgzq52c4wja";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
features = {
"parallel" = [ "jobserver" ];
};
};
"cfg-if 0.1.10" = rec {
crateName = "cfg-if";
version = "0.1.10";
edition = "2018";
sha256 = "08h80ihs74jcyp24cd75wwabygbbdgl05k6p5dmq8akbr78vv1a7";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
features = {
"rustc-dep-of-std" = [ "core" "compiler_builtins" ];
};
};
"cfg-if 1.0.0" = 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" ];
};
};
"chrono" = rec {
crateName = "chrono";
version = "0.4.19";
edition = "2015";
sha256 = "0wyfl6c00vhfl562spnfcna3zkw8jqvcp652m9iskhl8j26dc2k7";
authors = [
"Kang Seonghoon <public+rust@mearie.org>"
"Brandon W Maister <quodlibetor@gmail.com>"
];
dependencies = [
{
name = "libc";
packageId = "libc";
optional = true;
}
{
name = "num-integer";
packageId = "num-integer";
usesDefaultFeatures = false;
}
{
name = "num-traits";
packageId = "num-traits";
usesDefaultFeatures = false;
}
{
name = "time";
packageId = "time";
optional = true;
}
{
name = "winapi";
packageId = "winapi";
optional = true;
target = { target, features }: (target."windows" or false);
features = [ "std" "minwinbase" "minwindef" "timezoneapi" ];
}
];
features = {
"clock" = [ "libc" "std" "winapi" ];
"default" = [ "clock" "std" "oldtime" ];
"oldtime" = [ "time" ];
"unstable-locales" = [ "pure-rust-locales" "alloc" ];
"wasmbind" = [ "wasm-bindgen" "js-sys" ];
};
resolvedDefaultFeatures = [ "clock" "default" "libc" "oldtime" "std" "time" "winapi" ];
};
"chrono-humanize" = rec {
crateName = "chrono-humanize";
version = "0.2.1";
edition = "2018";
sha256 = "1jvm6fcs3zvz4kcqkp9q5hjy0i2zc17194nb63ckyn0xa0cw3p9f";
authors = [
"Cyril Plisko <cyril.plisko@mountall.com>"
];
dependencies = [
{
name = "chrono";
packageId = "chrono";
}
];
features = {
"wasmbind" = [ "chrono/wasmbind" ];
};
};
"clap" = rec {
crateName = "clap";
version = "2.33.3";
edition = "2015";
sha256 = "00i065a58987k1sbzqmlz721rw521zcg08jmsh40gi3khp3qmr9p";
authors = [
"Kevin K. <kbknapp@gmail.com>"
];
dependencies = [
{
name = "ansi_term";
packageId = "ansi_term";
optional = true;
target = { target, features }: (!(target."windows" or false));
}
{
name = "atty";
packageId = "atty";
optional = true;
}
{
name = "bitflags";
packageId = "bitflags";
}
{
name = "strsim";
packageId = "strsim";
optional = true;
}
{
name = "textwrap";
packageId = "textwrap";
}
{
name = "unicode-width";
packageId = "unicode-width";
}
{
name = "vec_map";
packageId = "vec_map";
optional = true;
}
];
features = {
"color" = [ "ansi_term" "atty" ];
"default" = [ "suggestions" "color" "vec_map" ];
"doc" = [ "yaml" ];
"lints" = [ "clippy" ];
"suggestions" = [ "strsim" ];
"wrap_help" = [ "term_size" "textwrap/term_size" ];
"yaml" = [ "yaml-rust" ];
};
resolvedDefaultFeatures = [ "ansi_term" "atty" "color" "default" "strsim" "suggestions" "vec_map" ];
};
"constant_time_eq" = rec {
crateName = "constant_time_eq";
version = "0.1.5";
edition = "2015";
sha256 = "1g3vp04qzmk6cpzrd19yci6a95m7ap6wy7wkwgiy2pjklklrfl14";
authors = [
"Cesar Eduardo Barros <cesarb@cesarb.eti.br>"
];
};
"crossbeam-utils" = rec {
crateName = "crossbeam-utils";
version = "0.8.5";
edition = "2018";
sha256 = "1ny481cx8a5pdknypb41jqym03dl8x26i2ldyyp3yb3zrq8zqb6q";
authors = [
"The Crossbeam Project Developers"
];
dependencies = [
{
name = "cfg-if";
packageId = "cfg-if 1.0.0";
}
{
name = "lazy_static";
packageId = "lazy_static";
optional = true;
}
];
features = {
"default" = [ "std" ];
"std" = [ "lazy_static" ];
};
resolvedDefaultFeatures = [ "default" "lazy_static" "std" ];
};
"dirs" = rec {
crateName = "dirs";
version = "1.0.5";
edition = "2015";
sha256 = "009rrhzj9pxyncmm2vhlj70npg0cgggv2hjbbkiwdl9vccq8kmrz";
authors = [
"Simon Ochsenreither <simon@ochsenreither.de>"
];
dependencies = [
{
name = "libc";
packageId = "libc";
target = { target, features }: (target."unix" or false);
}
{
name = "redox_users";
packageId = "redox_users";
target = { target, features }: (target."os" == "redox");
}
{
name = "winapi";
packageId = "winapi";
target = { target, features }: (target."windows" or false);
features = [ "knownfolders" "objbase" "shlobj" "winbase" "winerror" ];
}
];
};
"encode_unicode" = rec {
crateName = "encode_unicode";
version = "0.3.6";
edition = "2015";
sha256 = "07w3vzrhxh9lpjgsg2y5bwzfar2aq35mdznvcp3zjl0ssj7d4mx3";
authors = [
"Torbjørn Birch Moltu <t.b.moltu@lyse.net>"
];
features = {
"default" = [ "std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"garbage" = rec {
crateName = "garbage";
version = "0.3.1";
edition = "2018";
crateBin = [
{ name = "garbage"; path = "src/main.rs"; }
];
src = lib.cleanSourceWith { filter = sourceFilter; src = ./.; };
authors = [
"Michael Zhang <mail@mzhang.io>"
];
dependencies = [
{
name = "chrono";
packageId = "chrono";
}
{
name = "chrono-humanize";
packageId = "chrono-humanize";
}
{
name = "lazy_static";
packageId = "lazy_static";
}
{
name = "libc";
packageId = "libc";
}
{
name = "libmount";
packageId = "libmount";
}
{
name = "log";
packageId = "log";
}
{
name = "percent-encoding";
packageId = "percent-encoding";
}
{
name = "prettytable-rs";
packageId = "prettytable-rs";
usesDefaultFeatures = false;
}
{
name = "stderrlog";
packageId = "stderrlog";
}
{
name = "structopt";
packageId = "structopt";
}
{
name = "thiserror";
packageId = "thiserror";
}
{
name = "walkdir";
packageId = "walkdir";
}
{
name = "xdg";
packageId = "xdg";
}
];
};
"getrandom" = rec {
crateName = "getrandom";
version = "0.1.16";
edition = "2018";
sha256 = "1kjzmz60qx9mn615ks1akjbf36n3lkv27zfwbcam0fzmj56wphwg";
authors = [
"The Rand Project Developers"
];
dependencies = [
{
name = "cfg-if";
packageId = "cfg-if 1.0.0";
}
{
name = "libc";
packageId = "libc";
usesDefaultFeatures = false;
target = { target, features }: (target."unix" or false);
}
{
name = "wasi";
packageId = "wasi 0.9.0+wasi-snapshot-preview1";
target = { target, features }: (target."os" == "wasi");
}
];
features = {
"rustc-dep-of-std" = [ "compiler_builtins" "core" ];
"test-in-browser" = [ "wasm-bindgen" ];
"wasm-bindgen" = [ "bindgen" "js-sys" ];
};
};
"heck" = rec {
crateName = "heck";
version = "0.3.3";
edition = "2018";
sha256 = "0b0kkr790p66lvzn9nsmfjvydrbmh9z5gb664jchwgw64vxiwqkd";
authors = [
"Without Boats <woboats@gmail.com>"
];
dependencies = [
{
name = "unicode-segmentation";
packageId = "unicode-segmentation";
}
];
};
"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" ];
};
"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.97";
edition = "2015";
sha256 = "1dlgdziv6nkabx287jjmghnlgc5dqv6fgpvh9n7ibpr0synsvf0j";
authors = [
"The Rust Project Developers"
];
features = {
"default" = [ "std" ];
"rustc-dep-of-std" = [ "align" "rustc-std-workspace-core" ];
"use_std" = [ "std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"libmount" = rec {
crateName = "libmount";
version = "0.1.15";
edition = "2015";
sha256 = "0py3kl473jgfwnfajzr0xi9xs2lk8npks3320md2zgaw5nnw5i13";
authors = [
"paul@colomiets.name"
];
dependencies = [
{
name = "libc";
packageId = "libc";
}
{
name = "nix";
packageId = "nix";
}
{
name = "quick-error";
packageId = "quick-error";
}
];
};
"log" = rec {
crateName = "log";
version = "0.4.14";
edition = "2015";
sha256 = "04175hv0v62shd82qydq58a48k3bjijmk54v38zgqlbxqkkbpfai";
authors = [
"The Rust Project Developers"
];
dependencies = [
{
name = "cfg-if";
packageId = "cfg-if 1.0.0";
}
];
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" ];
};
resolvedDefaultFeatures = [ "std" ];
};
"nix" = rec {
crateName = "nix";
version = "0.14.1";
edition = "2015";
sha256 = "1kmxdlmvnmq8cfpmr3g6wk37rwi2ybdvp1z6z3831m1p23p2nwkc";
authors = [
"The nix-rust Project Developers"
];
dependencies = [
{
name = "bitflags";
packageId = "bitflags";
}
{
name = "cfg-if";
packageId = "cfg-if 0.1.10";
}
{
name = "libc";
packageId = "libc";
}
{
name = "void";
packageId = "void";
}
];
buildDependencies = [
{
name = "cc";
packageId = "cc";
target = {target, features}: (target."os" == "dragonfly");
}
];
};
"num-integer" = rec {
crateName = "num-integer";
version = "0.1.44";
edition = "2015";
sha256 = "1nq152y3304as1iai95hqz8prqnc94lks1s7q05sfjdmcf56kk6j";
authors = [
"The Rust Project Developers"
];
dependencies = [
{
name = "num-traits";
packageId = "num-traits";
usesDefaultFeatures = false;
}
];
buildDependencies = [
{
name = "autocfg";
packageId = "autocfg";
}
];
features = {
"default" = [ "std" ];
"i128" = [ "num-traits/i128" ];
"std" = [ "num-traits/std" ];
};
};
"num-traits" = rec {
crateName = "num-traits";
version = "0.2.14";
edition = "2015";
sha256 = "144j176s2p76azy2ngk2vkdzgwdc0bc8c93jhki8c9fsbknb2r4s";
authors = [
"The Rust Project Developers"
];
buildDependencies = [
{
name = "autocfg";
packageId = "autocfg";
}
];
features = {
"default" = [ "std" ];
};
};
"percent-encoding" = rec {
crateName = "percent-encoding";
version = "2.1.0";
edition = "2015";
sha256 = "0bp3zrsk3kr47fbpipyczidbbx4g54lzxdm77ni1i3qws10mdzfl";
libPath = "lib.rs";
authors = [
"The rust-url developers"
];
};
"prettytable-rs" = rec {
crateName = "prettytable-rs";
version = "0.8.0";
edition = "2015";
crateBin = [];
sha256 = "0bmcsxkcy94hi0jz5db0fz137w5aaf17z2j1ryn2vyh400blpl0g";
libName = "prettytable";
authors = [
"Pierre-Henri Symoneaux"
];
dependencies = [
{
name = "atty";
packageId = "atty";
}
{
name = "encode_unicode";
packageId = "encode_unicode";
}
{
name = "lazy_static";
packageId = "lazy_static";
}
{
name = "term";
packageId = "term";
}
{
name = "unicode-width";
packageId = "unicode-width";
}
];
features = {
"default" = [ "win_crlf" "csv" ];
};
};
"proc-macro-error" = rec {
crateName = "proc-macro-error";
version = "1.0.4";
edition = "2018";
sha256 = "1373bhxaf0pagd8zkyd03kkx6bchzf6g0dkwrwzsnal9z47lj9fs";
authors = [
"CreepySkeleton <creepy-skeleton@yandex.ru>"
];
dependencies = [
{
name = "proc-macro-error-attr";
packageId = "proc-macro-error-attr";
}
{
name = "proc-macro2";
packageId = "proc-macro2";
}
{
name = "quote";
packageId = "quote";
}
{
name = "syn";
packageId = "syn";
optional = true;
usesDefaultFeatures = false;
}
];
buildDependencies = [
{
name = "version_check";
packageId = "version_check";
}
];
features = {
"default" = [ "syn-error" ];
"syn-error" = [ "syn" ];
};
resolvedDefaultFeatures = [ "default" "syn" "syn-error" ];
};
"proc-macro-error-attr" = rec {
crateName = "proc-macro-error-attr";
version = "1.0.4";
edition = "2018";
sha256 = "0sgq6m5jfmasmwwy8x4mjygx5l7kp8s4j60bv25ckv2j1qc41gm1";
procMacro = true;
authors = [
"CreepySkeleton <creepy-skeleton@yandex.ru>"
];
dependencies = [
{
name = "proc-macro2";
packageId = "proc-macro2";
}
{
name = "quote";
packageId = "quote";
}
];
buildDependencies = [
{
name = "version_check";
packageId = "version_check";
}
];
};
"proc-macro2" = rec {
crateName = "proc-macro2";
version = "1.0.27";
edition = "2018";
sha256 = "0f3h0zl5w5090ajmmvpmhkpr4iwqnn5rip3afacabhc657vwmn7h";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
"David Tolnay <dtolnay@gmail.com>"
];
dependencies = [
{
name = "unicode-xid";
packageId = "unicode-xid";
}
];
features = {
"default" = [ "proc-macro" ];
};
resolvedDefaultFeatures = [ "default" "proc-macro" ];
};
"quick-error" = rec {
crateName = "quick-error";
version = "1.2.3";
edition = "2015";
sha256 = "1q6za3v78hsspisc197bg3g7rpc989qycy8ypr8ap8igv10ikl51";
authors = [
"Paul Colomiets <paul@colomiets.name>"
"Colin Kiegel <kiegel@gmx.de>"
];
};
"quote" = rec {
crateName = "quote";
version = "1.0.9";
edition = "2018";
sha256 = "19rjmfqzk26rxbgxy5j2ckqc2v12sw2xw8l4gi8bzpn2bmsbkl63";
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.1.57";
edition = "2015";
sha256 = "1kh59fpwy33w9nwd5iyc283yglq8pf2s41hnhvl48iax9mz0zk21";
libName = "syscall";
authors = [
"Jeremy Soller <jackpot51@gmail.com>"
];
};
"redox_users" = rec {
crateName = "redox_users";
version = "0.3.5";
edition = "2015";
sha256 = "179fxmyqaqzibp533ajgbn4ljah9lrzpqvd3i73h55bs7qrkf1yy";
authors = [
"Jose Narvaez <goyox86@gmail.com>"
"Wesley Hershberger <mggmugginsmc@gmail.com>"
];
dependencies = [
{
name = "getrandom";
packageId = "getrandom";
}
{
name = "redox_syscall";
packageId = "redox_syscall";
}
{
name = "rust-argon2";
packageId = "rust-argon2";
optional = true;
}
];
features = {
"auth" = [ "rust-argon2" ];
"default" = [ "auth" ];
};
resolvedDefaultFeatures = [ "auth" "default" "rust-argon2" ];
};
"rust-argon2" = rec {
crateName = "rust-argon2";
version = "0.8.3";
edition = "2018";
sha256 = "1yvqkv04fqk3cbvyasibr4bqbxa6mij8jdvibakwlcsbjh6q462b";
libName = "argon2";
authors = [
"Martijn Rijkeboer <mrr@sru-systems.com>"
];
dependencies = [
{
name = "base64";
packageId = "base64";
}
{
name = "blake2b_simd";
packageId = "blake2b_simd";
}
{
name = "constant_time_eq";
packageId = "constant_time_eq";
}
{
name = "crossbeam-utils";
packageId = "crossbeam-utils";
optional = true;
}
];
features = {
"default" = [ "crossbeam-utils" ];
};
resolvedDefaultFeatures = [ "crossbeam-utils" "default" ];
};
"same-file" = rec {
crateName = "same-file";
version = "1.0.6";
edition = "2018";
sha256 = "00h5j1w87dmhnvbv9l8bic3y7xxsnjmssvifw2ayvgx9mb1ivz4k";
authors = [
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "winapi-util";
packageId = "winapi-util";
target = { target, features }: (target."windows" or false);
}
];
};
"stderrlog" = rec {
crateName = "stderrlog";
version = "0.5.1";
edition = "2018";
sha256 = "0f2s2lfkjkjfn5w517zy6ffmpc2cw275w9m6mwcs151yzwp3x9a5";
authors = [
"Doug Goldstein <cardoe@cardoe.com>"
];
dependencies = [
{
name = "atty";
packageId = "atty";
}
{
name = "chrono";
packageId = "chrono";
}
{
name = "log";
packageId = "log";
features = [ "std" ];
}
{
name = "termcolor";
packageId = "termcolor";
}
{
name = "thread_local";
packageId = "thread_local";
}
];
};
"strsim" = rec {
crateName = "strsim";
version = "0.8.0";
edition = "2015";
sha256 = "0sjsm7hrvjdifz661pjxq5w4hf190hx53fra8dfvamacvff139cf";
authors = [
"Danny Guo <dannyguo91@gmail.com>"
];
};
"structopt" = rec {
crateName = "structopt";
version = "0.3.21";
edition = "2018";
sha256 = "136j0lvjmpv5syi751vxg8vb30gfyv4k81x8d18kxrj6xvbsqxsj";
authors = [
"Guillaume Pinot <texitoi@texitoi.eu>"
"others"
];
dependencies = [
{
name = "clap";
packageId = "clap";
usesDefaultFeatures = false;
}
{
name = "lazy_static";
packageId = "lazy_static";
}
{
name = "structopt-derive";
packageId = "structopt-derive";
}
];
features = {
"color" = [ "clap/color" ];
"debug" = [ "clap/debug" ];
"default" = [ "clap/default" ];
"doc" = [ "clap/doc" ];
"lints" = [ "clap/lints" ];
"no_cargo" = [ "clap/no_cargo" ];
"paw" = [ "structopt-derive/paw" "paw_dep" ];
"suggestions" = [ "clap/suggestions" ];
"wrap_help" = [ "clap/wrap_help" ];
"yaml" = [ "clap/yaml" ];
};
resolvedDefaultFeatures = [ "default" ];
};
"structopt-derive" = rec {
crateName = "structopt-derive";
version = "0.4.14";
edition = "2018";
sha256 = "143gjwvz3s86hwp070km83y25n8kqp5f01kb1dr19f4ilkywvaav";
procMacro = true;
authors = [
"Guillaume Pinot <texitoi@texitoi.eu>"
];
dependencies = [
{
name = "heck";
packageId = "heck";
}
{
name = "proc-macro-error";
packageId = "proc-macro-error";
}
{
name = "proc-macro2";
packageId = "proc-macro2";
}
{
name = "quote";
packageId = "quote";
}
{
name = "syn";
packageId = "syn";
features = [ "full" ];
}
];
features = {
};
};
"syn" = rec {
crateName = "syn";
version = "1.0.73";
edition = "2018";
sha256 = "1ixw4lscc7009ibaic8g5bvnc94hdcr62ksjk3jjl38363zqj57p";
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" "full" "parsing" "printing" "proc-macro" "quote" ];
};
"term" = rec {
crateName = "term";
version = "0.5.2";
edition = "2015";
sha256 = "0hkgjrfisj6zjwz525639pmsvzhlc48a0h65nw87qrdp6jihdlgd";
authors = [
"The Rust Project Developers"
"Steven Allen"
];
dependencies = [
{
name = "byteorder";
packageId = "byteorder";
}
{
name = "dirs";
packageId = "dirs";
}
{
name = "winapi";
packageId = "winapi";
target = { target, features }: (target."windows" or false);
features = [ "consoleapi" "wincon" "handleapi" "fileapi" ];
}
];
features = {
};
resolvedDefaultFeatures = [ "default" ];
};
"termcolor" = rec {
crateName = "termcolor";
version = "1.1.2";
edition = "2018";
sha256 = "1x65i1ny4m6z1by62ra6wdcrd557p2ysm866x0pg60zby2cxizid";
authors = [
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "winapi-util";
packageId = "winapi-util";
target = { target, features }: (target."windows" or false);
}
];
};
"textwrap" = rec {
crateName = "textwrap";
version = "0.11.0";
edition = "2015";
sha256 = "0q5hky03ik3y50s9sz25r438bc4nwhqc6dqwynv4wylc807n29nk";
authors = [
"Martin Geisler <martin@geisler.net>"
];
dependencies = [
{
name = "unicode-width";
packageId = "unicode-width";
}
];
};
"thiserror" = rec {
crateName = "thiserror";
version = "1.0.25";
edition = "2018";
sha256 = "1ip9j8riar3xffp261yls4phpasz768xhnafxdz4qlargx2pcvzs";
authors = [
"David Tolnay <dtolnay@gmail.com>"
];
dependencies = [
{
name = "thiserror-impl";
packageId = "thiserror-impl";
}
];
};
"thiserror-impl" = rec {
crateName = "thiserror-impl";
version = "1.0.25";
edition = "2018";
sha256 = "139i3bxidyncjd1sphkn4c577nkba8lzmphhr9gb26xz1y67cdla";
procMacro = true;
authors = [
"David Tolnay <dtolnay@gmail.com>"
];
dependencies = [
{
name = "proc-macro2";
packageId = "proc-macro2";
}
{
name = "quote";
packageId = "quote";
}
{
name = "syn";
packageId = "syn";
}
];
};
"thread_local" = rec {
crateName = "thread_local";
version = "1.0.1";
edition = "2015";
sha256 = "054vlrr1vsdy1h4b7n99mr24pnj8928ig9qwzg36wnkld4dns36l";
authors = [
"Amanieu d'Antras <amanieu@gmail.com>"
];
dependencies = [
{
name = "lazy_static";
packageId = "lazy_static";
}
];
};
"time" = rec {
crateName = "time";
version = "0.1.44";
edition = "2015";
sha256 = "0m9jwy2pcmk232r3b9r80fs12mkckfjffjha4qfaxcdq9a8ydfbd";
authors = [
"The Rust Project Developers"
];
dependencies = [
{
name = "libc";
packageId = "libc";
}
{
name = "wasi";
packageId = "wasi 0.10.0+wasi-snapshot-preview1";
target = { target, features }: (target."os" == "wasi");
}
{
name = "winapi";
packageId = "winapi";
target = { target, features }: (target."windows" or false);
features = [ "std" "minwinbase" "minwindef" "ntdef" "profileapi" "sysinfoapi" "timezoneapi" ];
}
];
devDependencies = [
{
name = "winapi";
packageId = "winapi";
features = [ "std" "processthreadsapi" "winbase" ];
}
];
};
"unicode-segmentation" = rec {
crateName = "unicode-segmentation";
version = "1.7.1";
edition = "2015";
sha256 = "15n736z0pbj30pj44jb9s9rjavzrmx8v8pzdgsl5yfmfwrxjw3dv";
authors = [
"kwantam <kwantam@gmail.com>"
"Manish Goregaokar <manishsmail@gmail.com>"
];
features = {
};
};
"unicode-width" = rec {
crateName = "unicode-width";
version = "0.1.8";
edition = "2015";
sha256 = "1qxizyi6xbcqyi4z79p523ywvmgsfcgfqb3zv3c8i6x1jcc5jdwk";
authors = [
"kwantam <kwantam@gmail.com>"
"Manish Goregaokar <manishsmail@gmail.com>"
];
features = {
"rustc-dep-of-std" = [ "std" "core" "compiler_builtins" ];
};
resolvedDefaultFeatures = [ "default" ];
};
"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" ];
};
"vec_map" = rec {
crateName = "vec_map";
version = "0.8.2";
edition = "2015";
sha256 = "1481w9g1dw9rxp3l6snkdqihzyrd2f8vispzqmwjwsdyhw8xzggi";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
"Jorge Aparicio <japaricious@gmail.com>"
"Alexis Beingessner <a.beingessner@gmail.com>"
"Brian Anderson <>"
"tbu- <>"
"Manish Goregaokar <>"
"Aaron Turon <aturon@mozilla.com>"
"Adolfo Ochagavía <>"
"Niko Matsakis <>"
"Steven Fackler <>"
"Chase Southwood <csouth3@illinois.edu>"
"Eduard Burtescu <>"
"Florian Wilkens <>"
"Félix Raimundo <>"
"Tibor Benke <>"
"Markus Siemens <markus@m-siemens.de>"
"Josh Branchaud <jbranchaud@gmail.com>"
"Huon Wilson <dbau.pp@gmail.com>"
"Corey Farwell <coref@rwell.org>"
"Aaron Liblong <>"
"Nick Cameron <nrc@ncameron.org>"
"Patrick Walton <pcwalton@mimiga.net>"
"Felix S Klock II <>"
"Andrew Paseltiner <apaseltiner@gmail.com>"
"Sean McArthur <sean.monstar@gmail.com>"
"Vadim Petrochenkov <>"
];
features = {
"eders" = [ "serde" ];
};
};
"version_check" = rec {
crateName = "version_check";
version = "0.9.3";
edition = "2015";
sha256 = "1zmkcgj2m0pq0l4wnhrp1wl1lygf7x2h5p7pvjwc4719lnlxrv2z";
authors = [
"Sergio Benitez <sb@sergio.bz>"
];
};
"void" = rec {
crateName = "void";
version = "1.0.2";
edition = "2015";
sha256 = "0zc8f0ksxvmhvgx4fdg0zyn6vdnbxd2xv9hfx4nhzg6kbs4f80ka";
authors = [
"Jonathan Reem <jonathan.reem@gmail.com>"
];
features = {
"default" = [ "std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"walkdir" = rec {
crateName = "walkdir";
version = "2.3.2";
edition = "2018";
sha256 = "0mnszy33685v8y9js8mw6x2p3iddqs8vfj7n2dhqddnlbirz5340";
authors = [
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "same-file";
packageId = "same-file";
}
{
name = "winapi";
packageId = "winapi";
target = { target, features }: (target."windows" or false);
features = [ "std" "winnt" ];
}
{
name = "winapi-util";
packageId = "winapi-util";
target = { target, features }: (target."windows" or false);
}
];
};
"wasi 0.10.0+wasi-snapshot-preview1" = rec {
crateName = "wasi";
version = "0.10.0+wasi-snapshot-preview1";
edition = "2018";
sha256 = "07y3l8mzfzzz4cj09c8y90yak4hpsi9g7pllyzpr6xvwrabka50s";
authors = [
"The Cranelift Project Developers"
];
features = {
"default" = [ "std" ];
"rustc-dep-of-std" = [ "compiler_builtins" "core" "rustc-std-workspace-alloc" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"wasi 0.9.0+wasi-snapshot-preview1" = rec {
crateName = "wasi";
version = "0.9.0+wasi-snapshot-preview1";
edition = "2018";
sha256 = "06g5v3vrdapfzvfq662cij7v8a1flwr2my45nnncdv2galrdzkfc";
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" "ntdef" "objbase" "processenv" "profileapi" "shlobj" "std" "sysinfoapi" "timezoneapi" "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-util" = rec {
crateName = "winapi-util";
version = "0.1.5";
edition = "2018";
sha256 = "0y71bp7f6d536czj40dhqk0d55wfbbwqfp2ymqf1an5ibgl6rv3h";
authors = [
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "winapi";
packageId = "winapi";
target = { target, features }: (target."windows" or false);
features = [ "std" "consoleapi" "errhandlingapi" "fileapi" "minwindef" "processenv" "winbase" "wincon" "winerror" "winnt" ];
}
];
};
"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>"
];
};
"xdg" = rec {
crateName = "xdg";
version = "2.2.0";
edition = "2015";
sha256 = "0mws8a0fr3cqk5nh7aq9lmkmhzghvasqy4mhw6nnza06l4d6i2fh";
authors = [
"Ben Longbons <b.r.longbons@gmail.com>"
"whitequark <whitequark@whitequark.org>"
];
};
};
#
# 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, testPreRun, testPostRun }:
assert builtins.typeOf testCrateFlags == "list";
assert builtins.typeOf testInputs == "list";
assert builtins.typeOf testPreRun == "string";
assert builtins.typeOf testPostRun == "string";
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;
}
);
# If the user hasn't set any pre/post commands, we don't want to
# insert empty lines. This means that any existing users of crate2nix
# don't get a spurious rebuild unless they set these explicitly.
testCommand = pkgs.lib.concatStringsSep "\n"
(pkgs.lib.filter (s: s != "") [
testPreRun
"$f $testCrateFlags 2>&1 | tee -a $out"
testPostRun
]);
in
pkgs.runCommand "run-tests-${testCrate.name}"
{
inherit testCrateFlags;
buildInputs = testInputs;
} ''
set -ex
export RUST_BACKTRACE=1
# recreate a file hierarchy as when running tests with cargo
# the source for test data
${pkgs.xorg.lndir}/bin/lndir ${crate.src}
# build outputs
testRoot=target/debug
mkdir -p $testRoot
# executables of the crate
# we copy to prevent std::env::current_exe() to resolve to a store location
for i in ${crate}/bin/*; do
cp "$i" "$testRoot"
done
chmod +w -R .
# test harness executables are suffixed with a hash, like cargo does
# this allows to prevent name collision with the main
# executables of the crate
hash=$(basename $out)
for file in ${drv}/tests/*; do
f=$testRoot/$(basename $file)-$hash
cp $file $f
${testCommand}
done
'';
in
pkgs.runCommand "${crate.name}-linked"
{
inherit (crate) outputs crateName;
passthru = (crate.passthru or { }) // {
inherit test;
};
} ''
echo tested by ${test}
${lib.concatMapStringsSep "\n" (output: "ln -s ${crate.${output}} ${"$"}${output}") crate.outputs}
'';
/* A restricted overridable version of builtRustCratesWithFeatures. */
buildRustCrateWithFeatures =
{ packageId
, features ? rootFeatures
, crateOverrides ? defaultCrateOverrides
, buildRustCrateForPkgsFunc ? null
, runTests ? false
, testCrateFlags ? [ ]
, testInputs ? [ ]
# Any command to run immediatelly before a test is executed.
, testPreRun ? ""
# Any command run immediatelly after a test is executed.
, testPostRun ? ""
}:
lib.makeOverridable
(
{ features
, crateOverrides
, runTests
, testCrateFlags
, testInputs
, testPreRun
, testPostRun
}:
let
buildRustCrateForPkgsFuncOverriden =
if buildRustCrateForPkgsFunc != null
then buildRustCrateForPkgsFunc
else
(
if crateOverrides == pkgs.defaultCrateOverrides
then buildRustCrateForPkgs
else
pkgs: (buildRustCrateForPkgs pkgs).override {
defaultCrateOverrides = crateOverrides;
}
);
builtRustCrates = builtRustCratesWithFeatures {
inherit packageId features;
buildRustCrateForPkgsFunc = buildRustCrateForPkgsFuncOverriden;
runTests = false;
};
builtTestRustCrates = builtRustCratesWithFeatures {
inherit packageId features;
buildRustCrateForPkgsFunc = buildRustCrateForPkgsFuncOverriden;
runTests = true;
};
drv = builtRustCrates.crates.${packageId};
testDrv = builtTestRustCrates.crates.${packageId};
derivation =
if runTests then
crateWithTest
{
crate = drv;
testCrate = testDrv;
inherit testCrateFlags testInputs testPreRun testPostRun;
}
else drv;
in
derivation
)
{ inherit features crateOverrides runTests testCrateFlags testInputs testPreRun testPostRun; };
/* Returns an attr set with packageId mapped to the result of buildRustCrateForPkgsFunc
for the corresponding crate.
*/
builtRustCratesWithFeatures =
{ packageId
, features
, crateConfigs ? crates
, buildRustCrateForPkgsFunc
, 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; };
}
);
# Memoize built packages so that reappearing packages are only built once.
builtByPackageIdByPkgs = mkBuiltByPackageIdByPkgs pkgs;
mkBuiltByPackageIdByPkgs = pkgs:
let
self = {
crates = lib.mapAttrs (packageId: value: buildByPackageIdForPkgsImpl self pkgs packageId) crateConfigs;
build = mkBuiltByPackageIdByPkgs pkgs.buildPackages;
};
in
self;
buildByPackageIdForPkgsImpl = self: pkgs: 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 features target;
buildByPackageId = depPackageId:
# proc_macro crates must be compiled for the build architecture
if crateConfigs.${depPackageId}.procMacro or false
then self.build.crates.${depPackageId}
else self.crates.${depPackageId};
dependencies =
(crateConfig.dependencies or [ ])
++ devDependencies;
};
buildDependencies =
dependencyDerivations {
inherit features target;
buildByPackageId = depPackageId:
self.build.crates.${depPackageId};
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
)
);
# Crate renames have the form:
#
# {
# crate_name = [
# { version = "1.2.3"; rename = "crate_name01"; }
# ];
# # ...
# }
crateRenames =
let
grouped =
lib.groupBy
(dependency: dependency.name)
dependenciesWithRenames;
versionAndRename = dep:
let
package = crateConfigs."${dep.packageId}";
in
{ inherit (dep) rename; version = package.version; };
in
lib.mapAttrs (name: choices: builtins.map versionAndRename choices) grouped;
in
buildRustCrateForPkgsFunc pkgs
(
crateConfig // {
src = crateConfig.src or (
pkgs.fetchurl rec {
name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
# https://www.pietroalbini.org/blog/downloading-crates-io/
# Not rate-limited, CDN URL.
url = "https://static.crates.io/crates/${crateConfig.crateName}/${crateConfig.crateName}-${crateConfig.version}.crate";
sha256 =
assert (lib.assertMsg (crateConfig ? sha256) "Missing sha256 for ${name}");
crateConfig.sha256;
}
);
extraRustcOpts = lib.lists.optional (targetFeatures != [ ]) "-C target-feature=${lib.concatMapStringsSep "," (x: "+${x}") targetFeatures}";
inherit features dependencies buildDependencies crateRenames release;
}
);
in
builtByPackageIdByPkgs;
/* Returns the actual derivations for the given dependencies. */
dependencyDerivations =
{ buildByPackageId
, features
, dependencies
, target
}:
assert (builtins.isList features);
assert (builtins.isList dependencies);
assert (builtins.isAttrs target);
let
enabledDependencies = filterEnabledDependencies {
inherit dependencies features target;
};
depDerivation = dependency: buildByPackageId 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 {
buildRustCrateForPkgsFunc = _: lib.id;
inherit packageId;
};
sanitizedBuildTree = sanitizeForJson buildTree;
dependencyTree = sanitizeForJson
(
buildRustCrateWithFeatures {
buildRustCrateForPkgsFunc = _: 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;
enabledFeatures = enableFeatures (crateConfig.dependencies or [ ]) expandedFeatures;
depWithResolvedFeatures = dependency:
let
packageId = dependency.packageId;
features = dependencyFeatures enabledFeatures dependency;
in
{ inherit packageId features; };
resolveDependencies = cache: path: dependencies:
assert (builtins.isAttrs cache);
assert (builtins.isList dependencies);
let
enabledDependencies = filterEnabledDependencies {
inherit dependencies target;
features = enabledFeatures;
};
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 ++ enabledFeatures);
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 = lib.concatMap expandFeature inputFeatures;
in
sortedUnique outFeatures;
/* This function adds optional dependencies as features if they are enabled
indirectly by dependency features. This function mimics Cargo's behavior
described in a note at:
https://doc.rust-lang.org/nightly/cargo/reference/features.html#dependency-features
*/
enableFeatures = dependencies: features:
assert (builtins.isList features);
assert (builtins.isList dependencies);
let
additionalFeatures = lib.concatMap
(
dependency:
assert (builtins.isAttrs dependency);
let
enabled = builtins.any (doesFeatureEnableDependency dependency) features;
in
if (dependency.optional or false) && enabled then [ dependency.name ] else [ ]
)
dependencies;
in
sortedUnique (features ++ additionalFeatures);
/*
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)
#
};
}