1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 iproute2,
6 runtimeShell,
7 systemd,
8 coreutils,
9 util-linux,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "update-systemd-resolved";
14 # when updating this, check if additional binaries need injecting into PATH
15 version = "1.3.0";
16
17 src = fetchFromGitHub {
18 owner = "jonathanio";
19 repo = "update-systemd-resolved";
20 rev = "v${version}";
21 hash = "sha256-lYJTR3oBmpENcqNHa9PFXsw7ly6agwjBWf4UXf1d8Kc=";
22 };
23
24 # set SCRIPT_NAME in case we are wrapped and inject PATH
25 patches = [
26 ./update-systemd-resolved.patch
27 ];
28
29 PREFIX = "${placeholder "out"}/libexec/openvpn";
30
31 postInstall = ''
32 substituteInPlace ${PREFIX}/update-systemd-resolved \
33 --subst-var-by PATH ${
34 lib.makeBinPath [
35 coreutils
36 iproute2
37 runtimeShell
38 systemd
39 util-linux
40 ]
41 }
42 '';
43
44 meta = with lib; {
45 description = "Helper script for OpenVPN to directly update the DNS settings of a link through systemd-resolved via DBus";
46 homepage = "https://github.com/jonathanio/update-systemd-resolved";
47 license = licenses.gpl3Only;
48 maintainers = with maintainers; [ eadwu ];
49 platforms = platforms.linux;
50 };
51}