summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Livshin <repo@cmm.kakpryg.net>2022-05-05 11:59:36 +0300
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2022-05-16 07:07:38 +0000
commit2989ff7134d51e2cb295c594b48c40cd11fbafb2 (patch)
tree424ff91be26cef0a81cabeebbfe2a33518defc46
parentMerge pull request #169198 from NixOS/backport-168875-to-release-21.11 (diff)
downloadnixpkgs-origin/backport-173142-to-release-21.11.tar.gz
zerotierone: 1.8.4 -> 1.8.9origin/backport-173142-to-release-21.11
(cherry picked from commit d42fd31f18375219239e2ca64ed789e05e9cb161)
-rw-r--r--pkgs/tools/networking/zerotierone/default.nix64
1 files changed, 49 insertions, 15 deletions
diff --git a/pkgs/tools/networking/zerotierone/default.nix b/pkgs/tools/networking/zerotierone/default.nix
index 3062befe2d3b..5a9239e2737c 100644
--- a/pkgs/tools/networking/zerotierone/default.nix
+++ b/pkgs/tools/networking/zerotierone/default.nix
@@ -1,15 +1,37 @@
-{ lib, stdenv, buildPackages, fetchFromGitHub, openssl, lzo, zlib, iproute2, ronn }:
+{ lib
+, stdenv
+, rustPlatform
+, fetchFromGitHub
+, fetchurl
-stdenv.mkDerivation rec {
+, buildPackages
+, iproute2
+, lzo
+, openssl
+, pkg-config
+, ronn
+, zlib
+}:
+
+let
pname = "zerotierone";
- version = "1.8.4";
+ version = "1.8.9";
src = fetchFromGitHub {
owner = "zerotier";
repo = "ZeroTierOne";
rev = version;
- sha256 = "sha256-aM0FkcrSd5dEJVdJryIGuyWNFwvKH0SBfOuy4dIMK4A=";
+ sha256 = "sha256-N1VqzjaFJRJiSG4qHqRy4Fs8TlkUqyDoq0/3JQdGwfA=";
+ };
+in stdenv.mkDerivation {
+ inherit pname version src;
+
+ cargoDeps = rustPlatform.fetchCargoTarball {
+ src = "${src}/zeroidc";
+ name = "${pname}-${version}";
+ sha256 = "sha256-PDsJtz279P2IpgiL0T92IbcANeGSUnGKhEH1dj9VtbM=";
};
+ postPatch = "cp ${src}/zeroidc/Cargo.lock Cargo.lock";
preConfigure = ''
patchShebangs ./doc/build.sh
@@ -20,9 +42,19 @@ stdenv.mkDerivation rec {
--replace 'armv5' 'armv6'
'';
-
- nativeBuildInputs = [ ronn ];
- buildInputs = [ openssl lzo zlib iproute2 ];
+ nativeBuildInputs = [
+ pkg-config
+ ronn
+ rustPlatform.cargoSetupHook
+ rustPlatform.rust.cargo
+ rustPlatform.rust.rustc
+ ];
+ buildInputs = [
+ iproute2
+ lzo
+ openssl
+ zlib
+ ];
enableParallelBuilding = true;
@@ -30,18 +62,20 @@ stdenv.mkDerivation rec {
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
checkPhase = ''
+ runHook preCheck
./zerotier-selftest
+ runHook postCheck
'';
- installPhase = ''
- install -Dt "$out/bin/" zerotier-one
- ln -s $out/bin/zerotier-one $out/bin/zerotier-idtool
- ln -s $out/bin/zerotier-one $out/bin/zerotier-cli
+ 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
- mkdir -p $man/share/man/man8
- for cmd in zerotier-one.8 zerotier-cli.1 zerotier-idtool.1; do
- cat doc/$cmd | gzip -9n > $man/share/man/man8/$cmd.gz
- done
+ rm -rf $out/upstream
'';
outputs = [ "out" "man" ];