summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2021-07-12 15:34:26 +0800
committerPeter Hoeg <peter@hoeg.com>2022-03-13 20:21:21 +0800
commit27e32bbfde6c0c27c78859b23943e79b84e3c860 (patch)
treee2052ea4b57650110765c3a2679988ea97fc89de /nixos/modules
parent8d0f7b0cdad909b3d7d4904909a0361e4673026c (diff)
nixos/systembus-notify: add support for system services notifying users
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/system/systembus-notify.nix27
2 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index ff95d6500b9c..13703968167c 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -987,6 +987,7 @@
./services/system/nscd.nix
./services/system/saslauthd.nix
./services/system/self-deploy.nix
+ ./services/system/systembus-notify.nix
./services/system/uptimed.nix
./services/torrent/deluge.nix
./services/torrent/flexget.nix
diff --git a/nixos/modules/services/system/systembus-notify.nix b/nixos/modules/services/system/systembus-notify.nix
new file mode 100644
index 000000000000..e918bc552ece
--- /dev/null
+++ b/nixos/modules/services/system/systembus-notify.nix
@@ -0,0 +1,27 @@
+{ config, lib, pkgs, ... }:
+
+let
+ cfg = config.services.systembus-notify;
+
+ inherit (lib) mkEnableOption mkIf;
+
+in
+{
+ options.services.systembus-notify = {
+ enable = mkEnableOption ''
+ System bus notification support
+
+ WARNING: enabling this option (while convenient) should *not* be done on a
+ machine where you do not trust the other users as it allows any other
+ local user to DoS your session by spamming notifications.
+ '';
+ };
+
+ config = mkIf cfg.enable {
+ systemd = {
+ packages = with pkgs; [ systembus-notify ];
+
+ user.services.systembus-notify.wantedBy = [ "graphical-session.target" ];
+ };
+ };
+}