diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 82626809e..4818d8cf4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -266,6 +266,8 @@ /modules/services/network-manager-applet.nix @rycee +/modules/services/notify-osd.nix @imalison + /modules/services/pantalaimon.nix @jojosch /tests/modules/services/pantalaimon @jojosch diff --git a/modules/misc/news.nix b/modules/misc/news.nix index ae63cd2a6..a4f06a468 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -2149,6 +2149,14 @@ in A new module is available: 'services.trayer'. ''; } + + { + time = "2021-07-19T01:30:46+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.notify-osd'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 6114c2425..52dd9d3c9 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -182,6 +182,7 @@ let ./services/muchsync.nix ./services/network-manager-applet.nix ./services/nextcloud-client.nix + ./services/notify-osd.nix ./services/owncloud-client.nix ./services/pantalaimon.nix ./services/parcellite.nix diff --git a/modules/services/notify-osd.nix b/modules/services/notify-osd.nix new file mode 100644 index 000000000..19f5a62b9 --- /dev/null +++ b/modules/services/notify-osd.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.notify-osd; + +in { + meta.maintainers = [ maintainers.imalison ]; + + options = { + services.notify-osd = { + enable = mkEnableOption "notify-osd"; + + package = mkOption { + type = types.package; + default = pkgs.notify-osd; + defaultText = literalExample "pkgs.notify-osd"; + description = '' + Package containing the notify-osd program. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.notify-osd" pkgs + lib.platforms.linux) + ]; + + systemd.user.services.notify-osd = { + Unit = { + Description = "notify-osd"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install.WantedBy = [ "graphical-session.target" ]; + + Service = { + ExecStart = "${cfg.package}/bin/notify-osd"; + Restart = "on-abort"; + }; + }; + }; +}