-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
266 lines (230 loc) · 6.99 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
{
description = "Xarvex's Nix configuration";
inputs = {
devenv.url = "github:cachix/devenv";
devenv-root = {
url = "file+file:///dev/null";
flake = false;
};
dotfyls-firefox = {
url = "gitlab:dotfyls/firefox";
inputs = {
flake-parts.follows = "flake-parts";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
dotfyls-neovim = {
url = "gitlab:dotfyls/neovim";
inputs = {
devenv.follows = "devenv";
flake-parts.follows = "flake-parts";
nix2container.follows = "nix2container";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
dotfyls-wezterm = {
url = "gitlab:dotfyls/wezterm";
inputs = {
devenv.follows = "devenv";
flake-parts.follows = "flake-parts";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
dotfyls-zsh = {
url = "gitlab:dotfyls/zsh";
inputs = {
flake-parts.follows = "flake-parts";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
nix2container = {
url = "github:nlewo/nix2container";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs_cliphist.url = "github:NixOS/nixpkgs/5633bcff0c6162b9e4b5f1264264611e950c8ec7";
persistwd = {
url = "gitlab:xarvex/persistwd";
inputs = {
devenv.follows = "devenv";
flake-parts.follows = "flake-parts";
nix2container.follows = "nix2container";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
systems.url = "github:nix-systems/default";
wherenver = {
url = "gitlab:xarvex/wherenver";
inputs = {
devenv.follows = "devenv";
flake-parts.follows = "flake-parts";
nix2container.follows = "nix2container";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
};
outputs =
{
flake-parts,
home-manager,
nixpkgs,
self,
...
}@inputs:
let
inherit (nixpkgs) lib;
hosts =
let
user = "xarvex"; # Change this if you aren't me!
nixosModules = with inputs; [
impermanence.nixosModules.impermanence
nix-index-database.nixosModules.nix-index
persistwd.nixosModules.persistwd
];
homeManagerModules = with inputs; [
dotfyls-firefox.homeManagerModules.firefox
dotfyls-neovim.homeManagerModules.neovim
dotfyls-wezterm.homeManagerModules.wezterm
dotfyls-zsh.homeManagerModules.zsh
nix-index-database.hmModules.nix-index
wherenver.homeManagerModules.wherenver
];
overlays = [ self.overlays.default ];
unfreePkgs = [
"discord"
"nvidia-settings"
"nvidia-x11"
"obsidian"
"spotify"
"steam"
"steam-original"
"steam-run"
];
defaultHost = id: system: {
inherit
home-manager
homeManagerModules
id
nixosModules
nixpkgs
overlays
system
unfreePkgs
user
;
};
in
{
botworks = defaultHost "ef01cd45" "x86_64-linux";
botworks-mobilized = defaultHost "fd9daca2" "x86_64-linux";
botworks-pioneer = defaultHost "3540bf30" "x86_64-linux";
botworks-virtualized = defaultHost "3bb44cc9" "x86_64-linux";
};
nixosHosts = {
inherit (hosts)
botworks
botworks-mobilized
botworks-pioneer
botworks-virtualized
;
};
homeManagerHosts = {
inherit (hosts)
botworks
botworks-mobilized
botworks-pioneer
botworks-virtualized
;
};
in
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.devenv.flakeModule ];
systems = import inputs.systems;
perSystem =
{ pkgs, ... }:
{
packages = import ./packages { inherit pkgs; };
devenv.shells = rec {
default = dotfyls;
dotfyls = {
devenv.root =
let
devenvRoot = builtins.readFile inputs.devenv-root.outPath;
in
# If not overridden (/dev/null), --impure is necessary.
lib.mkIf (devenvRoot != "") devenvRoot;
name = "dotfyls";
packages = with pkgs; [
codespell
];
languages = {
nix.enable = true;
shell.enable = true;
};
pre-commit.hooks = {
deadnix.enable = true;
flake-checker.enable = true;
nixfmt-rfc-style.enable = true;
statix.enable = true;
};
};
};
formatter = pkgs.nixfmt-rfc-style;
};
flake = {
nixosConfigurations =
builtins.mapAttrs self.lib.mkNixosConfiguration nixosHosts
# Keep installer separate for now.
// {
installer = lib.nixosSystem { modules = [ ./hosts/installer ]; };
};
homeConfigurations = builtins.mapAttrs self.lib.mkHomeManagerConfiguration homeManagerHosts;
# Aggregate for export convenience.
homeManagerModules = with inputs; {
inherit (dotfyls-firefox.homeManagerModules) firefox;
inherit (dotfyls-neovim.homeManagerModules) neovim;
inherit (dotfyls-wezterm.homeManagerModules) wezterm;
inherit (dotfyls-zsh.homeManagerModules) zsh;
};
overlays =
let
overlays = [
"bat-extras"
"dotfyls"
"evil-winrm"
"fastfetch"
"wezterm"
];
in
lib.genAttrs overlays (
overlay: final: prev: { ${overlay} = import ./overlays/${overlay} final prev; }
)
# WARNING: later elements replace duplicates, however will not occur thanks to above's unique keys
// {
default =
final: prev: lib.mergeAttrsList (lib.map (overlay: self.overlays.${overlay} final prev) overlays);
};
templates = import ./templates;
lib = import ./lib { inherit inputs lib self; };
};
};
}