summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-05-19 22:49:54 +0100
committerGitHub <noreply@github.com>2018-05-19 22:49:54 +0100
commit8bcec815bdecdb7a6094ec538860c08b23410378 (patch)
treea38dcb067c9ebbd690b7ab2c8ba6f65ab64eb280 /pkgs/tools
parentb998139b85a7db6f35b2ccdf4d091d889649ebc8 (diff)
parentf8ed43e600228ab415866d4938703fa5eaa7b121 (diff)
downloadnixpkgs-8bcec815bdecdb7a6094ec538860c08b23410378.tar
nixpkgs-8bcec815bdecdb7a6094ec538860c08b23410378.tar.gz
nixpkgs-8bcec815bdecdb7a6094ec538860c08b23410378.tar.bz2
nixpkgs-8bcec815bdecdb7a6094ec538860c08b23410378.tar.lz
nixpkgs-8bcec815bdecdb7a6094ec538860c08b23410378.tar.xz
nixpkgs-8bcec815bdecdb7a6094ec538860c08b23410378.tar.zst
nixpkgs-8bcec815bdecdb7a6094ec538860c08b23410378.zip
Merge pull request #40744 from kirelagin/wireguard-darwin
WireGuard: Make tools available on other platforms
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/networking/wireguard-tools/default.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/tools/networking/wireguard-tools/default.nix b/pkgs/tools/networking/wireguard-tools/default.nix
new file mode 100644
index 00000000000..f34119893c4
--- /dev/null
+++ b/pkgs/tools/networking/wireguard-tools/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, lib, fetchzip, libmnl, useSystemd ? stdenv.isLinux }:
+
+let
+  inherit (lib) optional optionalString;
+in
+
+stdenv.mkDerivation rec {
+  name = "wireguard-tools-${version}";
+  version = "0.0.20180514";
+
+  src = fetchzip {
+    url    = "https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${version}.tar.xz";
+    sha256 = "15z0s1i8qyq1fpw8j6rky53ffrpp3f49zn1022jwdslk4g0ncaaj";
+  };
+
+  preConfigure = "cd src";
+
+  buildInputs = optional stdenv.isLinux libmnl;
+
+  enableParallelBuilding = true;
+
+  makeFlags = [
+    "WITH_BASHCOMPLETION=yes"
+    "WITH_WGQUICK=yes"
+    "WITH_SYSTEMDUNITS=${if useSystemd then "yes" else "no"}"
+    "DESTDIR=$(out)"
+    "PREFIX=/"
+    "-C" "tools"
+  ];
+
+  buildPhase = "make tools";
+
+  postInstall = optionalString useSystemd ''
+    substituteInPlace $out/lib/systemd/system/wg-quick@.service \
+      --replace /usr/bin $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    homepage     = https://www.wireguard.com/;
+    downloadPage = https://git.zx2c4.com/WireGuard/refs/;
+    description  = " Tools for the WireGuard secure network tunnel";
+    maintainers  = with maintainers; [ ericsagnes mic92 zx2c4 ];
+    license      = licenses.gpl2;
+    platforms    = platforms.unix;
+  };
+}