All my system configs and packages in one repo
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(systems): massively simplify & add inputs', self and self'

+47 -100
+47 -20
systems/default.nix
··· 1 - { self, inputs, ... }: 1 + { withSystem, inputs, self, ... }: 2 + let 3 + mkMachine = 4 + name: { system, modules, builder }: 5 + withSystem system ({ inputs', self', ... }: 6 + builder { 7 + specialArgs = { inherit inputs inputs' self self'; }; 8 + modules = modules ++ [ 9 + ./${name} 10 + { 11 + networking.hostName = name; 12 + nixpkgs.hostPlatform = system; 13 + } 14 + ]; 15 + } 16 + ); 17 + 18 + mkMachines = builtins.mapAttrs mkMachine; 19 + 20 + # Composable parts 21 + personal = [ 22 + inputs.home-manager.nixosModules.home-manager 23 + ../users/personal.nix 24 + ]; 25 + nixos = [ ../roles/nixos.nix ]; 26 + darwin = [ ../roles/darwin.nix ]; 27 + 28 + # Presets 29 + nixos-pc = { 30 + system = "x86_64-linux"; 31 + modules = nixos ++ personal; 32 + builder = inputs.nixpkgs.lib.nixosSystem; 33 + }; 34 + darwin-pc = { 35 + system = "x86_64-darwin"; 36 + modules = darwin ++ personal; 37 + builder = inputs.nix-darwin.lib.darwinSystem; 38 + }; 39 + in 2 40 { 3 - flake = 4 - let 5 - inherit (inputs.nixpkgs) lib; 6 - inherit (import ./profiles/lib.nix) mkSystems; 7 - 8 - profiles = import ./profiles inputs; 9 - machines = import ./machines profiles; 10 - in 11 - builtins.mapAttrs (_: mkSystems) machines 12 - // { 13 - hydraJobs = 14 - let 15 - ciSystems = [ "x86_64-linux" ]; 16 - mapCfgsToDerivs = lib.mapAttrs (_: cfg: cfg.activationPackage or cfg.config.system.build.toplevel); 17 - getCompatibleCfgs = lib.filterAttrs (_: cfg: lib.elem cfg.pkgs.system ciSystems); 18 - in 19 - { 20 - nixosConfigurations = mapCfgsToDerivs (getCompatibleCfgs self.nixosConfigurations); 21 - }; 41 + flake = { 42 + nixosConfigurations = mkMachines { 43 + fettuccine = nixos-pc; 44 + tagliatelle = nixos-pc; 45 + }; 46 + darwinConfigurations = mkMachines { 47 + fromage = darwin-pc; 22 48 }; 49 + }; 23 50 }
-10
systems/machines/default.nix
··· 1 - { personal, personal-mac, ... }: 2 - { 3 - nixosConfigurations = { 4 - tagliatelle.profile = personal; 5 - fettuccine.profile = personal; 6 - }; 7 - darwinConfigurations = { 8 - fromage.profile = personal-mac; 9 - }; 10 - }
systems/machines/fettuccine/default.nix systems/fettuccine/default.nix
systems/machines/fettuccine/hardware-configuration.nix systems/fettuccine/hardware-configuration.nix
systems/machines/fromage/default.nix systems/fromage/default.nix
systems/machines/tagliatelle/default.nix systems/tagliatelle/default.nix
systems/machines/tagliatelle/hardware-configuration.nix systems/tagliatelle/hardware-configuration.nix
-4
systems/profiles/default.nix
··· 1 - inputs: { 2 - personal = import ./personal inputs; 3 - personal-mac = import ./personal-mac inputs; 4 - }
-32
systems/profiles/lib.nix
··· 1 - let 2 - mkSystem = 3 - name: 4 - { 5 - profile, 6 - system ? null, 7 - modules ? [ ], 8 - specialArgs ? { }, 9 - }: 10 - let 11 - profile' = profile name; 12 - system' = if (system != null) then system else profile'.system; 13 - in 14 - profile'.builder { 15 - system = system'; 16 - specialArgs = profile'.specialArgs // specialArgs; 17 - modules = 18 - profile'.modules 19 - ++ modules 20 - ++ [ 21 - ../machines/${name} 22 - { 23 - networking.hostName = name; 24 - nixpkgs.hostPlatform = system'; 25 - } 26 - ]; 27 - }; 28 - in 29 - { 30 - inherit mkSystem; 31 - mkSystems = builtins.mapAttrs mkSystem; 32 - }
-17
systems/profiles/personal-mac/default.nix
··· 1 - inputs@{ nix-darwin, home-manager, ... }: 2 - name: { 3 - system = "x86_64-darwin"; 4 - builder = nix-darwin.lib.darwinSystem; 5 - 6 - modules = [ 7 - home-manager.darwinModules.home-manager 8 - 9 - ../../../roles/darwin.nix 10 - ../../../users/personal.nix 11 - 12 - { system.stateVersion = 4; } 13 - ]; 14 - specialArgs = { 15 - inherit inputs; 16 - }; 17 - }
-17
systems/profiles/personal/default.nix
··· 1 - inputs@{ nixpkgs, home-manager, ... }: 2 - name: { 3 - system = "x86_64-linux"; 4 - builder = nixpkgs.lib.nixosSystem; 5 - 6 - modules = [ 7 - home-manager.nixosModules.home-manager 8 - 9 - ../../../roles/nixos.nix 10 - ../../../users/personal.nix 11 - 12 - { system.stateVersion = "24.05"; } 13 - ]; 14 - specialArgs = { 15 - inherit inputs; 16 - }; 17 - }