62 lines
1.4 KiB
Nix
62 lines
1.4 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
utils.url = "github:numtide/flake-utils";
|
|
git-hooks.url = "github:cachix/git-hooks.nix";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, utils, git-hooks, rust-overlay }:
|
|
utils.lib.eachDefaultSystem (system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
|
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
|
|
};
|
|
|
|
pre-commit-check = git-hooks.lib.${system}.run {
|
|
src = ./.;
|
|
hooks = {
|
|
rustfmt = {
|
|
enable = true;
|
|
packageOverrides = {
|
|
cargo = rustToolchain;
|
|
rustfmt = rustToolchain;
|
|
};
|
|
};
|
|
clippy = {
|
|
enable = true;
|
|
packageOverrides = {
|
|
cargo = rustToolchain;
|
|
clippy = rustToolchain;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
in
|
|
{
|
|
checks = {
|
|
inherit pre-commit-check;
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
inherit (pre-commit-check) shellHook;
|
|
nativeBuildInputs = with pkgs; [
|
|
pre-commit
|
|
gitleaks
|
|
|
|
rustToolchain
|
|
cargo-watch
|
|
crates-lsp
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = with pkgs; [
|
|
openssl
|
|
];
|
|
};
|
|
});
|
|
}
|