From 1cc9ba632a1b191bee2d445228380a9ff6e8cb7d Mon Sep 17 00:00:00 2001 From: foosinn Date: Sun, 11 Jul 2021 00:27:17 +0200 Subject: [PATCH] add nixos shell --- .envrc | 1 + rust-toolchain | 4 ++++ shell.nix | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 .envrc create mode 100644 rust-toolchain create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..051d09d --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +eval "$(lorri direnv)" diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..7aefc74 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = [ "rust-src" ] +targets = [ "thumbv6m-none-eabi" ] diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..8d205bb --- /dev/null +++ b/shell.nix @@ -0,0 +1,20 @@ +# Use nixpkgs with oxalica rust-bin overlay +let + rust_overlay = import (builtins.fetchTarball + "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"); + nixpkgs = import { overlays = [ rust_overlay ]; }; + rust_channel = nixpkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain; +in +# Avoid typing `nixpkgs.` before each package name +with nixpkgs; + +# Define the shell +pkgs.mkShell { + buildInputs = [ + dfu-util + ]; + + nativeBuildInputs = [ + rust_channel # Full rust from overlay, includes cargo + ]; +}