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