-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
143 lines (130 loc) · 3.67 KB
/
flake.nix
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
{
description = "Hetzner-specific NixOS deployment scripts and expressions";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
sops-nix.url = "github:Mic92/sops-nix";
disko.url = "github:nix-community/disko";
};
outputs = { self, nixpkgs, sops-nix, disko }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
system = "${system}";
config = { allowUnfree = true; };
};
in
rec {
packages = {
activate-rescue-mode = pkgs.writeShellApplication {
name = "activate-rescue-mode";
runtimeInputs = with pkgs; [
bash
curl
netcat
sops-nix
yq
];
text = ''
${builtins.readFile ./lib/common.sh}
${builtins.readFile ./scripts/activate-rescue-mode.sh}
'';
};
generate-disko-config = pkgs.writeShellApplication {
name = "generate-disko-config";
runtimeInputs = with pkgs; [
bash
curl
yq
sops-nix
];
text = ''
${builtins.readFile ./lib/common.sh}
${builtins.readFile ./scripts/generate-disko-config.sh}
'';
};
generate-hardware-config = pkgs.writeShellApplication {
name = "generate-hardware-config";
runtimeInputs = with pkgs; [
bash
curl
sops-nix
jq
];
text = ''
${builtins.readFile ./lib/common.sh}
${builtins.readFile ./scripts/generate-hardware-config.sh}
'';
};
generate-wireguard-config = pkgs.writeShellApplication {
name = "generate-wireguard-config";
runtimeInputs = with pkgs; [
jq
];
text = builtins.readFile ./scripts/generate-wireguard-config.sh;
};
generate-server-config = pkgs.writeShellApplication {
name = "generate-server-config";
runtimeInputs = with pkgs; [
curl
jq
yq
bash
];
text = ''
${builtins.readFile ./lib/common.sh}
${builtins.readFile ./scripts/generate-server-config.sh}
'';
};
deploy-nixos = pkgs.writeShellApplication {
name = "deploy-nixos";
runtimeInputs = with pkgs; [
nixos-anywhere
jq
sops
];
text = ''
${builtins.readFile ./lib/common.sh}
${builtins.readFile ./scripts/deploy-nixos.sh}
'';
};
add-wireguard-admin = pkgs.writeShellApplication {
name = "add-wireguard-admin";
runtimeInputs = with pkgs; [
jq
sops
nixfmt-rfc-style
];
text = ''
${builtins.readFile ./lib/common.sh}
${builtins.readFile ./scripts/add-wireguard-admin.sh}
'';
};
setup-servers = pkgs.writeShellApplication {
name = "setup-servers";
text = ''
${builtins.readFile ./scripts/setup-servers.sh}
'';
};
};
apps = builtins.mapAttrs
(name: pkg: {
type = "app";
program = "${pkg}/bin/${name}";
})
packages;
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
netcat
sops
yq
jq
ssh-to-age
stdenv.cc.cc.lib
curl
wireguard-tools
nixfmt-rfc-style
] ++ builtins.attrValues self.packages;
};
formatter = pkgs.nixfmt-rfc-style;
};
}