-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
executable file
·234 lines (199 loc) · 6.39 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
{
inputs = {
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-22-11.url = "github:NixOS/nixpkgs/nixos-22.11";
infra.url = "github:sekunho/infra";
emojiedpkg.url = "github:sekunho/emojied";
oshismashpkg.url = "github:sekunho/oshismash";
sekunpkg.url = "github:sekunho/sekun.dev";
agenix.url = "github:ryantm/agenix";
gnawex.url = "github:gnawex/gnawex";
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs-stable";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
# Private flakes
fontpkgs = {
url = "git+ssh://[email protected]/sekunho/fonts";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
dotfiles-private = {
url = "git+ssh://[email protected]/sekunho/dotfiles-private";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
};
outputs =
{ self
, nixpkgs-stable
, nixpkgs-unstable
, nixos-22-11
, infra
, emojiedpkg
, oshismashpkg
, sekunpkg
, agenix
, nix-darwin
, home-manager
, gnawex
, fontpkgs
, dotfiles-private
, nixos-generators
}:
let
lib = nixpkgs-stable.lib;
system = {
x86_64-linux = "x86_64-linux";
aarch64-darwin = "aarch64-darwin";
};
# Thank you https://github.com/hlissner/dotfiles/blob/master/flake.nix
mkPkgs = system: pkgs: extraOverlays: import pkgs {
inherit system;
config.allowUnfree = true;
overlays = extraOverlays;
};
pkgsOverlay = system: final: prev: {
agenix = agenix.packages.${system}.default;
myfonts = fontpkgs.packages.${system};
emojied = emojiedpkg.packages.${system}.emojied;
oshismash = oshismashpkg.packages.${system}.oshismash;
blog = sekunpkg.packages.${system}.blog;
};
pkgs-22-11 = mkPkgs nixos-22-11 [ ];
gnawexpkgs = gnawex.packages.${system};
publicKeys = {
arceus.sekun = "[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAINI269n68/pDDfMjkPaWeRUldzr1I/dWfUZl7sZPktwCAAAABHNzaDo= [email protected]";
blaziken.sekun = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE07iMNKunyBGdOq61DWKIBQYy77e1sm69lXaFofkmtp [email protected]";
};
pkgs = system: mkPkgs system nixpkgs-stable [ (pkgsOverlay system) ];
pkgs' = system: mkPkgs system nixpkgs-unstable [ ];
nix = system: (pkgs' system).nixVersions.nix_2_18;
in
{
packages = {
x86_64-linux = {
gce = nixos-generators.nixosGenerate {
system = "x86_64-linux";
format = "gce";
modules = [
];
specialArgs = {
inherit publicKeys;
};
};
};
aarch64-darwin = { };
};
devShells = {
x86_64-linux = {
default = (pkgs system.x86_64-linux).mkShell {
buildInputs = with (pkgs system.x86_64-linux); [
nil
nixpkgs-fmt
just
fzf
];
};
};
aarch64-darwin = {
default = (pkgs system.aarch64-darwin).mkShell {
buildInputs = with (pkgs system.aarch64-darwin); [
nil
nixpkgs-fmt
just
fzf
];
};
};
};
darwinConfigurations."blaziken" = nix-darwin.lib.darwinSystem {
modules = [
home-manager.darwinModules.default
./hosts/blaziken/configuration.nix
];
specialArgs = {
inherit self;
pkgs = pkgs "aarch64-darwin";
pkgs' = pkgs' "aarch64-darwin";
};
};
nixosConfigurations = {
# TODO: Move these to `hosts`, and move the existing modules to their
# own `modules` folder. e.g `modules/lucario/`
arceus = lib.nixosSystem {
system = system.x86_64-linux;
modules = [
infra.nixosModules.nix
agenix.nixosModules.age
./hosts/arceus/configuration.nix
];
specialArgs = {
trusted-users = [ "root" "sekun" ];
nix = (nix system.x86_64-linux);
pkgs = pkgs system.x86_64-linux;
pkgs' = pkgs' system.x86_64-linux;
};
};
mew = lib.nixosSystem {
system = system.x86_64-linux;
modules = [
emojiedpkg.nixosModules.default
oshismashpkg.nixosModule
agenix.nixosModules.age
./config/nix.nix
./hosts/mew/configuration.nix
./services/fail2ban.nix
./services/tailscale.nix
];
specialArgs = {
inherit (pkgs system.x86_64-linux) jq emojied oshismash blog;
inherit (pkgs' system.x86_64-linux) tailscale;
inherit publicKeys;
pkgs = pkgs system.x86_64-linux;
pkgs' = pkgs' system.x86_64-linux;
nix = nix system.x86_64-linux;
};
};
roserade = lib.nixosSystem {
system = system.x86_64-linux;
modules = [
./config/nix.nix
./hosts/roserade/configuration.nix
./services/fail2ban.nix
./services/tailscale.nix
agenix.nixosModules.age
];
specialArgs = {
inherit (pkgs system.x86_64-linux) jq;
inherit (pkgs' system.x86_64-linux) tailscale;
inherit publicKeys;
pkgs = pkgs system.x86_64-linux;
nix = nix system.x86_64-linux;
};
};
lucario = lib.nixosSystem {
system = system.x86_64-linux;
modules = [
dotfiles-private.nixosModules.lucario
agenix.nixosModules.age
./services/fail2ban.nix
./services/tailscale.nix
./config/nix.nix
];
specialArgs = {
inherit (pkgs system.x86_64-linux) jq;
inherit (pkgs' system.x86_64-linux) tailscale;
inherit publicKeys;
pkgs = pkgs system.x86_64-linux;
nix = nix system.x86_64-linux;
};
};
};
};
}