39 # Tools needed by ipsec scripts
40 binPath = lib.makeBinPath [
52 stdenv.mkDerivation rec {
57 url = "https://download.libreswan.org/${pname}-${version}.tar.gz";
58 hash = "sha256-HO6dQSyJeZ64v3EUUA1cFOAUPpVGBWFj7r45YOf0Y3w=";
88 # needed to patch shebangs
91 ] ++ lib.optional stdenv.hostPlatform.isLinux libselinux;
94 # Replace wget with curl to save a dependency
95 substituteInPlace programs/letsencrypt/letsencrypt.in \
96 --replace-fail 'wget -q -P' '${curl}/bin/curl -s --remote-name-all --output-dir'
102 "SYSTEMUNITDIR=$(out)/etc/systemd/system/"
103 "TMPFILESDIR=$(out)/lib/tmpfiles.d/"
104 "LINUX_VARIANT=nixos"
105 "DEFAULT_DNSSEC_ROOTKEY_FILE=${dns-root-data}/root.key"
108 # Hack to make install work
111 "SYSCONFDIR=\${out}/etc"
115 # Install letsencrypt config files
116 install -m644 -Dt "$out/share/doc/libreswan/letsencrypt" docs/examples/*
120 # Add a PATH to the main "ipsec" script
121 sed -e '0,/^$/{s||export PATH=${binPath}:$PATH|}' \
125 passthru.tests = { inherit (nixosTests) libreswan libreswan-nat; };
128 homepage = "https://libreswan.org";
129 description = "Free software implementation of the VPN protocol based on IPSec and the Internet Key Exchange";
130 platforms = platforms.linux ++ platforms.freebsd;
131 license = with licenses; [
135 maintainers = with maintainers; [
139 mainProgram = "ipsec";