]> patrickod personal git archive - keywing-rs.git/commitdiff
Add nix & direnv rust environment configuration
authorPatrick O'Doherty <p@trickod.com>
Fri, 4 Sep 2020 23:13:51 +0000 (16:13 -0700)
committerPatrick O'Doherty <p@trickod.com>
Fri, 4 Sep 2020 23:13:51 +0000 (16:13 -0700)
.envrc [new file with mode: 0644]
shell.nix [new file with mode: 0644]

diff --git a/.envrc b/.envrc
new file mode 100644 (file)
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 (file)
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
+    ];
+  }