Commit df2f1a85 authored by Yongun Seong's avatar Yongun Seong Committed by Peter Hoeg
Browse files

openvpn: cleanup unnecessary generic function

parent 327b7e01
Loading
Loading
Loading
Loading
+40 −63
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
, stdenv
, fetchurl
, pkg-config
, iproute2
, libcap_ng
, libnl
, lz4
@@ -18,36 +17,25 @@
}:

let
  inherit (lib) versionOlder optional optionals optionalString;

  generic = { version, sha256, extraBuildInputs ? [ ] }:
    let
      withIpRoute = stdenv.isLinux && (versionOlder version "2.5.4");
  inherit (lib) optional optionals optionalString;
in
    stdenv.mkDerivation
      rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "openvpn";
        inherit version;
  version = "2.6.8";

  src = fetchurl {
          url = "https://swupdate.openvpn.net/community/releases/${pname}-${version}.tar.gz";
          inherit sha256;
    url = "https://swupdate.openvpn.net/community/releases/openvpn-${finalAttrs.version}.tar.gz";
    hash = "sha256-Xt4VZcim2IAQD38jUxen7p7qg9UFLbVUfxOp52r3gF0=";
  };

  nativeBuildInputs = [ pkg-config ];

        buildInputs = [ lz4 lzo ]
  buildInputs = [ lz4 lzo openssl ]
    ++ optionals stdenv.isLinux [ libcap_ng libnl pam ]
          ++ optional withIpRoute iproute2
    ++ optional useSystemd systemd
          ++ optional pkcs11Support pkcs11helper
          ++ extraBuildInputs;
    ++ optional pkcs11Support pkcs11helper;

        configureFlags = optionals withIpRoute [
          "--enable-iproute2"
          "IPROUTE=${iproute2}/sbin/ip"
        ]
        ++ optional useSystemd "--enable-systemd"
  configureFlags = optional useSystemd "--enable-systemd"
    ++ optional pkcs11Support "--enable-pkcs11"
    ++ optional stdenv.isDarwin "--disable-plugin-auth-pam";

@@ -64,27 +52,16 @@ let

  enableParallelBuilding = true;

  passthru.tests = {
    inherit (nixosTests) initrd-network-openvpn systemd-initrd-networkd-openvpn;
  };

  meta = with lib; {
    description = "A robust and highly flexible tunneling application";
          mainProgram = "openvpn";
    downloadPage = "https://openvpn.net/community-downloads/";
    homepage = "https://openvpn.net/";
    license = licenses.gpl2Only;
    maintainers = with maintainers; [ viric peterhoeg ];
    platforms = platforms.unix;
  };
      };

in
{
  openvpn = (generic {
    version = "2.6.8";
    sha256 = "sha256-Xt4VZcim2IAQD38jUxen7p7qg9UFLbVUfxOp52r3gF0=";
    extraBuildInputs = [ openssl ];
  }).overrideAttrs
    (_: {
      passthru.tests = {
        inherit (nixosTests) initrd-network-openvpn systemd-initrd-networkd-openvpn;
      };
    });
}
})
+1 −2
Original line number Diff line number Diff line
@@ -11672,8 +11672,7 @@ with pkgs;
  opentsdb = callPackage ../tools/misc/opentsdb { };
  inherit (callPackages ../tools/networking/openvpn {})
    openvpn;
  openvpn = callPackage ../tools/networking/openvpn {};
  openvpn3 = callPackage ../tools/networking/openvpn3 { };