3
0
Fork 0
forked from mirrors/nixpkgs

openconnect: adapt vpnc-script for use in nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Matt McHenry 2020-12-02 14:24:12 -05:00
parent c2e076a767
commit 6160d7374f
3 changed files with 45 additions and 9 deletions

View file

@ -8,7 +8,7 @@
, libxml2
, stoken
, zlib
, fetchgit
, vpnc-scripts
, PCSC
, head ? false
, fetchFromGitLab
@ -17,13 +17,7 @@
assert (openssl != null) == (gnutls == null);
let vpnc = fetchgit {
url = "git://git.infradead.org/users/dwmw2/vpnc-scripts.git";
rev = "c0122e891f7e033f35f047dad963702199d5cb9e";
sha256 = "11b1ls012mb704jphqxjmqrfbbhkdjb64j2q4k8wb5jmja8jnd14";
};
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "openconnect${lib.optionalString head "-head"}";
version = if head then "2021-05-05" else "8.10";
@ -42,7 +36,7 @@ in stdenv.mkDerivation rec {
outputs = [ "out" "dev" ];
configureFlags = [
"--with-vpnc-script=${vpnc}/vpnc-script"
"--with-vpnc-script=${vpnc-scripts}/bin/vpnc-script"
"--disable-nls"
"--without-openssl-version-check"
];

View file

@ -0,0 +1,40 @@
{ lib, stdenv, fetchgit
, makeWrapper
, nettools, gawk, openresolv, coreutils, gnugrep
}:
stdenv.mkDerivation {
pname = "vpnc-scripts";
version = "unstable-2020-02-21";
src = fetchgit {
url = "git://git.infradead.org/users/dwmw2/vpnc-scripts.git";
rev = "c0122e891f7e033f35f047dad963702199d5cb9e";
sha256 = "11b1ls012mb704jphqxjmqrfbbhkdjb64j2q4k8wb5jmja8jnd14";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/bin
cp vpnc-script $out/bin
'';
preFixup = ''
substituteInPlace $out/bin/vpnc-script \
--replace "which" "type -P"
'' + lib.optionalString stdenv.isLinux ''
substituteInPlace $out/bin/vpnc-script \
--replace "/sbin/resolvconf" "${openresolv}/bin/resolvconf"
'' + ''
wrapProgram $out/bin/vpnc-script \
--prefix PATH : "${lib.makeBinPath ([ nettools gawk coreutils gnugrep ] ++ lib.optionals stdenv.isLinux [ openresolv ])}"
'';
meta = with lib; {
description = "script for vpnc to configure the network routing and name service";
homepage = "https://www.infradead.org/openconnect/";
license = licenses.gpl2Only;
maintainers = with maintainers; [ jerith666 ];
platforms = platforms.linux ++ platforms.darwin;
};
}

View file

@ -9456,6 +9456,8 @@ in
vpnc = callPackage ../tools/networking/vpnc { };
vpnc-scripts = callPackage ../tools/networking/vpnc-scripts { };
vpn-slice = python3Packages.callPackage ../tools/networking/vpn-slice { };
vp = callPackage ../applications/misc/vp {