nixos/logrotate docs: clarify settings

I found the description text of the freeform settings a bit unclear
regarding the priority and ordering of sections:
It was not immediately clear to me that the `priority` was a NixOS
module-level sub option instead of a logrotate-native configuration
directive.

To clarify this, I extend the examples and higlight `priority` as a
module option.
This commit is contained in:
Oliver Schmidt 2024-04-07 00:16:41 +02:00
parent 8c3463dec8
commit 694bef76b9
1 changed files with 13 additions and 2 deletions

View File

@ -104,9 +104,12 @@ in
default = { };
description = lib.mdDoc ''
logrotate freeform settings: each attribute here will define its own section,
ordered by priority, which can either define files to rotate with their settings
ordered by {option}`services.logrotate.settings.<name>.priority`,
which can either define files to rotate with their settings
or settings common to all further files settings.
Refer to <https://linux.die.net/man/8/logrotate> for details.
All attribute names not explicitly defined as sub-options here are passed through
as logrotate config directives,
refer to <https://linux.die.net/man/8/logrotate> for details.
'';
example = literalExpression ''
{
@ -125,6 +128,14 @@ in
"/var/log/second.log"
];
};
# specify custom order of sections
"/var/log/myservice/*.log" = {
# ensure lower priority
priority = 110;
postrotate = '''
systemctl reload myservice
''';
};
};
'';
type = types.attrsOf (types.submodule ({ name, ... }: {