aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/vpn.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2019-03-01 19:30:51 -0500
committerLeo Famulari <leo@famulari.name>2019-03-01 19:31:01 -0500
commit7a0479bb7b8535acad2bf36c7a0b0498a1313422 (patch)
tree812316053f4bf5386b01b56147b3e6bd4bd83951 /gnu/packages/vpn.scm
parent4fdd4d33125099fa2b5e5ea98a0c2bc16451b344 (diff)
downloadgnu-guix-7a0479bb7b8535acad2bf36c7a0b0498a1313422.tar
gnu-guix-7a0479bb7b8535acad2bf36c7a0b0498a1313422.tar.gz
gnu: Add WireGuard.
* gnu/packages/vpn.scm (wireguard): New variable.
Diffstat (limited to 'gnu/packages/vpn.scm')
-rw-r--r--gnu/packages/vpn.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index e135fdef17..f15b111a92 100644
--- a/gnu/packages/vpn.scm
+++ b/gnu/packages/vpn.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2018 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
+;;; Copyright © 2019 Leo Famulari <leo@famulari.name>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -449,3 +450,68 @@ The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
;; This project contains a bundled lwIP. lwIP is also released under the
;; 3-clause BSD license.
(license license:bsd-3)))
+
+(define-public wireguard
+ (package
+ (name "wireguard")
+ (version "0.0.20190123")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://git.zx2c4.com/WireGuard/snapshot/"
+ "WireGuard-" version ".tar.xz"))
+ (sha256
+ (base32
+ "16yzzy4i0z2zslmyr3kppkvkrxryzwdil6v270w9w5mg65v3rlgd"))))
+ (build-system gnu-build-system)
+ (outputs '("out" ; The WireGuard userspace tools
+ "kernel-patch")) ; A patch to build Linux with WireGuard support
+ (arguments
+ `(#:make-flags
+ (list "CC=gcc"
+ "WITH_BASHCOMPLETION=yes"
+ ;; Build and install the helper script wg-quick(8).
+ "WITH_WGQUICK=yes"
+ (string-append "PREFIX=" (assoc-ref %outputs "out"))
+ (string-append "SYSCONFDIR=" (assoc-ref %outputs "out") "/etc"))
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 popen)
+ (ice-9 textual-ports))
+ #:phases
+ (modify-phases %standard-phases
+ ;; There is no ./configure script.
+ (delete 'configure)
+ ;; Until WireGuard is added to the upstream Linux kernel, it is
+ ;; distributed as a kernel patch generated by this script.
+ (add-after 'patch-source-shebangs 'make-patch
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((output (string-append (assoc-ref outputs "kernel-patch")
+ "/wireguard.patch"))
+ (patch-builder "./contrib/kernel-tree/create-patch.sh")
+ (port (open-input-pipe patch-builder))
+ (str (get-string-all port)))
+ (close-pipe port)
+ (mkdir-p (dirname output))
+ (call-with-output-file output
+ (lambda (port)
+ (format port "~a" str))))
+ #t))
+ (add-after 'make-patch 'chdir
+ (lambda _
+ (chdir "src/tools")
+ #t))
+ ;; Otherwise the 'install-license-file' phase installs nothing.
+ ;; <https://bugs.gnu.org/34703>
+ (add-after 'install 'reset-cwd
+ (lambda _
+ (chdir "../..")
+ #t)))))
+ (inputs
+ `(("libmnl" ,libmnl)))
+ (home-page "https://www.wireguard.com/")
+ (synopsis "Tools for configuring WireGuard")
+ (description "This package provides the userspace tools for setting and
+retrieving configuration of WireGuard network tunnel interfaces, and a patch
+that can be applied to a Linux kernel source tree in order to build it with
+WireGuard support.")
+ (license license:gpl2)))