add flake

This commit is contained in:
Chris Cochrun 2026-03-31 10:00:00 -05:00
parent 5f26c94dce
commit fa2a1f1a00
2 changed files with 47 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

46
flake.nix Normal file
View file

@ -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;
};
}
);
}