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ZQC3OSWFHWEUSEMYQ4EQC
I52XSRUH5RVHQBFWVMAQPTUSPAJ4KNVID2RMI3UGCVKFLYUO6WZAC
AOK35FEXJBQODZEXEN3ZYAPMNAXDICKDQPNCBDDHCAXAGRSNCN3AC
LPOLG44WARRIWHNNOXVDOWPKGTYJGUATBXNVAQSEXR2WW7KHGWVAC
CCLLB7OIFNFYJZTG3UCI7536TOCWSCSXR67VELSB466R24WLJSDAC
AKARNWLHKVH4477BX2KZ6VY4YPTMXQFVPUSFCWHG4LZ4OCW2F5CQC
J6UIWIYYFEG3F4XJOZEGBV7UEFJA53356GG63JPUNZPYJEKUGZRQC
KUMJITTFBIAA7MFVPE6O7ZKIRSX553JNM72LF3KQJ6U3CXZI6MMQC
Q7CAYX5N2GFOGMZL3VXVWORMAPWEOECXE22BLXK7Q4WEPS4CE2SAC
6DOXSHWGKJIMIPFCNLASGKBAJCJMJULW5HFRZAZ67EYSMXXGJ3KAC
6XDVUSBMBXM4LKKKR7YPJ5PF4ISOZNT465GSOFR2GF7NTL5SNLZAC
YMWMWFA54PUELJI4YX77ZXEBQLHFM3DBJVQYQEP3DBO3GF7T4PCAC
FXT5FS5WIDBA3HPTJRFGRGULZIGAWAJXT2U6RFYGDLO2PYDG4VEAC
3VJB4ULDDBRUZQ3TSOEJQ3TFVYYHE347ONKMFWGTSCLUYUV536XQC
QJXNUQFJOAPQT3GUXRDTVKMJZCKFONSXUZMAZB7VC7OHDCGAVCOQC
let rustChannel = prev.rust-bin.stable."1.54.0";
in
{
inherit rustChannel;
rustc = rustChannel.minimal;
};
let
rustChannel = prev.rust-bin.stable."1.56.0";
in {
inherit rustChannel;
rustc = rustChannel.minimal;
};
let rustDevOverlay = final: prev:
{
# rust-analyzer needs core source
rustc-with-src = prev.rustc.override { extensions = [ "rust-src" ]; };
# need the latest rustfmt to match apheleia's behaviour
rustfmt = prev.rust-bin.nightly."2021-10-23".rustfmt;
};
pkgs = import nixpkgs {
inherit system;
overlays = [
(import rust-overlay)
rustOverlay
rustDevOverlay
];
};
let
rustDevOverlay = final: prev: {
# rust-analyzer needs core source
rustc-with-src = prev.rustc.override { extensions = [ "rust-src" ]; };
};
pkgs = import nixpkgs {
inherit system;
overlays = [
(import rust-overlay)
rustOverlay
rustDevOverlay
];
};
then lib.warn "`buildRustCrate` is deprecated, use `buildRustCrateForPkgs` instead" (_: buildRustCrate)
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)
version = "1.0.1";
edition = "2018";
sha256 = "0sx4a44c2n450lsmi0q1mgfbjhkw1sx57462cv77p0mmy9mgscla";
version = "1.2.0";
edition = "2021";
sha256 = "068ym54zxcma0z4w58l5dxlmx97l45d8mmns1ij5ls1d04mpfb1r";
"debug" = [ "clap_derive/debug" ];
"default" = [ "std" "derive" "cargo" "color" "env" "suggestions" "unicode_help" ];
"debug" = [ "clap_derive/debug" "backtrace" ];
"default" = [ "std" "derive" "cargo" "color" "env" "suggestions" "unicode" ];
resolvedDefaultFeatures = [ "atty" "cargo" "clap_derive" "color" "default" "derive" "env" "lazy_static" "std" "strsim" "suggestions" "termcolor" "unicode_help" ];
resolvedDefaultFeatures = [ "atty" "cargo" "clap_derive" "color" "default" "derive" "env" "lazy_static" "std" "strsim" "suggestions" "termcolor" "unicase" "unicode" ];
sha256 = "12rznp5gg0sf3w2ly2zbcm4shnhcdy1igmvpkzlrrz5dhvs01p0s";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
sha256 = "17jbp2zl1f0cfblaiky8d8kim6k82cxmmnbgy1gj8p1jih6j3l4c";
sha256 = "1yczc8hdwaa7lw52bh2xnarqjfs2bmfwj169kcylwvjzh08j9vbl";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
sha256 = "09rd4nigr2yyw074yv7yqqvzs90x80nnmkhd6kvnby6vwcwwvj3z";
sha256 = "168zy072rgzkvi3hsbjzhn8ynwy60a4dwffv0cvh7zzxlysb2ldg";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
sha256 = "0id4niawvf6vxv2s7w782jmm6m5arrcx2isvlsws1hp75zj1d4v2";
sha256 = "073nakpp5z0irlkqgr0fgcnwv47f79qr5f1p2kiilzmqaxd563ad";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
sha256 = "15scf1ifrdipidc7wzcvlsmgrf89b5sh8zlxffmnr8s86gsqp03v";
sha256 = "10hms4pzsxay7s9qclp78xis9mlklzf5ris6y9p3m3q6jg1hc3hb";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
sha256 = "04dakn3362gw8q2jd9wdq19df4am1j5p4sngdhj57hxmnr6kb0g4";
sha256 = "0lsbxbz72a82hyld35wz69k7l6i07krsafkl2ac12g9ncym0mwy0";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
sha256 = "1bq5jdv9d1llmlzq8ycmkbhw2z8yqkwhd6fd68dd4qkv8d168v4r";
sha256 = "1wlr0yl3vjk24281n1iz3yjxj4782fnzcqcmj2zg65q0cyc4mrdv";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
sha256 = "04nyz21ymr2r4fh9hdk1ppi8g61ryp97c8ighf3chcmbm9r1igys";
sha256 = "0y2dvm4r5cbw0mqw138zssswrq235kl4j050h624mr2qzmmq9sv7";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
sha256 = "0gmqxlf3vx9aikb0yhcihjn2p3g2rsr1l3xcc4h4fmi3289j5lj1";
resolvedDefaultFeatures = [ "alloc" "async-await" "async-await-macro" "channel" "default" "futures-channel" "futures-io" "futures-macro" "futures-sink" "io" "memchr" "proc-macro-hack" "proc-macro-nested" "sink" "slab" "std" ];
};
"gcc" = rec {
crateName = "gcc";
version = "0.3.55";
edition = "2015";
crateBin = [];
sha256 = "1hng1sajn4r67hndvhjysswz8niayjwvcj42zphpxzhbz89kjpwg";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
features = {
"parallel" = [ "rayon" ];
};
resolvedDefaultFeatures = [ "alloc" "async-await" "async-await-macro" "channel" "default" "futures-channel" "futures-io" "futures-macro" "futures-sink" "io" "memchr" "sink" "slab" "std" ];
};
"minimal-lexical" = rec {
crateName = "minimal-lexical";
version = "0.2.1";
edition = "2018";
sha256 = "16ppc5g84aijpri4jzv14rvcnslvlpphbszc7zzp6vfkddf4qdb8";
authors = [
"Alex Huszagh <ahuszagh@gmail.com>"
];
features = {
"default" = [ "std" ];
};
resolvedDefaultFeatures = [ "std" ];
"nom" = rec {
crateName = "nom";
version = "7.1.0";
edition = "2018";
sha256 = "0281jdx0xcyhjgs1jkj9pii8py1clcpazg41bgz7d71qxzhi278v";
authors = [
"contact@geoffroycouprie.com"
];
dependencies = [
{
name = "memchr";
packageId = "memchr";
usesDefaultFeatures = false;
}
{
name = "minimal-lexical";
packageId = "minimal-lexical";
usesDefaultFeatures = false;
}
];
buildDependencies = [
{
name = "version_check";
packageId = "version_check";
}
];
features = {
"default" = [ "std" ];
"std" = [ "alloc" "memchr/std" "minimal-lexical/std" ];
};
resolvedDefaultFeatures = [ "alloc" "default" "std" ];
};
];
};
"proc-macro-hack" = rec {
crateName = "proc-macro-hack";
version = "0.5.19";
edition = "2018";
sha256 = "1rg0kzsj7lj00qj602d3h77spwfz48vixn1wbjp7a4yrq65w9w6v";
procMacro = true;
authors = [
"David Tolnay <dtolnay@gmail.com>"
];
};
"proc-macro-nested" = rec {
crateName = "proc-macro-nested";
version = "0.1.7";
edition = "2015";
sha256 = "11hh1jynh62f3m1ii0f9gf1l3y0fhkwpmr40lz3704v848n1p25w";
authors = [
"David Tolnay <dtolnay@gmail.com>"
"quickcheck" = rec {
crateName = "quickcheck";
version = "1.0.3";
edition = "2018";
sha256 = "1mjhkfqwrb8mdyxdqr4zzbj1rm5dfx25n9zcc25lb6fxwiw673sq";
authors = [
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "env_logger";
packageId = "env_logger";
optional = true;
usesDefaultFeatures = false;
}
{
name = "log";
packageId = "log";
optional = true;
}
{
name = "rand";
packageId = "rand 0.8.4";
usesDefaultFeatures = false;
features = [ "getrandom" "small_rng" ];
}
];
features = {
"default" = [ "regex" "use_logging" ];
"regex" = [ "env_logger/regex" ];
"use_logging" = [ "log" "env_logger" ];
};
resolvedDefaultFeatures = [ "default" "env_logger" "log" "regex" "use_logging" ];
};
"quickcheck_macros" = rec {
crateName = "quickcheck_macros";
version = "1.0.0";
edition = "2015";
sha256 = "1s8nh0fmmzq3fd7928qcp2syvymlyv1pmww6fxcaj5np48r6jamj";
procMacro = true;
authors = [
"Andrew Gallant <jamslam@gmail.com>"
];
dependencies = [
{
name = "proc-macro2";
packageId = "proc-macro2";
}
{
name = "quote";
packageId = "quote";
}
{
name = "syn";
packageId = "syn";
features = [ "full" ];
}
];
};
name = "cpufeatures";
packageId = "cpufeatures";
target = { target, features }: ((target."arch" == "aarch64") && (target."os" == "linux"));
}
{
name = "cpufeatures";
packageId = "cpufeatures";
target = { target, features }: ((target."arch" == "x86") || (target."arch" == "x86_64"));
}
{
"unicase" = rec {
crateName = "unicase";
version = "2.6.0";
edition = "2015";
sha256 = "1xmlbink4ycgxrkjspp0mf7pghcx4m7vxq7fpfm04ikr2zk7pwsh";
authors = [
"Sean McArthur <sean@seanmonstar.com>"
];
buildDependencies = [
{
name = "version_check";
packageId = "version_check";
}
];
features = {
};
};
};
"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" ];
};
resolvedDefaultFeatures = [ "Blob" "BlobPropertyBag" "Document" "Event" "EventTarget" "FormData" "Headers" "HtmlDocument" "MessageEvent" "Navigator" "Node" "Request" "RequestCredentials" "RequestInit" "RequestMode" "Response" "ServiceWorkerGlobalScope" "Window" "Worker" "WorkerGlobalScope" ];
resolvedDefaultFeatures = [ "Blob" "BlobPropertyBag" "Document" "Event" "EventTarget" "FormData" "Headers" "Location" "MessageEvent" "Navigator" "Node" "Request" "RequestCredentials" "RequestInit" "RequestMode" "Response" "ServiceWorkerGlobalScope" "Window" "Worker" "WorkerGlobalScope" ];
testCrateFlags: list of flags to pass to the test exectuable
testInputs: list of packages that should be available during test execution
testCrateFlags: list of flags to pass to the test exectuable
testInputs: list of packages that should be available during test execution
# 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
]);
If multiple paths to a dependency enable different features, the
corresponding feature sets are merged. Features in rust are additive.
If multiple paths to a dependency enable different features, the
corresponding feature sets are merged. Features in rust are additive.
featureMap is an attribute set which maps feature names to lists of further
feature names to enable in case this feature is selected.
featureMap is an attribute set which maps feature names to lists of further
feature names to enable in case this feature is selected.
/* 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);