1{
2 nixConfig = {
3 experimental-features = "nix-command flakes";
4 substitute = "true";
5 extra-substituters = [
6 "https://cache.nixos.org"
7 "https://crane.cachix.org"
8 "https://isabelroses.cachix.org"
9 "https://nix-community.cachix.org"
10 "https://nixpkgs-wayland.cachix.org"
11 "https://viperml.cachix.org"
12 ];
13 trusted-public-keys = [
14 "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
15 "crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk="
16 "isabelroses.cachix.org-1:mXdV/CMcPDaiTmkQ7/4+MzChpOe6Cb97njKmBQQmLPM="
17 "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
18 "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
19 "viperml.cachix.org-1:qZhKBMTfmcLL+OG6fj/hzsMEedgKvZVFRRAhq7j8Vh8="
20 ];
21 cores = 0;
22 max-jobs = 2;
23 netrc-file = "/home/thehedgehog/.netrc";
24 };
25 description = "PyroNet machines and services";
26
27 inputs = {
28 snowfall-lib = {
29 url = "github:snowfallorg/lib";
30 inputs.nixpkgs.follows = "nixpkgs";
31 };
32 nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
33 stable.url = "github:nixos/nixpkgs/nixos-24.05";
34 # Overrides
35 flake-compat.url = "github:edolstra/flake-compat";
36 systems.url = "github:nix-systems/default";
37 flake-parts = {
38 url = "github:hercules-ci/flake-parts";
39 inputs.nixpkgs-lib.follows = "nixpkgs-lib";
40 };
41 flake-utils = {
42 url = "github:numtide/flake-utils";
43 inputs.systems.follows = "systems";
44 };
45 nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
46
47 # Inputs
48 agenix = {
49 url = "github:ryantm/agenix";
50 inputs = {
51 nixpkgs.follows = "nixpkgs";
52 systems.follows = "systems";
53 home-manager.follows = "home-manager";
54 };
55 };
56 authentik = {
57 url = "github:nix-community/authentik-nix";
58 inputs = {
59 flake-utils.follows = "flake-utils";
60 flake-parts.follows = "flake-parts";
61 flake-compat.follows = "flake-compat";
62 nixpkgs.follows = "nixpkgs";
63 };
64 };
65 buildbot-nix = {
66 url = "github:Mic92/buildbot-nix";
67 inputs.nixpkgs.follows = "nixpkgs";
68 inputs.flake-parts.follows = "flake-parts";
69 };
70 ctp = {
71 url = "github:catppuccin/nix";
72 };
73 deploy-rs = {
74 url = "github:serokell/deploy-rs";
75 inputs = {
76 nixpkgs.follows = "nixpkgs";
77 utils.follows = "flake-utils";
78 flake-compat.follows = "flake-compat";
79 };
80 };
81 dns = {
82 url = "github:nix-community/dns.nix";
83 inputs.flake-utils.follows = "flake-utils";
84 inputs.nixpkgs.follows = "nixpkgs";
85 };
86 golink = {
87 url = "github:tailscale/golink";
88 inputs.flake-utils.follows = "flake-utils";
89 inputs.nixpkgs.follows = "nixpkgs";
90 };
91 hardware = {
92 url = "github:nixos/nixos-hardware";
93 };
94 home-manager = {
95 url = "github:nix-community/home-manager";
96 inputs.nixpkgs.follows = "nixpkgs";
97 };
98 iceshrimp = {
99 url = "git+https://iceshrimp.dev/pyrox/packaging";
100 inputs.nixpkgs.follows = "nixpkgs";
101 };
102 mailserver = {
103 url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master";
104 inputs = {
105 flake-compat.follows = "flake-compat";
106 nixpkgs.follows = "nixpkgs";
107 };
108 };
109 mkshell-minimal = {
110 url = "github:viperML/mkshell-minimal";
111 };
112 neovim = {
113 url = "github:neovim/neovim/v0.9.5?dir=contrib";
114 inputs.nixpkgs.follows = "nixpkgs";
115 inputs.flake-utils.follows = "flake-utils";
116 };
117 nix-search = {
118 url = "github:diamondburned/nix-search";
119 inputs.nixpkgs.follows = "nixpkgs";
120 inputs.flake-utils.follows = "flake-utils";
121 inputs.flake-compat.follows = "flake-compat";
122 };
123 nixos-generators = {
124 url = "github:nix-community/nixos-generators";
125 inputs.nixpkgs.follows = "nixpkgs";
126 inputs.nixlib.follows = "nixpkgs-lib";
127 };
128 nvim = {
129 url = "github:nix-community/neovim-nightly-overlay";
130 inputs = {
131 nixpkgs.follows = "nixpkgs";
132 flake-parts.follows = "flake-parts";
133 flake-compat.follows = "flake-compat";
134 };
135 };
136 nh = {
137 url = "github:viperML/nh";
138 inputs.nixpkgs.follows = "nixpkgs";
139 };
140 nixd = {
141 url = "github:nix-community/nixd";
142 inputs.nixpkgs.follows = "nixpkgs";
143 inputs.flake-parts.follows = "flake-parts";
144 };
145 nix-index = {
146 url = "github:nix-community/nix-index";
147 inputs.flake-compat.follows = "flake-compat";
148 inputs.nixpkgs.follows = "nixpkgs";
149 };
150 nix-index-database = {
151 url = "github:Mic92/nix-index-database";
152 inputs.nixpkgs.follows = "nixpkgs";
153 };
154 nur.url = "github:nix-community/nur";
155 my-pkgs = {
156 url = "git+https://git.pyrox.dev/pyrox/pkgs";
157 inputs.nixpkgs.follows = "nixpkgs";
158 };
159 topology = {
160 url = "github:oddlama/nix-topology";
161 inputs.nixpkgs.follows = "nixpkgs";
162 inputs.flake-utils.follows = "flake-utils";
163 };
164 };
165
166 outputs =
167 inputs@{ self, ... }:
168 let
169 lib = inputs.snowfall-lib.mkLib {
170 inherit inputs;
171 src = ./.;
172 snowfall = {
173 meta = {
174 name = "pyronet";
175 title = "PyroNet Config";
176 };
177 namespace = "py";
178 };
179 };
180 overlays = [
181 self.overlays.pyronet-packages
182 self.overlays.nix-index
183 self.overlays.bluez-wiimote
184 self.overlays.sway-unwrapped
185 inputs.my-pkgs.overlays.cinny
186 inputs.golink.overlay
187 inputs.neovim.overlay
188 inputs.nixd.overlays.default
189 inputs.nur.overlays.default
190 inputs.topology.overlays.default
191 ];
192 in
193 lib.mkFlake {
194 # Nixpkgs configuration
195 channels-config = {
196 allowUnfree = true;
197 };
198
199 # Overlays for Nixpkgs.
200 inherit overlays;
201
202 # Home-manager configurations
203 homes = {
204 # Default modules for all homes
205 modules = with inputs; [
206 nix-index-database.hmModules.nix-index
207 ctp.homeManagerModules.catppuccin
208 ];
209 };
210
211 # NixOS Configurations
212 systems = {
213 # Modules for all systems
214 modules.nixos = with inputs; [
215 agenix.nixosModules.default
216 buildbot-nix.nixosModules.buildbot-worker
217 ctp.nixosModules.catppuccin
218 topology.nixosModules.default
219 ];
220 hosts = {
221 # Zaphod, my personal Framework 16 laptop
222 zaphod.modules = with inputs; [ hardware.nixosModules.framework-16-7040-amd ];
223
224 # Prefect, my main VPS
225 prefect.modules = with inputs; [ mailserver.nixosModule ];
226
227 # Marvin, my main homelab machine
228 marvin.modules = with inputs; [
229 authentik.nixosModules.default
230 buildbot-nix.nixosModules.buildbot-master
231 golink.nixosModules.default
232 iceshrimp.nixosModules.default
233 ];
234 };
235 };
236 templates = {
237 uv.description = "Python template flake that uses uv";
238 };
239
240 outputs-builder = channels: {
241 # Define default packages to use everywhere
242 packages = {
243 nvim = channels.nixpkgs.neovim-unwrapped;
244 customGit = channels.nixpkgs.git.override {
245 withLibsecret = true;
246 withSsh = true;
247 perlSupport = false;
248 osxkeychainSupport = false;
249 guiSupport = false;
250 svnSupport = false;
251 };
252 };
253 formatter = channels.nixpkgs.nixfmt-rfc-style;
254
255 # Export packages and systems as checks for buildbot-nix
256 checks =
257 let
258 inherit (channels.nixpkgs) system;
259 packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self.packages.${system};
260 devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self.devShells.${system};
261 machines = lib.mapAttrs' (
262 name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
263 ) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
264 in
265 packages // devShells // machines;
266 };
267 deploy = lib.mkDeploy { inherit (inputs) self; };
268 topology = import inputs.topology {
269 pkgs = import inputs.nixpkgs {
270 inherit overlays;
271 system = "x86_64-linux";
272 };
273 modules = [
274 ./topology.nix
275 { nixosConfigurations = self.nixosConfigurations; }
276 ];
277 };
278
279 };
280}