]> patrickod personal git archive - tincan.git/blobdiff - flake.nix
base flake.nix & direnv configuration for editors
[tincan.git] / flake.nix
diff --git a/flake.nix b/flake.nix
new file mode 100644 (file)
index 0000000..d9ef43b
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,39 @@
+{
+  description = "rust ARM M-0 development";
+  inputs = {
+    nixpkgs.url      = "github:patrickod/nixpkgs";
+    rust-overlay.url = "github:oxalica/rust-overlay";
+    flake-utils.url  = "github:numtide/flake-utils";
+  };
+
+  outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let
+        overlays = [ (import rust-overlay) ];
+        pkgs = import nixpkgs {
+          inherit system overlays;
+        };
+        rust = pkgs.rust-bin.nightly.latest.default.override {
+          extensions = [
+            "clippy-preview"
+            "rust-src"
+            "rustfmt-preview"
+            "rust-analyzer-preview"
+          ];
+          targets = [
+            "thumbv6m-none-eabi"
+          ];
+        };
+      in
+      {
+        devShell = pkgs.mkShell {
+          buildInputs = [
+            pkgs.gcc-arm-embedded
+            pkgs.probe-run
+            pkgs.cargo-hf2
+            rust
+          ];
+        };
+      }
+    );
+}