]> patrickod personal git archive - tincan.git/commitdiff
base flake.nix & direnv configuration for editors
authorPatrick O'Doherty <p@trickod.com>
Mon, 12 Jul 2021 05:02:54 +0000 (22:02 -0700)
committerPatrick O'Doherty <p@trickod.com>
Tue, 13 Jul 2021 07:09:48 +0000 (00:09 -0700)
add
  - flake.nix w/ rust, gcc-arm-embedded, & cargo utilities
  - add .envrc for direnv configuration (emacs, vscode, etc..)
  - add .direnv to .gitignore to prevent cross-contamination

.gitignore
flake.lock [new file with mode: 0644]
flake.nix [new file with mode: 0644]

index 756e9c61613325caa43fcb631d057600994c32b4..b51e51ab2a50e2ebb3955c032c3ead52de0e77da 100644 (file)
@@ -1,2 +1,3 @@
 target
 .*.sw?
+.direnv
diff --git a/flake.lock b/flake.lock
new file mode 100644 (file)
index 0000000..6b6c79b
--- /dev/null
@@ -0,0 +1,92 @@
+{
+  "nodes": {
+    "flake-utils": {
+      "locked": {
+        "lastModified": 1623875721,
+        "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_2": {
+      "locked": {
+        "lastModified": 1614513358,
+        "narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "5466c5bbece17adaab2d82fae80b46e807611bf3",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1625950041,
+        "narHash": "sha256-AG5nHJFa5ZYTS4XvPIQjLp6PRDaXw8ufzuSgQrsPFxk=",
+        "owner": "patrickod",
+        "repo": "nixpkgs",
+        "rev": "8526fbfca0d4a6cff72d85844e02ae0c8dbbfee2",
+        "type": "github"
+      },
+      "original": {
+        "owner": "patrickod",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs_2": {
+      "locked": {
+        "lastModified": 1617325113,
+        "narHash": "sha256-GksR0nvGxfZ79T91UUtWjjccxazv6Yh/MvEJ82v1Xmw=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "54c1e44240d8a527a8f4892608c4bce5440c3ecb",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs",
+        "rust-overlay": "rust-overlay"
+      }
+    },
+    "rust-overlay": {
+      "inputs": {
+        "flake-utils": "flake-utils_2",
+        "nixpkgs": "nixpkgs_2"
+      },
+      "locked": {
+        "lastModified": 1626055976,
+        "narHash": "sha256-JWqjfR0eeE505Xp26d3z/0T8+YljjHlS8VX/yCknskY=",
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "rev": "ecb9af08bc7ce17a4c51378c7a301925d4c4344c",
+        "type": "github"
+      },
+      "original": {
+        "owner": "oxalica",
+        "repo": "rust-overlay",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
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
+          ];
+        };
+      }
+    );
+}