configurations: use home-manager module by default

This commit is contained in:
Mateusz Słodkowicz 2024-03-21 23:01:42 +01:00
parent bc40af000f
commit cdc41c3934
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
9 changed files with 29 additions and 8 deletions

View File

@ -3,7 +3,7 @@
let
profiles = import ../profile;
makeSystem = { host, arch ? "x86_64-linux", extraModules ? [ ], stable ? true }:
makeSystem = { host, arch ? "x86_64-linux", extraModules ? [ ], stable ? true, hmAsModule ? true, hmUsers ? [ "materus" ] }:
let
nixosSystem = if stable then inputs.nixpkgs-stable.lib.nixosSystem else inputs.nixpkgs.lib.nixosSystem;
hm = if stable then inputs.configInputs-stable.home-manager else inputs.configInputs.home-manager;
@ -12,6 +12,7 @@ let
inherit materusFlake;
inherit host;
inherit hm;
inherit hmAsModule;
nixerus = if stable then inputs.configInputs-stable.nixerus else inputs.configInputs.nixerus;
configInputs = if stable then inputs.configInputs-stable else inputs.configInputs;
path = materusFlake.selfPath;
@ -27,6 +28,27 @@ let
inputs.private.systemModule
profiles.osProfile
materusCfg.configInputs.sops-nix.nixosModules.sops
(if hmAsModule then hm.nixosModules.home-manager else { })
(if hmAsModule then
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users = (builtins.foldl' (a: b: a // b) { } (builtins.map
(user: {
${user} = ({ ... }:
{
imports = [
(materusFlake.selfPath + "/configurations/shared/home/${user}")
(materusFlake.selfPath + "/configurations/host/${host}/home/${user}")
profiles.homeProfile
];
});
})
hmUsers));
home-manager.extraSpecialArgs = { materusCfg = materusCfg // { isHm = true; }; };
} else { })
] ++ extraModules;
}) // { inherit materusCfg; };
in
@ -34,7 +56,7 @@ in
materusPC = makeSystem { host = "materusPC"; stable = false; };
flamaster = makeSystem { host = "flamaster"; stable = true; };
valkyrie = makeSystem { host = "valkyrie"; stable = true; };
waffentrager = makeSystem { host = "waffentrager"; stable = false; arch = "aarch64-linux"; extraModules = [ ]; };
waffentrager = makeSystem { host = "waffentrager"; stable = true; arch = "aarch64-linux"; };
Old-materusPC = makeSystem { host = "Old-materusPC"; stable = false; };
}

View File

@ -14,10 +14,10 @@ let
value = let host = builtins.elemAt hosts i; in
materusFlake.nixosConfigurations.${host}.materusCfg.hm.lib.homeManagerConfiguration {
pkgs = materusFlake.nixosConfigurations.${host}.pkgs;
extraSpecialArgs = { materusCfg = materusFlake.nixosConfigurations.${host}.materusCfg // { homePath = materusFlake.selfPath + "/configurations/home/${username}"; isHm = true; }; };
extraSpecialArgs = { materusCfg = materusFlake.nixosConfigurations.${host}.materusCfg // { isHm = true; }; };
modules = [
./${username}
../host/${host}/extraHome.nix
(materusFlake.selfPath + "/configurations/shared/home/${username}")
(materusFlake.selfPath + "/configurations/host/${host}/home/${username}")
profiles.homeProfile
inputs.private.homeModule
materusFlake.nixosConfigurations.${host}.materusCfg.configInputs.sops-nix.homeManagerModules.sops
@ -36,10 +36,10 @@ let
inherit materusFlake;
host = "Generic";
hm = inputs.configInputs.home-manager;
hmAsModule = false;
nixerus = inputs.configInputs.nixerus;
configInputs = inputs.configInputs;
path = materusFlake.selfPath;
homePath = materusFlake.selfPath + "/configurations/home/${username}";
isHm = true;
};
in

View File

@ -56,7 +56,7 @@
outputs = inputs @ { self, nixpkgs, home-manager, nur, ... }:
rec {
nixosConfigurations = import ./configurations/host { inherit inputs; materusFlake = self; };
homeConfigurations = import ./configurations/home { inherit inputs; materusFlake = self; };
homeConfigurations = import ./configurations/shared/home { inherit inputs; materusFlake = self; };
selfPath = self;
decrypted = builtins.pathExists (selfPath + "/decrypted");
};