git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/systembus-notify: add support for system services notifying users
commit27e32bbfde6c0c27c78859b23943e79b84e3c860 authorPeter Hoeg <peter@hoeg.com> dateMon 12 Jul 2021, 15:34 (5 years ago) parent8d0f7b0
5 files changed+80−5
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml+11 nixos/doc/manual/release-notes/rl-2205.section.md+2 nixos/modules/module-list.nix+1 nixos/modules/services/system/systembus-notify.nix+27 pkgs/applications/misc/systembus-notify/default.nix+39−5
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml+11
@@ -249,6 +249,17 @@
249249 <link linkend="opt-services.prosody-filer.enable">services.prosody-filer</link>.
250250 </para>
251251 </listitem>
252+ <listitem>
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>
252263 <listitem>
253264 <para>
254265 <link xlink:href="https://github.com/audreyt/ethercalc">ethercalc</link>,
nixos/doc/manual/release-notes/rl-2205.section.md+2
@@ -72,6 +72,8 @@ In addition to numerous new and upgraded packages, this release has the followin
7272
7373- [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).
7474
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+
7577- [ethercalc](https://github.com/audreyt/ethercalc), an online collaborative
7678 spreadsheet. Available as [services.ethercalc](options.html#opt-services.ethercalc.enable).
7779
nixos/modules/module-list.nix+1
@@ -987,6 +987,7 @@
987987 ./services/system/nscd.nix
988988 ./services/system/saslauthd.nix
989989 ./services/system/self-deploy.nix
990+ ./services/system/systembus-notify.nix
990991 ./services/system/uptimed.nix
991992 ./services/torrent/deluge.nix
992993 ./services/torrent/flexget.nix
nixos/modules/services/system/systembus-notify.nixnew file+27
@@ -0,0 +1,27 @@
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+}
pkgs/applications/misc/systembus-notify/default.nix+39−5
@@ -1,5 +1,30 @@
1−{ lib, stdenv, fetchFromGitHub, systemd }:
1+{ lib
2+, stdenv
3+, fetchFromGitHub
4+, formats
5+, systemd
6+}:
27
8+let
9+ ini = formats.ini { };
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
328stdenv.mkDerivation rec {
429 pname = "systembus-notify";
530 version = "1.1";
@@ -8,23 +33,32 @@ stdenv.mkDerivation rec {
833 owner = "rfjakob";
934 repo = "systembus-notify";
1035 rev = "v${version}";
11− sha256 = "1pdn45rfpwhrf20hs87qmk2j8sr7ab8161f81019wnypnb1q2fsv";
36+ sha256 = "sha256-WzuBw7LXW54CCMgFE9BSJ2skxaz4IA2BcBny63Ihtt0=";
1237 };
1338
1439 buildInputs = [ systemd ];
1540
1641 installPhase = ''
1742 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+
2051 runHook postInstall
2152 '';
2253
54+ # requires a running dbus instance
55+ doCheck = false;
56+
2357 meta = with lib; {
2458 description = "System bus notification daemon";
2559 homepage = "https://github.com/rfjakob/systembus-notify";
2660 license = licenses.mit;
61+ maintainers = with maintainers; [ peterhoeg ];
2762 platforms = platforms.linux;
28− maintainers = with maintainers; [];
2963 };
3064}