tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
rustPlatform: add support for features
figsoda
4 years ago
5a08a288
b6a580b9
+32
-1
3 changed files
expand all
collapse all
unified
split
pkgs
build-support
rust
default.nix
hooks
cargo-build-hook.sh
cargo-check-hook.sh
+12
pkgs/build-support/rust/default.nix
···
36
, cargoLock ? null
37
, cargoVendorDir ? null
38
, checkType ? buildType
0
0
0
0
39
, depsExtraArgs ? {}
40
41
# Toggles whether a custom sysroot is created when the target is a .json file.
···
102
cargoBuildType = buildType;
103
104
cargoCheckType = checkType;
0
0
0
0
0
0
0
0
105
106
patchRegistryDeps = ./patch-registry-deps;
107
···
36
, cargoLock ? null
37
, cargoVendorDir ? null
38
, checkType ? buildType
39
+
, buildNoDefaultFeatures ? false
40
+
, checkNoDefaultFeatures ? buildNoDefaultFeatures
41
+
, buildFeatures ? [ ]
42
+
, checkFeatures ? buildFeatures
43
, depsExtraArgs ? {}
44
45
# Toggles whether a custom sysroot is created when the target is a .json file.
···
106
cargoBuildType = buildType;
107
108
cargoCheckType = checkType;
109
+
110
+
cargoBuildNoDefaultFeatures = buildNoDefaultFeatures;
111
+
112
+
cargoCheckNoDefaultFeatures = checkNoDefaultFeatures;
113
+
114
+
cargoBuildFeatures = buildFeatures;
115
+
116
+
cargoCheckFeatures = checkFeatures;
117
118
patchRegistryDeps = ./patch-registry-deps;
119
+10
pkgs/build-support/rust/hooks/cargo-build-hook.sh
···
13
cargoBuildProfileFlag="--${cargoBuildType}"
14
fi
15
0
0
0
0
0
0
0
0
16
(
17
set -x
18
env \
···
24
--target @rustTargetPlatformSpec@ \
25
--frozen \
26
${cargoBuildProfileFlag} \
0
0
27
${cargoBuildFlags}
28
)
29
···
13
cargoBuildProfileFlag="--${cargoBuildType}"
14
fi
15
16
+
if [ -n "${cargoBuildNoDefaultFeatures-}" ]; then
17
+
cargoBuildNoDefaultFeaturesFlag=--no-default-features
18
+
fi
19
+
20
+
if [ -n "${cargoBuildFeatures-}" ]; then
21
+
cargoBuildFeaturesFlag="--features=${cargoBuildFeatures// /,}"
22
+
fi
23
+
24
(
25
set -x
26
env \
···
32
--target @rustTargetPlatformSpec@ \
33
--frozen \
34
${cargoBuildProfileFlag} \
35
+
${cargoBuildNoDefaultFeaturesFlag} \
36
+
${cargoBuildFeaturesFlag} \
37
${cargoBuildFlags}
38
)
39
+10
-1
pkgs/build-support/rust/hooks/cargo-check-hook.sh
···
20
cargoCheckProfileFlag="--${cargoCheckType}"
21
fi
22
23
-
argstr="${cargoCheckProfileFlag} --target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}";
0
0
0
0
0
0
0
0
0
24
25
(
26
set -x
···
20
cargoCheckProfileFlag="--${cargoCheckType}"
21
fi
22
23
+
if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
24
+
cargoCheckNoDefaultFeaturesFlag=--no-default-features
25
+
fi
26
+
27
+
if [ -n "${cargoCheckFeatures-}" ]; then
28
+
cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}"
29
+
fi
30
+
31
+
argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag}
32
+
--target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}"
33
34
(
35
set -x