blob: 4e6a425c0f6dadc8a6a5bf1b0f1928dc8630528a (
plain)
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
|
{inputs, ...}: {
perSystem = {
lib,
pkgs,
system,
...
}: let
config = inputs.terranix.lib.terranixConfiguration {
inherit system;
modules = [
./cloudflare
./tailscale
./cloud.nix
./vars.nix
./versions.nix
];
};
in {
apps =
lib.genAttrs ["apply" "destroy" "plan"] (fn: {
type = "app";
program = pkgs.writeShellApplication {
name = fn;
runtimeInputs = [pkgs.opentofu];
text = ''
config_file="config.tf.json"
[ -e "$config_file" ] && rm -f "$config_file"
cp ${config} "$config_file"
tofu init && tofu ${fn}
'';
};
})
// {
tofu-config = {
type = "app";
program = pkgs.writeShellApplication {
name = "tofu-config";
runtimeInputs = [pkgs.opentofu];
text = ''
config_file="config.tf.json"
[ -e "$config_file" ] && rm -f "$config_file"
cp ${config} "$config_file"
'';
};
};
};
};
}
|