Configuration for my NixOS based systems and Home Manager
at master 233 lines 7.2 kB view raw
1{ 2 description = "Home Manager configuration for noah"; 3 4 inputs = { 5 # Specify the source of Home Manager and Nixpkgs. 6 nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; 7 nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; 8 nixos-wsl = { 9 url = "github:nix-community/NixOS-WSL/main"; 10 inputs.nixpkgs.follows = "nixpkgs"; 11 }; 12 determinite = { 13 url = "https://flakehub.com/f/DeterminateSystems/determinate/3"; 14 inputs.nixpkgs.follows = "nixpkgs"; 15 }; 16 home-manager = { 17 url = "github:nix-community/home-manager/release-25.11"; 18 inputs.nixpkgs.follows = "nixpkgs"; 19 }; 20 pre-commit-hooks = { 21 url = "github:cachix/git-hooks.nix"; 22 inputs.nixpkgs.follows = "nixpkgs"; 23 }; 24 agenix = { 25 url = "github:ryantm/agenix"; 26 inputs.nixpkgs.follows = "nixpkgs"; 27 }; 28 }; 29 30 outputs = 31 { 32 self, 33 nixpkgs, 34 nixpkgs-unstable, 35 nixos-wsl, 36 determinite, 37 home-manager, 38 pre-commit-hooks, 39 agenix, 40 ... 41 }@inputs: 42 let 43 supportedSystems = [ 44 "x86_64-linux" 45 "aarch64-linux" 46 "x86_64-darwin" 47 "aarch64-darwin" 48 ]; 49 forAllSystems = nixpkgs.lib.genAttrs supportedSystems; 50 basicSystem = 51 { 52 system ? "x86_64-linux", 53 modules ? [ ], 54 useUnstable ? false, 55 extraGroups ? [ ], 56 overlays ? [ ], 57 enableNFTables ? true, 58 }: 59 let 60 unstable = import nixpkgs-unstable { 61 inherit system overlays; 62 config.allowUnfree = true; 63 }; 64 in 65 inputs.nixpkgs.lib.nixosSystem { 66 inherit system; 67 specialArgs = { 68 inherit inputs extraGroups enableNFTables; 69 } 70 // nixpkgs.lib.optionalAttrs useUnstable { 71 inherit unstable; 72 }; 73 modules = [ 74 determinite.nixosModules.default 75 ./common.nix 76 ./users.nix 77 ./services.nix 78 agenix.nixosModules.default 79 home-manager.nixosModules.home-manager 80 { 81 home-manager.useGlobalPkgs = true; 82 home-manager.useUserPackages = true; 83 home-manager.users.noah = ./default-home.nix; 84 home-manager.extraSpecialArgs = { 85 inherit inputs; 86 } 87 // nixpkgs.lib.optionalAttrs useUnstable { 88 inherit unstable; 89 }; 90 } 91 ] 92 ++ modules; 93 }; 94 in 95 { 96 # incomplete 97 nixosConfigurations.odin = basicSystem { 98 extraGroups = [ 99 "libvirtd" 100 "qemu-libvirtd" 101 "docker" 102 ]; 103 useUnstable = true; 104 modules = [ 105 ./host-specific/odin/configuration.nix 106 ]; 107 }; 108 nixosConfigurations.shizuri = basicSystem { 109 useUnstable = true; 110 modules = [ 111 ./host-specific/shizuri/configuration.nix 112 ]; 113 }; 114 nixosConfigurations.misaki = basicSystem { 115 useUnstable = true; 116 extraGroups = [ 117 "render" 118 "nats" 119 "litterbox" 120 "httpd" 121 ]; 122 modules = [ 123 ./host-specific/misaki/configuration.nix 124 ]; 125 overlays = [ 126 (final: prev: { 127 # Override the version of Plex installed to be the latest 128 plexRaw = prev.plexRaw.overrideAttrs rec { 129 version = "1.43.0.10389-8be686aa6"; 130 src = final.fetchurl { 131 url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb"; 132 sha256 = "0HjB8Ggekwl5dKwM1Kh51Ic25t3V6veKbuzM7czrpeg="; 133 }; 134 }; 135 ## Override the json object that contains verions and hashes for Immich 136 #immich = prev.immich.override { sourcesJSON = ./overrides/immich-sources.json; }; 137 ## Fix errors wit numpy version failing to resolve in the immich ML package 138 #immich-machine-learning = prev.immich-machine-learning.overrideAttrs 139 # (finalAttrs: prevAttrs: { 140 # pythonRelaxDeps = prevAttrs.pythonRelaxDeps ++ [ "numpy" ]; 141 # }); 142 }) 143 ]; 144 }; 145 nixosConfigurations.touma-wsl = basicSystem { 146 useUnstable = true; 147 modules = [ 148 ./host-specific/touma-wsl.nix 149 nixos-wsl.nixosModules.default 150 ]; 151 enableNFTables = false; 152 }; 153 nixosConfigurations.edge = basicSystem { 154 useUnstable = true; 155 modules = [ 156 ./host-specific/edge/configuration.nix 157 ]; 158 }; 159 homeConfigurations."noah-aleister" = home-manager.lib.homeManagerConfiguration { 160 pkgs = import nixpkgs { 161 system = "aarch64-darwin"; 162 config.allowUnfree = true; 163 }; 164 # Specify your home configuration modules here, for example, 165 # the path to your home.nix. 166 modules = [ 167 ./host-specific/aleister-noah.nix 168 agenix.homeManagerModules.default 169 ]; 170 171 # Optionally use extraSpecialArgs 172 # to pass through arguments to home.nix 173 extraSpecialArgs = { 174 unstable = import nixpkgs-unstable { 175 system = "aarch64-darwin"; 176 config.allowUnfree = true; 177 }; 178 }; 179 }; 180 homeConfigurations."noah" = 181 let 182 system = "x86_64-linux"; 183 pkgs = import nixpkgs { 184 inherit system; 185 config.allowUnfree = true; 186 }; 187 unstable = import nixpkgs-unstable { 188 inherit system; 189 config.allowUnfree = true; 190 }; 191 in 192 home-manager.lib.homeManagerConfiguration { 193 inherit pkgs; 194 # Specify your home configuration modules here, for example, 195 # the path to your home.nix. 196 modules = [ 197 ./default-home.nix 198 { 199 nix.package = pkgs.nix; 200 } 201 ]; 202 203 # Optionally use extraSpecialArgs 204 # to pass through arguments to home.nix 205 extraSpecialArgs = { 206 inherit unstable; 207 inputs = inputs; 208 }; 209 }; 210 checks = forAllSystems (system: { 211 pre-commit-check = pre-commit-hooks.lib.${system}.run { 212 src = ./.; 213 # If your hooks are intrusive, avoid running on each commit with a default_states like this: 214 # default_stages = ["manual" "push"]; 215 hooks = { 216 nixfmt-rfc-style.enable = true; 217 nil.enable = true; 218 luacheck.enable = true; 219 }; 220 }; 221 }); 222 devShells = forAllSystems (system: { 223 default = nixpkgs.legacyPackages.${system}.mkShell { 224 inherit (self.checks.${system}.pre-commit-check) shellHook; 225 buildInputs = [ 226 nixpkgs.legacyPackages.${system}.nixfmt-rfc-style 227 ] 228 ++ self.checks.${system}.pre-commit-check.enabledPackages; 229 }; 230 }); 231 formatter = forAllSystems (system: inputs.nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); 232 }; 233}