mirror of
https://git.sr.ht/~bryan_bennett/flake_env
synced 2025-12-16 22:51:24 +01:00
Add pre-commit-hooks.nix integration
This commit is contained in:
parent
44d628b6d9
commit
ce8b85584a
4 changed files with 170 additions and 20 deletions
59
flake.nix
59
flake.nix
|
|
@ -6,30 +6,43 @@
|
|||
url = "github:hercules-ci/flake-parts";
|
||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
nix-filter = {
|
||||
url = "github:numtide/nix-filter";
|
||||
};
|
||||
pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; };
|
||||
nix-filter = { url = "github:numtide/nix-filter"; };
|
||||
};
|
||||
|
||||
outputs = inputs @ { flake-parts, nix-filter, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; }
|
||||
({ lib, ... }: {
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
outputs =
|
||||
inputs @ { flake-parts
|
||||
, nix-filter
|
||||
, pre-commit-hooks
|
||||
, ...
|
||||
}:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: {
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
perSystem = { config, pkgs, self', ... }: {
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
imports = [ pre-commit-hooks.flakeModule ];
|
||||
perSystem =
|
||||
{ config
|
||||
, pkgs
|
||||
, self'
|
||||
, ...
|
||||
}: {
|
||||
packages = {
|
||||
flake_env = pkgs.ocamlPackages.callPackage ./default.nix { inherit nix-filter; };
|
||||
flake_env = pkgs.ocamlPackages.callPackage ./default.nix {
|
||||
inherit nix-filter;
|
||||
};
|
||||
default = config.packages.flake_env;
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
inputsFrom = [ self'.packages.default ];
|
||||
packages = [
|
||||
pkgs.just
|
||||
pkgs.rnix-lsp
|
||||
pkgs.pre-commit
|
||||
pkgs.ocamlPackages.alcotest
|
||||
pkgs.ocamlPackages.bisect_ppx
|
||||
pkgs.ocamlPackages.dune_3
|
||||
|
|
@ -39,12 +52,22 @@
|
|||
pkgs.ocamlPackages.ocamlformat
|
||||
pkgs.ocamlPackages.ocamlformat-rpc-lib
|
||||
];
|
||||
shellHook = config.pre-commit.installationScript;
|
||||
};
|
||||
pre-commit = {
|
||||
check.enable = true;
|
||||
settings.hooks = {
|
||||
nixpkgs-fmt.enable = true;
|
||||
dune-fmt.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
flake = {
|
||||
overlays.default = final: _prev: {
|
||||
flake_env = final.ocamlPackages.callPackage ./default.nix { inherit nix-filter; };
|
||||
flake = {
|
||||
overlays.default = final: _prev: {
|
||||
flake_env = final.ocamlPackages.callPackage ./default.nix {
|
||||
inherit nix-filter;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue