-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
282 lines (263 loc) · 7.56 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
{
description = "Reyu Zenfold's NixOS Flake";
inputs = {
# Core
nixpkgs.url = "github:nixos/nixpkgs";
unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
systems.url = "github:nix-systems/default";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nur.url = "github:nix-community/NUR";
mobile-nixos = {
url = "github:NixOS/mobile-nixos";
flake = false;
};
impermanence.url = "github:nix-community/impermanence";
nixos-hardware.url = "github:NixOS/nixos-hardware";
# Automatic deployment
ragenix = {
url = "github:/yaxitech/ragenix";
inputs.nixpkgs.follows = "nixpkgs";
};
# ZSH Plugins
zsh-vimode-visual = {
url = "github:b4b4r07/zsh-vimode-visual";
flake = false;
};
# Vim + Plugins
neovim-nightly = {
url = "github:nix-community/neovim-nightly-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
bufresize-nvim = {
url = "github:kwkarlwang/bufresize.nvim";
flake = false;
};
edgy-nvim = {
url = "github:folke/edgy.nvim";
flake = false;
};
github-nvim-theme = {
url = "github:projekt0n/github-nvim-theme";
flake = false;
};
nvim-projector = {
url = "github:kndndrj/nvim-projector";
flake = false;
};
# Discord + Plugins
replugged = {
url = "github:LunNova/replugged-nix-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
discord-better-status = {
url = "github:GriefMoDz/better-status-indicators";
flake = false;
};
discord-read-all = {
url = "github:intrnl/powercord-read-all";
flake = false;
};
discord-theme-slate = {
url = "github:DiscordStyles/Slate";
flake = false;
};
discord-theme-toggler = {
url = "github:redstonekasi/theme-toggler";
flake = false;
};
discord-tweaks = {
url = "github:NurMarvin/discord-tweaks";
flake = false;
};
discord-vc-timer = {
url = "github:RazerMoon/vcTimer";
flake = false;
};
# Other Sources
kmonad = {
url = "github:kmonad/kmonad?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
systems,
...
}@inputs:
let
eachSystem =
f:
nixpkgs.lib.genAttrs (import systems) (
system:
f (
import nixpkgs {
inherit system;
overlays = [
inputs.devshell.overlays.default
inputs.ragenix.overlays.default
];
}
)
);
in
{
nixosConfigurations = import ./hosts { inherit self inputs; };
nixosModules =
{
inherit (inputs.ragenix.nixosModules) age;
inherit (inputs.home-manager.nixosModules) home-manager;
kmonad = inputs.kmonad.nixosModules.default;
}
// builtins.listToAttrs (
map (x: {
name = x;
value = import (./modules + "/${x}");
}) (builtins.attrNames (builtins.readDir ./modules))
);
homeConfigurations = import ./home-manager { inherit self inputs; };
homeModules = builtins.listToAttrs (
map (x: {
name = x;
value = import ./home-manager/modules/${x};
}) (builtins.attrNames (builtins.readDir ./home-manager/modules))
);
overlays.default = import ./overlays { inherit inputs; };
devShells = eachSystem (
pkgs:
let
formatter = pkg: {
package = pkg;
category = "formatters";
};
buildTool = pkg: {
package = pkg;
category = "build tools";
};
in
{
default = pkgs.devshell.mkShell (
with pkgs;
{
name = "FoxNet-Nix";
packages = [ cachix ];
commands = [
{
package = ragenix;
category = "secrets management";
}
{
package = "linode-cli";
category = "deployment";
}
{
package = "hcloud";
category = "deployment";
}
(buildTool nixos-generators)
(formatter treefmt)
(formatter nixfmt-rfc-style)
(formatter luaformatter)
(formatter hclfmt)
(formatter shfmt)
];
}
);
}
);
apps = eachSystem (pkgs: {
linode-image-upload = {
type = "app";
program = toString (
pkgs.writeShellScript "linode-image-upload" ''
LINODE_LABEL="NixOS_$(date -I)"
LINODE_DESCR="Commit: $(${pkgs.git}/bin/git describe --always --abbrev=40 --dirty)"
LINODE_IMAGE=${self.packages.${pkgs.system}.linode}/nixos.img.gz
${pkgs.linode-cli}/bin/linode-cli image-upload --label "$LINODE_LABEL" --description "$LINODE_DESCR" $LINODE_IMAGE
''
);
};
});
packages = {
x86_64-linux.linode =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in
inputs.nixos-generators.nixosGenerate {
inherit (pkgs) system;
format = "linode";
modules = with self.nixosModules; [
{
_module.args = {
inherit self;
};
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
}
{
home-manager.extraSpecialArgs = {
inherit inputs self;
};
home-manager.useGlobalPkgs = true;
}
home-manager
environment
locale
nix-common
security
users.root
];
};
};
formatter = eachSystem (
pkgs:
inputs.treefmt-nix.lib.mkWrapper pkgs {
projectRootFile = "flake.nix";
programs = {
deadnix.enable = true;
nixpkgs-fmt.enable = true;
};
}
);
checks = eachSystem (
_:
with builtins;
# Checks to run with `nix flake check -L`, will run in a QEMU VM.
# Looks for all ./modules/<module name>/test.nix files and adds them to
# the flake's checks output. The test.nix file is optional and may be
# added to any module.
listToAttrs (
map
(x: {
name = x;
value = (import ./modules/${x}/test.nix) {
pkgs = nixpkgs;
inherit self;
};
})
# Filter list of modules, leaving only modules which contain a
# `test.nix` file
(filter (p: pathExists (./modules/${p}/test.nix)) (attrNames (readDir ./modules)))
)
);
};
nixConfig = {
extra-substituters = [ "https://foxnet.cachix.org" ];
extra-trusted-public-keys = [ "foxnet.cachix.org-1:Ks4Si8oE6KfTXTwLlaLiE8M/I3XyfVO4IP4Q17DudAs=" ];
};
}