blob: fbb9bbcef781749f22e42782c973b451d171be68 (
plain)
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
|
{ config, lib, pkgs, ... }:
with lib;
with builtins;
let cfg = config.rust;
in {
options.rust = {
enable = mkEnableOption { name = "rust"; };
packages = mkOption {
type = types.lazyAttrsOf types.package;
default = pkgs.rust.packages.stable;
defaultText = literalExample "pkgs.rust.packages.stable";
description = ''
The set of Rust packages from which to get the toolchain.
'';
};
};
config = mkIf cfg.enable {
nativeBuildInputs = with cfg.packages; [ rustc cargo pkgs.gcc ];
buildInputs = with cfg.packages; [ rustfmt clippy ];
envVars = {
RUST_SRC_PATH = {
value = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
};
};
}
|