xdg.userDirs: change the syntax for extraConfig
E.g., use `MISC` instead of `XDG_MISC_DIR`, the same way `xdg-user-dirs-update` works. This is conditionalized on 26.05, so in future `XDG_MISC_DIR` will be disallowed.
This commit is contained in:
parent
db9044b119
commit
9b62076484
4 changed files with 104 additions and 12 deletions
|
|
@ -4,5 +4,7 @@
|
|||
xdg-mime-disabled = ./mime-disabled.nix;
|
||||
xdg-autostart = ./autostart.nix;
|
||||
xdg-autostart-readonly = ./autostart-readonly.nix;
|
||||
xdg-user-dirs-mixed = ./user-dirs-mixed.nix;
|
||||
xdg-user-dirs-null = ./user-dirs-null.nix;
|
||||
xdg-user-dirs-short = ./user-dirs-short.nix;
|
||||
}
|
||||
|
|
|
|||
35
tests/modules/misc/xdg/user-dirs-mixed.nix
Normal file
35
tests/modules/misc/xdg/user-dirs-mixed.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
config = {
|
||||
home.stateVersion = "25.11";
|
||||
|
||||
xdg.userDirs = {
|
||||
enable = true;
|
||||
extraConfig.PROJECTS = "${config.home.homeDirectory}/Projects";
|
||||
## This will trigger a warning.
|
||||
extraConfig.XDG_MISC_DIR = "${config.home.homeDirectory}/Misc";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configFile=home-files/.config/user-dirs.dirs
|
||||
assertFileExists $configFile
|
||||
assertFileContent $configFile ${pkgs.writeText "expected" ''
|
||||
XDG_DESKTOP_DIR="/home/hm-user/Desktop"
|
||||
XDG_DOCUMENTS_DIR="/home/hm-user/Documents"
|
||||
XDG_DOWNLOAD_DIR="/home/hm-user/Downloads"
|
||||
XDG_MISC_DIR="/home/hm-user/Misc"
|
||||
XDG_MUSIC_DIR="/home/hm-user/Music"
|
||||
XDG_PICTURES_DIR="/home/hm-user/Pictures"
|
||||
XDG_PROJECTS_DIR="/home/hm-user/Projects"
|
||||
XDG_PUBLICSHARE_DIR="/home/hm-user/Public"
|
||||
XDG_TEMPLATES_DIR="/home/hm-user/Templates"
|
||||
XDG_VIDEOS_DIR="/home/hm-user/Videos"
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
||||
30
tests/modules/misc/xdg/user-dirs-short.nix
Normal file
30
tests/modules/misc/xdg/user-dirs-short.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
config = {
|
||||
xdg.userDirs = {
|
||||
enable = true;
|
||||
extraConfig.PROJECTS = "${config.home.homeDirectory}/Projects";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configFile=home-files/.config/user-dirs.dirs
|
||||
assertFileExists $configFile
|
||||
assertFileContent $configFile ${pkgs.writeText "expected" ''
|
||||
XDG_DESKTOP_DIR="/home/hm-user/Desktop"
|
||||
XDG_DOCUMENTS_DIR="/home/hm-user/Documents"
|
||||
XDG_DOWNLOAD_DIR="/home/hm-user/Downloads"
|
||||
XDG_MUSIC_DIR="/home/hm-user/Music"
|
||||
XDG_PICTURES_DIR="/home/hm-user/Pictures"
|
||||
XDG_PROJECTS_DIR="/home/hm-user/Projects"
|
||||
XDG_PUBLICSHARE_DIR="/home/hm-user/Public"
|
||||
XDG_TEMPLATES_DIR="/home/hm-user/Templates"
|
||||
XDG_VIDEOS_DIR="/home/hm-user/Videos"
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue