config: make mkHome more universal

I don't know how to deploy the home-manager configurations with more
than one systems reliably without ruining the experience of having to
pass an autogenerated name for the correct configuration. The way it's
currently done provides no benefit for multi-system users.

It's not perfect but for now, we'll set the system through importing
nixpkgs which has auto-detection for its system. Though, this makes the
user system declaration ineffective.
This commit is contained in:
Gabriel Arazas 2023-12-10 18:34:20 +08:00
parent e1c081b96d
commit 198ded079b
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 4 additions and 5 deletions

View File

@ -380,9 +380,8 @@
lib'.mapAttrs lib'.mapAttrs
(filename: metadata: (filename: metadata:
let let
name = metadata._name; name = metadata.username or filename;
system = metadata._system; pkgs = import nixpkgs { inherit overlays; };
pkgs = inputs.${metadata.nixpkgs-channel or "nixpkgs"}.legacyPackages.${system};
path = ./users/home-manager/${name}; path = ./users/home-manager/${name};
extraModules = [ extraModules = [
({ pkgs, config, ... }: { ({ pkgs, config, ... }: {
@ -417,7 +416,7 @@
]; ];
in in
mkHome { mkHome {
inherit pkgs system extraModules extraArgs; inherit pkgs extraModules extraArgs;
home-manager-channel = metadata.home-manager-channel or "home-manager"; home-manager-channel = metadata.home-manager-channel or "home-manager";
}) })
users; users;

View File

@ -13,7 +13,7 @@
}; };
# A wrapper around the home-manager configuration function. # A wrapper around the home-manager configuration function.
mkHome = { pkgs, system, extraModules ? [ ], extraArgs ? { }, home-manager-channel ? "home-manager" }: mkHome = { pkgs, extraModules ? [ ], extraArgs ? { }, home-manager-channel ? "home-manager" }:
inputs."${home-manager-channel}".lib.homeManagerConfiguration { inputs."${home-manager-channel}".lib.homeManagerConfiguration {
inherit lib pkgs; inherit lib pkgs;
extraSpecialArgs = extraArgs; extraSpecialArgs = extraArgs;