forked from DGNum/infrastructure
feat(git-hooks): Update
- Patch git-hooks.nix source to rename `nixfmt` to `nixfmt-classic` and avoid annoying warnings when reloading the shell
This commit is contained in:
parent
60267b4ff6
commit
2cb6c24535
3 changed files with 75 additions and 31 deletions
14
default.nix
14
default.nix
|
@ -41,7 +41,15 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
pre-commit-check = (import sources.pre-commit-hooks).run {
|
git-checks =
|
||||||
|
(import (
|
||||||
|
pkgs.applyPatches {
|
||||||
|
name = "git-hooks.nix";
|
||||||
|
src = builtins.storePath sources.git-hooks;
|
||||||
|
patches = [ ./patches/00-git-hooks-nixfmt.patch ];
|
||||||
|
}
|
||||||
|
)).run
|
||||||
|
{
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
hooks = {
|
hooks = {
|
||||||
|
@ -86,7 +94,7 @@ in
|
||||||
] ++ (import ./scripts { inherit pkgs; });
|
] ++ (import ./scripts { inherit pkgs; });
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
${pre-commit-check.shellHook}
|
${git-checks.shellHook}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
@ -96,7 +104,7 @@ in
|
||||||
name = "pre-commit-shell";
|
name = "pre-commit-shell";
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
${pre-commit-check.shellHook}
|
${git-checks.shellHook}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,6 +79,18 @@
|
||||||
"url": null,
|
"url": null,
|
||||||
"hash": "1bashjbh71dqs32yld7ihw2vz0vrad73pc35crf3qck8ssgpzv7d"
|
"hash": "1bashjbh71dqs32yld7ihw2vz0vrad73pc35crf3qck8ssgpzv7d"
|
||||||
},
|
},
|
||||||
|
"git-hooks": {
|
||||||
|
"type": "Git",
|
||||||
|
"repository": {
|
||||||
|
"type": "GitHub",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix"
|
||||||
|
},
|
||||||
|
"branch": "master",
|
||||||
|
"revision": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07",
|
||||||
|
"url": "https://github.com/cachix/git-hooks.nix/archive/0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07.tar.gz",
|
||||||
|
"hash": "0bmgc731c5rvky6qxc4f6gvgyiic8dna5dv3j19kya86idf7wn0p"
|
||||||
|
},
|
||||||
"kadenios": {
|
"kadenios": {
|
||||||
"type": "Git",
|
"type": "Git",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -233,18 +245,6 @@
|
||||||
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre647518.1afc5440469f/nixexprs.tar.xz",
|
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre647518.1afc5440469f/nixexprs.tar.xz",
|
||||||
"hash": "1y526xag5s2jyrs3w08pgwa8891zv2ibwl5jmkbr94x4vpyir8hz"
|
"hash": "1y526xag5s2jyrs3w08pgwa8891zv2ibwl5jmkbr94x4vpyir8hz"
|
||||||
},
|
},
|
||||||
"pre-commit-hooks": {
|
|
||||||
"type": "Git",
|
|
||||||
"repository": {
|
|
||||||
"type": "GitHub",
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "pre-commit-hooks.nix"
|
|
||||||
},
|
|
||||||
"branch": "master",
|
|
||||||
"revision": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07",
|
|
||||||
"url": "https://github.com/cachix/pre-commit-hooks.nix/archive/0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07.tar.gz",
|
|
||||||
"hash": "0bmgc731c5rvky6qxc4f6gvgyiic8dna5dv3j19kya86idf7wn0p"
|
|
||||||
},
|
|
||||||
"signal-irc-bridge": {
|
"signal-irc-bridge": {
|
||||||
"type": "Git",
|
"type": "Git",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
36
patches/00-git-hooks-nixfmt.patch
Normal file
36
patches/00-git-hooks-nixfmt.patch
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
diff --git a/modules/hooks.nix b/modules/hooks.nix
|
||||||
|
index bb194ee..8505794 100644
|
||||||
|
--- a/modules/hooks.nix
|
||||||
|
+++ b/modules/hooks.nix
|
||||||
|
@@ -2848,7 +2848,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
|
||||||
|
{
|
||||||
|
name = "nixfmt";
|
||||||
|
description = "Nix code prettifier.";
|
||||||
|
- package = tools.nixfmt;
|
||||||
|
+ package = tools.nixfmt-classic;
|
||||||
|
entry = "${hooks.nixfmt.package}/bin/nixfmt ${lib.optionalString (hooks.nixfmt.settings.width != null) "--width=${toString hooks.nixfmt.settings.width}"}";
|
||||||
|
files = "\\.nix$";
|
||||||
|
};
|
||||||
|
diff --git a/nix/tools.nix b/nix/tools.nix
|
||||||
|
index 9bcc89d..9fec5d5 100644
|
||||||
|
--- a/nix/tools.nix
|
||||||
|
+++ b/nix/tools.nix
|
||||||
|
@@ -44,7 +44,7 @@
|
||||||
|
, mdl
|
||||||
|
, mdsh
|
||||||
|
, nil
|
||||||
|
-, nixfmt
|
||||||
|
+, nixfmt-classic
|
||||||
|
, nixpkgs-fmt
|
||||||
|
, nodePackages
|
||||||
|
, ocamlPackages
|
||||||
|
@@ -131,7 +131,7 @@ in
|
||||||
|
mdl
|
||||||
|
mdsh
|
||||||
|
nil
|
||||||
|
- nixfmt
|
||||||
|
+ nixfmt-classic
|
||||||
|
nixpkgs-fmt
|
||||||
|
ormolu
|
||||||
|
pre-commit-hook-ensure-sops
|
||||||
|
|
Loading…
Reference in a new issue