-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathflake.nix
More file actions
115 lines (104 loc) · 3.46 KB
/
Copy pathflake.nix
File metadata and controls
115 lines (104 loc) · 3.46 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{
description = "A collection of Terraform versions that are automatically updated";
inputs = {
# INFO: Channel used for building versions from 1.0 up to 1.5
nixpkgs-23_05.url = "github:nixos/nixpkgs/nixos-23.05-small";
# INFO: Channel used for building versions from 1.6 up to 1.8
nixpkgs-24_05.url = "github:nixos/nixpkgs/nixos-24.05-small";
# INFO: Channel used for building versions from 1.9 onwards
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs =
inputs@{ self
, nixpkgs
, systems
, ...
}:
let
forAllSystems = nixpkgs.lib.genAttrs (import systems);
terraformVersions = builtins.fromJSON (builtins.readFile ./versions.json);
terraformReleases = forAllSystems (
system:
self.lib.mkReleases {
inherit system;
releases = terraformVersions.releases;
namePrefix = "terraform";
mkRelease = self.lib.mkTerraform;
}
);
terraformAliases = forAllSystems (
system:
nixpkgs.lib.mapAttrs'
(cycle: version: {
name = "terraform-${cycle}";
value = terraformReleases.${system}."terraform-${version}";
})
terraformVersions.aliases
);
deprecatedReleases = forAllSystems (
system:
builtins.mapAttrs
(
version: _:
builtins.warn "package \"${version}\" is deprecated; use \"terraform-${version}\" instead"
terraformReleases.${system}."terraform-${version}"
)
terraformVersions.releases
);
deprecatedAliases = forAllSystems (
system:
builtins.mapAttrs
(
cycle: _:
builtins.warn "package \"${cycle}\" is deprecated; use \"terraform-${cycle}\" instead"
terraformAliases.${system}."terraform-${cycle}"
)
terraformVersions.aliases
);
in
{
packages = forAllSystems (
system:
terraformReleases.${system}
// terraformAliases.${system}
// deprecatedReleases.${system}
// deprecatedAliases.${system}
);
checks = terraformAliases;
overlays = {
default =
final: prev:
{
terraform-versions =
builtins.warn
"\"terraform-versions\" packages are deprecated; use the prefixed \"terraform-\" packages instead"
self.packages.${prev.stdenv.hostPlatform.system};
}
// self.overlays.terraform final prev;
terraform =
final: prev:
terraformReleases.${prev.stdenv.hostPlatform.system}
// terraformAliases.${prev.stdenv.hostPlatform.system};
};
lib = import ./lib { inherit inputs; };
templates = {
default = {
description = "Simple nix-shell with Terraform installed via nixpkgs-terraform";
path = ./templates/default;
};
devenv = {
description = "Using nixpkgs-terraform with devenv";
path = ./templates/devenv;
};
nixpkgs-terraform-providers-bin = {
description = "Using nixpkgs-terraform with nixpkgs-terraform-providers-bin";
path = ./templates/nixpkgs-terraform-providers-bin;
};
terranix = {
description = "Using nixpkgs-terraform with terranix";
path = ./templates/terranix;
};
};
};
}