/
interface.nix
66 lines (65 loc) · 1.67 KB
/
interface.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
lib,
dream2nix,
specialArgs,
...
}: let
l = lib // builtins;
t = l.types;
in {
options.deps = {
cargo = l.mkOption {
type = t.package;
description = "The Cargo package to use";
};
craneSource = l.mkOption {
type = t.path;
description = "Source to use for crane functions";
};
crane = {
buildPackage = l.mkOption {
type = t.functionTo t.package;
description = "The function to use when building packages";
};
buildDepsOnly = l.mkOption {
type = t.functionTo t.package;
description = "The function to use when building dependencies of a package";
};
};
};
options.rust-crane = l.mapAttrs (_: l.mkOption) {
runTests = {
type = t.bool;
description = "Whether to run tests via `cargo test`";
default = true;
};
buildProfile = {
type = t.str;
description = "The profile to use when running `cargo build` and `cargo check`";
default = "release";
};
testProfile = {
type = t.str;
description = "The profile to use when running `cargo test`";
default = "release";
};
buildFlags = {
type = t.listOf t.str;
description = "Flags to add when running `cargo build` and `cargo check`";
default = [];
};
testFlags = {
type = t.listOf t.str;
description = "Flags to add when running `cargo test`";
default = [];
};
depsDrv = {
type = t.submoduleWith {
modules = [dream2nix.modules.dream2nix.mkDerivation];
inherit specialArgs;
};
description = "A single derivation with all dependencies of the package";
default = {};
};
};
}