mirror of
https://github.com/nix-community/home-manager
synced 2024-12-23 10:19:48 +01:00
xdg: fix typo and add test
This commit is contained in:
parent
a19f40d39d
commit
c82bc787b8
3 changed files with 37 additions and 1 deletions
|
@ -108,7 +108,7 @@ in {
|
||||||
xdg.cacheHome = mkDefault defaultCacheHome;
|
xdg.cacheHome = mkDefault defaultCacheHome;
|
||||||
xdg.configHome = mkDefault defaultConfigHome;
|
xdg.configHome = mkDefault defaultConfigHome;
|
||||||
xdg.dataHome = mkDefault defaultDataHome;
|
xdg.dataHome = mkDefault defaultDataHome;
|
||||||
xdg.stateHome = mkDefault stateHome;
|
xdg.stateHome = mkDefault defaultStateHome;
|
||||||
})
|
})
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
35
tests/modules/misc/xdg/default-locations.nix
Normal file
35
tests/modules/misc/xdg/default-locations.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
# Test fallback behavior for stateVersion >= 20.09, which is pure.
|
||||||
|
xdg.enable = lib.mkForce false;
|
||||||
|
home.stateVersion = "20.09";
|
||||||
|
|
||||||
|
xdg.configFile.test.text = "config";
|
||||||
|
xdg.dataFile.test.text = "data";
|
||||||
|
home.file."${config.xdg.cacheHome}/test".text = "cache";
|
||||||
|
home.file."${config.xdg.stateHome}/test".text = "state";
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/test
|
||||||
|
assertFileExists home-files/.local/share/test
|
||||||
|
assertFileExists home-files/.cache/test
|
||||||
|
assertFileExists home-files/.local/state/test
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.config/test \
|
||||||
|
${builtins.toFile "test" "config"}
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.local/share/test \
|
||||||
|
${builtins.toFile "test" "data"}
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.cache/test \
|
||||||
|
${builtins.toFile "test" "cache"}
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.local/state/test \
|
||||||
|
${builtins.toFile "test" "state"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,4 +3,5 @@
|
||||||
xdg-system-dirs = ./system-dirs.nix;
|
xdg-system-dirs = ./system-dirs.nix;
|
||||||
xdg-desktop-entries = ./desktop-entries.nix;
|
xdg-desktop-entries = ./desktop-entries.nix;
|
||||||
xdg-file-gen = ./file-gen.nix;
|
xdg-file-gen = ./file-gen.nix;
|
||||||
|
xdg-default-locations = ./default-locations.nix;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue