-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
415 lines (357 loc) · 15 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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
{
description = "A cookie jar full of flakes.";
inputs = {
## PURE-NIX UTILITIES ##
# Devenv (for this repo's devShells)
devenv.url = "github:cachix/devenv";
# Disko for declarative partitioning
disko.url = "github:nix-community/disko?ref=v1.9.0";
disko.inputs.nixpkgs.follows = "nixpkgs";
# Flake utils for stripping some boilerplate
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.systems.follows = "systems";
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus?ref=v1.5.1";
flake-utils-plus.inputs.flake-utils.follows = "flake-utils";
# Haumea for directory-defined attrset loading
haumea.url = "github:nix-community/haumea?ref=v0.2.2";
haumea.inputs.nixpkgs.follows = "nixpkgs";
# Impermanence
impermanence.url = "github:nix-community/impermanence";
# My personal data which is *not* technically secret but I don't want to show in this repo.
personal-data.url = "github:lordkekz/personal-data";
#personal-data.url = "/home/hpreiser/git/personal-data";
personal-data.inputs.haumea.follows = "haumea";
personal-data.inputs.systems.follows = "systems";
personal-data.inputs.nixpkgs.follows = "nixpkgs";
# The list of supported systems.
systems.url = "github:nix-systems/default-linux";
## PACKAGES, CONFIGURATION AND APPLICATIONS ##
agenix.url = "github:ryantm/agenix";
agenix.inputs = {
systems.follows = "systems";
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
agenix-rekey.url = "github:oddlama/agenix-rekey";
agenix-rekey.inputs.nixpkgs.follows = "nixpkgs";
# Anyrun is a modern, wayland-native runner written in Rust.
anyrun.url = "github:lordkekz/anyrun?ref=add-nix-overlay";
#anyrun.url = "github:anyrun-org/anyrun";
anyrun.inputs.nixpkgs.follows = "nixpkgs";
# Hardware configs for known systems.
hardware.url = "github:nixos/nixos-hardware";
# Home manager
home-manager.url = "github:lordkekz/home-manager?ref=release-24.11";
# home-manager.url = "github:nix-community/home-manager?ref=release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Kwin effect to force blur of transparent windows
kwin-effects-forceblur.url = "github:taj-ny/kwin-effects-forceblur?ref=v1.3.4";
kwin-effects-forceblur.inputs.nixpkgs.follows = "nixpkgs";
kwin-effects-forceblur.inputs.utils.follows = "flake-utils";
# Lix (correctness-focused fork of Nix)
lix-module.url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz";
lix-module.inputs.nixpkgs.follows = "nixpkgs";
# microvm.nix
#microvm.url = "github:astro/microvm.nix?ref=main";
microvm.url = "github:lordkekz/microvm.nix?ref=initialize-shares-permissions"; # FIXME update after merge
microvm.inputs.nixpkgs.follows = "nixpkgs";
# Tmux status bar configured in Rust
#muxbar.url = "github:Dlurak/muxbar";
muxbar.url = "github:lordkekz/muxbar"; # FIXME Update once PR gets merged
muxbar.inputs.nixpkgs.follows = "nixpkgs";
muxbar.inputs.systems.follows = "systems";
# Naersk for easily building Rust packages
naersk.url = "github:nix-community/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
# Nixpkgs
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.follows = "nixpkgs-stable";
# A nixpkgs downstream which only contains the lib
#nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
# nix-index allows searching for binary names; nix-index-database contains a prebuilt db for nix-index.
nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
# Nix-minecraft allows declarative minecraft servers with plugins
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
nix-minecraft.inputs.nixpkgs.follows = "nixpkgs";
nix-minecraft.inputs.flake-utils.follows = "flake-utils";
# NixVim distro for neovim
nixvim.url = "github:nix-community/nixvim/main";
#nixvim.url = "github:lordkekz/nixvim/main";
nixvim.inputs.nixpkgs.follows = "nixpkgs-unstable";
# Doesn't work: nixvim.inputs.pre-commit-hooks.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
# see: https://github.com/msteen/nix-flake-override
# Mirror of VSCode marketplace and Open VSX registry.
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions?ref=master";
nix-vscode-extensions.inputs.nixpkgs.follows = "nixpkgs";
# Yazi plugins
# nix-yazi-plugins.url = "github:lordkekz/nix-yazi-plugins?ref=main";
nix-yazi-plugins.url = "/home/hpreiser/git/nix-yazi-plugins";
nix-yazi-plugins.inputs.nixpkgs.follows = "nixpkgs";
# Yazi flake
yazi.url = "github:sxyazi/yazi?ref=v0.4.2";
#yazi.inputs.nixpkgs.follows = "nixpkgs-unstable"; # FIXME there's an infinite recursion as of 2024-12-15
# Generate images etc. from NixOS configs
nixos-generators.url = "github:nix-community/nixos-generators";
nixos-generators.inputs.nixpkgs.follows = "nixpkgs";
nixos-generators.inputs.nixlib.follows = "nixpkgs";
# Simple NixOS mailserver
nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.11";
nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs-unstable";
nixos-mailserver.inputs.nixpkgs-24_11.follows = "nixpkgs-stable";
# NixOS-WSL
NixOS-WSL.url = "github:nix-community/NixOS-WSL";
NixOS-WSL.inputs.nixpkgs.follows = "nixpkgs";
# Plasma manager
plasma-manager.url = "github:pjones/plasma-manager?ref=trunk";
#plasma-manager.url = "/home/hpreiser/git/plasma-manager";
plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
plasma-manager.inputs.home-manager.follows = "home-manager";
# Stylix helps theme applications using base16
#stylix.url = "/home/hpreiser/git/stylix";
stylix.url = "github:lordkekz/stylix?ref=release-24.11"; # FIXME switch back to upstream once merged
#stylix.url = "github:danth/stylix?ref=master";
stylix.inputs.nixpkgs.follows = "nixpkgs";
stylix.inputs.home-manager.follows = "home-manager";
# Hyprland, a wayland tiling compositor
hyprland.url = "github:hyprwm/Hyprland?ref=v0.39.1";
hyprland.inputs.nixpkgs.follows = "nixpkgs";
hyprland.inputs.systems.follows = "systems";
hyprlock.url = "github:hyprwm/hyprlock?ref=main"; #FIXME update with the next release
hyprlock.inputs.nixpkgs.follows = "nixpkgs";
hyprlock.inputs.systems.follows = "systems";
hypridle.url = "github:hyprwm/hypridle?ref=v0.1.2";
hypridle.inputs.nixpkgs.follows = "nixpkgs";
hypridle.inputs.systems.follows = "systems";
hyprpaper.url = "github:hyprwm/hyprpaper?ref=v0.6.0";
hyprpaper.inputs.nixpkgs.follows = "nixpkgs";
#hyprpaper.inputs.systems.follows = "systems";
hyprpicker.url = "github:hyprwm/hyprpicker?ref=v0.2.0";
hyprpicker.inputs.nixpkgs.follows = "nixpkgs";
#hyprpicker.inputs.systems.follows = "systems";
hyprland-contrib.url = "github:hyprwm/contrib?ref=v0.1";
hyprland-contrib.inputs.nixpkgs.follows = "nixpkgs";
#hyprland-contrib.inputs.systems.follows = "systems";
# The phinger-cursor theme, but packaged as a SVG Hyprcursor theme
hyprcursor-phinger.url = "github:jappie3/hyprcursor-phinger";
hyprcursor-phinger.inputs.nixpkgs.follows = "nixpkgs-unstable";
# Walker, a Wayland-native runner
walker.url = "github:abenz1267/walker";
# Worms.tex contains my custom texmf stuff
worms-tex = {
url = "github:lordkekz/worms.tex";
flake = false;
};
};
outputs = inputs @ {
flake-utils-plus,
haumea,
home-manager,
nixpkgs,
nixpkgs-stable,
nixpkgs-unstable,
self,
systems,
...
}: let
inherit (self) outputs;
inherit (nixpkgs.lib) attrValues mapAttrs;
hl = haumea.lib;
lib =
nixpkgs.lib
// {
my = hl.load {
src = ./lib;
inputs = {
inherit (nixpkgs) lib;
flake = self;
};
# Load it but require explicit inputs line in each file
loader = hl.loaders.default;
# Make the default.nix's attrs directly children of lib
transformer = hl.transformers.liftDefault;
};
};
homeManagerModules = hl.load {
src = ./modules/home-manager;
inputs = {
inherit lib;
flake = self;
};
# Load it without passing inputs, to preserve the functional nature of the modules
loader = hl.loaders.verbatim;
};
nixosModules = hl.load {
src = ./modules/nixos;
inputs = {
inherit lib;
flake = self;
};
# Load it without passing inputs, to preserve the functional nature of the modules
loader = hl.loaders.verbatim;
};
homeProfiles = lib.my.loadProfiles "home";
nixosProfiles = lib.my.loadProfiles "nixos";
hardwareProfiles = lib.my.loadProfiles "hardware";
workloadProfiles = lib.my.loadProfiles.loadModulesOfProfiles "workload";
getHomeConfig = system: name: outputs.legacyPackages.${system}.homeConfigurations.${name};
mkSessions = system: {
config.multi-hm.sessions = {
kde = {
homeConfiguration = getHomeConfig system "kde";
launchCommand = "startplasma-wayland";
displayName = "Plasma 6 (mutli-hm)";
};
#hypr = {
# homeConfiguration = getHomeConfig system "hypr";
# launchCommand = "Hyprland";
# displayName = "Hyprland (multi-hm)";
#};
};
config.services.displayManager.defaultSession = lib.mkForce "kde";
};
# A set containing the paths of assets in ./assets directory
assets = hl.load {
src = ./assets;
loader = [(hl.matchers.always hl.loaders.path)];
};
in
flake-utils-plus.lib.mkFlake {
inherit self inputs;
# CHANNEL DEFINITIONS
# Channels are automatically generated from nixpkgs inputs
# e.g the inputs which contain `legacyPackages` attribute are used.
channelsConfig.allowUnfree = true;
sharedOverlays = map (i: i.overlays.default) (with inputs; [
yazi
nix-yazi-plugins
nix-minecraft
hyprland
hyprlock
hypridle
hyprpaper
hyprpicker
hyprland-contrib
anyrun
agenix
agenix-rekey
]);
# HOST DEFINITIONS
hostDefaults = {
modules =
(attrValues nixosModules)
++ (with inputs; [
nixos-generators.nixosModules.all-formats
lix-module.nixosModules.default
agenix.nixosModules.default
agenix-rekey.nixosModules.default
]);
specialArgs = {
inherit inputs outputs assets nixosProfiles hardwareProfiles workloadProfiles;
inherit (inputs) personal-data;
system = "x86_64-linux"; # FIXME for other architectures
};
channelName = "nixpkgs";
system = "x86_64-linux";
};
# declare hosts in flake.nix (hosts are defined by hostname, arch and profiles)
hosts = with nixosProfiles;
with hardwareProfiles; {
live.modules = [
live-installer
(lib.my.mkNixosModuleForHomeProfile (getHomeConfig "x86_64-linux" "terminal"))
];
nasman2404.modules = [
homelab
ryzen-server-2404
(lib.my.mkNixosModuleForHomeProfile (getHomeConfig "x86_64-linux" "terminal"))
];
kekswork2404.modules = [
personal
graphical
framework-laptop-2404
# Adds entries for graphical sessions which first activate a home configuration
(mkSessions "x86_64-linux")
# Fallback so I get a decent tty experience without starting graphical session
(lib.my.mkNixosModuleForHomeProfile (getHomeConfig "x86_64-linux" "terminal"))
];
keksjumbo2410.modules = [
personal
graphical
framework-laptop-2410
# Adds entries for graphical sessions which first activate a home configuration
(mkSessions "x86_64-linux")
# Fallback so I get a decent tty experience without starting graphical session
(lib.my.mkNixosModuleForHomeProfile (getHomeConfig "x86_64-linux" "terminal"))
];
vortex.modules = [
homelab
vortex
(lib.my.mkNixosModuleForHomeProfile (getHomeConfig "x86_64-linux" "terminal"))
];
};
# PER-SYSTEM OUTPUTS
outputsBuilder = channels: let
system = channels.nixpkgs.system;
pkgs = channels.nixpkgs;
pkgs-stable = channels.nixpkgs-stable;
pkgs-unstable = channels.nixpkgs-unstable;
flake = self;
in {
# generate homeConfigurations from homeProfiles
legacyPackages.homeConfigurations = mapAttrs (homeProfileName: homeProfile:
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit flake inputs outputs assets system pkgs-stable pkgs-unstable homeProfiles;
inherit (inputs) personal-data;
inherit (inputs) stylix-image;
};
modules = [homeProfile] ++ (attrValues homeManagerModules);
})
homeProfiles;
packages = hl.load {
src = ./pkgs;
inputs = {
inherit flake inputs outputs assets system pkgs pkgs-stable pkgs-unstable;
};
# Load it but require explicit inputs line in each file
loader = hl.loaders.default;
# Make the default.nix's attrs directly children of lib
transformer = hl.transformers.liftDefault;
};
# Dev shells
devShells.default = inputs.devenv.lib.mkShell {
inherit inputs pkgs;
modules = [./devenv.nix];
};
# Output channels for easier debugging in nix repl
inherit channels;
formatter = pkgs.alejandra;
};
# SYSTEMLESS OUTPUTS
# Expose the necessary information in your flake so agenix-rekey
# knows where it has too look for secrets and paths.
#
# Make sure that the pkgs passed here comes from the same nixpkgs version as
# the pkgs used on your hosts in `nixosConfigurations`, otherwise the rekeyed
# derivations will not be found!
agenix-rekey = inputs.agenix-rekey.configure {
userFlake = self;
nodes = {
inherit (self.nixosConfigurations) kekswork2404 keksjumbo2410 nasman2404 vortex;
};
# Example for colmena:
# inherit ((colmena.lib.makeHive self.colmena).introspect (x: x)) nodes;
};
# export homeProfiles and nixosProfiles but not hardwareProfiles
profiles.nixos = nixosProfiles;
profiles.home = homeProfiles;
profiles.workload = workloadProfiles;
# export generic homeManagerModules and nixosModules (e.g. patched versions to be upstreamed)
inherit homeManagerModules nixosModules;
# export lib, templates, etc.
inherit lib assets;
};
}