From 0db0890e15a37418bf1d281b64c236358d40ad44 Mon Sep 17 00:00:00 2001 From: Aaron Honeycutt Date: Sat, 15 Feb 2025 23:07:35 -0700 Subject: [PATCH] add shell and flake for nix-shell or nix develop for Rust --- dev/rust/flake.lock | 27 +++++++++++++++++++++++++++ dev/rust/flake.nix | 21 +++++++++++++++++++++ dev/rust/shell.nix | 13 +++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 dev/rust/flake.lock create mode 100644 dev/rust/flake.nix create mode 100644 dev/rust/shell.nix diff --git a/dev/rust/flake.lock b/dev/rust/flake.lock new file mode 100644 index 0000000..bdca2b2 --- /dev/null +++ b/dev/rust/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1739446958, + "narHash": "sha256-+/bYK3DbPxMIvSL4zArkMX0LQvS7rzBKXnDXLfKyRVc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2ff53fe64443980e139eaa286017f53f88336dd0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/dev/rust/flake.nix b/dev/rust/flake.nix new file mode 100644 index 0000000..123646a --- /dev/null +++ b/dev/rust/flake.nix @@ -0,0 +1,21 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + in + { + + devShells."x86_64-linux".default = pkgs.mkShell { + packages = with pkgs; [ cargo rustc ]; + }; + + RUST_BACKTRACE = 1; + + }; +} diff --git a/dev/rust/shell.nix b/dev/rust/shell.nix new file mode 100644 index 0000000..f6754e1 --- /dev/null +++ b/dev/rust/shell.nix @@ -0,0 +1,13 @@ +{ pkgs ? import {} }: + + pkgs.mkShell { + packages = with pkgs; [ cargo rustc ]; + + #inputsFrom = with pkgs; [ bat ]; + + RUST_BACKTRACE = 1; + + shellHook = '' + echo "Ready to make some rust!" + ''; +}