Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
310 lines (294 loc) · 9.79 KB
/
Copy pathflake.nix
File metadata and controls
310 lines (294 loc) · 9.79 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
{
description = "cunbidun's dotfiles";
inputs = {
master.url = "github:nixos/nixpkgs?ref=master";
nixpkgs-unstable = {url = "github:nixos/nixpkgs/nixos-unstable";};
nixpkgs-stable = {url = "github:nixos/nixpkgs/nixos-25.05";};
nix-darwin = {url = "github:LnL7/nix-darwin";};
home-manager = {url = "github:nix-community/home-manager";};
apple-fonts = {url = "github:Lyndeno/apple-fonts.nix";};
nix-speedtest-module = {url = "github:PulfordJ/nix-speedtest-module";};
claude-code.url = "github:sadjow/claude-code-nix";
disko.url = "github:nix-community/disko";
nixos-raspberrypi.url = "github:nvmd/nixos-raspberrypi/main";
# +----------+
# | Hyprland |
# +----------+
hyprland = {url = "github:hyprwm/Hyprland/?submodules=1";};
pyprland = {url = "github:hyprland-community/pyprland";};
hyprland-contrib = {url = "github:hyprwm/contrib";};
hyprcursor-phinger = {url = "github:jappie3/hyprcursor-phinger";};
xremap-flake = {
url = "github:xremap/nix-flake";
inputs.hyprland.follows = "hyprland";
};
hyprfocus = {
url = "github:daxisunder/hyprfocus";
inputs.hyprland.follows = "hyprland";
};
Hyprspace = {
url = "github:KZDKM/Hyprspace";
inputs.hyprland.follows = "hyprland";
};
# +--------+
# | Others |
# +--------+
yazi = {url = "github:sxyazi/yazi/v25.4.8";};
stylix = {url = "github:nix-community/stylix";};
vicinae = {
url = "https://github.com/vicinaehq/vicinae/releases/download/v0.2.1/vicinae-linux-x86_64-v0.2.1.tar.gz";
flake = false;
};
nur.url = "github:nix-community/nur";
rust-overlay.url = "github:oxalica/rust-overlay";
nix-monitored = {
url = "github:ners/nix-monitored";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
# +----------------+
# | Neovim plugins |
# +----------------+
auto-dark-mode-nvim = {
url = "github:f-person/auto-dark-mode.nvim";
flake = false;
};
copilot-lua = {
url = "github:zbirenbaum/copilot.lua";
flake = false;
};
blink-copilot = {
url = "github:fang2hou/blink-copilot";
flake = false;
};
# +-- MacOS specific --+
mac-app-util.url = "github:hraban/mac-app-util";
};
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.agenix.url = "github:ryantm/agenix";
inputs.agenix-rekey.url = "github:oddlama/agenix-rekey";
# Make sure to override the nixpkgs version to follow your flake,
# otherwise derivation paths can mismatch (when using storageMode = "derivation"),
# resulting in the rekeyed secrets not being found!
inputs.agenix-rekey.inputs.nixpkgs.follows = "nixpkgs-unstable";
outputs = inputs @ {
self,
nixpkgs-unstable,
nix-darwin,
home-manager,
agenix,
agenix-rekey,
flake-utils,
claude-code,
disko,
...
}: let
project_root = ./.;
userdata = import ./userdata.nix;
kawaiiuserdata = import ./kawaiiuserdata.nix;
rossuserdata = import ./rossuserdata.nix;
mkPkgs = system:
import nixpkgs-unstable {
inherit system;
overlays = import "${project_root}/nix/overlays" inputs;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
};
mkHomeManagerModule = configPath: userdata: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${userdata.username} = import configPath;
extraSpecialArgs = {
inherit project_root inputs;
inherit userdata;
};
};
};
mkDarwinSystem = {
system,
stateVersionNum,
}:
nix-darwin.lib.darwinSystem {
pkgs = mkPkgs system;
specialArgs = {
inherit inputs userdata;
inherit (inputs) nix-speedtest-module;
stateVersion = stateVersionNum;
};
modules = [
inputs.mac-app-util.darwinModules.default
./nix/hosts/macbook/configuration.nix
inputs.nix-speedtest-module.darwinModules.default
home-manager.darwinModules.home-manager
(mkHomeManagerModule "${project_root}/nix/hosts/macbook/home.nix" userdata)
agenix.darwinModules.default
#agenix-rekey.nixosModules.default
./secrets/macsecrets.nix
];
};
mkNixosHost = {
system,
hostPath,
homePath,
diskoPath,
}:
nixpkgs-unstable.lib.nixosSystem {
pkgs = mkPkgs system;
specialArgs = {
inherit inputs userdata;
};
modules = [
inputs.disko.nixosModules.disko
diskoPath
hostPath
home-manager.nixosModules.home-manager
(mkHomeManagerModule homePath userdata)
agenix.nixosModules.default
agenix-rekey.nixosModules.default
./secrets/secrets.nix
];
};
in {
# for running commands like `nix eval .#inputs.hyprland.packages.x86_64-linux.hyprland`
inputs = inputs;
# Home Manager modules
homeManagerModules = {
theme-manager = import "${project_root}/nix/theme-manager/hm-module.nix";
};
# ---------------------------------#
# standalone home-manager configs #
# ---------------------------------#
# For hosts where Nix sits on top of a foreign distro (WSL on Ubuntu) and
# there is therefore no NixOS/nix-darwin layer to hang home-manager off.
#
# home-manager switch --flake ~/dotfiles#john@wsl
homeConfigurations = {
"${userdata.username}@wsl" = home-manager.lib.homeManagerConfiguration {
pkgs = mkPkgs "x86_64-linux";
extraSpecialArgs = {
inherit project_root inputs;
# userdata.nix is shared with the GPU desktop, so the CUDA opt-out is
# applied here rather than in the file itself.
userdata = userdata // {cudaSupport = false;};
};
modules = [./nix/hosts/wsl/home.nix];
};
};
# -----------------------#
# macbook configurations #
# -----------------------#
darwinConfigurations = {
"macbook-m1" = mkDarwinSystem {
system = "aarch64-darwin";
stateVersionNum = 4;
};
};
# -----------------------#
# nixos configurations #
# -----------------------#
nixosConfigurations = {
nixos = nixpkgs-unstable.lib.nixosSystem {
pkgs = mkPkgs "x86_64-linux";
specialArgs = {
inherit inputs userdata;
};
modules = [
./nix/hosts/nixos/configuration.nix
./nix/hosts/nixos/hardware-configuration.nix
./nix/hosts/nixos/yubikey.nix
home-manager.nixosModules.home-manager
(mkHomeManagerModule "${project_root}/nix/hosts/nixos/home.nix" userdata)
agenix.nixosModules.default
agenix-rekey.nixosModules.default
./secrets/secrets.nix
];
};
# Raspberry Pi 5 system (accessible as .#rpi5)
rpi5 = inputs.nixos-raspberrypi.lib.nixosSystem {
specialArgs = {
inherit inputs;
nixos-raspberrypi = inputs.nixos-raspberrypi;
userdata = userdata;
};
trustCaches = true;
modules = [
({modulesPath, ...}: {
imports = with inputs.nixos-raspberrypi.nixosModules; [
raspberry-pi-5.base
];
disabledModules = [
# disable the sd-image module that nixos-images uses
(modulesPath + "/installer/sd-card/sd-image-aarch64-installer.nix")
];
})
inputs.disko.nixosModules.disko
./nix/hosts/rpi/disko.nix
./nix/hosts/rpi/configuration.nix
./cachix.nix
./cuda-maintainers.nix
];
};
kawaiinixos = nixpkgs-unstable.lib.nixosSystem {
pkgs = mkPkgs "x86_64-linux";
specialArgs = {
inherit inputs;
userdata = kawaiiuserdata;
};
modules = [
./nix/hosts/nixos/configuration.nix
./nix/hosts/kawaiinixos/hardware-configuration.nix
#./nix/hosts/kawaiinixos/disko.nix
disko.nixosModules.disko
home-manager.nixosModules.home-manager
(mkHomeManagerModule "${project_root}/nix/hosts/nixos/home.nix" kawaiiuserdata)
agenix.nixosModules.default
agenix-rekey.nixosModules.default
./secrets/secrets.nix
];
};
rossnixos = nixpkgs-unstable.lib.nixosSystem {
pkgs = mkPkgs "x86_64-linux";
specialArgs = {
inherit inputs;
userdata = rossuserdata;
};
modules = [
./nix/hosts/nixos/configuration.nix
./nix/hosts/rossnixos/hardware-configuration.nix
disko.nixosModules.disko
home-manager.nixosModules.home-manager
(mkHomeManagerModule "${project_root}/nix/hosts/nixos/home.nix" rossuserdata)
agenix.nixosModules.default
agenix-rekey.nixosModules.default
./secrets/secrets.nix
];
};
};
# ------------------------#
# devShell for nixos #
# ------------------------#
devShells = {
x86_64-linux = let
pkgs = mkPkgs "x86_64-linux";
in {
default = pkgs.mkShell {
packages = [pkgs.agenix-rekey];
};
};
};
# Expose the necessary information in your flake so agenix-rekey
# knows where it has to 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 = agenix-rekey.configure {
userFlake = self;
nixosConfigurations = self.nixosConfigurations;
# Example for colmena:
# nixosConfigurations = ((colmena.lib.makeHive self.colmena).introspect (x: x)).nodes;
};
};
}