Skip to content

Commit 2827fe6

Browse files
committed
flake: set default CARGO_PROFILE to "dev"
1 parent 5586b14 commit 2827fe6

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

flake.nix

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
]) path != null;
4646
filter = path: type: (filter' path type) || (craneLib.filterCargoSources path type);
4747
src = lib.cleanSourceWith {
48-
src = ./.;
48+
src = ./.;
4949
inherit filter;
5050
name = "source";
5151
};
@@ -65,10 +65,10 @@
6565
++ lib.optionals pkgs.stdenv.isDarwin (
6666
with pkgs;
6767
[
68-
# additional dependencies on Darwin systems
69-
CoreFoundation
70-
libresolv
71-
Security
68+
# additional dependencies on Darwin systems
69+
CoreFoundation
70+
libresolv
71+
Security
7272
]
7373
);
7474
# Software required for project build
@@ -79,8 +79,10 @@
7979
# Tools required for checks
8080
nativeCheckInputs = with pkgs; [ git ];
8181

82-
# Additional environment variables can be set directly
83-
# MY_CUSTOM_VAR = "some value";
82+
# Additional environment variables
83+
# This one overrides build profile (default is 'release')
84+
CARGO_PROFILE = "dev";
85+
8486
};
8587

8688
# Build dependencies only, so we will be able to reuse them further
@@ -100,8 +102,8 @@
100102
clippy = craneLib.cargoClippy (
101103
common
102104
// {
103-
inherit cargoArtifacts;
104-
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
105+
inherit cargoArtifacts;
106+
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
105107
}
106108
);
107109

@@ -128,10 +130,10 @@
128130
nextest = craneLib.cargoNextest (
129131
common
130132
// {
131-
inherit cargoArtifacts;
132-
partitions = 1;
133-
partitionType = "count";
134-
cargoNextestPartitionsExtraArgs = "--no-tests=pass";
133+
inherit cargoArtifacts;
134+
partitions = 1;
135+
partitionType = "count";
136+
cargoNextestPartitionsExtraArgs = "--no-tests=pass";
135137
}
136138
);
137139
};
@@ -142,20 +144,20 @@
142144
// {
143145
inherit cargoArtifacts;
144146
doCheck = false;
145-
CARGO_PROFILE = "dev";
146147
}
147148
);
148149
onefetch = craneLib.buildPackage (
149150
common
150151
// {
152+
CARGO_PROFILE = "release";
151153
inherit cargoArtifacts;
152154
doCheck = false;
153155
}
154156
);
155157
default = onefetch-debug;
156158
};
157159

158-
apps.default = flake-utils.lib.mkApp { drv = build; };
160+
apps.default = flake-utils.lib.mkApp { drv = (build // { CARGO_PROFILE = "release"; }); };
159161

160162
devShells.default = craneLib.devShell {
161163
# Inherit inputs from checks.

0 commit comments

Comments
 (0)