summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/networking/openvpn/update-resolv-conf.nix
blob: c31915e0a7efc8c560effe580abe157506449e7e (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
{
  stdenv,
  lib,
  fetchFromGitHub,
  makeWrapper,
  openresolv,
  coreutils,
  systemd,
}:

let
  binPath = lib.makeBinPath [
    coreutils
    openresolv
    systemd
  ];

in
stdenv.mkDerivation {
  pname = "update-resolv-conf";
  version = "unstable-2017-06-21";

  src = fetchFromGitHub {
    owner = "alfredopalhares";
    repo = "openvpn-update-resolv-conf";
    rev = "43093c2f970bf84cd374e18ec05ac6d9cae444b8";
    sha256 = "1lf66bsgv2w6nzg1iqf25zpjf4ckcr45adkpgdq9gvhkfnvlp8av";
  };

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    install -Dm555 update-resolv-conf.sh $out/libexec/openvpn/update-resolv-conf
    install -Dm555 update-systemd-network.sh $out/libexec/openvpn/update-systemd-network

    for i in $out/libexec/openvpn/*; do
      wrapProgram $i --prefix PATH : ${binPath}
    done
  '';

  meta = {
    description = "Script to update your /etc/resolv.conf with DNS settings that come from the received push dhcp-options";
    homepage = "https://github.com/alfredopalhares/openvpn-update-resolv-conf/";
    maintainers = [ ];
    license = lib.licenses.gpl2Only;
    platforms = lib.platforms.unix;
  };
}