nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 formats,
6 systemd,
7}:
8
9let
10 ini = formats.ini { };
11
12 unit = ini.generate "systembus-notify.service" {
13 Unit = {
14 Description = "system bus notification daemon";
15 };
16
17 Service = {
18 Type = "exec";
19 ExecStart = "@out@/bin/systembus-notify";
20 PrivateTmp = true;
21 # NB. We cannot `ProtectHome`, or it would block session dbus access.
22 InaccessiblePaths = "/home";
23 ReadOnlyPaths = "/run/user";
24 ProtectSystem = "strict";
25 Restart = "on-failure";
26 Slice = "background.slice";
27 };
28 };
29
30in
31stdenv.mkDerivation rec {
32 pname = "systembus-notify";
33 version = "1.1";
34
35 src = fetchFromGitHub {
36 owner = "rfjakob";
37 repo = "systembus-notify";
38 rev = "v${version}";
39 sha256 = "sha256-WzuBw7LXW54CCMgFE9BSJ2skxaz4IA2BcBny63Ihtt0=";
40 };
41
42 buildInputs = [ systemd ];
43
44 installPhase = ''
45 runHook preInstall
46
47 install -Dm555 -t $out/bin systembus-notify
48 install -Dm444 -t $out/share/systembus-notify systembus-notify.desktop
49
50 install -d $out/lib/systemd/user
51 substitute ${unit} $out/lib/systemd/user/${unit.name} \
52 --subst-var out
53
54 runHook postInstall
55 '';
56
57 # requires a running dbus instance
58 doCheck = false;
59
60 meta = with lib; {
61 description = "System bus notification daemon";
62 homepage = "https://github.com/rfjakob/systembus-notify";
63 license = licenses.mit;
64 maintainers = with maintainers; [ peterhoeg ];
65 platforms = platforms.linux;
66 mainProgram = "systembus-notify";
67 };
68}