diff --git a/configuration.nix b/configuration.nix index b9cdd8e..56373aa 100755 --- a/configuration.nix +++ b/configuration.nix @@ -2,6 +2,7 @@ config, lib, pkgs, + meta, ... }: @@ -56,8 +57,8 @@ }; }; - networking.hostName = "roy-laptop"; - networking.hostId = "4cb9fc76"; + networking.hostName = meta.hostname; + networking.hostId = meta.hostId; networking = { useDHCP = true; @@ -116,7 +117,7 @@ users.mutableUsers = false; users.users.roy = { isNormalUser = true; - hashedPassword = "$y$j9T$4yOAv6R7Xtn23XmhSSC8g.$T1CckfWgxjEyZshjBzcaMO9WidP.q..OG7LwtXFTw12"; + hashedPassword = meta.hashedPass; extraGroups = [ "wheel" "networkmanager" diff --git a/flake.nix b/flake.nix index 2f1591b..062ab44 100755 --- a/flake.nix +++ b/flake.nix @@ -37,32 +37,58 @@ sops-nix, firefox-addons, }@inputs: + # Place all config differences between laptop/desktop here + # If they grow sufficiently different, maybe split them out completely + let + platforms = [ + { + name = "roy-laptop"; + hostId = "4cb9fc76"; + hashedPass = "$y$j9T$4yOAv6R7Xtn23XmhSSC8g.$T1CckfWgxjEyZshjBzcaMO9WidP.q..OG7LwtXFTw12"; + } + { + name = "roy-desktop"; + hostId = "67cf9bc4"; + hashedPass = "$y$j9T$4yOAv6R7Xtn23XmhSSC8g.$T1CckfWgxjEyZshjBzcaMO9WidP.q..OG7LwtXFTw12"; + } + ]; + in { - nixosConfigurations.default = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./configuration.nix - ./hardware-configuration.nix - ./disk-config.nix - disko.nixosModules.disko - impermanence.nixosModules.impermanence - sops-nix.nixosModules.sops - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { inherit inputs; }; - home-manager.users.roy = - { ... }: + nixosConfigurations = builtins.listToAttrs ( + map (platform: { + name = platform.name; + value = nixpkgs.lib.nixosSystem { + specialArgs.meta = { + hostname = platform.name; + hostId = platform.hostId; + hashedPass = platform.hashedPass; + }; + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ./hardware-configuration.nix + ./disk-config.nix + disko.nixosModules.disko + impermanence.nixosModules.impermanence + sops-nix.nixosModules.sops + home-manager.nixosModules.home-manager { - imports = [ - ./home.nix - nixvim.homeModules.nixvim - sops-nix.homeManagerModules.sops - ]; - }; - } - ]; - }; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.users.roy = + { ... }: + { + imports = [ + ./home.nix + nixvim.homeModules.nixvim + sops-nix.homeManagerModules.sops + ]; + }; + } + ]; + }; + }) platforms + ); }; }