mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 21:29:48 +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:
parent
0382c5f75e
commit
3549f5d0f5
1 changed files with 17 additions and 10 deletions
|
@ -33,57 +33,62 @@ in {
|
||||||
# https://gitlab.freedesktop.org/xdg/xdg-user-dirs/blob/master/man/user-dirs.dirs.xml
|
# https://gitlab.freedesktop.org/xdg/xdg-user-dirs/blob/master/man/user-dirs.dirs.xml
|
||||||
|
|
||||||
desktop = mkOption {
|
desktop = mkOption {
|
||||||
type = types.str;
|
type = with types; coercedTo path toString str;
|
||||||
default = "$HOME/Desktop";
|
default = "$HOME/Desktop";
|
||||||
description = "The Desktop directory.";
|
description = "The Desktop directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
documents = mkOption {
|
documents = mkOption {
|
||||||
type = types.str;
|
type = with types; coercedTo path toString str;
|
||||||
default = "$HOME/Documents";
|
default = "$HOME/Documents";
|
||||||
description = "The Documents directory.";
|
description = "The Documents directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
download = mkOption {
|
download = mkOption {
|
||||||
type = types.str;
|
type = with types; coercedTo path toString str;
|
||||||
default = "$HOME/Downloads";
|
default = "$HOME/Downloads";
|
||||||
description = "The Downloads directory.";
|
description = "The Downloads directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
music = mkOption {
|
music = mkOption {
|
||||||
type = types.str;
|
type = with types; coercedTo path toString str;
|
||||||
default = "$HOME/Music";
|
default = "$HOME/Music";
|
||||||
description = "The Music directory.";
|
description = "The Music directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
pictures = mkOption {
|
pictures = mkOption {
|
||||||
type = types.str;
|
type = with types; coercedTo path toString str;
|
||||||
default = "$HOME/Pictures";
|
default = "$HOME/Pictures";
|
||||||
description = "The Pictures directory.";
|
description = "The Pictures directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
publicShare = mkOption {
|
publicShare = mkOption {
|
||||||
type = types.str;
|
type = with types; coercedTo path toString str;
|
||||||
default = "$HOME/Public";
|
default = "$HOME/Public";
|
||||||
description = "The Public share directory.";
|
description = "The Public share directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
templates = mkOption {
|
templates = mkOption {
|
||||||
type = types.str;
|
type = with types; coercedTo path toString str;
|
||||||
default = "$HOME/Templates";
|
default = "$HOME/Templates";
|
||||||
description = "The Templates directory.";
|
description = "The Templates directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
videos = mkOption {
|
videos = mkOption {
|
||||||
type = types.str;
|
type = with types; coercedTo path toString str;
|
||||||
default = "$HOME/Videos";
|
default = "$HOME/Videos";
|
||||||
description = "The Videos directory.";
|
description = "The Videos directory.";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = with types; attrsOf str;
|
type = with types; attrsOf (coercedTo path toString str);
|
||||||
default = { };
|
default = { };
|
||||||
example = { XDG_MISC_DIR = "$HOME/Misc"; };
|
defaultText = literalExpression "{ }";
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
XDG_MISC_DIR = "$HOME/Misc";
|
||||||
|
}
|
||||||
|
'';
|
||||||
description = "Other user directories.";
|
description = "Other user directories.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -113,6 +118,8 @@ in {
|
||||||
|
|
||||||
xdg.configFile."user-dirs.conf".text = "enabled=False";
|
xdg.configFile."user-dirs.conf".text = "enabled=False";
|
||||||
|
|
||||||
|
home.sessionVariables = directories;
|
||||||
|
|
||||||
home.activation = mkIf cfg.createDirectories {
|
home.activation = mkIf cfg.createDirectories {
|
||||||
createXdgUserDirectories = let
|
createXdgUserDirectories = let
|
||||||
directoriesList = attrValues directories;
|
directoriesList = attrValues directories;
|
||||||
|
|
Loading…
Reference in a new issue