From ae7e9009c24193d06daa77bdfcde9caeb37053e4 Mon Sep 17 00:00:00 2001 From: Patrick O'Doherty Date: Fri, 4 Sep 2020 16:13:51 -0700 Subject: [PATCH] Add nix & direnv rust environment configuration --- .envrc | 1 + shell.nix | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .envrc 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/shell.nix b/shell.nix new file mode 100644 index 0000000..19b7c15 --- /dev/null +++ b/shell.nix @@ -0,0 +1,38 @@ +let + rust-version = "1.46.0"; + + nixpkgs = fetchGit { + url = "https://github.com/patrickod/nixpkgs.git"; + rev = "8bb6ca5f0a93bb0b9264b50a8c56431c7c7cc591"; + ref = "personal"; + }; + + mozilla-overlay = + import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz); + + pkgs = import nixpkgs { + overlays = [ mozilla-overlay ]; + }; + + targets = [ + "x86_64-unknown-linux-gnu" + "thumbv7em-none-eabihf" + ]; + +in + pkgs.mkShell { + name = "rust-dev"; + nativeBuildInputs = with pkgs; [ + (rustChannels.stable.rust.override { + targets = targets; + extensions = [ + "rust-src" + "rust-analysis" + "rls-preview" + ]; + }) + gcc-arm-embedded + cargo-hf2 + rustup + ]; + } -- 2.42.0