xdg.userDirs: avoid using $HOME

Instead of referencing the `HOME` environment variable, use the
`home.homeDirectory` option. This allows other modules to reference an
XDG user directory without having to support shell syntax.
This commit is contained in:
Robert Helgesson 2022-09-15 22:17:19 +02:00
parent 5408e27961
commit b0247ceedc
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -34,49 +34,65 @@ in {
desktop = mkOption {
type = with types; coercedTo path toString str;
default = "$HOME/Desktop";
default = "${config.home.homeDirectory}/Desktop";
defaultText =
literalExpression ''"''${config.home.homeDirectory}/Desktop"'';
description = "The Desktop directory.";
};
documents = mkOption {
type = with types; coercedTo path toString str;
default = "$HOME/Documents";
default = "${config.home.homeDirectory}/Documents";
defaultText =
literalExpression ''"''${config.home.homeDirectory}/Documents"'';
description = "The Documents directory.";
};
download = mkOption {
type = with types; coercedTo path toString str;
default = "$HOME/Downloads";
default = "${config.home.homeDirectory}/Downloads";
defaultText =
literalExpression ''"''${config.home.homeDirectory}/Downloads"'';
description = "The Downloads directory.";
};
music = mkOption {
type = with types; coercedTo path toString str;
default = "$HOME/Music";
default = "${config.home.homeDirectory}/Music";
defaultText =
literalExpression ''"''${config.home.homeDirectory}/Music"'';
description = "The Music directory.";
};
pictures = mkOption {
type = with types; coercedTo path toString str;
default = "$HOME/Pictures";
default = "${config.home.homeDirectory}/Pictures";
defaultText =
literalExpression ''"''${config.home.homeDirectory}/Pictures"'';
description = "The Pictures directory.";
};
publicShare = mkOption {
type = with types; coercedTo path toString str;
default = "$HOME/Public";
default = "${config.home.homeDirectory}/Public";
defaultText =
literalExpression ''"''${config.home.homeDirectory}/Public"'';
description = "The Public share directory.";
};
templates = mkOption {
type = with types; coercedTo path toString str;
default = "$HOME/Templates";
default = "${config.home.homeDirectory}/Templates";
defaultText =
literalExpression ''"''${config.home.homeDirectory}/Templates"'';
description = "The Templates directory.";
};
videos = mkOption {
type = with types; coercedTo path toString str;
default = "$HOME/Videos";
default = "${config.home.homeDirectory}/Videos";
defaultText =
literalExpression ''"''${config.home.homeDirectory}/Videos"'';
description = "The Videos directory.";
};
@ -86,7 +102,7 @@ in {
defaultText = literalExpression "{ }";
example = literalExpression ''
{
XDG_MISC_DIR = "$HOME/Misc";
XDG_MISC_DIR = "''${config.home.homeDirectory}/Misc";
}
'';
description = "Other user directories.";