mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
106 lines
2.3 KiB
Nix
106 lines
2.3 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
|
|
cfg = config.services.rsyslogd;
|
|
|
|
syslogConf = pkgs.writeText "syslog.conf" ''
|
|
$ModLoad imuxsock
|
|
$SystemLogSocketName /run/systemd/journal/syslog
|
|
$WorkDirectory /var/spool/rsyslog
|
|
|
|
${cfg.defaultConfig}
|
|
${cfg.extraConfig}
|
|
'';
|
|
|
|
defaultConf = ''
|
|
# "local1" is used for dhcpd messages.
|
|
local1.* -/var/log/dhcpd
|
|
|
|
mail.* -/var/log/mail
|
|
|
|
*.=warning;*.=err -/var/log/warn
|
|
*.crit /var/log/warn
|
|
|
|
*.*;mail.none;local1.none -/var/log/messages
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.rsyslogd = {
|
|
|
|
enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to enable syslogd. Note that systemd also logs
|
|
syslog messages, so you normally don't need to run syslogd.
|
|
'';
|
|
};
|
|
|
|
defaultConfig = lib.mkOption {
|
|
type = lib.types.lines;
|
|
default = defaultConf;
|
|
description = ''
|
|
The default {file}`syslog.conf` file configures a
|
|
fairly standard setup of log files, which can be extended by
|
|
means of {var}`extraConfig`.
|
|
'';
|
|
};
|
|
|
|
extraConfig = lib.mkOption {
|
|
type = lib.types.lines;
|
|
default = "";
|
|
example = "news.* -/var/log/news";
|
|
description = ''
|
|
Additional text appended to {file}`syslog.conf`,
|
|
i.e. the contents of {var}`defaultConfig`.
|
|
'';
|
|
};
|
|
|
|
extraParams = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ ];
|
|
example = [ "-m 0" ];
|
|
description = ''
|
|
Additional parameters passed to {command}`rsyslogd`.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ pkgs.rsyslog ];
|
|
|
|
systemd.services.syslog = {
|
|
description = "Syslog Daemon";
|
|
|
|
requires = [ "syslog.socket" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.rsyslog}/sbin/rsyslogd ${toString cfg.extraParams} -f ${syslogConf} -n";
|
|
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /var/spool/rsyslog";
|
|
# Prevent syslogd output looping back through journald.
|
|
StandardOutput = "null";
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
}
|