diff --git a/README.md b/README.md index ac188501..e6895e4d 100644 --- a/README.md +++ b/README.md @@ -297,7 +297,7 @@ clang-format supports. ### Terraform -- `terraform-format`: built-in formatter (using [OpenTofu](https://opentofu.org/)'s [`fmt`](https://opentofu.org/docs/cli/commands/fmt/)) +- [tofu fmt](https://opentofu.org/docs/cli/commands/fmt/) - [tflint](https://github.com/terraform-linters/tflint) ### YAML diff --git a/modules/hooks.nix b/modules/hooks.nix index 95e7df89..2c2a703a 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -3340,8 +3340,8 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol { name = "terraform-format"; description = "Format terraform (`.tf`) files."; - package = tools.terraform-fmt; - entry = "${hooks.terraform-format.package}/bin/terraform-fmt"; + package = tools.opentofu; + entry = "${hooks.terraform-format.package}/bin/tofu fmt"; files = "\\.tf$"; }; tflint = 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 9bcc89d5..b121ab82 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -49,6 +49,7 @@ , nodePackages , ocamlPackages , opam +, opentofu , ormolu , pkgsBuildBuild , poetry @@ -133,6 +134,7 @@ in nil nixfmt nixpkgs-fmt + opentofu ormolu pre-commit-hook-ensure-sops poetry @@ -180,7 +182,6 @@ in hpack-dir = callPackage ./hpack-dir { }; hunspell = callPackage ./hunspell { }; purty = callPackage ./purty { purty = nodePackages.purty; }; - terraform-fmt = callPackage ./terraform-fmt { }; tflint = callPackage ./tflint { }; dune-build-opam-files = callPackage ./dune-build-opam-files { dune = dune_3; inherit (pkgsBuildBuild) ocaml; }; dune-fmt = callPackage ./dune-fmt { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };