refactor: Overhaul external user modules

This commit is contained in:
2025-12-17 15:34:34 -05:00
committed by Hunter Halloran
parent f98aa0b19b
commit ab5e7568ab
8 changed files with 346 additions and 102 deletions

View File

@@ -51,14 +51,17 @@ let
userNixosModulePaths = lib.filterAttrs (_: v: v != null) (
lib.mapAttrs (
name: user:
if (user ? home && user.home != null) then
if (user ? external && user.external != null) then
let
homePath =
if builtins.isAttrs user.home && user.home ? outPath then user.home.outPath else user.home;
nixosModulePath = homePath + "/nixos.nix";
externalPath =
if builtins.isAttrs user.external && user.external ? outPath then
user.external.outPath
else
user.external;
nixosModulePath = externalPath + "/nixos.nix";
in
if
(builtins.isPath homePath || (builtins.isString homePath && lib.hasPrefix "/" homePath))
(builtins.isPath externalPath || (builtins.isString externalPath && lib.hasPrefix "/" externalPath))
&& builtins.pathExists nixosModulePath
then
nixosModulePath