nixpkgs/pkgs/tools/networking/zerotierone/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

90 lines
2.0 KiB
Nix
Raw Normal View History

2022-05-05 08:59:36 +00:00
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, fetchurl
2015-04-05 06:46:14 +00:00
2022-05-05 08:59:36 +00:00
, buildPackages
, iproute2
, lzo
, openssl
, pkg-config
, ronn
, zlib
}:
let
2019-07-30 17:19:15 +00:00
pname = "zerotierone";
2022-11-02 18:48:57 +00:00
version = "1.10.2";
2019-07-30 17:19:15 +00:00
src = fetchFromGitHub {
owner = "zerotier";
repo = "ZeroTierOne";
rev = version;
2022-11-02 18:48:57 +00:00
sha256 = "sha256-p900bw+BGzyMwH91W9NRfYS1ZUW74YaALwr1Gv9BlvQ=";
2022-05-05 08:59:36 +00:00
};
in stdenv.mkDerivation {
inherit pname version src;
2015-04-05 06:46:14 +00:00
preConfigure = ''
2021-04-26 13:55:31 +00:00
patchShebangs ./doc/build.sh
substituteInPlace ./doc/build.sh \
--replace '/usr/bin/ronn' '${buildPackages.ronn}/bin/ronn' \
2021-04-26 13:55:31 +00:00
substituteInPlace ./make-linux.mk \
2022-06-18 13:29:49 +00:00
--replace '-march=armv6zk' "" \
--replace '-mcpu=arm1176jzf-s' ""
# 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
2016-06-30 10:12:20 +00:00
'';
2015-04-05 06:46:14 +00:00
2022-05-05 08:59:36 +00:00
nativeBuildInputs = [
pkg-config
ronn
rustPlatform.rust.cargo
rustPlatform.rust.rustc
];
buildInputs = [
iproute2
lzo
openssl
zlib
];
2020-01-04 01:10:37 +00:00
enableParallelBuilding = true;
2016-06-30 01:20:26 +00:00
buildFlags = [ "all" "selftest" ];
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
checkPhase = ''
2022-05-05 08:59:36 +00:00
runHook preCheck
./zerotier-selftest
2022-05-05 08:59:36 +00:00
runHook postCheck
'';
2022-05-05 08:59:36 +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
2016-06-30 10:12:20 +00:00
2022-05-05 08:59:36 +00:00
rm -rf $out/upstream
2015-04-05 06:46:14 +00:00
'';
2016-06-30 10:12:20 +00:00
outputs = [ "out" "man" ];
meta = with lib; {
2015-04-05 06:46:14 +00:00
description = "Create flat virtual Ethernet networks of almost unlimited size";
homepage = "https://www.zerotier.com";
2019-08-28 20:28:46 +00:00
license = licenses.bsl11;
maintainers = with maintainers; [ sjmackenzie zimbatm ehmry obadz danielfullmer ];
2020-03-16 16:17:18 +00:00
platforms = platforms.all;
2015-04-05 06:46:14 +00:00
};
}