1{
2 lib,
3 fetchFromGitLab,
4 buildPythonApplication,
5 dbus-python,
6 pygobject3,
7 systemd,
8 wirelesstools,
9 wrapGAppsNoGuiHook,
10}:
11
12buildPythonApplication rec {
13 pname = "networkd-notify";
14 version = "unstable-2022-11-29";
15 # There is no setup.py, just a single Python script.
16 format = "other";
17
18 src = fetchFromGitLab {
19 owner = "wavexx";
20 repo = pname;
21 rev = "c2f3e71076a0f51c097064b1eb2505a361c7cc0e";
22 hash = "sha256-fanP1EWERT2Jy4OnMo8OMdR9flginYUgMw+XgmDve3o=";
23 };
24
25 nativeBuildInputs = [
26 wrapGAppsNoGuiHook
27 ];
28
29 propagatedBuildInputs = [
30 dbus-python
31 pygobject3
32 ];
33
34 patchPhase = ''
35 sed -i \
36 -e '/^NETWORKCTL = /c\NETWORKCTL = ["${systemd}/bin/networkctl"]' \
37 -e '/^IWCONFIG = /c\IWCONFIG = ["${wirelesstools}/bin/iwconfig"]' \
38 networkd-notify
39 '';
40
41 dontBuild = true;
42
43 installPhase = ''
44 install -D networkd-notify -t "$out/bin/"
45 install -D -m0644 networkd-notify.desktop -t "$out/share/applications/"
46 '';
47
48 # Let the Python wrapper add gappsWrapperArgs, to avoid two layers of wrapping.
49 dontWrapGApps = true;
50
51 preFixup = ''
52 makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
53 '';
54
55 meta = with lib; {
56 description = "Desktop notification integration for systemd-networkd";
57 mainProgram = "networkd-notify";
58 homepage = "https://gitlab.com/wavexx/networkd-notify";
59 maintainers = with maintainers; [ danc86 ];
60 license = licenses.gpl3;
61 platforms = platforms.linux;
62 };
63}