-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
375 lines (328 loc) · 12.9 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
{
description = "My nixos configuration and dotfiles";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
emacs-overlay.url = "github:nix-community/emacs-overlay/master";
rust-overlay.url = "github:oxalica/rust-overlay";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
# TODO use local flake to support my own languages instead
# TODO Maybe consider adding the taffybar overlay (but prob not necessary)
# emacs-ng.url = "github:emacs-ng/emacs-ng";
lanzaboote = {
url = "github:nix-community/lanzaboote";
# Optional but recommended to limit the size of your system closure.
inputs.nixpkgs.follows = "nixpkgs";
# inputs.rust-overlay.follows = "rust-overlay";
};
anyrun.url = "github:Kirottu/anyrun";
anyrun.inputs.nixpkgs.follows = "nixpkgs";
nixos-cosmic = {
url = "github:lilyinstarlight/nixos-cosmic";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, nixos-hardware, rust-overlay
, lanzaboote, anyrun, disko, nixos-cosmic, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
# Interesting, this is how you consume a "eachDefaultSystem" flake. you have to specify the system in the overlay / package.
# TODO tree grepper defines it's own tree-sitter binaries, I wonder if I can just use those rather than some other one?
overlays = [
(import self.inputs.emacs-overlay)
# emacs-ng.overlays.default
];
};
# in nixpkgs.lib.extend - uses the makeExtensible pattern, which allows attribute sets to be extended.
# uses the fixed point combinator - the self is the current attribute set, and the super is the "old" attribute set
# this way, I can extend the nix lib to include my lib functions
lib = nixpkgs.lib.extend (self: super: {
my = import ./lib.nix {
inherit self pkgs;
lib = self;
};
});
username = "thanawat";
home-modules = import ./home/modules-list.nix;
in {
lib = lib;
# nixosModules = {ttsystem = {}; } // lib.my.mapModules import ./system-modules;
nixosConfigurations = {
"thanawat-thinkpad" = lib.nixosSystem {
inherit system;
modules = (lib.my.getModules ./system-modules) ++ [
./thinkpad-t480/configuration.nix
nixos-hardware.nixosModules.lenovo-thinkpad-t480
({ pkgs, ... }: {
# TTsystem things to enable
ttsystem.xmonad-de = {
enable = true;
diskEncryptautoLogin = true;
};
ttsystem.gaming.enable = true;
ttsystem.syncthing.enable = true;
ttsystem.mobile-debugging.android-enable = true;
ttsystem.mobile-debugging.apple-enable = true;
ttsystem.audio.enable = true;
ttsystem.printing.enable = true;
ttsystem.zoom.enable = true;
})
];
};
# my um560 configuration
"thanawat-um560" = lib.nixosSystem {
inherit system;
inherit lib;
# figured it out..
# lib.my.mapModules (a: a) ./system-modules - basically returns all of the absolute nix paths in ./system-modules# then, I can import them using this:
modules = (lib.my.getModules ./system-modules) ++ [
./um560/configuration.nix
lanzaboote.nixosModules.lanzaboote
# enable stuff here!
({ pkgs, ... }:
{
# Enable system modules
ttsystem.mobile-debugging.android-enable = true;
ttsystem.xmonad-de = {
enable = false;
diskEncryptautoLogin = false;
};
# programs.nix-ld.enable = true;
ttsystem.nix-ld.enable = true;
ttsystem.syncthing.enable = true;
ttsystem.gaming.enable = true;
ttsystem.audio.enable = true;
ttsystem.printing.enable = true;
ttsystem.zoom.enable = true;
# enable version control
ttsystem.version-control.enable = true;
# wayland compositors
programs.hyprland.enable = true;
programs.sway.enable = true;
programs.river.enable = true;
documentation.dev.enable = true;
# services.xserver.displayManager.sddm.enable = true;
# make swaylock work
security.pam.services = { swaylock = { }; };
# secure boot
boot.bootspec.enable = true;
environment.systemPackages = [
# For debugging and troubleshooting Secure Boot.
pkgs.sbctl
pkgs.hikari
];
# Lanzaboote currently replaces the systemd-boot module.
# This setting is usually set to true in configuration.nix
# generated at installation time. So we force it to false
# for now.
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
})
];
};
"framework-thanawat" = lib.nixosSystem {
inherit system;
inherit lib;
# figured it out..
# lib.my.mapModules (a: a) ./system-modules - basically returns all of the absolute nix paths in ./system-modules# then, I can import them using this:
modules = (lib.my.getModules ./system-modules) ++ [
./framework/configuration.nix
nixos-hardware.nixosModules.framework-13-7040-amd
disko.nixosModules.disko
./disk-config.nix
{
nix.settings = {
substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
];
};
}
nixos-cosmic.nixosModules.default
# enable stuff here!
({ pkgs, ... }:
{
# Enable system modules
# ttsystem.mobile-debugging.android-enable = true;
ttsystem.xmonad-de = {
enable = false;
diskEncryptautoLogin = false;
};
# programs.nix-ld.enable = true;
ttsystem.nix-ld.enable = true;
ttsystem.syncthing.enable = true;
ttsystem.gaming.enable = true;
ttsystem.audio.enable = true;
# services.desktopManager.cosmic.enable = true;
# services.displayManager.cosmic-greeter.enable = true;
# environment.systemPackages = [ pkgs.cosmic-greeter ];
# security.pam.services.cosmic-greeter = { };
hardware.pulseaudio.enable = false;
ttsystem.printing.enable = true;
ttsystem.zoom.enable = true;
# enable version control
ttsystem.version-control.enable = true;
# wayland compositors
programs.hyprland.enable = true;
programs.sway.enable = true;
programs.river.enable = true;
documentation.dev.enable = true;
# services.xserver.displayManager.sddm.enable = true;
# make swaylock work
security.pam.services = {
swaylock = {
text = ''
auth sufficient pam_unix.so try_first_pass likeauth nullok
auth sufficient pam_fprintd.so
auth include login
'';
};
};
# TODO: fprintd..?
services.fprintd.enable = true;
# enable power-profiles-daemon
})
];
};
# Installation iso
# TODO: copy my dotfiles into the iso
exampleIso = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
({ pkgs, ... }: {
environment.systemPackages = [
pkgs.neovim
pkgs.git
disko.outputs.packages."${system}".default
];
environment.etc = { dotfiles.source = ./.; };
})
];
};
};
# TODO rewrite this into the nixos module instead of an individual module
# so I don't have to update twice?
homeConfigurations = {
"desktop" = home-manager.lib.homeManagerConfiguration {
# Specify the path to your home configuration here
#
pkgs = pkgs;
# TODO: I need to rework this...
modules = home-modules ++ [
({
nixpkgs.overlays = [
(import self.inputs.emacs-overlay)
rust-overlay.overlays.default
];
})
({
home = {
inherit username;
# username = "thanawat";
homeDirectory = "/home/${username}";
stateVersion = "22.05";
};
home.packages =
[ anyrun.packages.${system}.anyrun-with-all-plugins ];
# I can change this to emacs-ng instead
tthome.emacs = {
enable = true;
emacsPkg =
(pkgs.emacs-pgtk.override { withTreeSitter = true; });
# emacsPkg = emacs-ng.packages.x86_64-linux.emacsng;
# emacsPkg = emacs-ng.packages.x86_64-linux.emacsng;
};
tthome.dev-tools.enable = true;
tthome.home.enable = true;
# tthome.de.audio.enable = true;
# tthome.de.video-editing.enable = true;
tthome.de.drawing.enable = true;
tthome.wayland.enable = true;
tthome.design.enable = true;
})
# rust
./home/rust.nix
];
};
"framework" = home-manager.lib.homeManagerConfiguration {
# Specify the path to your home configuration here
#
pkgs = pkgs;
# TODO: I need to rework this...
modules = home-modules ++ [
({
nixpkgs.overlays = [
(import self.inputs.emacs-overlay)
rust-overlay.overlays.default
];
})
({
home = {
inherit username;
# username = "thanawat";
homeDirectory = "/home/${username}";
stateVersion = "22.05";
};
home.packages =
[ anyrun.packages.${system}.anyrun-with-all-plugins ];
# I can change this to emacs-ng instead
tthome.emacs = {
enable = true;
emacsPkg = pkgs.emacs29;
# emacsPkg = emacs-ng.packages.x86_64-linux.emacsng;
# emacsPkg = emacs-ng.packages.x86_64-linux.emacsng;
};
tthome.dev-tools.enable = true;
tthome.home.enable = true;
tthome.de.audio.enable = true;
# tthome.de.audio.enable = true;
# tthome.de.video-editing.enable = true;
tthome.de.drawing.enable = true;
tthome.wayland.enable = true;
})
# rust
./home/rust.nix
];
};
laptop = home-manager.lib.homeManagerConfiguration {
# Specify the path to your home configuration here
#
pkgs = pkgs;
modules = home-manager ++ [
({
nixpkgs.overlays = [
(import self.inputs.emacs-overlay)
rust-overlay.overlays.default
];
})
# TODO move imports over to here.. and rewrite to use cfg instead.
({
home = {
inherit username;
# username = "thanawat";
homeDirectory = "/home/${username}";
stateVersion = "22.05";
};
home.packages = [ ];
tthome.emacs = {
enable = true;
emacsPkg = pkgs.emacs;
};
tthome.dev-tools.enable = true;
tthome.home.enable = true;
})
];
};
};
};
}