2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildPackages
|
2023-05-24 13:37:59 +00:00
|
|
|
, cargo
|
2022-05-18 14:49:53 +00:00
|
|
|
, lzo
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
|
|
|
, ronn
|
2023-05-24 13:37:59 +00:00
|
|
|
, rustc
|
2022-05-18 14:49:53 +00:00
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "zerotierone";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.12.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zerotier";
|
|
|
|
repo = "ZeroTierOne";
|
|
|
|
rev = version;
|
2023-10-09 19:29:22 +00:00
|
|
|
sha256 = "sha256-430wdPrSNohM3sXewusjsW3tbE7EFGISGxABZF21yRc=";
|
2022-05-18 14:49:53 +00:00
|
|
|
};
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit pname version src;
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"jwt-0.16.0" = "sha256-P5aJnNlcLe9sBtXZzfqHdRvxNfm6DPBcfcKOVeLZxcM=";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
postPatch = "cp ${./Cargo.lock} Cargo.lock";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preConfigure = ''
|
2023-04-29 16:46:19 +00:00
|
|
|
cmp ./Cargo.lock ./zeroidc/Cargo.lock || {
|
|
|
|
echo 1>&2 "Please make sure that the derivation's Cargo.lock is identical to ./zeroidc/Cargo.lock!"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
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' ""
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
ronn
|
2023-04-29 16:46:19 +00:00
|
|
|
rustPlatform.cargoSetupHook
|
2023-05-24 13:37:59 +00:00
|
|
|
cargo
|
|
|
|
rustc
|
2022-05-18 14:49:53 +00:00
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
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" ];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
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 ];
|
2023-08-04 22:07:22 +00:00
|
|
|
platforms = platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|