config: improve home-manager user creation

Now with configurable home-manager channel! Also, I've improved some
usage of the metadata to be used from `users.toml`.
This commit is contained in:
Gabriel Arazas 2023-06-29 13:50:26 +08:00
parent fc6da2a710
commit a91a9fe110
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 5 additions and 4 deletions

View File

@ -326,8 +326,8 @@
nixpkgs.config.allowUnfree = true;
# Setting the homely options.
home.username = builtins.baseNameOf path;
home.homeDirectory = "/home/${config.home.username}";
home.username = metadata.username or name;
home.homeDirectory = metadata.home-directory or "/home/${config.home.username}";
})
userSharedConfig
path
@ -336,6 +336,7 @@
mkUser {
inherit extraModules extraArgs;
system = metadata.system or defaultSystem;
home-manager-channel = metadata.home-manager-channel or "home-manager";
})
users;

View File

@ -21,8 +21,8 @@ in
};
# A wrapper around the home-manager configuration function.
mkUser = { system, extraModules ? [ ], extraArgs ? { } }:
inputs.home-manager.lib.homeManagerConfiguration {
mkUser = { system, extraModules ? [ ], extraArgs ? { }, home-manager-channel ? "home-manager" }:
inputs."${home-manager-channel}".lib.homeManagerConfiguration {
inherit lib;
extraSpecialArgs = extraArgs;
pkgs = import nixpkgs { inherit system; };