1{ lib
2, stdenv
3, fetchgit
4, coreutils
5, gawk
6, gnugrep
7, iproute2
8, makeWrapper
9, nettools
10, openresolv
11, systemd
12}:
13
14stdenv.mkDerivation {
15 pname = "vpnc-scripts";
16 version = "unstable-2023-01-03";
17
18 src = fetchgit {
19 url = "https://gitlab.com/openconnect/vpnc-scripts.git";
20 rev = "22756827315bc875303190abb3756b5b1dd147ce";
21 hash = "sha256-EWrDyXg47Ur9mFutaG8+oYOCAW9AZowzwwJp3YbogIY=";
22 };
23
24 nativeBuildInputs = [ makeWrapper ];
25
26 installPhase = ''
27 mkdir -p $out/bin
28 cp vpnc-script $out/bin
29 '';
30
31 preFixup = ''
32 substituteInPlace $out/bin/vpnc-script \
33 --replace "which" "type -P"
34 '' + lib.optionalString stdenv.isLinux ''
35 substituteInPlace $out/bin/vpnc-script \
36 --replace "/sbin/resolvconf" "${openresolv}/bin/resolvconf" \
37 --replace "/usr/bin/resolvectl" "${systemd}/bin/resolvectl"
38 '' + ''
39 wrapProgram $out/bin/vpnc-script \
40 --prefix PATH : "${lib.makeBinPath ([ nettools gawk coreutils gnugrep ] ++ lib.optionals stdenv.isLinux [ openresolv iproute2 ])}"
41 '';
42
43 meta = with lib; {
44 homepage = "https://www.infradead.org/openconnect/";
45 description = "Script for vpnc to configure the network routing and name service";
46 license = licenses.gpl2Only;
47 maintainers = with maintainers; [ jerith666 ];
48 platforms = platforms.linux ++ platforms.darwin;
49 };
50}