From fcbbb03060a3d1ea4e4c9646eb6b578576f1fc98 Mon Sep 17 00:00:00 2001 From: Jan-Bulthuis Date: Sun, 9 Feb 2025 23:53:27 +0100 Subject: [PATCH] Added rust to devShell --- shell-modules/default.nix | 1 + shell-modules/languages/rust.nix | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 shell-modules/languages/rust.nix diff --git a/shell-modules/default.nix b/shell-modules/default.nix index 9a4b561..99acc3f 100644 --- a/shell-modules/default.nix +++ b/shell-modules/default.nix @@ -8,6 +8,7 @@ let imports = [ ./shell.nix ./languages/python.nix + ./languages/rust.nix ./utilities/cuda.nix ./utilities/jupyter.nix ]; diff --git a/shell-modules/languages/rust.nix b/shell-modules/languages/rust.nix new file mode 100644 index 0000000..5663dba --- /dev/null +++ b/shell-modules/languages/rust.nix @@ -0,0 +1,34 @@ +{ + pkgs, + lib, + config, + ... +}: + +with lib; +let + rustPackage = pkgs.rustc; +in +{ + options.rust = { + enable = mkEnableOption "Rust"; + # TODO: Add option to specify toolchain file + # See https://ayats.org/blog/nix-rustup + }; + + config = mkIf config.rust.enable { + packages = [ + bacon + evcxr + cargo + + rustPackage + + # TODO: Might be needed for bindgen + # rustPlatform.bindgenHook + # pkg-config + ]; + + # env.RUST_SRC_PATH = "${rustPackage}/lib/rustlib/src/rust/library"; + }; +}