-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
399 lines (363 loc) · 11.7 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
{
description = "Nix Infrastructure";
inputs = {
# Nixpkgs
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
linkwarden.url = "github:EricTheMagician/nixpkgs/linkwarden";
# Home manager
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# disko disk formatter
disko.url = "https://flakehub.com/f/nix-community/disko/*.tar.gz";
disko.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "https://flakehub.com/f/Mic92/sops-nix/*.tar.gz";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
hardware.url = "https://flakehub.com/f/NixOS/nixos-hardware/*.tar.gz";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
# arion docker-compose in nix
#arion.url = "github:hercules-ci/arion";
arion.url = "github:ericthemagician/arion/docker-build";
arion.inputs.nixpkgs.follows = "nixpkgs";
# for pre-commit-hooks
nix-pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
nix-pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
# vim plugins
vim-perforce.url = "github:nfvs/vim-perforce";
vim-perforce.flake = false;
# ipfs podcasting
ipfs-podcasting.url = "https://flakehub.com/f/EricTheMagician/ipfs-podcasting.nix/*.tar.gz";
#ipfs-podcasting.url = "/home/eric/git/ipfs-podcasting";
ipfs-podcasting.inputs.nixpkgs.follows = "nixos-unstable";
# microvm = {
# url = "github:astro/microvm.nix";
# inputs = {nixpkgs.follows = "nixpkgs";};
# };
# kde 6 until it is merged into nixpkgs
kde6.url = "github:nix-community/kde2nix";
#kde6.inputs.nixpkgs.follows = "nixpkgs";
# matrix/synapse deployment
#synapse.url = "github:dali99/nixos-matrix-modules";
libre-chat = {
url = "github:danny-avila/LibreChat";
flake = false;
};
nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.nixpkgs.follows = "nixos-unstable";
nixvim.inputs.home-manager.follows = "home-manager";
#nixvim.inputs.home-manager.inputs.nixpkgs.follows = "nixos-unstable";
nixvim.inputs.pre-commit-hooks.follows = "nix-pre-commit-hooks";
nvim-codeium.url = "github:Exafunction/codeium.nvim";
# nixos-router
nixos-router.url = "github:chayleaf/nixos-router";
nixos-router.inputs.nixpkgs.follows = "nixpkgs";
# notnft
notnft.url = "github:chayleaf/notnft";
notnft.inputs.nixpkgs.follows = "nixpkgs";
# enable flox in my environment
flox.url = "github:flox/flox";
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-23.11-darwin";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs-darwin";
};
outputs = {
self,
nixpkgs,
home-manager,
disko,
deploy-rs,
sops-nix,
nixos-unstable,
nixpkgs-unstable,
nix-pre-commit-hooks,
arion,
ipfs-podcasting,
# microvm,
kde6,
libre-chat,
nvim-codeium,
nixpkgs-darwin,
nix-darwin,
...
} @ inputs: let
system = "x86_64-linux";
overlays = import ./overlays.nix {inherit inputs;};
# Unmodified nixpkgs
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
nvim-codeium.overlays.${system}.default
overlays.additions
overlays.my_vim_plugins
overlays.unstable-nixos
overlays.other-packages
(final: prev: {
lib = prev.lib // (import ./common/net.nix {inherit (final) lib;}).lib;
})
];
};
darwin-system = "aarch64-darwin";
darwin-pkgs = import nixpkgs-darwin {
system = darwin-system;
config.allowUnfree = true;
overlays = [overlays.unstable-nixos];
};
deployPkgs = import nixpkgs {
inherit system;
overlays = [
deploy-rs.overlay
(self: super: {
deploy-rs = {
inherit (pkgs) deploy-rs;
inherit (super.deploy-rs) lib;
};
})
];
};
in {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
# add my personal cache
nixConfig = {
extra-substituters = [
"https://minio-api.eyen.ca/nix-cache"
];
extra-trusted-public-keys = [
"mini-nix.eyen.ca:YDI5WEPr5UGe9HjhU8y1iR07XTacpoBDQHiLcm/t2QY="
];
};
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
nixos-workstation = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit pkgs;
}; # Pass flake inputs to our config
# > Our main nixos configuration file <
modules = [
disko.nixosModules.disko
./systems/defaults.nix
./systems/workstation/configuration.nix
];
};
letouch = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit pkgs;
}; # Pass flake inputs to our config
# > Our main nixos configuration file <
modules = [
./systems/defaults.nix
./systems/letouch
#kde6.nixosModules.default
#{
# services.xserver.desktopManager.plasma6.enable = true;
# programs.ssh.askPassword = pkgs.gnome.seahorse + "/bin/seahorse";
#}
];
};
mini-nix = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit pkgs;
}; # Pass flake inputs to our config
# > Our main nixos configuration file <
modules = [
disko.nixosModules.disko
ipfs-podcasting.nixosModules.ipfs-podcasting
# microvm.nixosModules.host
./systems/mini-nix
];
};
headscale = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
inherit pkgs;
}; # Pass flake inputs to our config
# > Our main nixos configuration file <
modules = [
disko.nixosModules.disko
./systems/defaults.nix
./systems/headscale
];
};
thepodfather = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit pkgs;
}; # Pass flake inputs to our config
#specialArgs = {inherit pkgs;};
modules = [
disko.nixosModules.disko
arion.nixosModules.arion
# microvm.nixosModules.host
# microvm.nixosModules.microvm
#synapse.nixosModules
./systems/defaults.nix
./systems/thepodfather/configuration.nix
];
};
nixos-rica = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit pkgs;
}; # Pass flake inputs to our config
#specialArgs = {inherit pkgs;};
modules = [
disko.nixosModules.disko
./systems/defaults.nix
./systems/rica/configuration.nix
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
"eric@nixos-workstation" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgs.unstable;
extraSpecialArgs = {
inherit inputs;
stable = pkgs;
}; # Pass flake inputs to our config
# Our main home-manager configuration file <
modules = [
./home-manager/workstation
inputs.sops-nix.homeManagerModule
{
home = {
username = "eric";
homeDirectory = "/home/eric";
};
}
];
};
"[email protected]" = home-manager.lib.homeManagerConfiguration {
pkgs = darwin-pkgs.unstable;
extraSpecialArgs = {
inherit inputs;
stable = pkgs;
}; # Pass flake inputs to our config
# Our main home-manager configuration file <
modules = [
inputs.sops-nix.homeManagerModule
./home-manager/default
{
home = {
username = "ericyen";
homeDirectory = "/Users/ericyen";
};
}
];
};
"eric@letouch" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgs.unstable;
extraSpecialArgs = {
inherit inputs;
stable = pkgs;
}; # Pass flake inputs to our config
# Our main home-manager configuration file <
modules = [
./home-manager/letouch
inputs.sops-nix.homeManagerModule
{
home = {
username = "eric";
homeDirectory = "/home/eric";
};
}
];
};
"eric" = home-manager.lib.homeManagerConfiguration {
pkgs = pkgs.unstable; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {
inherit inputs;
stable = pkgs;
}; # Pass flake inputs to our config
# > Our main home-manager configuration file <
modules = [
./home-manager/default
inputs.sops-nix.homeManagerModule
{
#imports = [(inputs.sops-nix + "/modules/home-manager/sops.nix")];
home = {
username = "eric";
homeDirectory = "/home/eric";
};
}
];
};
};
darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem {
pkgs = darwin-pkgs;
specialArgs = {inherit inputs self;};
modules = [./systems/macbook];
};
darwinPackages = darwin-pkgs;
# deploy-rs section
deploy.nodes = {
nixos-rica = {
hostname = "nixos-rica";
profiles.system = {
fastConnection = false;
sshUser = "root";
user = "root";
path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.nixos-rica;
};
};
mini-nix = {
hostname = "mini-nix";
profiles.system = {
fastConnection = true;
sshUser = "root";
user = "root";
path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.mini-nix;
};
};
headscale = {
hostname = "headscale";
profiles.system = {
fastConnection = true;
sshUser = "root";
user = "root";
path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.headscale;
};
};
thepodfather = {
hostname = "thepodfather";
fastConnection = true;
profiles.system = {
sshUser = "root";
user = "root";
path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.thepodfather;
};
};
};
checks =
# This is highly advised, and will prevent many possible mistakes
builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
devShells.aarch64-darwin.default = import ./devShells/default {
inherit inputs;
pkgs = darwin-pkgs;
};
devShells.x86_64-linux.default = import ./devShells/default {inherit pkgs inputs;};
devShells.x86_64-linux.my-admin-portal = let
python_env = pkgs.python3.withPackages (ps: [ps.textual ps.textual ps.systemd ps.pydantic ps.typing-extensions ps.fastapi ps.uvicorn]);
in
pkgs.mkShell {
nativeBuildInputs = [python_env pkgs.python3Packages.textual-dev pkgs.hatch pkgs.yarn];
shellHook = ''
CWD=`pwd`
export PYTHONPATH=$CWD/src
'';
};
};
}