1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-04 08:59:46 +01:00

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