mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
tmpfiles: migrate to an RFC42-style option
This commit is contained in:
parent
32a671dce5
commit
090aa14e5d
9 changed files with 247 additions and 31 deletions
24
tests/modules/misc/tmpfiles/basic-rules.nix
Normal file
24
tests/modules/misc/tmpfiles/basic-rules.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
imports = [ ./common-stubs.nix ];
|
||||
|
||||
systemd.user.tmpfiles.settings = {
|
||||
cache."%C".d.age = "4 weeks";
|
||||
myTool."%h/.config/myTool.conf"."f+" = {
|
||||
mode = "0644";
|
||||
user = "alice";
|
||||
group = "users";
|
||||
argument = "my unescaped config";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
cacheRulesFile=home-files/.config/user-tmpfiles.d/home-manager-cache.conf
|
||||
assertFileExists $cacheRulesFile
|
||||
assertFileRegex $cacheRulesFile "^'d' '%C' '-' '-' '-' '4 weeks' $"
|
||||
|
||||
myToolRulesFile=home-files/.config/user-tmpfiles.d/home-manager-myTool.conf
|
||||
assertFileExists $myToolRulesFile
|
||||
assertFileRegex $myToolRulesFile \
|
||||
"^'f+' '%h/.config/myTool.conf' '0644' 'alice' 'users' '-' my\\\\x20unescaped\\\\x20config$"
|
||||
'';
|
||||
}
|
||||
3
tests/modules/misc/tmpfiles/common-stubs.nix
Normal file
3
tests/modules/misc/tmpfiles/common-stubs.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
test.stubs.systemd.outPath = null;
|
||||
}
|
||||
6
tests/modules/misc/tmpfiles/default.nix
Normal file
6
tests/modules/misc/tmpfiles/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
tmpfiles-no-rules = ./no-rules.nix;
|
||||
tmpfiles-basic-rules = ./basic-rules.nix;
|
||||
|
||||
tmpfiles-escaped-argument-warning = ./escaped-argument-warning.nix;
|
||||
}
|
||||
14
tests/modules/misc/tmpfiles/escaped-argument-warning.nix
Normal file
14
tests/modules/misc/tmpfiles/escaped-argument-warning.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
imports = [ ./common-stubs.nix ];
|
||||
|
||||
systemd.user.tmpfiles.settings.foo.path.f.argument = "my\\x20unescaped\\x20config";
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
''
|
||||
The 'systemd.user.tmpfiles.settings.foo.path.f.argument' option
|
||||
appears to contain escape sequences, which will be escaped again.
|
||||
Unescape them if this is not intended. The assigned string is:
|
||||
"my\x20unescaped\x20config"
|
||||
''
|
||||
];
|
||||
}
|
||||
9
tests/modules/misc/tmpfiles/no-rules.nix
Normal file
9
tests/modules/misc/tmpfiles/no-rules.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
imports = [ ./common-stubs.nix ];
|
||||
|
||||
systemd.user.tmpfiles.settings = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/user-tmpfiles.d/
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue