-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
282 lines (247 loc) · 8.37 KB
/
Copy pathflake.nix
File metadata and controls
282 lines (247 loc) · 8.37 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
{
description = "sebe nix config";
nixConfig = {
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
extra-substituters = [
"https://nix-community.cachix.org"
"https://attic.xuyh0120.win/lantian"
"https://cache.garnix.io"
];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-26.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixos-unstable";
# use home-manager
home-manager = {
url = "github:nix-community/home-manager?ref=release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# manages bind mounts to persistent storage
impermanence = {
url = "github:nix-community/impermanence";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
# secureboot for nixOS
lanzaboote.url = "github:nix-community/lanzaboote/v1.0.0";
# CachyOS kernel (BORE scheduler, cachyos perf patches, sched-ext)
# replaces chaotic-cx/nyx which was archived Dec 2025
nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release";
# do NOT override nixpkgs — patches must match the kernel version pinned upstream
# declarative disk partitioning
disko = {
url = "github:nix-community/disko/latest";
inputs.nixpkgs.follows = "nixpkgs";
};
# declarative flatpak installs
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
# nice little emoji picker
simplemoji.url = "github:SergioRibera/Simplemoji?ref=v1.2.4";
# Qt6 theme engine for Hyprland (replaces qt6ct)
hyprqt6engine = {
url = "github:hyprwm/hyprqt6engine";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
forgecode = {
url = "github:antinomyhq/forgecode";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
peek-a-meet = {
url = "git+https://github.com/sbresin/peek-a-meet.git";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
# screenshot utility for Hyprland (replaces hyprshot)
hyprcap.url = "github:alonso-herreros/hyprcap";
};
outputs =
{
self,
nixpkgs,
...
}@inputs:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
# Shared unfree package allowlist
allowedUnfreePackages = [
"corefonts"
"nvidia-x11"
"nvidia-settings"
"dank-mono"
"dank-mono-nerd"
"terraform"
"ngrok"
"steam"
"steam-unwrapped"
"zsh-abbr"
"duckstation"
"1password"
"1password-cli"
"1password-gui"
"castlabs-electron"
"claude-code"
"xrt-plugin-amdxdna"
"fastflowlm"
];
# Shared nixpkgs config (allowUnfree + ROCm for Linux)
mkNixpkgsConfig =
{
system ? "x86_64-linux",
extraConfig ? { },
}:
{
allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) allowedUnfreePackages;
}
// nixpkgs.lib.optionalAttrs (nixpkgs.lib.hasSuffix "-linux" system) {
rocmSupport = true;
}
// extraConfig;
# Auto-import all NixOS modules from nix/modules/nixos/*/
nixosModulesList =
let
dir = ./nix/modules/nixos;
in
map (name: dir + "/${name}") (builtins.attrNames (builtins.readDir dir));
# Auto-import all home-manager modules from nix/modules/home/*/
homeModulesList =
let
dir = ./nix/modules/home;
in
map (name: dir + "/${name}") (builtins.attrNames (builtins.readDir dir));
# Pre-compute unstable pkgs per system — outside overlay fixed-point.
# This avoids the expensive `import nixpkgs-unstable` inside the overlay,
# where it would depend on `prev.config` and get entangled with the
# fixed-point resolution. Benchmarked at 35% faster eval (77s → 50s).
unstablePkgs = builtins.listToAttrs (
map (system: {
name = system;
value = import inputs.nixpkgs-unstable {
inherit system;
config = mkNixpkgsConfig { inherit system; };
};
}) (systems ++ [ "x86_64-darwin" ])
);
# Overlay sets — cachyos kernel overlay is only useful on x86_64-linux
baseOverlays = with self.overlays; [
unstable
lix
sebe-packages
];
x86LinuxOverlays = baseOverlays ++ [ self.overlays.cachyos ];
overlaysForSystem = system: if system == "x86_64-linux" then x86LinuxOverlays else baseOverlays;
# Shared NixOS modules applied to ALL hosts
sharedNixosModules = [
inputs.home-manager.nixosModules.home-manager
inputs.impermanence.nixosModules.impermanence
inputs.lanzaboote.nixosModules.lanzaboote
inputs.nix-flatpak.nixosModules.nix-flatpak
# nixpkgs config + home-manager settings (overlays set per-host in mkNixos)
{
nixpkgs.config = mkNixpkgsConfig { };
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
backupFileExtension = "backuphm";
extraSpecialArgs = { inherit inputs self; };
sharedModules = homeModulesList;
};
}
]
++ nixosModulesList;
# Helper to create a NixOS system configuration
mkNixos =
{
hostPath,
system ? "x86_64-linux",
extraModules ? [ ],
}:
nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs self; };
modules =
sharedNixosModules
++ [ { nixpkgs.overlays = overlaysForSystem system; } ]
++ extraModules
++ [ hostPath ];
};
# Helper to create a standalone home-manager configuration
mkHome =
{
system,
homePath,
}:
inputs.home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
overlays = overlaysForSystem system;
config = mkNixpkgsConfig { inherit system; };
};
extraSpecialArgs = { inherit inputs self; };
modules = homeModulesList ++ [ homePath ];
};
in
{
overlays = {
unstable = import ./nix/overlays/unstable { inherit inputs unstablePkgs; };
lix = import ./nix/overlays/lix;
sebe-packages = import ./nix/overlays/sebe-packages { inherit inputs; };
cachyos = inputs.nix-cachyos-kernel.overlays.pinned;
};
packages = forAllSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = overlaysForSystem system;
config.allowUnfree = true;
};
in
pkgs.sebe
);
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-tree);
nixosConfigurations = {
blade15 = mkNixos {
hostPath = ./nix/systems/x86_64-linux/blade15;
extraModules = [
{ home-manager.users.sebe = import (./nix/homes/x86_64-linux + "/sebe@blade15"); }
];
};
MONDO-1504 = mkNixos {
hostPath = ./nix/systems/x86_64-linux/MONDO-1504;
extraModules = [
inputs.disko.nixosModules.default
{ home-manager.users.sebe = import (./nix/homes/x86_64-linux + "/sebe@MONDO-1504"); }
];
};
pi-server = mkNixos {
hostPath = ./nix/systems/aarch64-linux/pi-server;
system = "aarch64-linux";
extraModules = [ inputs.disko.nixosModules.default ];
};
pi-installer = mkNixos {
hostPath = ./nix/systems/aarch64-linux/pi-installer;
system = "aarch64-linux";
};
};
homeConfigurations = {
"sebe@blade15" = mkHome {
system = "x86_64-linux";
homePath = ./nix/homes/x86_64-linux + "/sebe@blade15";
};
"sebe@MONDO-1504" = mkHome {
system = "x86_64-linux";
homePath = ./nix/homes/x86_64-linux + "/sebe@MONDO-1504";
};
"sbresin@MONDO-0614" = mkHome {
system = "x86_64-darwin";
homePath = ./nix/homes/x86_64-darwin + "/sbresin@MONDO-0614";
};
};
};
}