mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 07:04:17 +00:00
xdg: add option 'xdg.stateFile'
This commit is contained in:
parent
03b49187a2
commit
b00bdf59c0
2 changed files with 13 additions and 1 deletions
|
@ -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 {
|
stateHome = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
defaultText = "~/.local/state";
|
defaultText = "~/.local/state";
|
||||||
|
@ -122,6 +132,8 @@ in {
|
||||||
cfg.configFile)
|
cfg.configFile)
|
||||||
(mapAttrs' (name: file: nameValuePair "${cfg.dataHome}/${name}" file)
|
(mapAttrs' (name: file: nameValuePair "${cfg.dataHome}/${name}" file)
|
||||||
cfg.dataFile)
|
cfg.dataFile)
|
||||||
|
(mapAttrs' (name: file: nameValuePair "${cfg.stateHome}/${name}" file)
|
||||||
|
cfg.stateFile)
|
||||||
{ "${cfg.cacheHome}/.keep".text = ""; }
|
{ "${cfg.cacheHome}/.keep".text = ""; }
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ with lib;
|
||||||
|
|
||||||
xdg.configFile.test.text = "config";
|
xdg.configFile.test.text = "config";
|
||||||
xdg.dataFile.test.text = "data";
|
xdg.dataFile.test.text = "data";
|
||||||
|
xdg.stateFile.test.text = "state";
|
||||||
home.file."${config.xdg.cacheHome}/test".text = "cache";
|
home.file."${config.xdg.cacheHome}/test".text = "cache";
|
||||||
home.file."${config.xdg.stateHome}/test".text = "state";
|
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-files/.dummy-config/test
|
assertFileExists home-files/.dummy-config/test
|
||||||
|
|
Loading…
Reference in a new issue