diff --git a/flake.nix b/flake.nix index f1f2235..84d0b72 100644 --- a/flake.nix +++ b/flake.nix @@ -23,13 +23,26 @@ }; }; - outputs = { self, nixpkgs, home-manager, ... }@inputs: { - nixosConfigurations.desktop = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; - modules = [ - inputs.home-manager.nixosModules.default - ./hosts/desktop/configuration.nix - ]; + outputs = { self, nixpkgs, home-manager, ... }@inputs: + let + create-host = (configs: builtins.listToAttrs (map + (c: { + name = c; + value = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + inputs.home-manager.nixosModules.default + (./. + ("/hosts/" + builtins.replaceStrings [ "@" ] [ "/" ] c) + /configuration.nix) + ]; + }; + }) + configs)); + in + { + nixosConfigurations = (create-host [ + "desktop@default" + "desktop@work" + ]); }; - }; } + diff --git a/hosts/desktop/default/configuration.nix b/hosts/desktop/default/configuration.nix new file mode 100644 index 0000000..e1a53d2 --- /dev/null +++ b/hosts/desktop/default/configuration.nix @@ -0,0 +1,15 @@ +{ config, pkgs, inputs, lib, ... }: + +{ + imports = [ + ../shared-configuration.nix + ]; + + set-user.users = [ + { + username = "guz"; + shell = pkgs.zsh; + home = import ./home.nix; + } + ]; +} diff --git a/hosts/desktop/default/home.nix b/hosts/desktop/default/home.nix new file mode 100644 index 0000000..59b3492 --- /dev/null +++ b/hosts/desktop/default/home.nix @@ -0,0 +1,7 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = [ + ../shared-home.nix + ]; +} diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/shared-configuration.nix similarity index 93% rename from hosts/desktop/configuration.nix rename to hosts/desktop/shared-configuration.nix index eed4912..27f90cd 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/shared-configuration.nix @@ -27,13 +27,6 @@ programs.zsh.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. - set-user.users = [ - { - username = "guz"; - shell = pkgs.zsh; - home = import ./home.nix; - } - ]; services.flatpak.enable = true; diff --git a/hosts/desktop/home.nix b/hosts/desktop/shared-home.nix similarity index 100% rename from hosts/desktop/home.nix rename to hosts/desktop/shared-home.nix diff --git a/hosts/desktop/work/configuration.nix b/hosts/desktop/work/configuration.nix new file mode 100644 index 0000000..e1a53d2 --- /dev/null +++ b/hosts/desktop/work/configuration.nix @@ -0,0 +1,15 @@ +{ config, pkgs, inputs, lib, ... }: + +{ + imports = [ + ../shared-configuration.nix + ]; + + set-user.users = [ + { + username = "guz"; + shell = pkgs.zsh; + home = import ./home.nix; + } + ]; +} diff --git a/hosts/desktop/work/home.nix b/hosts/desktop/work/home.nix new file mode 100644 index 0000000..59b3492 --- /dev/null +++ b/hosts/desktop/work/home.nix @@ -0,0 +1,7 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = [ + ../shared-home.nix + ]; +}