summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ne/networkd-notify/package.nix
blob: def199aa7686bf5d1abae0e99a98316d9be3bb5e (plain)
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
{
  lib,
  fetchFromGitLab,
  python3Packages,
  systemd,
  wirelesstools,
  wrapGAppsNoGuiHook,
}:

python3Packages.buildPythonApplication {
  pname = "networkd-notify";
  version = "unstable-2022-11-29";
  # There is no setup.py, just a single Python script.
  pyproject = false;

  src = fetchFromGitLab {
    owner = "wavexx";
    repo = "networkd-notify";
    rev = "c2f3e71076a0f51c097064b1eb2505a361c7cc0e";
    hash = "sha256-fanP1EWERT2Jy4OnMo8OMdR9flginYUgMw+XgmDve3o=";
  };

  nativeBuildInputs = [
    wrapGAppsNoGuiHook
  ];

  dependencies = with python3Packages; [
    dbus-python
    pygobject3
  ];

  patchPhase = ''
    sed -i \
      -e '/^NETWORKCTL = /c\NETWORKCTL = ["${systemd}/bin/networkctl"]' \
      -e '/^IWCONFIG = /c\IWCONFIG = ["${wirelesstools}/bin/iwconfig"]' \
      networkd-notify
  '';

  dontBuild = true;

  installPhase = ''
    install -D networkd-notify -t "$out/bin/"
    install -D -m0644 networkd-notify.desktop -t "$out/share/applications/"
  '';

  # Let the Python wrapper add gappsWrapperArgs, to avoid two layers of wrapping.
  dontWrapGApps = true;

  preFixup = ''
    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
  '';

  meta = {
    description = "Desktop notification integration for systemd-networkd";
    mainProgram = "networkd-notify";
    homepage = "https://gitlab.com/wavexx/networkd-notify";
    maintainers = with lib.maintainers; [ danc86 ];
    license = lib.licenses.gpl3;
    platforms = lib.platforms.linux;
  };
}