2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
, buildPackages
|
|
|
|
, iproute2
|
|
|
|
, lzo
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
|
|
|
, ronn
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "zerotierone";
|
2022-05-18 14:49:53 +00:00
|
|
|
version = "1.8.9";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zerotier";
|
|
|
|
repo = "ZeroTierOne";
|
|
|
|
rev = version;
|
2022-05-18 14:49:53 +00:00
|
|
|
sha256 = "sha256-N1VqzjaFJRJiSG4qHqRy4Fs8TlkUqyDoq0/3JQdGwfA=";
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit pname version src;
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
src = "${src}/zeroidc";
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
sha256 = "sha256-PDsJtz279P2IpgiL0T92IbcANeGSUnGKhEH1dj9VtbM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-05-18 14:49:53 +00:00
|
|
|
postPatch = "cp ${src}/zeroidc/Cargo.lock Cargo.lock";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
2021-04-26 19:14:03 +00:00
|
|
|
patchShebangs ./doc/build.sh
|
|
|
|
substituteInPlace ./doc/build.sh \
|
|
|
|
--replace '/usr/bin/ronn' '${buildPackages.ronn}/bin/ronn' \
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-26 19:14:03 +00:00
|
|
|
substituteInPlace ./make-linux.mk \
|
|
|
|
--replace 'armv5' 'armv6'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
ronn
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
rustPlatform.rust.cargo
|
|
|
|
rustPlatform.rust.rustc
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
iproute2
|
|
|
|
lzo
|
|
|
|
openssl
|
|
|
|
zlib
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
buildFlags = [ "all" "selftest" ];
|
|
|
|
|
|
|
|
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
|
|
|
|
checkPhase = ''
|
2022-05-18 14:49:53 +00:00
|
|
|
runHook preCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
./zerotier-selftest
|
2022-05-18 14:49:53 +00:00
|
|
|
runHook postCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00: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
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
rm -rf $out/upstream
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Create flat virtual Ethernet networks of almost unlimited size";
|
|
|
|
homepage = "https://www.zerotier.com";
|
|
|
|
license = licenses.bsl11;
|
|
|
|
maintainers = with maintainers; [ sjmackenzie zimbatm ehmry obadz danielfullmer ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|