nixos/systembus-notify: add support for system services notifying users

+80 -5
+11
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
··· 251 251 </listitem> 252 252 <listitem> 253 253 <para> 254 + <link xlink:href="https://github.com/rfjakob/systembus-notify">systembus-notify</link>, 255 + allow system level notifications to reach the users. Available 256 + as 257 + <link xlink:href="opt-services.systembus-notify.enable">services.systembus-notify</link>. 258 + Please keep in mind that this service should only be enabled 259 + on machines with fully trusted users, as any local user is 260 + able to DoS user sessions by spamming notifications. 261 + </para> 262 + </listitem> 263 + <listitem> 264 + <para> 254 265 <link xlink:href="https://github.com/audreyt/ethercalc">ethercalc</link>, 255 266 an online collaborative spreadsheet. Available as 256 267 <link xlink:href="options.html#opt-services.ethercalc.enable">services.ethercalc</link>.
+2
nixos/doc/manual/release-notes/rl-2205.section.md
··· 72 72 73 73 - [prosody-filer](https://github.com/ThomasLeister/prosody-filer), a server for handling XMPP HTTP Upload requests. Available at [services.prosody-filer](#opt-services.prosody-filer.enable). 74 74 75 + - [systembus-notify](https://github.com/rfjakob/systembus-notify), allow system level notifications to reach the users. Available as [services.systembus-notify](opt-services.systembus-notify.enable). Please keep in mind that this service should only be enabled on machines with fully trusted users, as any local user is able to DoS user sessions by spamming notifications. 76 + 75 77 - [ethercalc](https://github.com/audreyt/ethercalc), an online collaborative 76 78 spreadsheet. Available as [services.ethercalc](options.html#opt-services.ethercalc.enable). 77 79
+1
nixos/modules/module-list.nix
··· 987 987 ./services/system/nscd.nix 988 988 ./services/system/saslauthd.nix 989 989 ./services/system/self-deploy.nix 990 + ./services/system/systembus-notify.nix 990 991 ./services/system/uptimed.nix 991 992 ./services/torrent/deluge.nix 992 993 ./services/torrent/flexget.nix
+27
nixos/modules/services/system/systembus-notify.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + let 4 + cfg = config.services.systembus-notify; 5 + 6 + inherit (lib) mkEnableOption mkIf; 7 + 8 + in 9 + { 10 + options.services.systembus-notify = { 11 + enable = mkEnableOption '' 12 + System bus notification support 13 + 14 + WARNING: enabling this option (while convenient) should *not* be done on a 15 + machine where you do not trust the other users as it allows any other 16 + local user to DoS your session by spamming notifications. 17 + ''; 18 + }; 19 + 20 + config = mkIf cfg.enable { 21 + systemd = { 22 + packages = with pkgs; [ systembus-notify ]; 23 + 24 + user.services.systembus-notify.wantedBy = [ "graphical-session.target" ]; 25 + }; 26 + }; 27 + }
+39 -5
pkgs/applications/misc/systembus-notify/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub, systemd }: 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , formats 5 + , systemd 6 + }: 7 + 8 + let 9 + ini = formats.ini { }; 2 10 11 + unit = ini.generate "systembus-notify.service" { 12 + Unit = { 13 + Description = "system bus notification daemon"; 14 + }; 15 + 16 + Service = { 17 + Type = "exec"; 18 + ExecStart = "@out@/bin/systembus-notify"; 19 + PrivateTmp = true; 20 + ProtectHome = true; 21 + ProtectSystem = "strict"; 22 + Restart = "on-failure"; 23 + Slice = "background.slice"; 24 + }; 25 + }; 26 + 27 + in 3 28 stdenv.mkDerivation rec { 4 29 pname = "systembus-notify"; 5 30 version = "1.1"; ··· 8 33 owner = "rfjakob"; 9 34 repo = "systembus-notify"; 10 35 rev = "v${version}"; 11 - sha256 = "1pdn45rfpwhrf20hs87qmk2j8sr7ab8161f81019wnypnb1q2fsv"; 36 + sha256 = "sha256-WzuBw7LXW54CCMgFE9BSJ2skxaz4IA2BcBny63Ihtt0="; 12 37 }; 13 38 14 39 buildInputs = [ systemd ]; 15 40 16 41 installPhase = '' 17 42 runHook preInstall 18 - install -Dm755 systembus-notify -t $out/bin 19 - install -Dm644 systembus-notify.desktop -t $out/etc/xdg/autostart 43 + 44 + install -Dm555 -t $out/bin systembus-notify 45 + install -Dm444 -t $out/share/systembus-notify systembus-notify.desktop 46 + 47 + install -d $out/lib/systemd/user 48 + substitute ${unit} $out/lib/systemd/user/${unit.name} \ 49 + --subst-var out 50 + 20 51 runHook postInstall 21 52 ''; 22 53 54 + # requires a running dbus instance 55 + doCheck = false; 56 + 23 57 meta = with lib; { 24 58 description = "System bus notification daemon"; 25 59 homepage = "https://github.com/rfjakob/systembus-notify"; 26 60 license = licenses.mit; 61 + maintainers = with maintainers; [ peterhoeg ]; 27 62 platforms = platforms.linux; 28 - maintainers = with maintainers; []; 29 63 }; 30 64 }