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R3LFZK6QCW7JIBLSQC
OUWD436ATBTZJR53B6XDSI5SXRRNZV7YGRUEA5ACHZC2RUDP7G5QC
WEHUTJUKHOJIBMEK2M7ILPK532FMO7YGWTEAHOIXZP5WOOOSF3ZAC
H62VFFJEBL2I3O4D3BAJZ57ROPWUISC7JCDIWFBC5DAYJRHMMDXAC
, buildRustCrate ? pkgs.buildRustCrate
, buildRustCrateForPkgs ? if buildRustCrate != null
then lib.warn "`buildRustCrate` is deprecated, use `buildRustCrateForPkgs` instead" (_: buildRustCrate)
else pkgs: pkgs.buildRustCrate
# Deprecated
, buildRustCrate ? null
workspace_members =
internal.deprecationWarning
"workspace_members is deprecated in crate2nix 0.4. Please use workspaceMembers instead."
lib.mapAttrs (n: v: v.build) workspaceMembers;
# 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;
};
"generator" = rec {
crateName = "generator";
version = "0.6.24";
edition = "2018";
sha256 = "174skwxbr99p6kf285nraj7dmsd1k4l6amad5djjg271s57x5zm9";
authors = [
"Xudong Huang <huangxu008@hotmail.com>"
];
dependencies = [
{
name = "libc";
packageId = "libc";
target = { target, features }: target."unix";
}
{
name = "log";
packageId = "log";
}
{
name = "winapi";
packageId = "winapi";
target = { target, features }: target."windows";
features = [ "memoryapi" "sysinfoapi" ];
}
];
buildDependencies = [
{
name = "cc";
packageId = "cc";
}
{
name = "rustversion";
packageId = "rustversion";
}
];
};
};
"loom" = rec {
crateName = "loom";
version = "0.4.0";
edition = "2018";
sha256 = "1941ji91nvriqqkgzlx285kq38zg74sw68gb2x4pnjbfcfs76k6l";
authors = [
"Carl Lerche <me@carllerche.com>"
];
dependencies = [
{
name = "cfg-if";
packageId = "cfg-if 1.0.0";
}
{
name = "generator";
packageId = "generator";
}
{
name = "scoped-tls";
packageId = "scoped-tls";
}
];
features = {
"checkpoint" = [ "serde" "serde_json" ];
"futures" = [ "futures-util" ];
};
resolvedDefaultFeatures = [ "default" ];
};
"tracing-futures" = rec {
crateName = "tracing-futures";
version = "0.2.5";
edition = "2018";
sha256 = "1wimg0iwa2ldq7xv98lvivvf3q9ykfminig8r1bs0ig22np9bl4p";
authors = [
"Eliza Weisman <eliza@buoyant.io>"
"Tokio Contributors <team@tokio.rs>"
];
dependencies = [
{
name = "pin-project";
packageId = "pin-project";
optional = true;
}
{
name = "tracing";
packageId = "tracing";
usesDefaultFeatures = false;
}
];
features = {
"default" = [ "std-future" "std" ];
"futures-01" = [ "futures_01" "std" ];
"futures-03" = [ "std-future" "futures" "futures-task" "std" ];
"std" = [ "tracing/std" ];
"std-future" = [ "pin-project" ];
};
resolvedDefaultFeatures = [ "pin-project" "std-future" ];
test = let
drv = testCrate.override (
_: {
buildTests = true;
}
);
in
pkgs.runCommand "run-tests-${testCrate.name}" {
inherit testCrateFlags;
buildInputs = testInputs;
} ''
test =
let
drv = testCrate.override
(
_: {
buildTests = true;
}
);
in
pkgs.runCommand "run-tests-${testCrate.name}"
{
inherit testCrateFlags;
buildInputs = testInputs;
} ''
cd ${crate.src}
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)
crate.overrideAttrs (
old: {
checkPhase = ''
test -e ${test}
'';
passthru = (old.passthru or {}) // {
inherit test;
};
}
);
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}
'';
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 {
lib.makeOverridable
(
{ features
, crateOverrides
, runTests
, testCrateFlags
, testInputs
}:
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
{
mergedFeatures = mergePackageFeatures (
args // {
inherit rootPackageId;
target = target // { test = runTests; };
}
);
buildByPackageId = packageId: buildByPackageIdImpl packageId;
mergedFeatures = mergePackageFeatures
(
args // {
inherit rootPackageId;
target = target // { test = runTests; };
}
);
features = mergedFeatures."${packageId}" or [];
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 [ ];
inherit builtByPackageId features target;
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};
lib.filter (d: d ? "rename") (
filterEnabledDependenciesForThis
(
(crateConfig.buildDependencies or [])
++ (crateConfig.dependencies or [])
++ devDependencies
)
);
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"; }
# ];
# # ...
# }
builtins.listToAttrs
(map (d: { name = d.name; value = d.rename; }) dependenciesWithRenames);
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;
url = "https://crates.io/api/v1/crates/${crateConfig.crateName}/${crateConfig.version}/download";
sha256 = crateConfig.sha256;
# 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;
dependencyTree = sanitizeForJson (
buildRustCrateWithFeatures {
buildRustCrateFunc = crate: {
"01_crateName" = crate.crateName or false;
"02_features" = crate.features or [];
"03_dependencies" = crate.dependencies or [];
};
inherit packageId;
}
);
dependencyTree = sanitizeForJson
(
buildRustCrateWithFeatures {
buildRustCrateForPkgsFunc = _: crate: {
"01_crateName" = crate.crateName or false;
"02_features" = crate.features or [ ];
"03_dependencies" = crate.dependencies or [ ];
};
inherit packageId;
}
);
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;
}
);
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;
}
);
resolveDependencies cacheWithSelf "dep" (
crateConfig.dependencies or []
++ lib.optionals
(runTests && packageId == rootPackageId)
(crateConfig.devDependencies or [])
);
resolveDependencies cacheWithSelf "dep"
(
crateConfig.dependencies or [ ]
++ lib.optionals
(runTests && packageId == rootPackageId)
(crateConfig.devDependencies or [ ])
);
let
targetFunc = dep.target or (features: true);
in
targetFunc { inherit features target; }
&& (
!(dep.optional or false)
|| builtins.any (doesFeatureEnableDependency dep) features
)
let
targetFunc = dep.target or (features: true);
in
targetFunc { inherit features target; }
&& (
!(dep.optional or false)
|| builtins.any (doesFeatureEnableDependency dep) features
)
[ feature ] ++ (expandFeatures featureMap (featureMap."${feature}" or []));
outFeatures = builtins.concatMap expandFeature inputFeatures;
[ feature ] ++ (expandFeatures featureMap (featureMap."${feature}" or [ ]));
outFeatures = lib.concatMap expandFeature inputFeatures;
defaultOrNil = if dependency.usesDefaultFeatures or true
then [ "default" ]
else [];
explicitFeatures = dependency.features or [];
defaultOrNil =
if dependency.usesDefaultFeatures or true
then [ "default" ]
else [ ];
explicitFeatures = dependency.features or [ ];
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "loom"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d44c73b4636e497b4917eb21c33539efa3816741a2d3ff26c6316f1b529481a4"
]
[[package]]
name = "tracing-futures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
dependencies = [
"pin-project",
"tracing",