1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-26 08:28:30 +02:00

xdg: fix typo and add test

This commit is contained in:
oxalica 2021-11-19 09:14:11 +08:00 committed by Robert Helgesson
parent a19f40d39d
commit c82bc787b8
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
3 changed files with 37 additions and 1 deletions

View File

@ -108,7 +108,7 @@ in {
xdg.cacheHome = mkDefault defaultCacheHome;
xdg.configHome = mkDefault defaultConfigHome;
xdg.dataHome = mkDefault defaultDataHome;
xdg.stateHome = mkDefault stateHome;
xdg.stateHome = mkDefault defaultStateHome;
})
{

View 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"}
'';
};
}

View File

@ -3,4 +3,5 @@
xdg-system-dirs = ./system-dirs.nix;
xdg-desktop-entries = ./desktop-entries.nix;
xdg-file-gen = ./file-gen.nix;
xdg-default-locations = ./default-locations.nix;
}