From beadfa5754f184c1fc9268e942c6f782e0e7f7ae Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 8 Dec 2023 15:22:58 +0530 Subject: [PATCH] add rust devshell --- README.md | 16 ++++++++++++++++ flake.nix | 1 + shells/rust.nix | 7 +++++++ 3 files changed, 24 insertions(+) create mode 100644 shells/rust.nix diff --git a/README.md b/README.md index 7a0424e..4bb823d 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,19 @@ $ nix develop github:adtya/devshell#haskell ```sh use flake github:adtya/devshell#haskell ``` + +### Rust + +#### What's included? + - rustc + - rustfmt + - rust-analyzer + +#### Activate with Nix +```sh +$ nix develop github:adtya/devshell#rust +``` +#### Activate with Direnv +```sh +use flake github:adtya/devshell#rust +``` diff --git a/flake.nix b/flake.nix index acc3a38..ad365b3 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,7 @@ go = import ./shells/go.nix { inherit pkgs; }; haskell = import ./shells/haskell.nix { inherit pkgs; }; python = import ./shells/python.nix { inherit pkgs; }; + rust = import ./shells/rust.nix { inherit pkgs; }; }; } ); diff --git a/shells/rust.nix b/shells/rust.nix new file mode 100644 index 0000000..ec3af8b --- /dev/null +++ b/shells/rust.nix @@ -0,0 +1,7 @@ +{ pkgs }: pkgs.mkShell { + packages = with pkgs; [ cargo rustc rustfmt rust-analyzer ]; + shellHook = '' + export CARGO_HOME=$PWD/.nix/cargo + export PATH=$CARGO_HOME/bin:$PATH + ''; +}