2022-05-05 09:59:36 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
2015-04-05 07:46:14 +01:00
|
|
|
|
2022-05-05 09:59:36 +01:00
|
|
|
, buildPackages
|
|
|
|
, iproute2
|
|
|
|
, lzo
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
|
|
|
, ronn
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2019-07-30 18:19:15 +01:00
|
|
|
pname = "zerotierone";
|
2022-06-18 14:29:49 +01:00
|
|
|
version = "1.10.0";
|
2019-07-30 18:19:15 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zerotier";
|
|
|
|
repo = "ZeroTierOne";
|
|
|
|
rev = version;
|
2022-06-18 14:29:49 +01:00
|
|
|
sha256 = "sha256-2lxXgQArHTFCuSBbKRSaLka42p2INLDg0z3TZ+J5msc=";
|
2022-05-05 09:59:36 +01:00
|
|
|
};
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit pname version src;
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
src = "${src}/zeroidc";
|
|
|
|
name = "${pname}-${version}";
|
2022-06-18 14:29:49 +01:00
|
|
|
sha256 = "sha256-Q9uBUD5xxo5gcTQTedVqQv+Z7B1TTPWtaTSuWo7WEPM=";
|
2015-04-05 07:46:14 +01:00
|
|
|
};
|
2022-05-05 09:59:36 +01:00
|
|
|
postPatch = "cp ${src}/zeroidc/Cargo.lock Cargo.lock";
|
2015-04-05 07:46:14 +01:00
|
|
|
|
|
|
|
preConfigure = ''
|
2021-04-26 14:55:31 +01:00
|
|
|
patchShebangs ./doc/build.sh
|
|
|
|
substituteInPlace ./doc/build.sh \
|
|
|
|
--replace '/usr/bin/ronn' '${buildPackages.ronn}/bin/ronn' \
|
2020-03-16 16:16:43 +00:00
|
|
|
|
2021-04-26 14:55:31 +01:00
|
|
|
substituteInPlace ./make-linux.mk \
|
2022-06-18 14:29:49 +01:00
|
|
|
--replace '-march=armv6zk' "" \
|
|
|
|
--replace '-mcpu=arm1176jzf-s' ""
|
2016-06-30 11:12:20 +01:00
|
|
|
'';
|
2015-04-05 07:46:14 +01:00
|
|
|
|
2022-05-05 09:59:36 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
ronn
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
rustPlatform.rust.cargo
|
|
|
|
rustPlatform.rust.rustc
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
iproute2
|
|
|
|
lzo
|
|
|
|
openssl
|
|
|
|
zlib
|
|
|
|
];
|
2020-01-04 01:10:37 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2016-06-30 02:20:26 +01:00
|
|
|
|
2020-03-16 19:43:35 +00:00
|
|
|
buildFlags = [ "all" "selftest" ];
|
|
|
|
|
|
|
|
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
|
|
|
|
checkPhase = ''
|
2022-05-05 09:59:36 +01:00
|
|
|
runHook preCheck
|
2020-03-16 19:43:35 +00:00
|
|
|
./zerotier-selftest
|
2022-05-05 09:59:36 +01:00
|
|
|
runHook postCheck
|
2020-03-16 19:43:35 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-05 09:59:36 +01:00
|
|
|
installFlags = [ "DESTDIR=$$out/upstream" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mv $out/upstream/usr/sbin $out/bin
|
|
|
|
|
|
|
|
mkdir -p $man/share
|
|
|
|
mv $out/upstream/usr/share/man $man/share/man
|
2016-06-30 11:12:20 +01:00
|
|
|
|
2022-05-05 09:59:36 +01:00
|
|
|
rm -rf $out/upstream
|
2015-04-05 07:46:14 +01:00
|
|
|
'';
|
|
|
|
|
2016-06-30 11:12:20 +01:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2015-04-05 07:46:14 +01:00
|
|
|
description = "Create flat virtual Ethernet networks of almost unlimited size";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.zerotier.com";
|
2019-08-28 21:28:46 +01:00
|
|
|
license = licenses.bsl11;
|
2020-01-04 01:10:55 +00:00
|
|
|
maintainers = with maintainers; [ sjmackenzie zimbatm ehmry obadz danielfullmer ];
|
2020-03-16 16:17:18 +00:00
|
|
|
platforms = platforms.all;
|
2015-04-05 07:46:14 +01:00
|
|
|
};
|
|
|
|
}
|