1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

xdg-user-dirs: allow paths and define sessionVariables (#2757)

Changed option types to `either str path` to allow using path values.

The related session variable is defined for the default and the extra
user directories now.
This commit is contained in:
ilkecan 2022-04-05 06:32:03 +03:00 committed by GitHub
parent 0382c5f75e
commit 3549f5d0f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = { };
example = { XDG_MISC_DIR = "$HOME/Misc"; };
defaultText = literalExpression "{ }";
example = literalExpression ''
{
XDG_MISC_DIR = "$HOME/Misc";
}
'';
description = "Other user directories.";
};
@ -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;