refactor: extract machine setup

This commit is contained in:
mandlm 2022-08-18 21:55:47 +02:00
parent 07484604d4
commit 66aa9cd407
Signed by: mandlm
GPG Key ID: 4AA25D647AA54CC7

View File

@ -12,17 +12,15 @@
let let
user = "mandlm"; user = "mandlm";
theme = "dark"; # dark or light theme = "dark"; # dark or light
in
{ buildMachineConfig = machineName: nixpkgs.lib.nixosSystem {
nixosConfigurations = {
nixos-vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = inputs; specialArgs = inputs;
modules = [ modules = [
./configuration.nix ./configuration.nix
./users.nix ./users.nix
./machines/nixos-vm/configuration.nix ./machines/${machineName}/configuration.nix
./machines/nixos-vm/hardware-configuration.nix ./machines/${machineName}/hardware-configuration.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
@ -35,54 +33,12 @@
} }
]; ];
}; };
in
apache = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs;
modules = [
./configuration.nix
./users.nix
./machines/apache/configuration.nix
./machines/apache/hardware-configuration.nix
home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; nixosConfigurations = {
home-manager.useUserPackages = true; nixos-vm = buildMachineConfig ("nixos-vm");
home-manager.extraSpecialArgs = { inherit user theme; }; apache = buildMachineConfig ("apache");
home-manager.users.${user} = { p330 = buildMachineConfig ("p330");
imports = [
./home-${user}.nix
./machines/apache/home-${user}.nix
];
};
}
];
};
p330 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs;
modules = [
./configuration.nix
./users.nix
./machines/p330/configuration.nix
./machines/p330/hardware-configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit user theme; };
home-manager.users.${user} = {
imports = [
./home-${user}.nix
./machines/p330/home-${user}.nix
];
};
}
];
};
}; };
}; };
} }