Allow access to the main home manager user directly

This commit is contained in:
outfoxxed 2023-06-19 22:51:29 -07:00
parent 9b4ec6e0a1
commit 45ab2f83aa
Signed by: outfoxxed
GPG Key ID: 4C88A185FB89301E
1 changed files with 59 additions and 46 deletions

View File

@ -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;
};
};
};