diff --git a/modules/swaync/module.nix b/modules/swaync/module.nix index 68fc176..05f1ee9 100644 --- a/modules/swaync/module.nix +++ b/modules/swaync/module.nix @@ -9,6 +9,9 @@ let in { _class = "wrapper"; + + imports = [ wlib.modules.systemd ]; + options = { configOptions = lib.mkOption { type = jsonFmt.type; @@ -26,6 +29,11 @@ in type = wlib.types.file config.pkgs; default.content = ""; }; + systemdTarget = lib.mkOption { + type = lib.types.str; + default = "graphical-session.target"; + description = "Systemd unit to bind to"; + }; }; config.package = config.pkgs.swaynotificationcenter; @@ -39,4 +47,17 @@ in lib.maintainers.randomdude ]; config.meta.platforms = lib.platforms.linux; + + config.systemd = { + partOf = [ config.systemdTarget ]; + after = [ config.systemdTarget ]; + wantedBy = [ config.systemdTarget ]; + unitConfig.ConditionEnvironment = "WAYLAND_DISPLAY"; + serviceConfig = { + Type = "dbus"; + BusName = "org.freedesktop.Notifications"; + ExecStart = "${config.exePath} --config ${config.configFile.path} --style ${config."style.css".path}"; + Restart = "on-failure"; + }; + }; }