aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/networking/openvpn/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/tools/networking/openvpn/default.nix')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/tools/networking/openvpn/default.nix112
1 files changed, 70 insertions, 42 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/tools/networking/openvpn/default.nix b/infra/libkookie/nixpkgs/pkgs/tools/networking/openvpn/default.nix
index c5a15c2f87a8..04ac97003102 100644
--- a/infra/libkookie/nixpkgs/pkgs/tools/networking/openvpn/default.nix
+++ b/infra/libkookie/nixpkgs/pkgs/tools/networking/openvpn/default.nix
@@ -1,14 +1,23 @@
-{ stdenv, fetchurl, fetchpatch, pkgconfig, makeWrapper
-, iproute, lzo, openssl, pam
-, useSystemd ? stdenv.isLinux, systemd ? null, utillinux ? null
-, pkcs11Support ? false, pkcs11helper ? null,
+{ stdenv
+, fetchurl
+, pkg-config
+, makeWrapper
+, runtimeShell
+, iproute ? null
+, lzo
+, openssl
+, pam
+, useSystemd ? stdenv.isLinux
+, systemd ? null
+, util-linux ? null
+, pkcs11Support ? false
+, pkcs11helper ? null
}:
assert useSystemd -> (systemd != null);
assert pkcs11Support -> (pkcs11helper != null);
with stdenv.lib;
-
let
# Check if the script needs to have other binaries wrapped when changing this.
update-resolved = fetchurl {
@@ -16,49 +25,68 @@ let
sha256 = "021qzv1k0zxgv1rmyfpqj3zlzqr28xa7zff1n7vrbjk36ijylpsc";
};
-in stdenv.mkDerivation rec {
- pname = "openvpn";
- version = "2.4.9";
+ generic = { version, sha256 }:
+ let
+ withIpRoute = stdenv.isLinux && (versionOlder version "2.5");
+ in
+ stdenv.mkDerivation
+ rec {
+ pname = "openvpn";
+ inherit version;
- src = fetchurl {
- url = "https://swupdate.openvpn.net/community/releases/${pname}-${version}.tar.xz";
- sha256 = "1qpbllwlha7cffsd5dlddb8rl22g9rar5zflkz1wrcllhvfkl7v4";
- };
+ src = fetchurl {
+ url = "https://swupdate.openvpn.net/community/releases/${pname}-${version}.tar.xz";
+ inherit sha256;
+ };
+
+ nativeBuildInputs = [ makeWrapper pkg-config ];
- nativeBuildInputs = [ makeWrapper pkgconfig ];
+ buildInputs = [ lzo openssl ]
+ ++ optional stdenv.isLinux pam
+ ++ optional withIpRoute iproute
+ ++ optional useSystemd systemd
+ ++ optional pkcs11Support pkcs11helper;
- buildInputs = [ lzo openssl ]
- ++ optionals stdenv.isLinux [ pam iproute ]
- ++ optional useSystemd systemd
- ++ optional pkcs11Support pkcs11helper;
+ configureFlags = optionals withIpRoute [
+ "--enable-iproute2"
+ "IPROUTE=${iproute}/sbin/ip"
+ ]
+ ++ optional useSystemd "--enable-systemd"
+ ++ optional pkcs11Support "--enable-pkcs11"
+ ++ optional stdenv.isDarwin "--disable-plugin-auth-pam";
- configureFlags = optionals stdenv.isLinux [
- "--enable-iproute2"
- "IPROUTE=${iproute}/sbin/ip" ]
- ++ optional useSystemd "--enable-systemd"
- ++ optional pkcs11Support "--enable-pkcs11"
- ++ optional stdenv.isDarwin "--disable-plugin-auth-pam";
+ postInstall = ''
+ mkdir -p $out/share/doc/openvpn/examples
+ cp -r sample/sample-config-files/ $out/share/doc/openvpn/examples
+ cp -r sample/sample-keys/ $out/share/doc/openvpn/examples
+ cp -r sample/sample-scripts/ $out/share/doc/openvpn/examples
+ '' + optionalString useSystemd ''
+ install -Dm555 ${update-resolved} $out/libexec/update-systemd-resolved
+ wrapProgram $out/libexec/update-systemd-resolved \
+ --prefix PATH : ${makeBinPath [ runtimeShell iproute systemd util-linux ]}
+ '';
- postInstall = ''
- mkdir -p $out/share/doc/openvpn/examples
- cp -r sample/sample-config-files/ $out/share/doc/openvpn/examples
- cp -r sample/sample-keys/ $out/share/doc/openvpn/examples
- cp -r sample/sample-scripts/ $out/share/doc/openvpn/examples
- '' + optionalString useSystemd ''
- install -Dm555 ${update-resolved} $out/libexec/update-systemd-resolved
- wrapProgram $out/libexec/update-systemd-resolved \
- --prefix PATH : ${makeBinPath [ stdenv.shell iproute systemd utillinux ]}
- '';
+ enableParallelBuilding = true;
- enableParallelBuilding = true;
+ meta = with stdenv.lib; {
+ description = "A robust and highly flexible tunneling application";
+ downloadPage = "https://openvpn.net/community-downloads/";
+ homepage = "https://openvpn.net/";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ viric peterhoeg ];
+ platforms = platforms.unix;
+ };
+ };
+
+in
+{
+ openvpn_24 = generic {
+ version = "2.4.9";
+ sha256 = "1qpbllwlha7cffsd5dlddb8rl22g9rar5zflkz1wrcllhvfkl7v4";
+ };
- meta = with stdenv.lib; {
- description = "A robust and highly flexible tunneling application";
- downloadPage = "https://openvpn.net/community-downloads/";
- homepage = "https://openvpn.net/";
- license = licenses.gpl2;
- maintainers = with maintainers; [ viric ];
- platforms = platforms.unix;
- updateWalker = true;
+ openvpn = generic {
+ version = "2.5.0";
+ sha256 = "sha256-AppCbkTWVstOEYkxnJX+b8mGQkdyT1WZ2Z35xMNHj70=";
};
}