summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/networking/murmur.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2018-04-11 17:41:42 +0300
committerNikolay Amiantov <ab@fmap.me>2019-05-30 15:43:32 +0300
commitf23c110692c66a278c1ffcd57d880b5ed0803b06 (patch)
tree15a5fee50f19be142668341ce94a610c411d8211 /nixos/modules/services/networking/murmur.nix
parentecb99304ff365a23ea82f832679becde06d1e5f6 (diff)
murmur service: log to journald by default
Save an option to log to file with new `logFile` option. As a side effect deprecate `pidfile` option and instead use systemd's RuntimeDirectory.
Diffstat (limited to 'nixos/modules/services/networking/murmur.nix')
-rw-r--r--nixos/modules/services/networking/murmur.nix28
1 files changed, 12 insertions, 16 deletions
diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix
index a6e90feff7ea..7ac4d0c6419d 100644
--- a/nixos/modules/services/networking/murmur.nix
+++ b/nixos/modules/services/networking/murmur.nix
@@ -4,6 +4,7 @@ with lib;
let
cfg = config.services.murmur;
+ forking = cfg.logFile != null;
configFile = pkgs.writeText "murmurd.ini" ''
database=/var/lib/murmur/murmur.sqlite
dbDriver=QSQLITE
@@ -12,8 +13,8 @@ let
autobanTimeframe=${toString cfg.autobanTimeframe}
autobanTime=${toString cfg.autobanTime}
- logfile=/var/log/murmur/murmurd.log
- pidfile=${cfg.pidfile}
+ logfile=${optionalString (cfg.logFile != null) cfg.logFile}
+ ${optionalString forking "pidfile=/run/murmur/murmurd.pid"}
welcometext="${cfg.welcometext}"
port=${toString cfg.port}
@@ -78,10 +79,11 @@ in
description = "The amount of time an IP ban lasts (in seconds).";
};
- pidfile = mkOption {
- type = types.path;
- default = "/run/murmur/murmurd.pid";
- description = "Path to PID file for Murmur daemon.";
+ logFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ example = "/var/log/murmur/murmurd.log";
+ description = "Path to the log file for Murmur daemon. Empty means log to journald.";
};
welcometext = mkOption {
@@ -251,19 +253,13 @@ in
after = [ "network-online.target "];
serviceConfig = {
- Type = "forking";
- RuntimeDirectory = "murmur";
- PIDFile = cfg.pidfile;
- Restart = "always";
+ # murmurd doesn't fork when logging to the console.
+ Type = if forking then "forking" else "simple";
+ PIDFile = mkIf forking "/run/murmur/murmurd.pid";
+ RuntimeDirectory = mkIf forking "murmur";
User = "murmur";
ExecStart = "${pkgs.murmur}/bin/murmurd -ini ${configFile}";
- PermissionsStartOnly = true;
};
-
- preStart = ''
- mkdir -p /var/log/murmur
- chown -R murmur /var/log/murmur
- '';
};
};
}