Convert to manual pre-commit

This commit is contained in:
Greg Hellings
2025-12-08 05:53:17 -06:00
parent 8964529f1a
commit a9806e4eb5
9 changed files with 71 additions and 140 deletions
-1
View File
@@ -1,6 +1,5 @@
host host
result result
.pre-commit-config.yaml
.direnv .direnv
# On home-manager only installs, this is built into the same dir # On home-manager only installs, this is built into the same dir
# where I am storing my repo # where I am storing my repo
+40
View File
@@ -0,0 +1,40 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-illegal-windows-names
- id: check-json
- id: check-merge-conflict
args:
- "--assume-in-merge"
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
hooks:
- id: yamllint
args:
- "-d"
- |-
extends: default
ignore:
- manifests/cnpg-system/barman-cloud.yaml
rules:
comments: false
comments-indentation: false
document-start: false
- repo: https://github.com/NixOS/nixfmt
rev: v1.1.0
hooks:
- id: nixfmt-nix
- repo: https://github.com/astro/deadnix
rev: v1.3.1
hooks:
- id: deadnix
+3 -34
View File
@@ -1,5 +1,4 @@
{ {
hooks,
lib, lib,
system, system,
top, top,
@@ -9,39 +8,9 @@
let let
meta = import ./hosts/metadata.nix; meta = import ./hosts/metadata.nix;
in in
{ # Pulls all hosts down to be a check
pre-commit-check = hooks.lib.${system}.run { (builtins.mapAttrs (_n: v: v.config.system.build.toplevel) (
src = ./.;
hooks = {
deadnix.enable = true;
# Needs https://github.com/DeterminateSystems/flake-checker/pull/130
#flake-checker.enable = true;
nixfmt-rfc-style.enable = true;
check-merge-conflicts.enable = true;
check-yaml.enable = true;
yamllint = {
enable = true;
args = [
"--config-data"
(lib.generators.toYAML { } {
extends = "default";
ignore = [
"manifests/cnpg-system/barman-cloud.yaml"
".pre-commit-config.yaml"
];
rules = {
comments = false;
comments-indentation = false;
document-start = false;
};
})
];
verbose = true;
};
};
};
}
// (builtins.mapAttrs (_n: v: v.config.system.build.toplevel) (
lib.filterAttrs (n: _v: builtins.any (a: a == system) meta.${n}.arch) top.self.nixosConfigurations lib.filterAttrs (n: _v: builtins.any (a: a == system) meta.${n}.arch) top.self.nixosConfigurations
)) ))
# Adds all packages as a check
// (top.self.packages.${system}) // (top.self.packages.${system})
Generated
+6 -80
View File
@@ -160,22 +160,6 @@
} }
}, },
"flake-compat": { "flake-compat": {
"flake": false,
"locked": {
"lastModified": 1761588595,
"narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"locked": { "locked": {
"lastModified": 1747046372, "lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
@@ -190,7 +174,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_3": { "flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1761588595, "lastModified": 1761588595,
@@ -358,27 +342,6 @@
"type": "github" "type": "github"
} }
}, },
"gitignore": {
"inputs": {
"nixpkgs": [
"hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"haumea": { "haumea": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -468,26 +431,6 @@
"type": "github" "type": "github"
} }
}, },
"hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1763988335,
"narHash": "sha256-QlcnByMc8KBjpU37rbq5iP7Cp97HvjRP0ucfdh+M4Qc=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "50b9238891e388c9fdc6a5c49e49c42533a1b5ce",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"ixx": { "ixx": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
@@ -713,22 +656,6 @@
} }
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": {
"lastModified": 1759417375,
"narHash": "sha256-O7eHcgkQXJNygY6AypkF9tFhsoDQjpNEojw3eFs73Ow=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dc704e6102e76aad573f63b74c742cd96f8f1e6c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1764517877, "lastModified": 1764517877,
"narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=",
@@ -744,7 +671,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1759770925, "lastModified": 1759770925,
"narHash": "sha256-CZwkCtzTNclqlhuwDsVtGoRumTpqCUK0xSnFIMgd8ls=", "narHash": "sha256-CZwkCtzTNclqlhuwDsVtGoRumTpqCUK0xSnFIMgd8ls=",
@@ -803,7 +730,7 @@
"nurpkgs": { "nurpkgs": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_4", "flake-parts": "flake-parts_4",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1764709261, "lastModified": 1764709261,
@@ -869,7 +796,7 @@
}, },
"proxmox": { "proxmox": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat",
"nixpkgs-libvncserver": "nixpkgs-libvncserver", "nixpkgs-libvncserver": "nixpkgs-libvncserver",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable": "nixpkgs-unstable_2", "nixpkgs-unstable": "nixpkgs-unstable_2",
@@ -898,7 +825,6 @@
"darwin": "darwin_2", "darwin": "darwin_2",
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"hmunstable": "hmunstable", "hmunstable": "hmunstable",
"hooks": "hooks",
"nix-hardware": "nix-hardware", "nix-hardware": "nix-hardware",
"nixos-generators": "nixos-generators", "nixos-generators": "nixos-generators",
"nixunstable": "nixunstable", "nixunstable": "nixunstable",
@@ -1092,7 +1018,7 @@
}, },
"vsext": { "vsext": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1764640937, "lastModified": 1764640937,
@@ -1110,7 +1036,7 @@
}, },
"wsl": { "wsl": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_2",
"nixpkgs": [ "nixpkgs": [
"nixunstable" "nixunstable"
] ]
-1
View File
@@ -24,7 +24,6 @@
inputs.nixpkgs.follows = "nixunstable"; inputs.nixpkgs.follows = "nixunstable";
}; };
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
hooks.url = "github:cachix/git-hooks.nix";
hmunstable = { hmunstable = {
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixunstable"; inputs.nixpkgs.follows = "nixunstable";
-1
View File
@@ -217,4 +217,3 @@ let g:ctrlp_user_command = {
\} \}
" let g:ctrpl_match_func = { 'match': 'pymatcher#PyMatch' } " let g:ctrpl_match_func = { 'match': 'pymatcher#PyMatch' }
" map <F6> <Esc>:CtrlP<Cr> " map <F6> <Esc>:CtrlP<Cr>
+3 -4
View File
@@ -1,5 +1,4 @@
{ {
self',
pkgs, pkgs,
nixvimunstable, nixvimunstable,
... ...
@@ -18,19 +17,19 @@ let
in in
{ {
default = pkgs.mkShell { default = pkgs.mkShell {
inherit (self'.checks.pre-commit-check) shellHook;
buildInputs = with pkgs; [ buildInputs = with pkgs; [
bashInteractive bashInteractive
stdenv.cc
curl curl
git git
gnutar gnutar
gzip gzip
inject inject
inject-darwin inject-darwin
nushell
vim vim
self'.checks.pre-commit-check.enabledPackages
tmux
xonsh xonsh
zellij
]; ];
}; };
} }