-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathcrate.nix
106 lines (101 loc) · 3.04 KB
/
crate.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
config,
lib,
pkgs,
...
}: let
l = lib // builtins;
t = l.types;
in {
imports = [
../options/drvConfig.nix
../options/numtideDevshell.nix
];
options = {
export = l.mkOption {
type = t.nullOr t.bool;
default = null;
example = true;
description = "Whether to export this all of this crate's outputs (if set will override project-wide setting)";
};
checkProfile = l.mkOption {
type = t.nullOr t.str;
default = null;
example = "custom-profile";
description = "Profile to use for the tests only package";
};
clippyProfile = l.mkOption {
type = t.nullOr t.bool;
default = null;
example = "custom-profile";
description = ''
Profile to use for clippy only package
Note that you will need to add 'clippy' as a component to the rust toolchain you are using yourself
'';
};
docsProfile = l.mkOption {
type = t.nullOr t.str;
default = null;
example = "custom-profile";
description = "Profile to use for the docs only package";
};
includeInProjectDocs = l.mkOption {
type = t.nullOr t.bool;
default = null;
example = false;
description = "Whether to include this crate's docs in the project docs package";
};
profiles = l.mkOption {
type = t.nullOr (
t.attrsOf (t.submoduleWith {
modules = [./profile.nix];
})
);
default = null;
example = l.literalExpression ''
{
dev = {};
release.runTests = true;
custom-profile.features = ["some" "features"];
}
'';
description = "Profiles to generate packages for this crate (if set will override project-wide setting)";
};
targets = l.mkOption {
type = t.nullOr (
t.attrsOf (t.submoduleWith {
modules = [./target.nix];
})
);
default = null;
example = l.literalExpression ''
{
wasm32-unknown-unknown.profiles = ["release"];
x86_64-unknown-linux-gnu.default = true;
}
'';
description = "Targets to generate packages for this crate (if set will override project-wide setting)";
};
runtimeLibs = l.mkOption {
type = t.listOf t.package;
default = [];
example = l.literalExpression ''
[pkgs.alsa-lib pkgs.libxkbcommon]
'';
description = ''
Runtime libraries that will be:
- patched into the binary at build time,
- present in `LD_LIBRARY_PATH` environment variable in development shell.
Note that when it's patched in at build time, a separate derivation will
be created that "wraps" the original derivation to not cause the whole
crate to recompile when you only change `runtimeLibs`. The original
derivation can be accessed via `.passthru.unwrapped` attribute.
'';
};
renameTo = l.mkOption {
type = t.nullOr t.str;
default = null;
description = "What to rename this crate's outputs to in `nix flake show`";
};
};
}