mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
logrotate: run through nixpkgs-fmt
Running once now will make further patches formatting easier
This commit is contained in:
parent
b457d917dc
commit
3a2fa0d049
@ -5,7 +5,7 @@ with lib;
|
|||||||
let
|
let
|
||||||
cfg = config.services.logrotate;
|
cfg = config.services.logrotate;
|
||||||
|
|
||||||
pathOpts = { name, ... }: {
|
pathOpts = { name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
@ -98,8 +98,8 @@ let
|
|||||||
|
|
||||||
paths = sortProperties (attrValues (filterAttrs (_: pathOpts: pathOpts.enable) cfg.paths));
|
paths = sortProperties (attrValues (filterAttrs (_: pathOpts: pathOpts.enable) cfg.paths));
|
||||||
configText = concatStringsSep "\n" (
|
configText = concatStringsSep "\n" (
|
||||||
[ "missingok" "notifempty" cfg.extraConfig ] ++ (map mkConf paths)
|
[ "missingok" "notifempty" cfg.extraConfig ] ++ (map mkConf paths)
|
||||||
);
|
);
|
||||||
configFile = pkgs.writeText "logrotate.conf" configText;
|
configFile = pkgs.writeText "logrotate.conf" configText;
|
||||||
|
|
||||||
mailOption =
|
mailOption =
|
||||||
@ -124,7 +124,7 @@ in
|
|||||||
|
|
||||||
paths = mkOption {
|
paths = mkOption {
|
||||||
type = with types; attrsOf (submodule pathOpts);
|
type = with types; attrsOf (submodule pathOpts);
|
||||||
default = {};
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Attribute set of paths to rotate. The order each block appears in the generated configuration file
|
Attribute set of paths to rotate. The order each block appears in the generated configuration file
|
||||||
can be controlled by the <link linkend="opt-services.logrotate.paths._name_.priority">priority</link> option
|
can be controlled by the <link linkend="opt-services.logrotate.paths._name_.priority">priority</link> option
|
||||||
@ -163,13 +163,16 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
assertions = mapAttrsToList (name: pathOpts:
|
assertions = mapAttrsToList
|
||||||
{ assertion = (pathOpts.user != null) == (pathOpts.group != null);
|
(name: pathOpts:
|
||||||
message = ''
|
{
|
||||||
If either of `services.logrotate.paths.${name}.user` or `services.logrotate.paths.${name}.group` are specified then *both* must be specified.
|
assertion = (pathOpts.user != null) == (pathOpts.group != null);
|
||||||
'';
|
message = ''
|
||||||
}
|
If either of `services.logrotate.paths.${name}.user` or `services.logrotate.paths.${name}.group` are specified then *both* must be specified.
|
||||||
) cfg.paths;
|
'';
|
||||||
|
}
|
||||||
|
)
|
||||||
|
cfg.paths;
|
||||||
|
|
||||||
systemd.services.logrotate = {
|
systemd.services.logrotate = {
|
||||||
description = "Logrotate Service";
|
description = "Logrotate Service";
|
||||||
|
Loading…
Reference in New Issue
Block a user