-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
464 lines (411 loc) · 16.4 KB
/
flake.nix
File metadata and controls
464 lines (411 loc) · 16.4 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
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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
{
description = "Olaf's flake with Home Manager enabled";
nixConfig = {
# Primary caches
substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org/"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
# Development and specific package caches
extra-substituters = [
"https://cuda-maintainers.cachix.org/"
"https://hyprland.cachix.org/"
"https://devenv.cachix.org/"
"https://cosmic.cachix.org/"
];
extra-trusted-public-keys = [
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
];
};
inputs = {
# Core
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
flake-utils.url = "github:numtide/flake-utils";
# MCP servers
mcp-nixos.url = "github:utensils/mcp-nixos";
# Environment and theming
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Development and utilities
sops-nix = {
url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Browser and media
spicetify-nix.url = "github:Gerg-L/spicetify-nix";
# System utilities
agenix.url = "github:ryantm/agenix";
nix-snapd.url = "github:io12/nix-snapd";
microvm.url = "github:astro/microvm.nix";
# Secure Boot — v0.4.1 broke against current nixpkgs (rust-1.78 toolchain
# fetch failure). v1.0.0 (released 2025-12-10) is the latest stable.
lanzaboote = {
url = "github:nix-community/lanzaboote/v1.0.0";
inputs.nixpkgs.follows = "nixpkgs";
};
# Additional tools
lan-mouse.url = "github:feschber/lan-mouse";
zjstatus.url = "github:dj95/zjstatus";
# = tag v2.0.16+claude1.9255.2, commit 5dd948e9 (2026-05-28).
# Claude binary bump 1.9255.0 -> 1.9255.2. Picks up:
# - #660 capture $-prefixed minified names in cowork spawn guard
# (refinement to cowork patch from v2.0.15)
# Carries forward from v2.0.15:
# - #657 anchor tray-var extraction on .Tray() literal
# - #650 filter .asar paths from --add-dir dispatch + session restore
# Known caveat carried in: #605 (Electron holds systemd-inhibit
# forever, blocking suspend while app runs). Razer-relevant.
# Workaround: close claude-desktop entirely to release inhibitor,
# or set CLAUDE_KEEP_AWAKE=0 (#645).
# Bump via /update-claude-code.
claude-desktop-linux.url = "github:aaddrick/claude-desktop-debian/5dd948e96d853ed37636bc0e2368fc2665cd1104";
# Claude Code skill catalogue (borghei). flake = false because it's a
# plain markdown/assets catalogue, not a Nix flake. We symlink one
# subdirectory (engineering/claude-code-mastery) into ~/.claude/skills/
# via home/development/claude-code-skills. Bump with `nix flake update
# claude-skills-borghei` to pull in upstream skill updates.
claude-skills-borghei = {
url = "github:borghei/Claude-Skills";
flake = false;
};
# Terminal YouTube browser
yt-x = {
url = "github:Benexl/yt-x";
inputs.nixpkgs.follows = "nixpkgs";
};
# Hardware specific (removed unused razer-laptop-control)
# Package collections
nur.url = "github:nix-community/NUR";
nixpkgs-f2k.url = "github:moni-dz/nixpkgs-f2k";
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
# Google Antigravity package
antigravity-nix = {
url = "github:jacopone/antigravity-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# COSMIC Desktop applets
cosmic-music-player = {
url = "github:olafkfreund/cosmic-applet-music-player";
inputs.nixpkgs.follows = "nixpkgs";
};
cosmic-applet-spotify = {
url = "github:nomoth/cosmic-applet-spotify";
inputs.nixpkgs.follows = "nixpkgs";
};
# COSMIC Radio Applet - Internet radio player for COSMIC Desktop
cosmic-ext-radio-applet = {
url = "github:olafkfreund/cosmic-ext-radio-applet";
inputs.nixpkgs.follows = "nixpkgs";
};
# COSMIC Web Apps - Web application manager for COSMIC Desktop
cosmic-ext-web-apps = {
url = "github:olafkfreund/cosmic-ext-web-apps";
inputs.nixpkgs.follows = "nixpkgs";
};
# Rust toolchain overlay — pulls in newer rustc than current nixpkgs
# ships. Required by splashboard (needs rustc 1.95+ via sysinfo 0.39).
# Consumed only by overlays/custom-packages.nix when wiring splashboard.
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
# skill-pool — self-hosted Claude Code skill/agent/command registry.
# Pinned to the v0.3.4 tagged release; consumed by
# modules/services/skill-pool.nix on p620.
skill-pool = {
url = "github:olafkfreund/skill_pool/v0.3.4";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ nixpkgs
, nixpkgs-unstable
, nur
, agenix
, spicetify-nix
, home-manager
, nix-index-database
, zjstatus
, antigravity-nix
, mcp-nixos
, ...
} @ inputs:
let
# ========================================
# SHARED ARCHITECTURE COMPONENTS
# ========================================
# Import centralized user mappings from shared variables
sharedVariables = import ./hosts/common/shared-variables.nix;
# Define users per host (can be customized per host if needed)
hostUsers = {
p620 = [ "olafkfreund" ];
razer = [ "olafkfreund" ];
p510 = [ "olafkfreund" ];
};
# Live image builder
liveImages = import ./lib/live-images.nix {
inherit nixpkgs inputs hostUsers;
};
# ========================================
# HELPER FUNCTIONS
# ========================================
# Get primary user (first in the list) for backward compatibility
getPrimaryUser = host: builtins.head (hostUsers.${host} or [ "olafkfreund" ]);
# Get all users for a host
getHostUsers = host: hostUsers.${host} or [ "olafkfreund" ];
# ========================================
# ARCHITECTURE TEMPLATES
# ========================================
# Host type templates for configuration reduction (workstation, laptop, server, hybrid)
hostTypes = import ./lib/hostTypes.nix { inherit (nixpkgs) lib; };
# Hardware profiles for GPU-specific configurations
hardwareProfiles = {
amd = import ./hosts/common/hardware-profiles/amd-gpu.nix;
nvidia = import ./hosts/common/hardware-profiles/nvidia-gpu.nix;
intel = import ./hosts/common/hardware-profiles/intel-integrated.nix;
};
# ========================================
# PACKAGE CONFIGURATION
# ========================================
# Helper function for package imports
mkPkgs = _pkgs: system: {
localSystem = system; # Modern replacement for deprecated 'system' parameter
config = {
allowUnfree = true;
# allowInsecure = false; # REMOVED for security - using targeted permissions
};
};
overlays = import ./overlays { inherit inputs; };
makeNixosSystem = host:
let
primaryUser = getPrimaryUser host;
allUsers = getHostUsers host;
# Stylix theming module - re-enabled after upstream cache fix
stylixModule = [ inputs.stylix.nixosModules.stylix ];
system = "x86_64-linux";
in
{
inherit system;
specialArgs = {
pkgs-unstable = import nixpkgs-unstable (mkPkgs nixpkgs-unstable system);
inherit inputs host hostTypes;
username = primaryUser; # Primary user for backward compatibility
hostUsers = allUsers; # All users for this host
# Shared variables and hardware profiles for explicit tracking
inherit sharedVariables hardwareProfiles;
# MCP servers from flakes
mcp-nixos-pkg = mcp-nixos.packages.${system}.default;
};
modules =
[
{ nixpkgs.overlays = overlays; }
./hosts/${host}/configuration.nix
nur.modules.nixos.default
home-manager.nixosModules.home-manager
inputs.nix-snapd.nixosModules.default
inputs.agenix.nixosModules.default
inputs.lanzaboote.nixosModules.lanzaboote
nix-index-database.nixosModules.nix-index
# cosmic-ext-applet-radio: local module workaround for upstream mkPackageOption 'description' arg bug
./modules/services/cosmic-ext-radio-applet
./home/shell/zellij/zjstatus.nix
]
++ stylixModule
++ [
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
# Use backup command to move files to timestamped directory
# This prevents backup file collisions by using unique directories
backupCommand = ''
backup_dir = "$HOME/.hm-backups/$(date +%Y-%m-%d-%H%M%S)"
mkdir - p "$(dirname "$backup_dir/$1 ")"
mv "$1" "$backup_dir/$1"
'';
# Shared modules for all users
sharedModules = [
{
stylix.targets.firefox.enable = false;
}
];
extraSpecialArgs = {
pkgs-unstable = import nixpkgs-unstable (mkPkgs nixpkgs-unstable system);
inherit
inputs
nixpkgs
zjstatus
spicetify-nix
agenix
antigravity-nix
host
;
username = primaryUser;
hostUsers = allUsers;
# Shared variables and hardware profiles for home-manager
inherit sharedVariables hardwareProfiles;
};
users = builtins.listToAttrs (map
(user: {
name = user;
value = import (./Users + "/${user}/${host}_home.nix");
})
allUsers);
};
}
];
};
in
{
# ========================================
# HOST CONFIGURATIONS
# ========================================
nixosConfigurations = {
# Workstations (high-performance desktop systems)
p620 = nixpkgs.lib.nixosSystem (makeNixosSystem "p620"); # AMD workstation (primary AI host)
p510 = nixpkgs.lib.nixosSystem (makeNixosSystem "p510"); # Intel Xeon server (media server)
# Laptops (portable systems with power management)
razer = nixpkgs.lib.nixosSystem (makeNixosSystem "razer"); # Intel/NVIDIA laptop (mobile dev)
# MicroVM configurations (temporarily disabled for flake restructuring)
# dev-vm = microvms.dev-vm;
# test-vm = microvms.test-vm;
# playground-vm = microvms.playground-vm;
};
# ========================================
# PACKAGES AND APPLICATIONS
# ========================================
packages.x86_64-linux =
let
pkgs = import nixpkgs {
system = "x86_64-linux";
config = {
allowUnfree = true;
permittedInsecurePackages = [
"mdatp"
];
};
};
in
{
# Custom applications
aerion = pkgs.callPackage ./pkgs/aerion { };
claude-code = import ./home/development/claude-code {
inherit (pkgs) lib buildNpmPackage fetchurl nodejs makeWrapper writeShellScriptBin;
};
claude-code-native = pkgs.callPackage ./pkgs/claude-code-native { };
codex-cli = pkgs.callPackage ./home/development/codex-cli {
inherit (pkgs) nodejs_24;
};
glim = pkgs.callPackage ./overlays/glim { };
intune-portal = pkgs.callPackage ./pkgs/intune-portal { };
kosli-cli = pkgs.callPackage ./pkgs/kosli-cli { };
opencode = pkgs.callPackage ./home/development/opencode { };
aurynk = pkgs.callPackage ./pkgs/aurynk { };
# add-skill = pkgs.callPackage ./pkgs/add-skill { };
# Security tools
mdatp = pkgs.callPackage ./pkgs/microsoft-defender-for-endpoint {
inherit (pkgs) buildFHSEnv;
};
# Enterprise tools
# NOTE: citrix-workspace is provided via overlay (overlays/citrix-workspace.nix)
# It requires manual tarball download - see pkgs/citrix-workspace/fetch-citrix.sh
# Icon themes
neuwaita-icon-theme = pkgs.stdenvNoCC.mkDerivation {
pname = "neuwaita-icon-theme";
version = "unstable-2025-01-15";
src = pkgs.fetchFromGitHub {
owner = "RusticBard";
repo = "Neuwaita";
rev = "4c63e30493ab34558539104309282877ab767798";
hash = "sha256-NL8/ceugdGNSMpa8G/a4Eolutf5BcN6PXiQ9qDmHM1U=";
};
dontBuild = true;
dontConfigure = true;
installPhase = ''
runHook
preInstall
mkdir - p $out/share/icons/Neuwaita
cp - r * $out/share/icons/Neuwaita/
rm - rf $out/share/icons/Neuwaita/.git *
runHook postInstall
'';
meta = with pkgs.lib; {
description = "A different take on the Adwaita icon theme";
homepage = "https://github.com/RusticBard/Neuwaita";
license = licenses.gpl3Plus;
platforms = platforms.linux;
};
};
# Documentation site (MkDocs Material, built reproducibly)
docs = pkgs.callPackage ./docs_gen/site.nix { };
# Live ISO images
live-iso-razer = liveImages.liveImages.live-iso-razer.config.system.build.isoImage;
# Development and deployment tools available as packages
# (Apps are available separately via apps.x86_64-linux)
};
# ========================================
# DEVELOPMENT ENVIRONMENTS
# ========================================
devShells.x86_64-linux =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
default = import ./tools/dev.nix { inherit pkgs inputs; };
testing = import ./tools/testing.nix { inherit pkgs; };
docs = import ./tools/docs.nix { inherit pkgs; };
};
# ========================================
# VALIDATION AND AUTOMATION
# ========================================
# Quality assurance and validation checks
checks.x86_64-linux = import ./checks/default.nix {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
inherit (nixpkgs) lib;
};
# Application entries for common workflows
apps.x86_64-linux =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
appPkgs = import ./tools/default.nix { inherit pkgs; };
in
{
deploy = {
type = "app";
program = "${appPkgs.deploy}/bin/nixos-deploy";
};
test = {
type = "app";
program = "${appPkgs.test}/bin/nixos-test";
};
build-live = {
type = "app";
program = "${appPkgs.build-live}/bin/nixos-build-live";
};
dev-utils = {
type = "app";
program = "${appPkgs.dev-utils} /bin/nixos-dev-utils";
};
};
# Code formatter for consistent formatting
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
};
}