diff --git a/modules/hooks.nix b/modules/hooks.nix index 9e358273..63bcc1cb 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -3688,9 +3688,9 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol terraform-format = { name = "terraform-format"; - description = "Format terraform (`.tf`) files."; - package = tools.terraform-fmt; - entry = "${hooks.terraform-format.package}/bin/terraform-fmt"; + description = "Format Terraform (`.tf`) files."; + package = tools.opentofu; + entry = "${lib.getExe hooks.terraform-format.package} fmt -check -diff"; files = "\\.tf$"; }; terraform-validate = diff --git a/nix/terraform-fmt/default.nix b/nix/terraform-fmt/default.nix deleted file mode 100644 index 2e18714a..00000000 --- a/nix/terraform-fmt/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ writeScriptBin, opentofu }: - -writeScriptBin "terraform-fmt" ''#!/usr/bin/env bash - for arg in "$@"; do - dirname "$arg" - done \ - | sort \ - | uniq \ - | while read dir; do - ${opentofu}/bin/tofu fmt "$dir" - done -'' diff --git a/nix/tools.nix b/nix/tools.nix index 7bcfda95..c509f8d3 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -51,6 +51,7 @@ , nodePackages , ocamlPackages , opam +, opentofu , ormolu , pkgsBuildBuild , poetry @@ -137,6 +138,7 @@ in mdsh nil nixpkgs-fmt + opentofu ormolu pre-commit-hook-ensure-sops poetry @@ -185,7 +187,6 @@ in hpack-dir = callPackage ./hpack-dir { }; hunspell = callPackage ./hunspell { }; purty = callPackage ./purty { purty = nodePackages.purty; }; - terraform-fmt = callPackage ./terraform-fmt { }; terraform-validate = callPackage ./terraform-validate { }; tflint = callPackage ./tflint { }; dune-build-opam-files = callPackage ./dune-build-opam-files { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };