diff options
| -rw-r--r-- | modules/default.nix | 3 | ||||
| -rw-r--r-- | modules/rust.nix | 29 |
2 files changed, 31 insertions, 1 deletions
diff --git a/modules/default.nix b/modules/default.nix index ec30513..889253d 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -8,8 +8,9 @@ in { ./golang.nix ./latex.nix ./nix.nix - ./python.nix ./ocaml.nix + ./python.nix + ./rust.nix ./why3.nix ]; diff --git a/modules/rust.nix b/modules/rust.nix new file mode 100644 index 0000000..fbb9bbc --- /dev/null +++ b/modules/rust.nix @@ -0,0 +1,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}"; + }; + }; + }; +} |
