forked from AdamCiuris/nixos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
247 lines (226 loc) · 9.16 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
# access your package set through nix build, shell, run, etc this flake
{
description = "precious config";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
hardware.url = "github:nixos/nixos-hardware";
# nixos-hardware.url = "github:NixOS/nixos-hardware/master"; # https://github.com/NixOS/nixos-hardware
# <nixos-hardware/system76> add something like this to hardware-configuration.nix imports
# Home manager
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs";
};
vscode-server = {
url = "github:nix-community/nixos-vscode-server";
inputs.nixpkgs.follows = "nixpkgs";
};
# nix-user-repositories = {
# url = "github:rycee/home-manager";
# inputs.nixpkgs.follows = "nixpkgs";
# };
plasma-manager ={
url = "github:pjones/plasma-manager";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
};
outputs = { self, nixpkgs, hardware, lanzaboote, vscode-server, home-manager, plasma-manager, nixos-generators, flake-utils, ... }@inputs:
let
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
];
in
rec {
myPkgs = forAllSystems (system:
import inputs.nixpkgs {
inherit system;
# NOTE: Using `nixpkgs.config` in your NixOS config won't work
# Instead, you should set nixpkgs configs here
# (https://nixos.org/manual/nixpkgs/stable/#idm140737322551056)
config.allowUnfree = true;
}
);
# vimjoyer iso nonsense https://www.youtube.com/watch?v=-G8mN6HJSZE&
nixosConfigurations = {
# https://github.com/nix-community/nixos-generators?tab=readme-ov-file#using-in-a-flake
formatConfigs.exampleCustomFormat = { config, modulesPath, ... }: {
imports = [ "${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix" ];
formatAttr = "isoImage";
fileExtension = ".iso";
};
"nixos" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
pkgs = myPkgs.x86_64-linux;
specialArgs = { inherit inputs; }; # Pass flake inputs to our config
modules = [
lanzaboote.nixosModules.lanzaboote # SECURE BOOT FOR NIXOS
({ pkgs, lib, ... }: { # wtf ????
environment.systemPackages = [
pkgs.sbctl # secure boot control
];
boot.loader.systemd-boot.enable = lib.mkForce false; # highest prio
boot.lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
environment.variables.NIXOS_FLAKE_CONFIGURATION = "nixos";
})
./top-level-configs/variants/dailyDrive.nix
# home-manager junk
home-manager.nixosModules.home-manager
hardware.nixosModules.system76
nixos-generators.nixosModules.all-formats # nix build .\#nixosConfigurations.nixos.config.formats. and hit tab to see all
# nix build .\#nixosConfigurations.nixos.config.formats.install-iso -o ./result
{
home-manager.extraSpecialArgs = { inherit inputs; }; # Pass flake input to home-manager
home-manager.users = {
nyx = {
imports = [ ./home-manager/users/nyx.nix ];
home.stateVersion="24.05";
};
bael = {
imports = [ ./home-manager/users/bael.nix ];
home.stateVersion="24.05";
};
};
}
];
};
"vm" = nixpkgs.lib.nixosSystem { # slightly modifying stuff for qemu/kvm vms
system = "x86_64-linux";
pkgs = myPkgs.x86_64-linux;
specialArgs = { inherit inputs; }; # Pass flake inputs to our config
modules = [
({ pkgs, lib, ... }: { # wtf ????
boot.loader = lib.mkForce {
systemd-boot.enable = false;
grub.enable = true;
grub.devices = ["/dev/vda"] ;
};
swapDevices = lib.mkForce [ ];
home-manager.users.nyx.home.file = lib.mkForce {}; # no autostarts
services.system76-scheduler.enable = lib.mkForce false;
hardware.system76.firmware-daemon.enable = lib.mkForce false;
environment.variables.NIXOS_FLAKE_CONFIGURATION = "vm";
})
./top-level-configs/variants/dailyDrive.nix
# home-manager junk
home-manager.nixosModules.home-manager
nixos-generators.nixosModules.all-formats # nix build .\#nixosConfigurations.nixos.config.formats. and hit tab to see all
# nix build .\#nixosConfigurations.nixos.config.formats.install-iso -o ./result
{
home-manager.extraSpecialArgs = { inherit inputs; }; # Pass flake input to home-manager
home-manager.users = {
nyx = {
imports = [ ./home-manager/users/nyx.nix ];
home.stateVersion="24.05";
};
};
}
];
};
"lockdown" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
pkgs = myPkgs.x86_64-linux;
specialArgs = { inherit inputs; }; # Pass flake inputs to our config
modules = [
# > Our main nixos configuration file <zzzzz
./top-level-configs/variants/lockdown.nix
# home-manager junk
home-manager.nixosModules.home-manager
{
environment.variables.NIXOS_FLAKE_CONFIGURATION = "lockdown";
home-manager.extraSpecialArgs = { inherit inputs; }; # Pass flake input to home-manager
home-manager.users = {
lock = {
imports = [ ./home-manager/users/lock.nix ];
home.stateVersion="24.05";
};
};
}
];
};
"compclub" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
pkgs = myPkgs.x86_64-linux;
specialArgs = { inherit inputs; }; # Pass flake inputs to our config
modules = [
# > Our main nixos configuration file <
./top-level-configs/variants/club.nix
home-manager.nixosModules.home-manager
{
environment.variables.NIXOS_FLAKE_CONFIGURATION = "compclub";
home-manager.extraSpecialArgs = { inherit inputs; }; # Pass flake input to home-manager
home-manager.users = {
rdp = {
imports = [ ./home-manager/users/rdp.nix ];
home.stateVersion="24.05";
};
teach = {
imports = [ ./home-manager/users/teach.nix ];
home.stateVersion="24.05";
};
tunnelThruMe = {
imports = [ ./home-manager/users/tunnelThruMe.nix ];
home.stateVersion="24.05";
};
chi = {
imports = [ ./home-manager/users/clubMember.nix ];
home.stateVersion="24.05";
};
};
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
}
];
};
"gcloud" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
pkgs = myPkgs.x86_64-linux;
specialArgs = { inherit inputs; }; # Pass flake inputs to our config
modules = [
# > Our main nixos configuration file <
./top-level-configs/variants/gcloud.nix
home-manager.nixosModules.home-manager
vscode-server.nixosModules.default
({ pkgs, lib, ... }: {
services.vscode-server.enable = true;
}
)
{
environment.variables.NIXOS_FLAKE_CONFIGURATION = "gcloud";
home-manager.extraSpecialArgs = { inherit inputs; }; # Pass flake input to home-manager
home-manager.users = {
rdp = {
imports = [ ./home-manager/users/rdp.nix ];
home.stateVersion="24.05";
};
nyx = {
imports = [ ./home-manager/users/nyx.nix ];
home.stateVersion="24.05";
};
tunnelThruMe = {
imports = [ ./home-manager/users/tunnelThruMe.nix ];
home.stateVersion="24.05";
};
};
home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
}
];
};
};
};
}