2016-02-24 05:06:45 +01:00
|
|
|
{ stdenv, fetchurl, makeWrapper,
|
|
|
|
pkgconfig, systemd, gmp, unbound, bison, flex, pam, libevent, libcap_ng, curl, nspr,
|
2016-05-24 10:34:51 +02:00
|
|
|
bash, iproute, iptables, procps, coreutils, gnused, gawk, nss, which, python,
|
2016-02-24 05:06:45 +01:00
|
|
|
docs ? false, xmlto
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
optional = stdenv.lib.optional;
|
2016-08-05 03:48:29 +02:00
|
|
|
version = "3.18";
|
2016-02-24 05:06:45 +01:00
|
|
|
name = "libreswan-${version}";
|
|
|
|
binPath = stdenv.lib.makeBinPath [
|
2016-05-24 10:34:51 +02:00
|
|
|
bash iproute iptables procps coreutils gnused gawk nss.tools which python
|
2016-02-24 05:06:45 +01:00
|
|
|
];
|
|
|
|
in
|
|
|
|
|
|
|
|
assert docs -> xmlto != null;
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit name;
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://download.libreswan.org/${name}.tar.gz";
|
2016-08-05 03:48:29 +02:00
|
|
|
sha256 = "0zginnakxw7m79zrdvfdvliaiyg78zgqfqkks9z5d1rjj5w13xig";
|
2016-02-24 05:06:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ pkgconfig bash iproute iptables systemd coreutils gnused gawk gmp unbound bison flex pam libevent
|
2016-05-24 10:34:51 +02:00
|
|
|
libcap_ng curl nspr nss python ]
|
2016-02-24 05:06:45 +01:00
|
|
|
++ optional docs xmlto;
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
# Correct bash path
|
|
|
|
sed -i -e 's|/bin/bash|/usr/bin/env bash|' mk/config.mk
|
|
|
|
|
|
|
|
# Fix systemd unit directory, and prevent the makefile from trying to reload the systemd daemon
|
|
|
|
sed -i -e 's|UNITDIR=.*$|UNITDIR=$\{out}/etc/systemd/system/|' -e 's|systemctl --system daemon-reload|true|' initsystems/systemd/Makefile
|
|
|
|
|
|
|
|
# Fix the ipsec program from crushing the PATH
|
|
|
|
sed -i -e 's|\(PATH=".*"\):.*$|\1:$PATH|' programs/ipsec/ipsec.in
|
|
|
|
|
|
|
|
# Fix python script to use the correct python
|
|
|
|
sed -i -e 's|#!/usr/bin/python|#!/usr/bin/env python|' -e 's/^\(\W*\)installstartcheck()/\1sscmd = "ss"\n\0/' programs/verify/verify.in
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Set appropriate paths for build
|
|
|
|
preBuild = "export INC_USRLOCAL=\${out}";
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"INITSYSTEM=systemd"
|
|
|
|
(if docs then "all" else "base")
|
|
|
|
];
|
|
|
|
|
|
|
|
installTargets = [ (if docs then "install" else "install-base") ];
|
|
|
|
# Hack to make install work
|
|
|
|
installFlags = [
|
|
|
|
"FINALVARDIR=\${out}/var"
|
|
|
|
"FINALSYSCONFDIR=\${out}/etc"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for i in $out/bin/* $out/libexec/ipsec/*; do
|
|
|
|
wrapProgram "$i" --prefix PATH ':' "$out/bin:${binPath}"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2016-03-02 16:36:22 +01:00
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
2016-02-24 05:06:45 +01:00
|
|
|
meta = {
|
|
|
|
homepage = "https://libreswan.org";
|
|
|
|
description = "A free software implementation of the VPN protocol based on IPSec and the Internet Key Exchange";
|
|
|
|
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin ++ stdenv.lib.platforms.freebsd;
|
|
|
|
maintainers = [ stdenv.lib.maintainers.afranchuk ];
|
|
|
|
};
|
|
|
|
}
|