git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #40744 from kirelagin/wireguard-darwin

WireGuard: Make tools available on other platforms

commit8bcec815bdecdb7a6094ec538860c08b23410378 authorJörg Thalheim <Mic92@users.noreply.github.com> dateSat 19 May 2018, 22:49 (9 years ago) parentb998139f8ed43e
5 files changed+73−63
nixos/modules/services/networking/wireguard.nix+2−2 pkgs/os-specific/linux/wireguard/default.nix+22−59 pkgs/tools/networking/wireguard-tools/default.nix+46 pkgs/top-level/aliases.nix+1 pkgs/top-level/all-packages.nix+2−2
nixos/modules/services/networking/wireguard.nix+2−2
@@ -193,7 +193,7 @@ let
193193 after = [ "network.target" ];
194194 wantedBy = [ "multi-user.target" ];
195195 environment.DEVICE = name;
196− path = with pkgs; [ kmod iproute wireguard ];
196+ path = with pkgs; [ kmod iproute wireguard-tools ];
197197
198198 serviceConfig = {
199199 Type = "oneshot";
@@ -279,7 +279,7 @@ in
279279 config = mkIf (cfg.interfaces != {}) {
280280
281281 boot.extraModulePackages = [ kernel.wireguard ];
282− environment.systemPackages = [ pkgs.wireguard ];
282+ environment.systemPackages = [ pkgs.wireguard-tools ];
283283
284284 systemd.services = mapAttrs' generateUnit cfg.interfaces;
285285
pkgs/os-specific/linux/wireguard/default.nix+22−59
@@ -1,73 +1,36 @@
1−{ stdenv, fetchurl, libmnl, kernel ? null }:
1+{ stdenv, fetchzip, kernel, wireguard-tools }:
22
33# module requires Linux >= 3.10 https://www.wireguard.io/install/#kernel-requirements
4−assert kernel != null -> stdenv.lib.versionAtLeast kernel.version "3.10";
4+assert stdenv.lib.versionAtLeast kernel.version "3.10";
55
6−let
6+stdenv.mkDerivation rec {
77 name = "wireguard-${version}";
8−
98 version = "0.0.20180514";
109
11− src = fetchurl {
12− url = "https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${version}.tar.xz";
13− sha256 = "1nk6yj1gdmpar99zzw39n1v795m6fxsrilg37d02jm780rgbd5g8";
14− };
10+ inherit (wireguard-tools) src;
1511
16− meta = with stdenv.lib; {
17− homepage = https://www.wireguard.com/;
18− downloadPage = https://git.zx2c4.com/WireGuard/refs/;
19− description = "A prerelease of an experimental VPN tunnel which is not to be depended upon for security";
20− maintainers = with maintainers; [ ericsagnes mic92 zx2c4 ];
21− license = licenses.gpl2;
22− platforms = platforms.linux;
23− };
24−
25− module = stdenv.mkDerivation {
26− inherit src meta name;
12+ preConfigure = ''
13+ cd src
14+ sed -i '/depmod/,+1d' Makefile
15+ '';
2716
28− preConfigure = ''
29− cd src
30− sed -i '/depmod/,+1d' Makefile
31− '';
17+ hardeningDisable = [ "pic" ];
3218
33− hardeningDisable = [ "pic" ];
19+ KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
20+ INSTALL_MOD_PATH = "\${out}";
3421
35− KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
36− INSTALL_MOD_PATH = "\${out}";
22+ NIX_CFLAGS = ["-Wno-error=cpp"];
3723
38− NIX_CFLAGS = ["-Wno-error=cpp"];
39−
40− nativeBuildInputs = kernel.moduleBuildDependencies;
41−
42− buildPhase = "make module";
43− };
24+ nativeBuildInputs = kernel.moduleBuildDependencies;
4425
45− tools = stdenv.mkDerivation {
46− inherit src meta name;
26+ buildPhase = "make module";
4727
48− preConfigure = "cd src";
49−
50− buildInputs = [ libmnl ];
51−
52− enableParallelBuilding = true;
53−
54− makeFlags = [
55− "WITH_BASHCOMPLETION=yes"
56− "WITH_WGQUICK=yes"
57− "WITH_SYSTEMDUNITS=yes"
58− "DESTDIR=$(out)"
59− "PREFIX=/"
60− "-C" "tools"
61− ];
62−
63− buildPhase = "make tools";
64−
65− postInstall = ''
66− substituteInPlace $out/lib/systemd/system/wg-quick@.service \
67− --replace /usr/bin $out/bin
68− '';
28+ meta = with stdenv.lib; {
29+ homepage = https://www.wireguard.com/;
30+ downloadPage = https://git.zx2c4.com/WireGuard/refs/;
31+ description = " Tools for the WireGuard secure network tunnel";
32+ maintainers = with maintainers; [ ericsagnes mic92 zx2c4 ];
33+ license = licenses.gpl2;
34+ platforms = platforms.linux;
6935 };
70−
71−in if kernel == null
72− then tools
73− else module
36+}
pkgs/tools/networking/wireguard-tools/default.nixnew file+46
@@ -0,0 +1,46 @@
1+{ stdenv, lib, fetchzip, libmnl, useSystemd ? stdenv.isLinux }:
2+
3+let
4+ inherit (lib) optional optionalString;
5+in
6+
7+stdenv.mkDerivation rec {
8+ name = "wireguard-tools-${version}";
9+ version = "0.0.20180514";
10+
11+ src = fetchzip {
12+ url = "https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${version}.tar.xz";
13+ sha256 = "15z0s1i8qyq1fpw8j6rky53ffrpp3f49zn1022jwdslk4g0ncaaj";
14+ };
15+
16+ preConfigure = "cd src";
17+
18+ buildInputs = optional stdenv.isLinux libmnl;
19+
20+ enableParallelBuilding = true;
21+
22+ makeFlags = [
23+ "WITH_BASHCOMPLETION=yes"
24+ "WITH_WGQUICK=yes"
25+ "WITH_SYSTEMDUNITS=${if useSystemd then "yes" else "no"}"
26+ "DESTDIR=$(out)"
27+ "PREFIX=/"
28+ "-C" "tools"
29+ ];
30+
31+ buildPhase = "make tools";
32+
33+ postInstall = optionalString useSystemd ''
34+ substituteInPlace $out/lib/systemd/system/wg-quick@.service \
35+ --replace /usr/bin $out/bin
36+ '';
37+
38+ meta = with stdenv.lib; {
39+ homepage = https://www.wireguard.com/;
40+ downloadPage = https://git.zx2c4.com/WireGuard/refs/;
41+ description = " Tools for the WireGuard secure network tunnel";
42+ maintainers = with maintainers; [ ericsagnes mic92 zx2c4 ];
43+ license = licenses.gpl2;
44+ platforms = platforms.unix;
45+ };
46+}
pkgs/top-level/aliases.nix+1
@@ -228,6 +228,7 @@ mapAliases (rec {
228228 vorbisTools = vorbis-tools; # added 2016-01-26
229229 wineStaging = wine-staging; # added 2018-01-08
230230 winusb = woeusb; # added 2017-12-22
231+ wireguard = wireguard-tools; # added 2018-05-19
231232 x11 = xlibsWrapper; # added 2015-09
232233 xf86_video_nouveau = xorg.xf86videonouveau; # added 2015-09
233234 xlibs = xorg; # added 2015-09
pkgs/top-level/all-packages.nix+2−2
@@ -5511,6 +5511,8 @@ with pkgs;
55115511
55125512 whois = callPackage ../tools/networking/whois { };
55135513
5514+ wireguard-tools = callPackage ../tools/networking/wireguard-tools { };
5515+
55145516 woff2 = callPackage ../development/web/woff2 { };
55155517
55165518 woof = callPackage ../tools/misc/woof { };
@@ -18557,8 +18559,6 @@ with pkgs;
1855718559 erlang = erlangR18;
1855818560 };
1855918561
18560− wireguard = callPackage ../os-specific/linux/wireguard { };
18561−
1856218562 alsamixer.app = callPackage ../applications/window-managers/windowmaker/dockapps/alsamixer.app.nix { };
1856318563
1856418564 wllvm = callPackage ../development/tools/wllvm { };