Skip to content

Commit

Permalink
rm opentofu registry patch, needs NixOS/nixpkgs#369770
Browse files Browse the repository at this point in the history
  • Loading branch information
KiaraGrouwstra committed Jan 9, 2025
1 parent 648b868 commit fb0d109
Showing 1 changed file with 22 additions and 50 deletions.
72 changes: 22 additions & 50 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,31 +110,7 @@
};
};

terraformProviders = let
terraform-providers = pkgs.terraform-providers.actualProviders;
in
lib.mapAttrs
(
_: provider:
if provider ? override
then
# use opentofu plugin registry over terraform's
provider.override (oldArgs: {
provider-source-address =
lib.replaceStrings ["https://registry.terraform.io/providers"] [
"registry.opentofu.org"
]
oldArgs.homepage;
})
else provider
)
(
removeAttrs terraform-providers [
"override"
"overrideDerivation"
"recurseForDerivations"
]
);
terraformProviders = pkgs.terraform-providers.actualProviders;

getRelease = terraform: pkgs.runCommand "release-tarball"
{
Expand Down Expand Up @@ -212,28 +188,6 @@
(name: p: (generateSchema terraform) (_: { ${name} = p; }))
terraformProviders;

mkDevShell = terraform:
args: pkgs.mkShell {
buildInputs = lib.attrValues
(pkgs.callPackage ./nix/devshell.nix
{
generateSchema = generateSchema terraform;
nickel = inputs.nickel.packages.${system}.nickel-lang-cli;
inherit terraform;
}
args) ++ [
inputs.nickel.packages.${system}.default
inputs.topiary.packages.${system}.default
];
shellHook = ''
cat <<EOF
* Use 'link-schema' to produce 'tf-ncl-schema.ncl'
* Use 'run-nickel' to evaluate 'main.ncl' to a Terraform deployment
* Use 'run-terraform' to first evaluate 'main.ncl' and then run Terraform on the result
EOF
'';
};

getDevShell = terraform: pkgs.mkShell {
inputsFrom = builtins.attrValues (getChecks terraform);
buildInputs = [ terraform ] ++ (with pkgs; [
Expand Down Expand Up @@ -269,9 +223,27 @@
checks = getChecks tf.opentofu;

lib = {
mkDevShell-terraform = mkDevShell tf.terraform;
mkDevShell-opentofu = mkDevShell tf.opentofu;
mkDevShell = mkDevShell tf.opentofu;
mkDevShell = { terraform ? tf.opentofu }:
args: pkgs.mkShell {
buildInputs = lib.attrValues
(pkgs.callPackage ./nix/devshell.nix
{
generateSchema = generateSchema terraform;
nickel = inputs.nickel.packages.${system}.nickel-lang-cli;
inherit terraform;
}
args) ++ [
inputs.nickel.packages.${system}.default
inputs.topiary.packages.${system}.default
];
shellHook = ''
cat <<EOF
* Use 'link-schema' to produce 'tf-ncl-schema.ncl'
* Use 'run-nickel' to evaluate 'main.ncl' to a Terraform deployment
* Use 'run-terraform' to first evaluate 'main.ncl' and then run Terraform on the result
EOF
'';
};
};

devShells = rec {
Expand Down

0 comments on commit fb0d109

Please sign in to comment.