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
36
, cargoLock ? null
37
37
, cargoVendorDir ? null
38
38
, checkType ? buildType
39
39
+
, buildNoDefaultFeatures ? false
40
40
+
, checkNoDefaultFeatures ? buildNoDefaultFeatures
41
41
+
, buildFeatures ? [ ]
42
42
+
, checkFeatures ? buildFeatures
39
43
, depsExtraArgs ? {}
40
44
41
45
# Toggles whether a custom sysroot is created when the target is a .json file.
···
102
106
cargoBuildType = buildType;
103
107
104
108
cargoCheckType = checkType;
109
109
+
110
110
+
cargoBuildNoDefaultFeatures = buildNoDefaultFeatures;
111
111
+
112
112
+
cargoCheckNoDefaultFeatures = checkNoDefaultFeatures;
113
113
+
114
114
+
cargoBuildFeatures = buildFeatures;
115
115
+
116
116
+
cargoCheckFeatures = checkFeatures;
105
117
106
118
patchRegistryDeps = ./patch-registry-deps;
107
119
+10
pkgs/build-support/rust/hooks/cargo-build-hook.sh
···
13
13
cargoBuildProfileFlag="--${cargoBuildType}"
14
14
fi
15
15
16
16
+
if [ -n "${cargoBuildNoDefaultFeatures-}" ]; then
17
17
+
cargoBuildNoDefaultFeaturesFlag=--no-default-features
18
18
+
fi
19
19
+
20
20
+
if [ -n "${cargoBuildFeatures-}" ]; then
21
21
+
cargoBuildFeaturesFlag="--features=${cargoBuildFeatures// /,}"
22
22
+
fi
23
23
+
16
24
(
17
25
set -x
18
26
env \
···
24
32
--target @rustTargetPlatformSpec@ \
25
33
--frozen \
26
34
${cargoBuildProfileFlag} \
35
35
+
${cargoBuildNoDefaultFeaturesFlag} \
36
36
+
${cargoBuildFeaturesFlag} \
27
37
${cargoBuildFlags}
28
38
)
29
39
+10
-1
pkgs/build-support/rust/hooks/cargo-check-hook.sh
···
20
20
cargoCheckProfileFlag="--${cargoCheckType}"
21
21
fi
22
22
23
23
-
argstr="${cargoCheckProfileFlag} --target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}";
23
23
+
if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
24
24
+
cargoCheckNoDefaultFeaturesFlag=--no-default-features
25
25
+
fi
26
26
+
27
27
+
if [ -n "${cargoCheckFeatures-}" ]; then
28
28
+
cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}"
29
29
+
fi
30
30
+
31
31
+
argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag}
32
32
+
--target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}"
24
33
25
34
(
26
35
set -x