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.nix b/flake.nix new file mode 100644 index 0000000..028f153 --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + inputs = { + naersk.url = "github:nix-community/naersk"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + utils.url = "github:numtide/flake-utils"; + fenix.url = "github:nix-community/fenix"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = inputs: + with inputs; + utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + naersk-lib = pkgs.callPackage naersk { }; + nbi = with pkgs; [ + + (rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { + extensions = [ "rust-src" "rust-analyzer" "clippy" ]; + })) + cargo-nextest + cargo-criterion + pkg-config + sccache + ]; + + bi = with pkgs; [ + just + cargo-watch + samply + ]; + in + { + defaultPackage = naersk-lib.buildPackage ./.; + devShell = with pkgs; mkShell { + nativeBuildInputs = nbi; + buildInputs = bi; + + RUST_SRC_PATH = rustPlatform.rustLibSrc; + }; + } + ); +}