diff --git a/pkgs/by-name/ze/zerotierone/0001-darwin-disable-link-time-optimization.patch b/pkgs/by-name/ze/zerotierone/0001-darwin-disable-link-time-optimization.patch index 475655f94a56..bb4bb976df25 100644 --- a/pkgs/by-name/ze/zerotierone/0001-darwin-disable-link-time-optimization.patch +++ b/pkgs/by-name/ze/zerotierone/0001-darwin-disable-link-time-optimization.patch @@ -1,7 +1,7 @@ -From f71d88a15f537cbc5ea80ad2922c013553a5caab Mon Sep 17 00:00:00 2001 +From 1bc576196d82b801df4e52548808068c4cb9ab9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 21 Jun 2024 14:43:03 +0200 -Subject: [PATCH 2/2] darwin: disable link-time optimization +Subject: [PATCH 1/2] darwin: disable link-time optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -15,18 +15,18 @@ Signed-off-by: Jörg Thalheim 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-mac.mk b/make-mac.mk -index 7af200ad..b388c05a 100644 +index e63fb7f88..3cf0be175 100644 --- a/make-mac.mk +++ b/make-mac.mk -@@ -84,7 +84,7 @@ ifeq ($(ZT_DEBUG),1) +@@ -89,7 +89,7 @@ ifeq ($(ZT_DEBUG),1) node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g $(INCLUDES) $(DEFS) else - CFLAGS?=-Ofast -fstack-protector-strong + CFLAGS?=-O3 -fstack-protector-strong - CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -mmacosx-version-min=$(MACOS_VERSION_MIN) -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS) + CFLAGS+=$(ARCH_FLAGS) -Wall -fPIE -mmacosx-version-min=$(MACOS_VERSION_MIN) -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS) STRIP=strip EXTRA_CARGO_FLAGS=--release RUST_VARIANT=release -- -2.44.1 +2.51.0 diff --git a/pkgs/by-name/ze/zerotierone/0001-rustfsm-remove-unsupported-lints.workspace.patch b/pkgs/by-name/ze/zerotierone/0001-rustfsm-remove-unsupported-lints.workspace.patch deleted file mode 100644 index 0db2b4d26fa2..000000000000 --- a/pkgs/by-name/ze/zerotierone/0001-rustfsm-remove-unsupported-lints.workspace.patch +++ /dev/null @@ -1,24 +0,0 @@ -From b83e6354de099860bcb1ca3876c222c57de89f0c Mon Sep 17 00:00:00 2001 -From: Michael Hoang -Date: Mon, 10 Feb 2025 18:03:12 +0700 -Subject: [PATCH] rustfsm: remove unsupported `lints.workspace` - -This patch will no longer be necessary when -https://github.com/NixOS/nixpkgs/pull/300532 is merged ---- - fsm/Cargo.toml | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/fsm/Cargo.toml b/fsm/Cargo.toml -index 5e9e1c9..3fda704 100644 ---- a/fsm/Cargo.toml -+++ b/fsm/Cargo.toml -@@ -17,5 +17,3 @@ rustfsm_trait = { version = "0.1", path = "rustfsm_trait" } - [package.metadata.workspaces] - independent = true - --[lints] --workspace = true --- -2.46.0 - diff --git a/pkgs/by-name/ze/zerotierone/0002-Support-single-arch-builds-on-macOS.patch b/pkgs/by-name/ze/zerotierone/0002-Support-single-arch-builds-on-macOS.patch new file mode 100644 index 000000000000..2b2c67023b25 --- /dev/null +++ b/pkgs/by-name/ze/zerotierone/0002-Support-single-arch-builds-on-macOS.patch @@ -0,0 +1,52 @@ +From 5c6f3e6c8c33e23b8bb3fe39b9ce26495724af09 Mon Sep 17 00:00:00 2001 +From: Daniel Fullmer +Date: Sat, 4 Oct 2025 19:27:19 -0700 +Subject: [PATCH 2/2] Support single arch builds on macOS + +Co-Authored-By: Michael Hoang +--- + make-mac.mk | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/make-mac.mk b/make-mac.mk +index 3cf0be175..8da630e90 100644 +--- a/make-mac.mk ++++ b/make-mac.mk +@@ -5,7 +5,8 @@ TOPDIR=$(shell pwd) + INCLUDES=-I$(shell pwd)/rustybits/target -isystem $(TOPDIR)/ext -I$(TOPDIR)/ext/prometheus-cpp-lite-1.0/core/include -I$(TOPDIR)/ext-prometheus-cpp-lite-1.0/3rdparty/http-client-lite/include -I$(TOPDIR)/ext/prometheus-cpp-lite-1.0/simpleapi/include + DEFS= + LIBS= +-ARCH_FLAGS=-arch x86_64 -arch arm64 ++ARCH := x86_64 arm64 ++ARCH_FLAGS=$(addprefix -arch ,$(ARCH)) + + CODESIGN=echo + PRODUCTSIGN=echo +@@ -79,6 +80,7 @@ endif + # Debug mode -- dump trace output, build binary with -g + ifeq ($(ZT_DEBUG),1) + ZT_TRACE=1 ++ ARCH= + ARCH_FLAGS= + CFLAGS+=-Wall -g $(INCLUDES) $(DEFS) $(ARCH_FLAGS) + STRIP=echo +@@ -156,12 +158,12 @@ rustybits/target/libsmeeclient.a: FORCE + endif + + rustybits/target/libzeroidc.a: FORCE +- cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -p zeroidc --target=x86_64-apple-darwin $(EXTRA_CARGO_FLAGS) +- cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -p zeroidc --target=aarch64-apple-darwin $(EXTRA_CARGO_FLAGS) +- cd rustybits && lipo -create target/x86_64-apple-darwin/$(RUST_VARIANT)/libzeroidc.a target/aarch64-apple-darwin/$(RUST_VARIANT)/libzeroidc.a -output target/libzeroidc.a ++ if [[ "$(ARCH)" == *"x86_64"* ]]; then cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -p zeroidc --target=x86_64-apple-darwin $(EXTRA_CARGO_FLAGS); fi ++ if [[ "$(ARCH)" == *"arm64"* ]]; then cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -p zeroidc --target=aarch64-apple-darwin $(EXTRA_CARGO_FLAGS); fi ++ cd rustybits && lipo -create target/*/$(RUST_VARIANT)/libzeroidc.a -output target/libzeroidc.a + + central-controller: +- make ARCH_FLAGS="-arch x86_64" ZT_CONTROLLER=1 one ++ make ARCH=x86_64 ZT_CONTROLLER=1 one + + zerotier-idtool: one + +-- +2.51.0 + diff --git a/pkgs/by-name/ze/zerotierone/package.nix b/pkgs/by-name/ze/zerotierone/package.nix index 6b258b96a046..1969a933aef6 100644 --- a/pkgs/by-name/ze/zerotierone/package.nix +++ b/pkgs/by-name/ze/zerotierone/package.nix @@ -12,18 +12,20 @@ rustc, zlib, libiconv, - fetchpatch, + # enableUnfree enables building the zerotier controller, which is subject to + # a source-available license that permits non-commercial use + enableUnfree ? false, }: let pname = "zerotierone"; - version = "1.14.2"; + version = "1.16.0"; src = fetchFromGitHub { owner = "zerotier"; repo = "ZeroTierOne"; tag = version; - hash = "sha256-D+7/ja5uYzH1iNd+Ti3k+dWOf5GvN4U+GuVBA9gxtTc="; + hash = "sha256-bFfRz695sbdZJd5DIfF7j8lbEqWHSaIqHq/AfXZgZ4s="; }; in @@ -33,23 +35,13 @@ stdenv.mkDerivation { cargoDeps = rustPlatform.fetchCargoVendor { inherit src; sourceRoot = "${src.name}/rustybits"; - hash = "sha256-CSpm4zBWKhcrM/KXGU6/51NSQ6hzpT44D2J+QETBtpQ="; - - # REMOVEME when https://github.com/NixOS/nixpkgs/pull/300532 is merged - postBuild = '' - pushd $out/git/730aadcc02767ae630e88f8f8c788a85d6bc81e6 - patch --verbose -p1 <${./0001-rustfsm-remove-unsupported-lints.workspace.patch} - popd - ''; + hash = "sha256-u3gqETbn4I+mtUeSkSym4s+qhA3eDb4Qaq7bl58M+AY="; }; patches = [ ./0001-darwin-disable-link-time-optimization.patch # https://github.com/zerotier/ZeroTierOne/pull/2435 - (fetchpatch { - url = "https://github.com/zerotier/ZeroTierOne/commit/8f56d484b681ea30cd28e19cab34499acfa6e64d.patch"; - hash = "sha256-UplkX2O4o8XKKTlR3ZsSG9E0y5gVhAagyepqwyGEYmA="; - }) + ./0002-Support-single-arch-builds-on-macOS.patch ]; postPatch = '' @@ -112,9 +104,12 @@ stdenv.mkDerivation { buildFlags = [ "all" "selftest" - ]; + ] + ++ lib.optional enableUnfree "ZT_NONFREE=1"; + + # darwin: disabled due to a test which fails to bind to 127.0.0.1 in a sandbox. + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform && !stdenv.hostPlatform.isDarwin; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; checkPhase = '' runHook preCheck ./zerotier-selftest @@ -147,7 +142,7 @@ stdenv.mkDerivation { meta = with lib; { description = "Create flat virtual Ethernet networks of almost unlimited size"; homepage = "https://www.zerotier.com"; - license = licenses.bsl11; + license = if enableUnfree then licenses.unfree else licenses.mpl20; maintainers = with maintainers; [ sjmackenzie zimbatm