From 59be1f4983ee3689de3172716a6c7e95a6a37bb7 Mon Sep 17 00:00:00 2001 From: Ctem Date: Sun, 8 Aug 2021 09:44:36 +0900 Subject: [PATCH] dunst: add option to read alternative configuration file (#2113) --- modules/services/dunst.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix index cf832f4bf..0f09d4146 100644 --- a/modules/services/dunst.nix +++ b/modules/services/dunst.nix @@ -64,6 +64,21 @@ in { description = "Package providing dunst."; }; + configFile = mkOption { + type = with types; either str path; + default = "${config.xdg.configHome}/dunst/dunstrc"; + defaultText = "$XDG_CONFIG_HOME/dunst/dunstrc"; + description = '' + Path to the configuration file read by dunst. + + Note that the configuration generated by Home Manager will be + written to $XDG_CONFIG_HOME/dunst/dunstrc + regardless. This allows using a mutable configuration file generated + from the immutable one, useful in scenarios where live reloading is + desired. + ''; + }; + iconTheme = mkOption { type = themeType; default = hicolorTheme; @@ -88,7 +103,8 @@ in { }; }; default = { }; - description = "Configuration written to ~/.config/dunst/dunstrc"; + description = + "Configuration written to $XDG_CONFIG_HOME/dunst/dunstrc."; example = literalExample '' { global = { @@ -165,7 +181,7 @@ in { Service = { Type = "dbus"; BusName = "org.freedesktop.Notifications"; - ExecStart = "${cfg.package}/bin/dunst"; + ExecStart = "${cfg.package}/bin/dunst -config ${cfg.configFile}"; Environment = optionalString (cfg.waylandDisplay != "") "WAYLAND_DISPLAY=${cfg.waylandDisplay}"; };