nixos-config/configurations/home/genHomes.nix

57 lines
2.2 KiB
Nix
Raw Normal View History

2023-10-08 11:42:08 +02:00
{ inputs, materusFlake, ... }:
let
profiles = import ../profile;
hosts = builtins.attrNames materusFlake.nixosConfigurations;
genHomes = username:
let
#Make host specific user profile "username@host"
_list = builtins.map (host: username + "@" + host) hosts;
_for = i: (
let len = builtins.length hosts; in
([{
name = builtins.elemAt _list i;
value = let host = builtins.elemAt hosts i; in
materusFlake.nixosConfigurations.${host}.materusCfg.hm.lib.homeManagerConfiguration {
2023-10-08 11:42:08 +02:00
pkgs = materusFlake.nixosConfigurations.${host}.pkgs;
extraSpecialArgs = { materusCfg = materusFlake.nixosConfigurations.${host}.materusCfg // {homePath = materusFlake.selfPath + "/configurations/home/${username}"; isHm = true;}; };
2023-10-08 11:42:08 +02:00
modules = [
./${username}
../host/${host}/extraHome.nix
profiles.homeProfile
inputs.private.homeModule
2024-03-02 22:36:43 +01:00
materusFlake.nixosConfigurations.${host}.materusCfg.configInputs.sops-nix.homeManagerModules.sops
2023-10-08 11:42:08 +02:00
];
};
}]
++ (if ((i + 1) < len) then _for (i + 1) else [ ]))
);
in
(builtins.listToAttrs (_for 0)) // {
#Make generic x86_64-linux user profile "username"
${username} =
let materusCfg = {
stable = false;
inherit materusFlake;
host = "Generic";
hm = inputs.configInputs.home-manager;
nixerus = inputs.configInputs.nixerus;
configInputs = inputs.configInputs;
path = materusFlake.selfPath;
homePath = materusFlake.selfPath + "/configurations/home/${username}";
2024-02-25 22:30:13 +01:00
isHm = true;
}; in
inputs.configInputs.home-manager.lib.homeManagerConfiguration {
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; config = { allowUnfree = true; }; };
extraSpecialArgs = { inherit materusCfg; };
modules = [
./${username}
profiles.homeProfile
inputs.private.homeModule
2024-03-02 22:36:43 +01:00
materusCfg.configInputs.sops-nix.homeManagerModules.sops
];
};
2023-10-08 11:42:08 +02:00
};
in
genHomes