My Nix Configuration
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 waybar = { 165 url = "github:Alexays/Waybar"; 166 inputs.nixpkgs.follows = "nixpkgs"; 167 inputs.flake-compat.follows = "flake-compat"; 168 }; 169 }; 170 171 outputs = 172 inputs@{ self, ... }: 173 let 174 lib = inputs.snowfall-lib.mkLib { 175 inherit inputs; 176 src = ./.; 177 snowfall = { 178 meta = { 179 name = "pyronet"; 180 title = "PyroNet Config"; 181 }; 182 namespace = "py"; 183 }; 184 }; 185 overlays = [ 186 self.overlays.pyronet-packages 187 self.overlays.nix-index 188 self.overlays.bluez-wiimote 189 self.overlays.sway-unwrapped 190 inputs.my-pkgs.overlays.cinny 191 inputs.golink.overlay 192 inputs.neovim.overlay 193 inputs.nixd.overlays.default 194 inputs.nur.overlays.default 195 inputs.topology.overlays.default 196 ]; 197 in 198 lib.mkFlake { 199 # Nixpkgs configuration 200 channels-config = { 201 allowUnfree = true; 202 }; 203 204 # Overlays for Nixpkgs. 205 inherit overlays; 206 207 # Home-manager configurations 208 homes = { 209 # Default modules for all homes 210 modules = with inputs; [ 211 nix-index-database.hmModules.nix-index 212 ctp.homeManagerModules.catppuccin 213 ]; 214 }; 215 216 # NixOS Configurations 217 systems = { 218 # Modules for all systems 219 modules.nixos = with inputs; [ 220 agenix.nixosModules.default 221 buildbot-nix.nixosModules.buildbot-worker 222 ctp.nixosModules.catppuccin 223 topology.nixosModules.default 224 ]; 225 hosts = { 226 # Zaphod, my personal Framework 16 laptop 227 zaphod.modules = with inputs; [ hardware.nixosModules.framework-16-7040-amd ]; 228 229 # Prefect, my main VPS 230 prefect.modules = with inputs; [ mailserver.nixosModule ]; 231 232 # Marvin, my main homelab machine 233 marvin.modules = with inputs; [ 234 authentik.nixosModules.default 235 buildbot-nix.nixosModules.buildbot-master 236 golink.nixosModules.default 237 iceshrimp.nixosModules.default 238 ]; 239 }; 240 }; 241 templates = { 242 uv.description = "Python template flake that uses uv"; 243 }; 244 245 outputs-builder = channels: { 246 # Define default packages to use everywhere 247 packages = { 248 nvim = channels.nixpkgs.neovim-unwrapped; 249 customGit = channels.nixpkgs.git.override { 250 withLibsecret = true; 251 withSsh = true; 252 perlSupport = false; 253 osxkeychainSupport = false; 254 guiSupport = false; 255 svnSupport = false; 256 }; 257 }; 258 formatter = channels.nixpkgs.nixfmt-rfc-style; 259 260 # Export packages and systems as checks for buildbot-nix 261 checks = 262 let 263 inherit (channels.nixpkgs) system; 264 packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self.packages.${system}; 265 devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self.devShells.${system}; 266 machines = lib.mapAttrs' ( 267 name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel 268 ) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations); 269 in 270 packages // devShells // machines; 271 }; 272 deploy = lib.mkDeploy { inherit (inputs) self; }; 273 topology = import inputs.topology { 274 pkgs = import inputs.nixpkgs { 275 inherit overlays; 276 system = "x86_64-linux"; 277 }; 278 modules = [ 279 ./topology.nix 280 { nixosConfigurations = self.nixosConfigurations; } 281 ]; 282 }; 283 284 }; 285}