From 720b5efc36822906a6894024b5745c9573878300 Mon Sep 17 00:00:00 2001
From: Michael Zhang <mail@mzhang.io>
Date: Fri, 17 Mar 2023 01:50:27 -0500
Subject: [PATCH] initial

---
 .envrc     |  1 +
 .gitignore |  2 ++
 flake.lock | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 flake.nix  | 34 ++++++++++++++++++++
 4 files changed, 130 insertions(+)
 create mode 100644 .envrc
 create mode 100644 .gitignore
 create mode 100644 flake.lock
 create mode 100644 flake.nix

diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..75e92a9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+target
+.direnv
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..75503b6
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,93 @@
+{
+  "nodes": {
+    "fenix": {
+      "inputs": {
+        "nixpkgs": "nixpkgs",
+        "rust-analyzer-src": "rust-analyzer-src"
+      },
+      "locked": {
+        "lastModified": 1678947834,
+        "narHash": "sha256-2+f3NAociAJV/Ux+dVZBbeDm94VxxoX6rFIVALMF1Y0=",
+        "owner": "nix-community",
+        "repo": "fenix",
+        "rev": "65537912ff6741f88271f11a0a48c293f865dd9d",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "repo": "fenix",
+        "type": "github"
+      }
+    },
+    "flake-utils": {
+      "locked": {
+        "lastModified": 1678901627,
+        "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
+        "type": "github"
+      },
+      "original": {
+        "id": "flake-utils",
+        "type": "indirect"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1678819893,
+        "narHash": "sha256-lfA6WGdxPsPkBK5Y19ltr5Sn7v7MlT+jpZ4nUgco0Xs=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "7067edc68c035e21780259ed2d26e1f164addaa2",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs_2": {
+      "locked": {
+        "lastModified": 1663551060,
+        "narHash": "sha256-e2SR4cVx9p7aW/XnVsGsWZBplApA9ZJUjc0fejJhnYo=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "8a5b9ee7b7a2b38267c9481f5c629c015108ab0d",
+        "type": "github"
+      },
+      "original": {
+        "id": "nixpkgs",
+        "type": "indirect"
+      }
+    },
+    "root": {
+      "inputs": {
+        "fenix": "fenix",
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs_2"
+      }
+    },
+    "rust-analyzer-src": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1678888936,
+        "narHash": "sha256-xs5tbRf0k1RA9li0rM7k1ar0sG5DHp9+rpAP7sjhsNw=",
+        "owner": "rust-lang",
+        "repo": "rust-analyzer",
+        "rev": "924d277f32b53219fcaa03226c17b485a081ed16",
+        "type": "github"
+      },
+      "original": {
+        "owner": "rust-lang",
+        "ref": "nightly",
+        "repo": "rust-analyzer",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..4ad1a69
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,34 @@
+{
+  inputs = { fenix.url = "github:nix-community/fenix"; };
+
+  outputs = { self, nixpkgs, flake-utils, fenix }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let
+        pkgs = import nixpkgs {
+          inherit system;
+          overlays = [ fenix.overlays.default ];
+        };
+
+        toolchain = pkgs.fenix.stable;
+      in rec {
+        devShell = pkgs.mkShell {
+          packages = (with pkgs; [
+            cargo-deny
+            cargo-edit
+            cargo-expand
+            cargo-flamegraph
+            cargo-watch
+
+          ]) ++ (with toolchain; [
+            cargo
+            rustc
+            clippy
+
+            # Get the nightly version of rustfmt so we can wrap comments
+            pkgs.fenix.default.rustfmt
+          ]);
+
+          CARGO_UNSTABLE_SPARSE_REGISTRY = "true";
+        };
+      });
+}