summary refs log tree commit diff
path: root/pkgs/applications/misc/systembus-notify/default.nix
blob: 770cd8584010ca9a2b0afc01e985e762231345e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ 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";

  src = fetchFromGitHub {
    owner = "rfjakob";
    repo = "systembus-notify";
    rev = "v${version}";
    sha256 = "sha256-WzuBw7LXW54CCMgFE9BSJ2skxaz4IA2BcBny63Ihtt0=";
  };

  buildInputs = [ systemd ];

  installPhase = ''
    runHook preInstall

    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;
  };
}