diff options
author | Peter Hoeg <peter@hoeg.com> | 2021-07-12 15:34:26 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2022-03-13 20:21:21 +0800 |
commit | 27e32bbfde6c0c27c78859b23943e79b84e3c860 (patch) | |
tree | e2052ea4b57650110765c3a2679988ea97fc89de /pkgs/applications/misc | |
parent | 8d0f7b0cdad909b3d7d4904909a0361e4673026c (diff) | |
download | nixpkgs-27e32bbfde6c0c27c78859b23943e79b84e3c860.tar nixpkgs-27e32bbfde6c0c27c78859b23943e79b84e3c860.tar.gz nixpkgs-27e32bbfde6c0c27c78859b23943e79b84e3c860.tar.bz2 nixpkgs-27e32bbfde6c0c27c78859b23943e79b84e3c860.tar.lz nixpkgs-27e32bbfde6c0c27c78859b23943e79b84e3c860.tar.xz nixpkgs-27e32bbfde6c0c27c78859b23943e79b84e3c860.tar.zst nixpkgs-27e32bbfde6c0c27c78859b23943e79b84e3c860.zip |
nixos/systembus-notify: add support for system services notifying users
Diffstat (limited to 'pkgs/applications/misc')
-rw-r--r-- | pkgs/applications/misc/systembus-notify/default.nix | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/pkgs/applications/misc/systembus-notify/default.nix b/pkgs/applications/misc/systembus-notify/default.nix index 6e5405ce988..770cd858401 100644 --- a/pkgs/applications/misc/systembus-notify/default.nix +++ b/pkgs/applications/misc/systembus-notify/default.nix @@ -1,5 +1,30 @@ -{ lib, stdenv, fetchFromGitHub, systemd }: +{ lib +, stdenv +, fetchFromGitHub +, formats +, systemd +}: +let + ini = formats.ini { }; + + unit = ini.generate "systembus-notify.service" { + Unit = { + Description = "system bus notification daemon"; + }; + + Service = { + Type = "exec"; + ExecStart = "@out@/bin/systembus-notify"; + PrivateTmp = true; + ProtectHome = true; + ProtectSystem = "strict"; + Restart = "on-failure"; + Slice = "background.slice"; + }; + }; + +in stdenv.mkDerivation rec { pname = "systembus-notify"; version = "1.1"; @@ -8,23 +33,32 @@ stdenv.mkDerivation rec { owner = "rfjakob"; repo = "systembus-notify"; rev = "v${version}"; - sha256 = "1pdn45rfpwhrf20hs87qmk2j8sr7ab8161f81019wnypnb1q2fsv"; + sha256 = "sha256-WzuBw7LXW54CCMgFE9BSJ2skxaz4IA2BcBny63Ihtt0="; }; buildInputs = [ systemd ]; installPhase = '' runHook preInstall - install -Dm755 systembus-notify -t $out/bin - install -Dm644 systembus-notify.desktop -t $out/etc/xdg/autostart + + install -Dm555 -t $out/bin systembus-notify + install -Dm444 -t $out/share/systembus-notify systembus-notify.desktop + + install -d $out/lib/systemd/user + substitute ${unit} $out/lib/systemd/user/${unit.name} \ + --subst-var out + runHook postInstall ''; + # requires a running dbus instance + doCheck = false; + meta = with lib; { description = "System bus notification daemon"; homepage = "https://github.com/rfjakob/systembus-notify"; license = licenses.mit; + maintainers = with maintainers; [ peterhoeg ]; platforms = platforms.linux; - maintainers = with maintainers; []; }; } |