From f6d9a910e6dc73a2f893a0ab017c756a87761450 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sun, 14 Sep 2025 04:31:56 +0200 Subject: [PATCH] nixos/murmur: Hard-code log directory to /var/log/murmur The Murmur NixOS module allows logging to a file instead of journald. At the moment any arbitrary directory may be specified by using the `logfile` option, but nothing ensures that the directory exists or proper permissions are configured. Since there is not much reason to specify a custom directory for log files anyway, just use `/var/log/murmur` by using the systemd way. This replaces the option `logfile` with the boolean option `logToFile` as well. Signed-off-by: Felix Singer --- nixos/modules/services/networking/murmur.nix | 26 ++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix index 98387d5acdf8..3879dd7a6bed 100644 --- a/nixos/modules/services/networking/murmur.nix +++ b/nixos/modules/services/networking/murmur.nix @@ -7,7 +7,7 @@ let cfg = config.services.murmur; - forking = cfg.logFile != null; + forking = cfg.logToFile; configFile = pkgs.writeText "murmurd.ini" '' database=${cfg.stateDir}/murmur.sqlite dbDriver=QSQLITE @@ -16,7 +16,7 @@ let autobanTimeframe=${toString cfg.autobanTimeframe} autobanTime=${toString cfg.autobanTime} - logfile=${lib.optionalString (cfg.logFile != null) cfg.logFile} + logfile=${lib.optionalString cfg.logToFile "/var/log/murmur/murmurd.log"} ${lib.optionalString forking "pidfile=/run/murmur/murmurd.pid"} welcometext="${cfg.welcometext}" @@ -51,6 +51,15 @@ let ''; in { + + imports = [ + (lib.mkRemovedOptionModule [ + "services" + "murmur" + "logfile" + ] "This option has been superseded by services.murmur.logToFile") + ]; + options = { services.murmur = { enable = lib.mkEnableOption "Mumble server"; @@ -108,12 +117,7 @@ in description = "The amount of time an IP ban lasts (in seconds)."; }; - logFile = lib.mkOption { - type = lib.types.nullOr lib.types.path; - default = null; - example = "/var/log/murmur/murmurd.log"; - description = "Path to the log file for Murmur daemon. Empty means log to journald."; - }; + logToFile = lib.mkEnableOption "logging to a file instead of journald, which is stored in /var/log/murmur"; welcometext = lib.mkOption { type = lib.types.str; @@ -329,6 +333,8 @@ in EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile; ExecStart = "${cfg.package}/bin/mumble-server -ini /run/murmur/murmurd.ini"; Restart = "always"; + LogsDirectory = lib.mkIf cfg.logToFile "murmur"; + LogsDirectoryMode = "0750"; RuntimeDirectory = "murmur"; RuntimeDirectoryMode = "0700"; User = cfg.user; @@ -403,8 +409,8 @@ in r /run/murmur/murmurd.ini, r ${configFile}, '' - + lib.optionalString (cfg.logFile != null) '' - rw ${cfg.logFile}, + + lib.optionalString cfg.logToFile '' + rw /var/log/murmur/murmurd.log, '' + lib.optionalString (cfg.sslCert != "") '' r ${cfg.sslCert},