Files
nix-config/modules/nixos/home/default.nix
2025-11-20 16:18:28 -06:00

81 lines
2.3 KiB
Nix

{
config,
lib,
options,
namespace,
inputs,
system,
...
}:
let
isArm = ("aarch64-linux" == system) || ("aarch64-darwin" == system);
isDarwin = ("aarch64-darwin" == system);
hasDestopEnvironment =
config.${namespace}.desktop.cosmic.enable
|| config.${namespace}.desktop.gnome.enable
|| config.${namespace}.desktop.hyprland.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 <option>xdg.configFile</option>.";
};
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 <option>home.file</option>.";
};
};
config = {
# ${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 = true;
# Pass inputs so external modules can access them
extraSpecialArgs = {
inherit inputs namespace hasDestopEnvironment;
overlays = with inputs; [
nix-vscode-extensions.overlays.default
];
};
# Make ALL external HM modules available globally
sharedModules =
with inputs;
[
sops-nix.homeManagerModules.sops
nix-plist-manager.homeManagerModules.default
# Add any other external HM modules here
]
++ (if (!isArm) then with inputs; [ steam-rom-manager.homeManagerModules.default ] else [ ])
++ (if (isDarwin) then with inputs; [ ] else [ ]);
users.${config.${namespace}.user.name} =
lib.mkAliasDefinitions
options.${namespace}.home.extraOptions;
# users.admin = lib.mkAliasDefinitions options.${namespace}.home.extraOptions;
verbose = true;
};
};
}