File tree 3 files changed +22
-16
lines changed 3 files changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -3632,9 +3632,26 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
3632
3632
terraform-format =
3633
3633
{
3634
3634
name = "terraform-format" ;
3635
- description = "Format terraform (`.tf`) files." ;
3636
- package = tools . terraform-fmt ;
3637
- entry = "${ hooks . terraform-format . package } /bin/terraform-fmt" ;
3635
+ description = "Format Terraform (`.tf`) files." ;
3636
+ package = tools . opentofu ;
3637
+ entry =
3638
+ let
3639
+ terraform-fmt = pkgs . writeScriptBin "terraform-fmt" ''
3640
+ #!/usr/bin/env bash
3641
+
3642
+ opentofu_or_terraform() {
3643
+ local bin_dir=${ hooks . terraform-format . package }
3644
+ if [ -f "'' ${bin_dir}/bin/tofu" ]; then
3645
+ '' ${bin_dir}/bin/tofu "$@"
3646
+ else
3647
+ '' ${bin_dir}/bin/terraform "$@"
3648
+ fi
3649
+ }
3650
+
3651
+ opentofu_or_terraform fmt -check -diff "$@"
3652
+ '' ;
3653
+ in
3654
+ "${ terraform-fmt } /bin/terraform-fmt" ;
3638
3655
files = "\\ .tf$" ;
3639
3656
} ;
3640
3657
terraform-validate =
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 51
51
, nodePackages
52
52
, ocamlPackages
53
53
, opam
54
+ , opentofu
54
55
, ormolu
55
56
, pkgsBuildBuild
56
57
, poetry
137
138
mdsh
138
139
nil
139
140
nixpkgs-fmt
141
+ opentofu
140
142
ormolu
141
143
pre-commit-hook-ensure-sops
142
144
poetry
185
187
hpack-dir = callPackage ./hpack-dir { } ;
186
188
hunspell = callPackage ./hunspell { } ;
187
189
purty = callPackage ./purty { purty = nodePackages . purty ; } ;
188
- terraform-fmt = callPackage ./terraform-fmt { } ;
189
190
terraform-validate = callPackage ./terraform-validate { } ;
190
191
tflint = callPackage ./tflint { } ;
191
192
dune-build-opam-files = callPackage ./dune-build-opam-files { dune = dune_3 ; inherit ( pkgsBuildBuild ) ocaml ; } ;
You can’t perform that action at this time.
0 commit comments