mirror of
https://github.com/nix-community/home-manager
synced 2024-12-28 04:39: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
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue