xdg: add option 'xdg.stateFile'

This commit is contained in:
Bruno BELANYI 2024-09-06 13:55:36 +01:00 committed by GitHub
parent 03b49187a2
commit b00bdf59c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -70,6 +70,16 @@ in {
'';
};
stateFile = mkOption {
type = fileType "xdg.stateFile" "<varname>xdg.stateHome</varname>"
cfg.stateHome;
default = { };
description = ''
Attribute set of files to link into the user's XDG
state home.
'';
};
stateHome = mkOption {
type = types.path;
defaultText = "~/.local/state";
@ -122,6 +132,8 @@ in {
cfg.configFile)
(mapAttrs' (name: file: nameValuePair "${cfg.dataHome}/${name}" file)
cfg.dataFile)
(mapAttrs' (name: file: nameValuePair "${cfg.stateHome}/${name}" file)
cfg.stateFile)
{ "${cfg.cacheHome}/.keep".text = ""; }
];
}

View file

@ -11,8 +11,8 @@ with lib;
xdg.configFile.test.text = "config";
xdg.dataFile.test.text = "data";
xdg.stateFile.test.text = "state";
home.file."${config.xdg.cacheHome}/test".text = "cache";
home.file."${config.xdg.stateHome}/test".text = "state";
nmt.script = ''
assertFileExists home-files/.dummy-config/test