-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathflake.nix
More file actions
355 lines (318 loc) · 9.55 KB
/
flake.nix
File metadata and controls
355 lines (318 loc) · 9.55 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
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
{
description = "Josh Symonds' nix config";
inputs = {
# Nixpkgs - using unstable as primary
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11"; # Keep stable available if needed
# Darwin
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
# Home manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Hardware-specific optimizations
hardware.url = "github:nixos/nixos-hardware/master";
# Linkpearl - clipboard sync
linkpearl.url = "github:joshsymonds/linkpearl";
# CC-Tools - Claude Code smart hooks
cc-tools.url = "github:joshsymonds/cc-tools";
# Target Process MCP - Target Process API integration
targetprocess-mcp.url = "github:joshsymonds/targetprocess-mcp";
# Shimmer - Unified MCP server (Reddit, Monarch Money, GitHub)
shimmer.url = "git+ssh://git@github.com/joshsymonds/shimmer.git";
# Redlib fork for customizations
redlib-fork = {
url = "github:joshsymonds/redlib";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
# Devenv for development environments
# No nixpkgs.follows — devenv 2.0 bundles a nix fork (cachix/nix) that
# requires its own pinned nixpkgs to build correctly.
devenv.url = "github:cachix/devenv";
# Determinate Nix - consistent Nix with parallel eval, flake stability
# No nixpkgs.follows — keeps FlakeHub Cache hits
determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/3";
};
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://joshsymonds.cachix.org"
"https://cuda-maintainers.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"joshsymonds.cachix.org-1:DajO7Bjk/Q8eQVZQZC/AWOzdUst2TGp8fHS/B1pua2c="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
];
};
outputs = {
nixpkgs,
darwin,
home-manager,
self,
...
} @ inputs: let
inherit (self) outputs;
inherit (nixpkgs) lib;
# Only the systems we actually use
systems = ["x86_64-linux" "aarch64-darwin"];
forAllSystems = f: lib.genAttrs systems f;
# Common special arguments for all configurations
mkSpecialArgs = _: {
inherit inputs outputs;
};
mkHomeManagerModules = {
hostname,
system,
module,
}: [
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
users.joshsymonds = import module;
extraSpecialArgs =
mkSpecialArgs system
// {
inherit hostname;
};
sharedModules = [inputs.agenix.homeManagerModules.default];
};
}
];
mkNixosHost = hostname: cfg:
lib.nixosSystem {
inherit (cfg) system;
specialArgs = mkSpecialArgs cfg.system;
modules =
cfg.modules
++ lib.optionals (cfg ? homeModule)
(mkHomeManagerModules {
inherit hostname;
inherit (cfg) system;
module = cfg.homeModule;
});
};
nixosHostDefinitions = {
egoengine = {
system = "x86_64-linux";
modules = [
./hosts/egoengine
inputs.agenix.nixosModules.default
];
};
ultraviolet = {
system = "x86_64-linux";
modules = [
./hosts/ultraviolet
./hosts/common.nix
inputs.agenix.nixosModules.default
];
homeModule = ./home-manager/hosts/ultraviolet.nix;
};
bluedesert = {
system = "x86_64-linux";
modules = [
./hosts/bluedesert
./hosts/common.nix
inputs.agenix.nixosModules.default
];
homeModule = ./home-manager/hosts/bluedesert.nix;
};
echelon = {
system = "x86_64-linux";
modules = [
./hosts/echelon
./hosts/common.nix
inputs.agenix.nixosModules.default
];
homeModule = ./home-manager/hosts/echelon.nix;
};
vermissian = {
system = "x86_64-linux";
modules = [
./hosts/vermissian
./hosts/common.nix
inputs.agenix.nixosModules.default
];
homeModule = ./home-manager/hosts/vermissian.nix;
};
stygianlibrary = {
system = "x86_64-linux";
modules = [
./hosts/stygianlibrary
./hosts/common.nix
inputs.agenix.nixosModules.default
];
homeModule = ./home-manager/hosts/stygianlibrary.nix;
};
stygianlibrary-installer = {
system = "x86_64-linux";
modules = [
./hosts/stygianlibrary/installer.nix
];
};
ultraviolet-installer = {
system = "x86_64-linux";
modules = [
./hosts/ultraviolet/installer.nix
];
};
vermissian-old = {
system = "x86_64-linux";
modules = [
./hosts/vermissian-old
./hosts/common.nix
inputs.agenix.nixosModules.default
];
homeModule = ./home-manager/hosts/vermissian-old.nix;
};
vermissian-installer = {
system = "x86_64-linux";
modules = [
./hosts/vermissian/installer.nix
];
};
};
in {
packages = let
base = forAllSystems (
system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [];
};
in
import ./pkgs {
inherit pkgs;
}
);
in
base
// {
x86_64-linux =
base.x86_64-linux
// {
egoengine = self.nixosConfigurations.egoengine.config.system.build.egoengineDockerImage;
stygianlibraryInstallerIso = self.nixosConfigurations.stygianlibrary-installer.config.system.build.isoImage;
ultravioletInstallerIso = self.nixosConfigurations.ultraviolet-installer.config.system.build.isoImage;
vermissianInstallerIso = self.nixosConfigurations.vermissian-installer.config.system.build.isoImage;
};
};
overlays = import ./overlays {inherit inputs outputs;};
devShells = forAllSystems (
system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in {
default = pkgs.mkShell {
name = "nix-config-dev";
packages = with pkgs; [
alejandra
nixpkgs-fmt
statix
deadnix
shellcheck
git
];
};
}
);
# NixOS configurations - inlined for clarity
nixosConfigurations =
lib.mapAttrs mkNixosHost nixosHostDefinitions;
# Darwin configuration - inlined for clarity
darwinConfigurations = let
mkDarwinHost = name:
darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = mkSpecialArgs "aarch64-darwin";
modules = [
./hosts/${name}
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
users.joshsymonds = import ./home-manager/aarch64-darwin.nix;
extraSpecialArgs =
mkSpecialArgs "aarch64-darwin"
// {
hostname = name;
};
sharedModules = [inputs.agenix.homeManagerModules.default];
};
}
];
};
in {
ninuan = mkDarwinHost "ninuan";
};
# Simplified home configurations - generated programmatically
homeConfigurations = let
mkHome = {
system,
module,
hostname,
}:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
overlays = [
outputs.overlays.default
outputs.overlays.darwin
];
config.allowUnfree = true;
};
extraSpecialArgs = mkSpecialArgs system // {inherit hostname;};
modules = [inputs.agenix.homeManagerModules.default module];
};
linuxHosts = builtins.attrNames (lib.filterAttrs (_: cfg: cfg ? homeModule) nixosHostDefinitions);
darwinHosts = ["ninuan"];
in
(
lib.genAttrs
(map (h: "joshsymonds@${h}") linuxHosts)
(h: let
hostname = lib.removePrefix "joshsymonds@" h;
in
mkHome {
system = "x86_64-linux";
module = ./home-manager/hosts/${hostname}.nix;
inherit hostname;
})
)
// (
lib.genAttrs
(map (h: "joshsymonds@${h}") darwinHosts)
(h: let
hostname = lib.removePrefix "joshsymonds@" h;
in
mkHome {
system = "aarch64-darwin";
module = ./home-manager/hosts/${hostname}.nix;
inherit hostname;
})
);
inherit (self.packages.x86_64-linux) egoengine;
};
}