From 6691342f5277ea6aae85a2df74d427da89147000 Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 17 Dec 2025 16:11:35 -0500 Subject: [PATCH 1/5] Update templates/user/user.nix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- templates/user/user.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/user/user.nix b/templates/user/user.nix index dc1ce32..2fee065 100644 --- a/templates/user/user.nix +++ b/templates/user/user.nix @@ -8,8 +8,9 @@ # 2. Home-manager configuration (home.*, programs.*, services.*) when imported # into home-manager # -# This file is optional - if not present, these options should be set -# directly in the main users.nix file. +# This file is optional - if not present, the system will use the defaults +# from the main users.nix file. Use this file to override or extend those +# default user and home-manager options for this user. # # This module receives the same `inputs` flake inputs as the main # nixos-systems configuration (nixpkgs, home-manager, etc.). From e58e54fbd6580ee3d68df65f6e50fab08c42b8bd Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 17 Dec 2025 16:14:26 -0500 Subject: [PATCH 2/5] Update templates/user/nixos.nix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- templates/user/nixos.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/user/nixos.nix b/templates/user/nixos.nix index f4dbfe2..b38080c 100644 --- a/templates/user/nixos.nix +++ b/templates/user/nixos.nix @@ -12,7 +12,8 @@ # - Installing system packages that require root # # Note: User options (description, shell, extraGroups, etc.) should be set -# in the main users.nix file, not here. +# in your external module's user.nix or in the main users.nix file, not in +# this nixos.nix. # # This module receives the same `inputs` flake inputs as the main # nixos-systems configuration. From 8ec3bd14acad13fc9c1c25d9087e41e2ecc3bbd6 Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 17 Dec 2025 16:14:56 -0500 Subject: [PATCH 3/5] Update hosts/user-config.nix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- hosts/user-config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/user-config.nix b/hosts/user-config.nix index c77e9e3..91bf233 100644 --- a/hosts/user-config.nix +++ b/hosts/user-config.nix @@ -245,7 +245,7 @@ in ; }; in - lib.filterAttrs (name: _: name != "ugaif") evaluated + lib.filterAttrs (attrName: _: attrName != "ugaif") evaluated else { }; From 4533cd2383fcf9eb903cc3c93e53192c91685bdf Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 17 Dec 2025 16:16:19 -0500 Subject: [PATCH 4/5] Update docs/USER_CONFIGURATION.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/USER_CONFIGURATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/USER_CONFIGURATION.md b/docs/USER_CONFIGURATION.md index 3d508ca..820ae64 100644 --- a/docs/USER_CONFIGURATION.md +++ b/docs/USER_CONFIGURATION.md @@ -154,7 +154,7 @@ dotfiles/ { # User account options (imported as NixOS module) - ugaif.users.myusername = { + ugaif.users.myuser = { description = "My Full Name"; extraGroups = [ "wheel" "docker" ]; shell = pkgs.zsh; From f417e2106c96225e418e8a02c690f3e0cee59cee Mon Sep 17 00:00:00 2001 From: Hunter Date: Wed, 17 Dec 2025 16:16:40 -0500 Subject: [PATCH 5/5] Update hosts/user-config.nix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- hosts/user-config.nix | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/hosts/user-config.nix b/hosts/user-config.nix index 91bf233..69b71a7 100644 --- a/hosts/user-config.nix +++ b/hosts/user-config.nix @@ -36,37 +36,37 @@ let && builtins.pathExists path; # Extract ugaif.users options from external user.nix modules - externalUserOptions = lib.foldl' ( - acc: item: + # First, build a cache of options per user from their external user.nix (if any). + externalUserModuleOptions = lib.genAttrs (lib.attrNames accounts) ( + name: let - name = item.name; - user = item.user; + user = accounts.${name}; externalPath = resolveExternalPath (user.external or null); userNixPath = if externalPath != null then externalPath + "/user.nix" else null; - - # Load the module and extract its ugaif.users options - moduleOptions = - if isValidPath userNixPath then - let - # Import and evaluate the module with minimal args - outerModule = import userNixPath { inherit inputs; }; - evaluatedModule = outerModule { - config = { }; - inherit lib pkgs; - osConfig = null; - }; - # Extract just the ugaif.users. options - ugaifUsers = evaluatedModule.ugaif.users or { }; - userOptions = ugaifUsers.${name} or { }; - in - userOptions - else - { }; in - if moduleOptions != { } then acc // { ${name} = moduleOptions; } else acc - ) { } (lib.mapAttrsToList (name: user: { inherit name user; }) accounts); + if isValidPath userNixPath then + let + # Import and evaluate the module with minimal args + outerModule = import userNixPath { inherit inputs; }; + evaluatedModule = outerModule { + config = { }; + inherit lib pkgs; + osConfig = null; + }; + # Extract just the ugaif.users. options + ugaifUsers = evaluatedModule.ugaif.users or { }; + in + ugaifUsers.${name} or { } + else + { } + ); + + # externalUserOptions only contains users that actually have options defined + externalUserOptions = lib.filterAttrs (_: moduleOptions: moduleOptions != { }) externalUserModuleOptions; # Submodule defining the structure of a user account + userSubmodule = lib.types.submodule { + options = { userSubmodule = lib.types.submodule { options = { isNormalUser = lib.mkOption {