26182618 # need version >= 0.4.0 for the --from-stdin flag
26192619 toolVersionCheck = lib . versionAtLeast convco . version "0.4.0" ;
26202620 in
2621- lib . throwIf ( convco == null || ! toolVersionCheck ) "The version of Nixpkgs used by git-hooks.nix does not have the `convco` package (>=0.4.0). Please use a more recent version of Nixpkgs."
2621+ lib . throwIfNot toolVersionCheck "The version of Nixpkgs used by git-hooks.nix does not have the `convco` package (>=0.4.0). Please use a more recent version of Nixpkgs."
26222622 builtins . toString
26232623 script ;
26242624 stages = [ "commit-msg" ] ;
@@ -3089,9 +3089,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
30893089 "$PRE_COMMIT_COMMIT_MSG_SOURCE" --commit-msg-file "$1"
30903090 '' ;
30913091 in
3092- lib . throwIf ( hooks . gptcommit . package == null ) "The version of Nixpkgs used by git-hooks.nix does not have the `gptcommit` package. Please use a more recent version of Nixpkgs."
3093- toString
3094- script ;
3092+ toString script ;
30953093 stages = [ "prepare-commit-msg" ] ;
30963094 } ;
30973095 hadolint =
@@ -3110,13 +3108,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
31103108 ## https://github.com/Frama-C/headache/blob/master/config_builtin.txt
31113109 files = "(\\ .ml[ily]?$)|(\\ .fmli?$)|(\\ .[chy]$)|(\\ .tex$)|(Makefile)|(README)|(LICENSE)" ;
31123110 package = tools . headache ;
3113- entry =
3114- ## NOTE: `headache` made into in nixpkgs on 12 April 2023. At the
3115- ## next NixOS release, the following code will become irrelevant.
3116- lib . throwIf
3117- ( hooks . headache . package == null )
3118- "The version of nixpkgs used by git-hooks.nix does not have `ocamlPackages.headache`. Please use a more recent version of nixpkgs."
3119- "${ hooks . headache . package } /bin/headache -h ${ hooks . headache . settings . header-file } " ;
3111+ entry = "${ hooks . headache . package } /bin/headache -h ${ hooks . headache . settings . header-file } " ;
31203112 } ;
31213113 hindent =
31223114 {
@@ -3646,16 +3638,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
36463638 pre-commit-hook-ensure-sops = {
36473639 name = "pre-commit-hook-ensure-sops" ;
36483640 package = tools . pre-commit-hook-ensure-sops ;
3649- entry =
3650- ## NOTE: pre-commit-hook-ensure-sops landed in nixpkgs on 8 July 2022. Once it reaches a
3651- ## release of NixOS, the `throwIf` piece of code below will become
3652- ## useless.
3653- lib . throwIf
3654- ( hooks . pre-commit-hook-ensure-sops . package == null )
3655- "The version of nixpkgs used by git-hooks.nix does not have the `pre-commit-hook-ensure-sops` package. Please use a more recent version of nixpkgs."
3656- ''
3657- ${ hooks . pre-commit-hook-ensure-sops . package } /bin/pre-commit-hook-ensure-sops
3658- '' ;
3641+ entry = "${ hooks . pre-commit-hook-ensure-sops . package } /bin/pre-commit-hook-ensure-sops" ;
36593642 files = "^secrets" ;
36603643 } ;
36613644 # See all CLI flags for prettier [here](https://prettier.io/docs/en/cli.html).
@@ -4134,25 +4117,17 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
41344117 description = "A universal formatter engine within the Tree-sitter ecosystem, with support for many languages." ;
41354118 package = tools . topiary ;
41364119 entry =
4137- ## NOTE: Topiary landed in nixpkgs on 2 Dec 2022. Once it reaches a
4138- ## release of NixOS, the `throwIf` piece of code below will become
4139- ## useless.
4140- lib . throwIf
4141- ( hooks . topiary . package == null )
4142- "The version of nixpkgs used by git-hooks.nix does not have the `topiary` package. Please use a more recent version of nixpkgs."
4143- (
4144- let
4145- topiary-inplace = pkgs . writeShellApplication {
4146- name = "topiary-inplace" ;
4147- text = ''
4148- for file; do
4149- ${ hooks . topiary . package } /bin/topiary --in-place --input-file "$file"
4150- done
4151- '' ;
4152- } ;
4153- in
4154- "${ topiary-inplace } /bin/topiary-inplace"
4155- ) ;
4120+ let
4121+ topiary-inplace = pkgs . writeShellApplication {
4122+ name = "topiary-inplace" ;
4123+ text = ''
4124+ for file; do
4125+ ${ hooks . topiary . package } /bin/topiary --in-place --input-file "$file"
4126+ done
4127+ '' ;
4128+ } ;
4129+ in
4130+ "${ topiary-inplace } /bin/topiary-inplace" ;
41564131 files = "(\\ .json$)|(\\ .toml$)|(\\ .mli?$)" ;
41574132 } ;
41584133 treefmt =
@@ -4257,11 +4232,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
42574232 name = "typstyle" ;
42584233 description = "Beautiful and reliable typst code formatter" ;
42594234 package = tools . typstyle ;
4260- entry =
4261- lib . throwIf
4262- ( hooks . typstyle . package == null )
4263- "The version of nixpkgs used by git-hooks.nix must contain typstyle"
4264- "${ hooks . typstyle . package } /bin/typstyle -i" ;
4235+ entry = "${ hooks . typstyle . package } /bin/typstyle -i" ;
42654236 files = "\\ .typ$" ;
42664237 } ;
42674238 uv-check = {
0 commit comments