Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions modules/misc/xdg-user-dirs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,57 +33,62 @@ in {
# https://gitlab.freedesktop.org/xdg/xdg-user-dirs/blob/master/man/user-dirs.dirs.xml

desktop = mkOption {
type = types.str;
type = with types; coercedTo path toString str;
default = "$HOME/Desktop";
description = "The Desktop directory.";
};

documents = mkOption {
type = types.str;
type = with types; coercedTo path toString str;
default = "$HOME/Documents";
description = "The Documents directory.";
};

download = mkOption {
type = types.str;
type = with types; coercedTo path toString str;
default = "$HOME/Downloads";
description = "The Downloads directory.";
};

music = mkOption {
type = types.str;
type = with types; coercedTo path toString str;
default = "$HOME/Music";
description = "The Music directory.";
};

pictures = mkOption {
type = types.str;
type = with types; coercedTo path toString str;
default = "$HOME/Pictures";
description = "The Pictures directory.";
};

publicShare = mkOption {
type = types.str;
type = with types; coercedTo path toString str;
default = "$HOME/Public";
description = "The Public share directory.";
};

templates = mkOption {
type = types.str;
type = with types; coercedTo path toString str;
default = "$HOME/Templates";
description = "The Templates directory.";
};

videos = mkOption {
type = types.str;
type = with types; coercedTo path toString str;
default = "$HOME/Videos";
description = "The Videos directory.";
};

extraConfig = mkOption {
type = with types; attrsOf str;
type = with types; attrsOf (coercedTo path toString str);
default = { };
Comment thread
berbiche marked this conversation as resolved.
example = { XDG_MISC_DIR = "$HOME/Misc"; };
defaultText = literalExpression "{ }";
example = literalExpression ''
{
XDG_MISC_DIR = "$HOME/Misc";
}
'';
description = "Other user directories.";
};

Expand Down Expand Up @@ -113,6 +118,8 @@ in {

xdg.configFile."user-dirs.conf".text = "enabled=False";

home.sessionVariables = directories;

home.activation = mkIf cfg.createDirectories {
createXdgUserDirectories = let
directoriesList = attrValues directories;
Expand Down