From 87cf73bd1a9c713278a5247168d76ad94b32d1a1 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 9 Aug 2018 17:09:11 +0200 Subject: [PATCH] networkmanager-openconnect: clean up --- .../network-manager/openconnect/default.nix | 29 +++++++++---------- .../openconnect/fix-paths.patch | 20 +++++++++++++ 2 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 pkgs/tools/networking/network-manager/openconnect/fix-paths.patch diff --git a/pkgs/tools/networking/network-manager/openconnect/default.nix b/pkgs/tools/networking/network-manager/openconnect/default.nix index ad15723dd331..23d4c816a20d 100644 --- a/pkgs/tools/networking/network-manager/openconnect/default.nix +++ b/pkgs/tools/networking/network-manager/openconnect/default.nix @@ -1,5 +1,5 @@ -{ stdenv, fetchurl, openconnect, intltool, pkgconfig, networkmanager, libsecret -, withGnome ? true, gnome3, sysctl, kmod }: +{ stdenv, fetchurl, substituteAll, openconnect, intltool, pkgconfig, networkmanager, libsecret +, withGnome ? true, gnome3, kmod }: let pname = "NetworkManager-openconnect"; @@ -12,24 +12,22 @@ in stdenv.mkDerivation rec { sha256 = "15j98wwspv6mcmy91w30as5qc1bzsnhlk060xhjy4qrvd37y0xx1"; }; - buildInputs = [ openconnect networkmanager libsecret ] - ++ stdenv.lib.optionals withGnome [ gnome3.gtk gnome3.libgnome-keyring ]; + patches = [ + (substituteAll { + src = ./fix-paths.patch; + inherit kmod openconnect; + }) + ]; + + buildInputs = [ openconnect networkmanager ] + ++ stdenv.lib.optionals withGnome [ gnome3.gtk libsecret ]; nativeBuildInputs = [ intltool pkgconfig ]; configureFlags = [ - "${if withGnome then "--with-gnome --with-gtkver=3" else "--without-gnome"}" - "--disable-static" + "--with-gnome=${if withGnome then "yes" else "no"}" ]; - preConfigure = '' - substituteInPlace "configure" \ - --replace "/sbin/sysctl" "${sysctl}/bin/sysctl" - substituteInPlace "src/nm-openconnect-service.c" \ - --replace "/usr/sbin/openconnect" "${openconnect}/bin/openconnect" \ - --replace "/sbin/modprobe" "${kmod}/bin/modprobe" - ''; - passthru = { updateScript = gnome3.updateScript { packageName = pname; @@ -37,8 +35,9 @@ in stdenv.mkDerivation rec { }; }; - meta = { + meta = with stdenv.lib; { description = "NetworkManager's OpenConnect plugin"; inherit (networkmanager.meta) maintainers platforms; + license = licenses.gpl2Plus; }; } diff --git a/pkgs/tools/networking/network-manager/openconnect/fix-paths.patch b/pkgs/tools/networking/network-manager/openconnect/fix-paths.patch new file mode 100644 index 000000000000..9b342f5bd08b --- /dev/null +++ b/pkgs/tools/networking/network-manager/openconnect/fix-paths.patch @@ -0,0 +1,20 @@ +--- a/src/nm-openconnect-service.c ++++ b/src/nm-openconnect-service.c +@@ -60,7 +60,7 @@ + + static const char *openconnect_binary_paths[] = + { +- "/usr/bin/openconnect", ++ "@openconnect@/bin/openconnect", + "/usr/sbin/openconnect", + "/usr/local/bin/openconnect", + "/usr/local/sbin/openconnect", +@@ -734,7 +734,7 @@ + + _LOGD ("nm-openconnect-service (version " DIST_VERSION ") starting..."); + +- if (system ("/sbin/modprobe tun") == -1) ++ if (system ("@kmod@/bin/modprobe tun") == -1) + exit (EXIT_FAILURE); + + if (bus_name)