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/flake.lock b/flake.lock new file mode 100644 index 0000000..a553314 --- /dev/null +++ b/flake.lock @@ -0,0 +1,78 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1783604885, + "narHash": "sha256-tzMgSkV7kljEkqIjlgV6F+n+xD+/a35Db8bs7a4BFAo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "767b0d3ec98a143ad9ed7dfc0d5553510ac27133", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", + "systems": "systems" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1783747106, + "narHash": "sha256-KlepQu/O5m11lAjcJ4ER5bc6bIzyX2UMPDARzMzQfIw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "e598b37857b895b81020a65a802ef55f5bbed72f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c6640d0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + rust-overlay.url = "github:oxalica/rust-overlay"; + + systems.url = "github:nix-systems/default"; + }; + + outputs = { + nixpkgs, + systems, + ... + } @ inputs: let + eachSystem = f: + nixpkgs.lib.genAttrs (import systems) ( + system: + f (import nixpkgs { + inherit system; + overlays = [inputs.rust-overlay.overlays.default]; + }) + ); + + rustToolchain = eachSystem (pkgs: (pkgs.rust-bin.stable.latest.default.override { + extensions = ["rust-src"]; + })); + in { + devShells = eachSystem (pkgs: { + default = pkgs.mkShell { + RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; + packages = + [ + rustToolchain.${pkgs.system} + ] + ++ (with pkgs; [ + rust-analyzer-unwrapped + cargo + cargo-insta + cargo-hack + bacon + ]); + }; + }); + }; +}