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";
|
2023-02-22 10:55:15 +00:00
|
|
|
version = "1.10.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zerotier";
|
|
|
|
repo = "ZeroTierOne";
|
|
|
|
rev = version;
|
2023-02-22 10:55:15 +00:00
|
|
|
sha256 = "sha256-MhkGcmt1YPvlePF54XsLVFUX+P979uUqhtJjudRx69g=";
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit pname version src;
|
|
|
|
|
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 \
|
2022-06-26 10:26:21 +00:00
|
|
|
--replace '-march=armv6zk' "" \
|
|
|
|
--replace '-mcpu=arm1176jzf-s' ""
|
2022-09-30 11:47:45 +00:00
|
|
|
|
|
|
|
# Upstream does not define the cargo settings necessary to use the vendorized rust-jwt version, so it has to be added manually.
|
|
|
|
# Can be removed once ZeroTierOne's zeroidc no longer uses a git url in Cargo.toml for jwt
|
|
|
|
echo '[source."https://github.com/glimberg/rust-jwt"]
|
|
|
|
git = "https://github.com/glimberg/rust-jwt"
|
|
|
|
replace-with = "vendored-sources"' >> ./zeroidc/.cargo/config.toml
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
ronn
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|