File tree Expand file tree Collapse file tree 1 file changed +21
-11
lines changed Expand file tree Collapse file tree 1 file changed +21
-11
lines changed Original file line number Diff line number Diff line change 861
861
entry = "${ tools . hunspell } /bin/hunspell -l" ;
862
862
files = "\\ .((txt)|(html)|(xml)|(md)|(rst)|(tex)|(odf)|\\ d)$" ;
863
863
} ;
864
+
864
865
topiary =
865
866
{
866
867
name = "topiary" ;
867
868
description = "A universal formatter engine within the Tree-sitter ecosystem, with support for many languages." ;
868
869
entry =
869
- let
870
- topiary-inplace = pkgs . writeShellApplication {
871
- name = "topiary-inplace" ;
872
- text = ''
873
- for file; do
874
- ${ tools . topiary } /bin/topiary --in-place --input-file "$file"
875
- done
876
- '' ;
877
- } ;
878
- in
879
- "${ topiary-inplace } /bin/topiary-inplace" ;
870
+ ## NOTE: Topiary landed in nixpkgs on 2 Dec 2022. Once it reaches a
871
+ ## release of NixOS, the `throwIf` piece of code below will become
872
+ ## useless.
873
+ lib . throwIf
874
+ ( tools . topiary == null )
875
+ "The version of nixpkgs used by pre-commit-hooks.nix does not have the `topiary` package. Please use a more recent version of nixpkgs."
876
+ (
877
+ let
878
+ topiary-inplace = pkgs . writeShellApplication {
879
+ name = "topiary-inplace" ;
880
+ text = ''
881
+ for file; do
882
+ ${ tools . topiary } /bin/topiary --in-place --input-file "$file"
883
+ done
884
+ '' ;
885
+ } ;
886
+ in
887
+ "${ topiary-inplace } /bin/topiary-inplace"
888
+ ) ;
880
889
files = "(\\ .json$)|(\\ .toml$)|(\\ .mli?$)" ;
881
890
} ;
891
+
882
892
typos =
883
893
{
884
894
name = "typos" ;
You can’t perform that action at this time.
0 commit comments