blob: 8f9cece27169068d7fe84650058e6ed7928330b5 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
{ lib
, stdenv
, fetchFromGitLab
, fetchpatch
, python3Packages
, asciidoc
, makeWrapper
, iw
}:
stdenv.mkDerivation rec {
pname = "networkd-dispatcher";
version = "2.2.4";
src = fetchFromGitLab {
domain = "gitlab.com";
owner = "craftyguy";
repo = pname;
rev = version;
hash = "sha256-yO9/HlUkaQmW/n9N3vboHw//YMzBjxIHA2zAxgZNEv0=";
};
patches = [
# Support rule files in NixOS store paths. Required for the networkd-dispatcher
# module to work
./support_nix_store_path.patch
# Fixes: networkd-dispatcher.service: Got notification message from PID XXXX, but reception only permitted for main PID XXXX
(fetchpatch {
url = "https://gitlab.com/craftyguy/networkd-dispatcher/-/commit/4796368d88da516fafda321d8565ae8ccf465120.patch";
hash = "sha256-RAoCSmZCjTXxVKesatWjiePY4xECGn5pwvOOV0clL+Q=";
})
];
postPatch = ''
# Fix paths in systemd unit file
substituteInPlace networkd-dispatcher.service \
--replace "/usr/bin/networkd-dispatcher" "$out/bin/networkd-dispatcher" \
--replace "/etc/conf.d" "$out/etc/conf.d"
# Remove conditions on existing rules path
sed -i '/ConditionPathExistsGlob/g' networkd-dispatcher.service
'';
nativeBuildInputs = [
asciidoc
makeWrapper
python3Packages.wrapPython
];
checkInputs = with python3Packages; [
dbus-python
iw
mock
pygobject3
pytestCheckHook
];
pythonPath = with python3Packages; [
configparser
dbus-python
pygobject3
];
installPhase = ''
runHook preInstall
install -D -m755 -t $out/bin networkd-dispatcher
install -Dm644 networkd-dispatcher.service $out/lib/systemd/system/networkd-dispatcher.service
install -Dm644 networkd-dispatcher.conf $out/etc/conf.d/networkd-dispatcher.conf
install -D networkd-dispatcher.8 -t $out/share/man/man8/
runHook postInstall
'';
doCheck = true;
postFixup = ''
wrapPythonPrograms
wrapProgram $out/bin/networkd-dispatcher --prefix PATH : ${lib.makeBinPath [ iw ]}
'';
meta = with lib; {
description = "Dispatcher service for systemd-networkd connection status changes";
homepage = "https://gitlab.com/craftyguy/networkd-dispatcher";
license = licenses.gpl3Only;
platforms = platforms.linux;
maintainers = with maintainers; [ onny ];
};
}
|