blob: 862c8e800be8f1c45cf6f6bdec86682295063926 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
{ lib
, buildGoModule
, buildGoPackage
, fetchFromGitHub
, callPackage
, config
}:
let
list = lib.importJSON ./providers.json;
buildWithGoModule = data:
buildGoModule {
pname = data.repo;
version = data.version;
subPackages = [ "." ];
doCheck = false;
src = fetchFromGitHub {
inherit (data) owner repo rev sha256;
};
vendorSha256 = data.vendorSha256 or null;
deleteVendor = data.deleteVendor or false;
# Terraform allow checking the provider versions, but this breaks
# if the versions are not provided via file paths.
postBuild = "mv $NIX_BUILD_TOP/go/bin/${data.repo}{,_v${data.version}}";
passthru = data;
};
buildWithGoPackage = data:
buildGoPackage {
pname = data.repo;
version = data.version;
goPackagePath = "github.com/${data.owner}/${data.repo}";
subPackages = [ "." ];
doCheck = false;
src = fetchFromGitHub {
inherit (data) owner repo rev sha256;
};
# Terraform allow checking the provider versions, but this breaks
# if the versions are not provided via file paths.
postBuild = "mv $NIX_BUILD_TOP/go/bin/${data.repo}{,_v${data.version}}";
passthru = data;
};
# Our generic constructor to build new providers
mkProvider = attrs:
(if (lib.hasAttr "vendorSha256" attrs) then buildWithGoModule else buildWithGoPackage)
attrs;
# These providers are managed with the ./update-all script
automated-providers = lib.mapAttrs (_: attrs: mkProvider attrs) list;
# These are the providers that don't fall in line with the default model
special-providers = {
# Packages that don't fit the default model
gandi = callPackage ./gandi { };
libvirt = callPackage ./libvirt { };
lxd = callPackage ./lxd { };
teleport = callPackage ./teleport { };
vpsadmin = callPackage ./vpsadmin { };
vercel = callPackage ./vercel { };
} // (lib.optionalAttrs (config.allowAliases or false) {
kubernetes-alpha = throw "This has been merged as beta into the kubernetes provider. See https://www.hashicorp.com/blog/beta-support-for-crds-in-the-terraform-provider-for-kubernetes for details";
});
in
automated-providers // special-providers // { inherit mkProvider; }
|