Allow access to the main home manager user directly
This commit is contained in:
parent
9b4ec6e0a1
commit
45ab2f83aa
|
@ -1,9 +1,15 @@
|
|||
{ system, inputs, config, pkgs, ... }: let
|
||||
{ system, inputs, config, lib, pkgs, ... }: let
|
||||
username = "admin";
|
||||
homeDirectory = "/home/${username}";
|
||||
in {
|
||||
imports = [ inputs.home-manager.nixosModules.home-manager ];
|
||||
|
||||
options.user = lib.mkOption {
|
||||
type = with lib.types; attrsOf anything;
|
||||
default = {};
|
||||
};
|
||||
|
||||
config = {
|
||||
users.users.${username} = {
|
||||
isNormalUser = true;
|
||||
uid = 1000;
|
||||
|
@ -52,16 +58,23 @@ in {
|
|||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit system inputs;
|
||||
systemConfig = config;
|
||||
};
|
||||
|
||||
# use system nixpkgs instead of home-manager nixpkgs
|
||||
useGlobalPkgs = true;
|
||||
|
||||
users.${username} = { system, inputs, systemConfig, pkgs, ... }: {
|
||||
users.${username} = config.user;
|
||||
};
|
||||
|
||||
# pass the user config as a system module argument
|
||||
_module.args = {
|
||||
homeConfig = config.home-manager.users.${username};
|
||||
};
|
||||
|
||||
user = {
|
||||
home = {
|
||||
inherit username homeDirectory;
|
||||
stateVersion = systemConfig.system.stateVersion;
|
||||
stateVersion = config.system.stateVersion;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue