{ config, lib, options, namespace, inputs, ... }: let hasDestopEnvironment = config.${namespace}.desktop.cosmic.enable || config.${namespace}.desktop.gnome.enable || config.${namespace}.desktop.hyprland.enable || config.${namespace}.desktop.plasma.enable; in { options.${namespace}.home = with lib.types; { configFile = lib.mkOption { type = attrs; default = { }; description = "A set of files to be managed by home-manager's ."; }; extraOptions = lib.mkOption { type = attrs; default = { }; description = "Options to pass directly to home-manager."; }; file = lib.mkOption { type = attrs; default = { }; description = "A set of files to be managed by home-manager's ."; }; }; config = { assertions = let desktopCount = lib.count lib.id [ config.${namespace}.desktop.gnome.enable config.${namespace}.desktop.hyprland.enable config.${namespace}.desktop.cosmic.enable config.${namespace}.desktop.plasma.enable ]; in [ { assertion = desktopCount <= 1; message = '' At most one desktop environment may be enabled simultaneously. Currently enabled: ${ lib.concatStringsSep ", " ( lib.optional config.${namespace}.desktop.gnome.enable "gnome" ++ lib.optional config.${namespace}.desktop.hyprland.enable "hyprland" ++ lib.optional config.${namespace}.desktop.cosmic.enable "cosmic" ++ lib.optional config.${namespace}.desktop.plasma.enable "plasma" ) }. ''; } ]; # ${namespace}.home.extraOptions = { # home.file = lib.mkAliasDefinitions options.${namespace}.home.file; # home.stateVersion = lib.mkOptionDefault config.system.stateVersion; # xdg.configFile = lib.mkAliasDefinitions options.${namespace}.home.configFile; # xdg.enable = lib.mkOptionDefault true; # }; home-manager = { # enables backing up existing files instead of erroring if conflicts exist backupFileExtension = "backup"; useGlobalPkgs = true; useUserPackages = false; # Pass inputs so external modules can access them extraSpecialArgs = { inherit inputs namespace hasDestopEnvironment; }; users.${config.${namespace}.user.name} = lib.mkAliasDefinitions options.${namespace}.home.extraOptions; # users.admin = lib.mkAliasDefinitions options.${namespace}.home.extraOptions; verbose = true; }; }; }