Skip to content

Commit

Permalink
Override terraform-format git hook package
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Jan 21, 2025
1 parent a30b871 commit 2c2ae2c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/modules/languages/opentofu.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:

let
cfg = config.languages.opentofu;
Expand All @@ -16,8 +21,10 @@ in
};

config = lib.mkIf cfg.enable {
packages = with pkgs; [
packages = [
cfg.package
];

git-hooks.hooks.terraform-format.package = cfg.package;
};
}
14 changes: 12 additions & 2 deletions src/modules/languages/terraform.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:

let
cfg = config.languages.terraform;
Expand Down Expand Up @@ -33,13 +38,18 @@ in

config = lib.mkIf cfg.enable {
languages.terraform.package = lib.mkMerge [
(lib.mkIf (cfg.version != null) (nixpkgs-terraform.packages.${pkgs.stdenv.system}.${cfg.version} or (throw "Unsupported Terraform version, update the nixpkgs-terraform input or go to https://github.com/stackbuilders/nixpkgs-terraform/blob/main/versions.json for the full list of supported versions.")))
(lib.mkIf (cfg.version != null) (
nixpkgs-terraform.packages.${pkgs.stdenv.system}.${cfg.version}
or (throw "Unsupported Terraform version, update the nixpkgs-terraform input or go to https://github.com/stackbuilders/nixpkgs-terraform/blob/main/versions.json for the full list of supported versions.")
))
];

packages = with pkgs; [
cfg.package
terraform-ls
tfsec
];

git-hooks.hooks.terraform-format.package = cfg.package;
};
}

0 comments on commit 2c2ae2c

Please sign in to comment.