Files
nix/hosts/common/user/configs/console/xdg/default.nix
2024-07-23 19:07:59 +01:00

52 lines
1020 B
Nix

{
username ? throw "username argument is required",
}:
{
config,
lib,
pkgs,
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
home-manager.users.${username} = {
imports = [ ./options.nix ];
xdg = {
enable = true;
mimeApps.enable = true;
portal = {
xdgOpenUsePortal = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
};
userDirs = {
enable = true;
extraConfig = {
XDG_VM_DIR = "${userConfig.home}/VMs";
XDG_GIT_DIR = "${userConfig.home}/git";
};
};
};
home = {
packages = with pkgs; [ xdg-utils ];
persistence."/persist${userConfig.home}".directories = with hmConfig.xdg.userDirs; [
relativeDesktop
relativeDocuments
relativeDownload
relativeMusic
relativePictures
relativeTemplates
relativeVideos
"VMs"
"git"
];
};
};
}