-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
299 lines (259 loc) · 8.24 KB
/
flake.nix
File metadata and controls
299 lines (259 loc) · 8.24 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
{
description = "Alexey's multi-machine configuration";
nixConfig = {
extra-substituters = [ "https://cache.numtide.com" ];
extra-trusted-public-keys = [ "niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=" ];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# Darwin support
nix-darwin = {
url = "github:LnL7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Home Manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Shared utilities
systems.url = "github:nix-systems/default";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
flake-parts.url = "github:hercules-ci/flake-parts";
# Declarative Jellyfin configuration
jellarr = {
url = "github:venkyr77/jellarr";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
systems.follows = "systems";
};
};
# Secret management
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# macOS-specific
dock-module = {
url = "github:dustinlyons/nixos-config";
flake = false;
};
# Zed Editor preview builds
zed-editor-flake = {
url = "github:shekhirin/zed-editor-flake";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
};
};
# AeroSpace custom fork with tabs support
aerospace-flake = {
url = "github:shekhirin/AeroSpace/release";
inputs.nixpkgs.follows = "nixpkgs";
};
# jj-starship
jj-starship = {
url = "github:dmmulroy/jj-starship";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
# LLM coding agents (daily updated)
llm-agents = {
url = "github:numtide/llm-agents.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# MESC (Multi-Endpoint Shared Configuration)
mesc-src = {
url = "github:paradigmxyz/mesc";
flake = false;
};
# IDÅSEN standing desk controller
idasen-control-src = {
url = "github:mitsuhiko/idasen-control";
flake = false;
};
};
outputs =
inputs@{
self,
nixpkgs,
nix-darwin,
home-manager,
jellarr,
sops-nix,
dock-module,
zed-editor-flake,
aerospace-flake,
jj-starship,
llm-agents,
mesc-src,
idasen-control-src,
...
}:
let
# System-specific package sets
mescOverlay = final: prev: {
mesc = prev.rustPlatform.buildRustPackage {
pname = "mesc";
version = "0-unstable";
src = mesc-src;
sourceRoot = "source/rust";
cargoHash = "sha256-zklhgxA/rkbP1hb2PRYu8LqTw9BP0UPzK1x88xP31M4=";
nativeBuildInputs = [ prev.pkg-config ];
buildInputs = [
prev.openssl
prev.oniguruma
]
++ prev.lib.optionals prev.stdenv.hostPlatform.isDarwin [
prev.apple-sdk_15
];
RUSTONIG_SYSTEM_LIBONIG = true;
};
};
idasenControlOverlay = final: prev: {
idasen-control = prev.rustPlatform.buildRustPackage {
pname = "idasen-control";
version = "0-unstable";
src = idasen-control-src;
cargoHash = "sha256-vla47ObpzFq/wqf1xy4CllOrgHWn3AG5Hy6RG1tr3ZU=";
};
};
# https://github.com/NixOS/nixpkgs/issues/510488
nushellDarwinOverlay =
final: prev:
prev.lib.optionalAttrs prev.stdenv.hostPlatform.isDarwin {
nushell = prev.nushell.overrideAttrs (old: {
checkPhase =
let
skippedTests = [
"repl::test_config_path::test_default_config_path"
"repl::test_config_path::test_xdg_config_bad"
"repl::test_config_path::test_xdg_config_empty"
"plugins::config::some"
"plugins::stress_internals::test_exit_early_local_socket"
"plugins::stress_internals::test_failing_local_socket_fallback"
"plugins::stress_internals::test_local_socket"
"shell::environment::env::path_is_a_list_in_repl"
"shell::environment::env::env_shlvl_in_repl"
"shell::environment::env::env_shlvl_in_exec_repl"
];
skippedTestsStr = prev.lib.concatStringsSep " " (
prev.lib.map (testId: "--skip=${testId}") skippedTests
);
in
''
runHook preCheck
cargo test -j $NIX_BUILD_CORES --offline -- \
--test-threads=$NIX_BUILD_CORES ${skippedTestsStr}
runHook postCheck
'';
});
};
overlays = [
mescOverlay
idasenControlOverlay
nushellDarwinOverlay
jj-starship.overlays.default
];
darwinPkgs = import nixpkgs {
system = "aarch64-darwin";
overlays = overlays ++ [
(final: prev: {
inherit (zed-editor-flake.packages.aarch64-darwin) zed-editor-preview-bin;
inherit (aerospace-flake.packages.aarch64-darwin) aerospace;
})
];
config.allowUnfree = true;
};
boxPkgs = import nixpkgs {
system = "x86_64-linux";
overlays = overlays;
config.allowUnfree = true;
};
in
{
# macOS configuration (personal)
darwinConfigurations.personal = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
pkgs = darwinPkgs;
specialArgs = { inherit inputs dock-module llm-agents; };
modules = [
./hosts/darwin/personal/default.nix
# Dock configuration
"${dock-module}/modules/darwin/dock"
# Home-Manager
home-manager.darwinModules.home-manager
# Set system revision
{
system.configurationRevision = self.rev or self.dirtyRev or null;
}
];
};
# macOS configuration (work)
darwinConfigurations.work = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
pkgs = darwinPkgs;
specialArgs = { inherit inputs dock-module llm-agents; };
modules = [
./hosts/darwin/work/default.nix
# Dock configuration
"${dock-module}/modules/darwin/dock"
# Home-Manager
home-manager.darwinModules.home-manager
# Set system revision
{
system.configurationRevision = self.rev or self.dirtyRev or null;
}
];
};
# NixOS configuration for the box
nixosConfigurations.box = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
pkgs = boxPkgs;
specialArgs = { inherit inputs; };
modules = [
./hosts/nixos/default.nix
jellarr.nixosModules.default
sops-nix.nixosModules.sops
# Pass inputs to Home Manager in NixOS as well
(_: {
home-manager.extraSpecialArgs = { inherit inputs; };
})
];
};
# Formatters for each system
formatter = {
aarch64-darwin = darwinPkgs.nixfmt-tree;
x86_64-linux = (import nixpkgs { system = "x86_64-linux"; }).nixfmt-tree;
};
# Checks for each system
checks = {
aarch64-darwin = {
fmt = darwinPkgs.runCommand "fmt-check" { } ''
export HOME=$TMPDIR
${darwinPkgs.lib.getExe self.formatter.aarch64-darwin} --ci ${./.}
touch $out
'';
statix = darwinPkgs.runCommand "statix-check" { } ''
${darwinPkgs.lib.getExe darwinPkgs.statix} check ${./.}
touch $out
'';
};
x86_64-linux = {
fmt = boxPkgs.runCommand "fmt-check" { } ''
export HOME=$TMPDIR
${boxPkgs.lib.getExe self.formatter.x86_64-linux} --ci ${./.}
touch $out
'';
statix = boxPkgs.runCommand "statix-check" { } ''
${boxPkgs.lib.getExe boxPkgs.statix} check ${./.}
touch $out
'';
};
};
};
}