flake.nix (7620B)
1 { 2 description = "NixOS"; 3 inputs = { 4 nixpkgs_stable.url = "nixpkgs/nixos-25.11"; 5 nixpkgs.url = "nixpkgs/nixos-unstable"; 6 7 nix-darwin.url = "github:nix-darwin/nix-darwin/master"; 8 nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; 9 10 nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; 11 nixos-hardware.url = "github:NixOS/nixos-hardware"; 12 13 niri.url = "github:sodiboo/niri-flake"; 14 noctalia.url = "github:noctalia-dev/noctalia-shell"; 15 16 betterfox.url = "github:HeitorAugustoLN/betterfox-nix"; 17 18 sops-nix = { 19 url = "github:Mic92/sops-nix"; 20 inputs.nixpkgs.follows = "nixpkgs"; 21 }; 22 23 home-manager = { 24 url = "github:nix-community/home-manager"; 25 inputs.nixpkgs.follows = "nixpkgs"; 26 }; 27 28 disko = { 29 url = "github:nix-community/disko"; 30 inputs.nixpkgs.follows = "nixpkgs"; 31 }; 32 }; 33 34 outputs = 35 { 36 self, 37 nixpkgs_stable, 38 nixpkgs, 39 nix-darwin, 40 disko, 41 home-manager, 42 nixos-hardware, 43 sops-nix, 44 betterfox, 45 ... 46 }@inputs: 47 let 48 linuxSystem = "x86_64-linux"; 49 darwinSystem = "aarch64-darwin"; 50 51 pkgsLinux = nixpkgs.legacyPackages.${linuxSystem}; 52 pkgsDarwin = nixpkgs.legacyPackages.${darwinSystem}; 53 54 # Set at build time with: IS_WAYLAND=1 nixos-rebuild switch --flake .#host 55 isWayland = builtins.getEnv "IS_WAYLAND" == "1"; 56 in 57 { 58 nixosConfigurations = 59 let 60 isDarwin = false; 61 in 62 { 63 frame = 64 let 65 hostName = "frame"; 66 system = linuxSystem; 67 in 68 nixpkgs.lib.nixosSystem { 69 inherit system; 70 specialArgs = { 71 inherit 72 inputs 73 hostName 74 system 75 isDarwin 76 isWayland 77 ; 78 }; 79 modules = [ 80 nixos-hardware.nixosModules.framework-13-7040-amd 81 home-manager.nixosModules.home-manager 82 sops-nix.nixosModules.sops 83 ./hosts/frame/configuration.nix 84 ./hosts/frame/hardware.nix 85 { 86 home-manager = { 87 useGlobalPkgs = true; 88 useUserPackages = true; 89 extraSpecialArgs = { 90 inherit 91 system 92 inputs 93 isDarwin 94 isWayland 95 ; 96 standalone = false; 97 }; 98 users.mika = import ./users/mika.nix; 99 }; 100 } 101 ]; 102 }; 103 nixos-frame = 104 let 105 hostName = "nixos-frame"; 106 system = linuxSystem; 107 in 108 nixpkgs.lib.nixosSystem { 109 inherit system; 110 specialArgs = { 111 inherit 112 inputs 113 hostName 114 system 115 isDarwin 116 ; 117 }; 118 modules = [ 119 nixos-hardware.nixosModules.framework-13-7040-amd 120 home-manager.nixosModules.home-manager 121 sops-nix.nixosModules.sops 122 ./hosts/frame/configuration.nix 123 ./hosts/vm/hardware.nix 124 { 125 home-manager = { 126 useGlobalPkgs = true; 127 useUserPackages = true; 128 extraSpecialArgs = { 129 inherit 130 system 131 inputs 132 isDarwin 133 isWayland 134 ; 135 standalone = false; 136 }; 137 users.mika = import ./users/mika.nix; 138 }; 139 } 140 ]; 141 }; 142 143 nixos-vm = 144 let 145 hostName = "nixos-vm"; 146 system = linuxSystem; 147 in 148 nixpkgs.lib.nixosSystem { 149 inherit system; 150 specialArgs = { 151 inherit 152 inputs 153 hostName 154 system 155 isDarwin 156 ; 157 }; 158 modules = [ 159 home-manager.nixosModules.home-manager 160 ./hosts/frame/configuration.nix 161 ./hosts/vm/hardware.nix 162 { 163 home-manager = { 164 useGlobalPkgs = true; 165 useUserPackages = true; 166 extraSpecialArgs = { 167 inherit system inputs isDarwin; 168 standalone = false; 169 }; 170 users.mika = import ./users/mika.nix; 171 }; 172 } 173 ]; 174 }; 175 176 nixos-server = 177 let 178 hostName = "nixos-server"; 179 system = linuxSystem; 180 in 181 nixpkgs_stable.lib.nixosSystem { 182 inherit system; 183 specialArgs = { 184 inherit inputs hostName system; 185 }; 186 modules = [ 187 home-manager.nixosModules.home-manager 188 ./hosts/server/configuration.nix 189 ./hosts/server/hardware.nix 190 { 191 home-manager = { 192 useGlobalPkgs = true; 193 useUserPackages = true; 194 extraSpecialArgs = { 195 inherit system inputs; 196 standalone = false; 197 }; 198 users.r2d2 = import ./users/r2d2.nix; 199 }; 200 } 201 ]; 202 }; 203 }; 204 205 darwinConfigurations = { 206 mac = 207 let 208 hostName = "mac"; 209 systemName = darwinSystem; 210 system = darwinSystem; 211 isDarwin = true; 212 in 213 nix-darwin.lib.darwinSystem { 214 specialArgs = { 215 inherit 216 hostName 217 systemName 218 inputs 219 isDarwin 220 ; 221 }; 222 modules = [ 223 home-manager.darwinModules.home-manager 224 sops-nix.darwinModules.sops 225 ./hosts/mac/configuration.nix 226 { 227 home-manager = { 228 useGlobalPkgs = true; 229 useUserPackages = true; 230 extraSpecialArgs = { 231 inherit 232 system 233 inputs 234 isDarwin 235 isWayland 236 ; 237 standalone = false; 238 }; 239 users.mika = import ./users/mika.nix; 240 }; 241 } 242 ]; 243 }; 244 }; 245 246 homeConfigurations = { 247 mika = 248 let 249 system = builtins.currentSystem; 250 pkgs = if system == darwinSystem then pkgsDarwin else pkgsLinux; 251 isDarwin = system == darwinSystem; 252 in 253 home-manager.lib.homeManagerConfiguration { 254 inherit pkgs; 255 modules = [ ./users/mika.nix ]; 256 extraSpecialArgs = { 257 inherit 258 system 259 inputs 260 isDarwin 261 isWayland 262 ; 263 standalone = true; 264 }; 265 }; 266 }; 267 }; 268 }