modularise flake config: fix and modularise home-manager config generation

unfortunately, homeConfigurations do not follow the pattern of having system-specific sub-attrs and thus are dependent on a specific system per-se.
This commit is contained in:
Trolli Schmittlauch 2024-01-10 00:25:45 +01:00
parent 993308a2d3
commit 27100bacb7

View file

@ -26,7 +26,7 @@
};
outputs =
{ self, nixpkgs, nur, lanzaboote, flake-utils, ... }@inputs:
{ self, nixpkgs, nur, lanzaboote, flake-utils, home-manager, ... }@inputs:
let
# FIXME: allow different systems
systems = flake-utils.lib.system;
@ -39,31 +39,34 @@
modules = defaultModules ++ extraModules;
inherit system;
};
mkHomeManager = confName: user: system: # unfortunately, home-manager configs are still system-specific
# FIXME: this is thus still linux-x86_64 specific
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
{
imports = [
nur.hmModules.nur
# TODO: $name can be utilised to conditionally load other config files
./home/home.nix
];
# extends the home config
home.username = user;
home.homeDirectory = "/home/${user}";
}
];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
extraSpecialArgs = {
inherit inputs system;
};
};
in
{
nixosConfigurations = {
thinknix = mkSystem systems.x86_64-linux [ ./hosts/thinknix inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440s lanzaboote.nixosModules.lanzaboote ];
framenix = mkSystem systems.x86_64-linux [ ./hosts/framenix inputs.nixos-hardware.nixosModules.framework-13-7040-amd lanzaboote.nixosModules.lanzaboote ];
};
# FIXME: see mkHomemanager
homeConfigurations.spiollinux = inputs.home-manager.lib.homeManagerConfiguration {
modules = [
{
imports = [
nur.hmModules.nur
./home/home.nix
];
# extends the home config
home.username = "spiollinux";
home.homeDirectory = "/home/spiollinux";
}
];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
extraSpecialArgs = {
inherit inputs;
};
};
homeConfigurations.spiollinux = mkHomeManager "spiollinux" "spiollinux" systems.x86_64-linux;
};
}