add more pre-commit-hooks

This commit is contained in:
sid 2026-05-10 18:10:45 +02:00
parent 93331e06f3
commit 21a610df37
3 changed files with 35 additions and 27 deletions

View file

@ -23,17 +23,14 @@
inherit (self) outputs;
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
lib = nixpkgs.lib.extend (final: prev: inputs.synix.lib or { });
lib = nixpkgs.lib.extend (_final: _prev: inputs.synix.lib or { });
mkNixosConfiguration =
system: modules:
nixpkgs.lib.nixosSystem {
lib.nixosSystem {
inherit system modules;
specialArgs = {
inherit inputs outputs lib;
@ -53,8 +50,6 @@
);
in
{
packages = forAllSystems (pkgs: import ./pkgs pkgs);
overlays = import ./overlays { inherit inputs; };
nixosModules = import ./modules/nixos;
@ -63,6 +58,8 @@
ess-helm = mkNixosConfiguration "x86_64-linux" [ ./hosts/ess-helm ];
};
packages = forAllSystems (pkgs: import ./pkgs pkgs);
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
shellHook = "export FLAKE_PATH=$(pwd)";
@ -72,25 +69,33 @@
formatter = forAllSystems (
pkgs:
let
inherit (self.checks.${pkgs.system}.pre-commit-check.config) package configFile;
script = ''
${pkgs.lib.getExe package} run --all-files --config ${configFile}
'';
inherit (pkgs.stdenv.hostPlatform) system;
inherit (self.checks.${system}.pre-commit-check.config) package configFile;
in
pkgs.writeShellScriptBin "pre-commit-run" script
pkgs.writeShellScriptBin "pre-commit-run" "${lib.getExe package} run --all-files --config ${configFile}"
);
checks = forAllSystems (pkgs: {
pre-commit-check = inputs.git-hooks.lib.${pkgs.system}.run {
src = ./.;
hooks = {
nixfmt.enable = true;
checks = forAllSystems (
pkgs:
let
inherit (pkgs.stdenv.hostPlatform) system;
in
{
pre-commit-check = inputs.git-hooks.lib.${system}.run {
src = ./.;
hooks = {
actionlint.enable = true;
nixfmt.enable = true;
shellcheck.enable = true;
statix.enable = true;
yamllint.enable = true;
};
};
};
build-packages = pkgs.linkFarm "flake-packages-${pkgs.system}" self.packages.${pkgs.system};
build-overlayed-packages = pkgs.linkFarm "flake-overlayed-packages-${pkgs.system}" (
self.overlays.modifications pkgs pkgs
);
});
build-packages = pkgs.linkFarm "flake-packages-${system}" self.packages.${system};
build-overlayed-packages = pkgs.linkFarm "flake-overlayed-packages-${system}" (
self.overlays.modifications pkgs pkgs
);
}
);
};
}