Skip to content

Commit c2dd438

Browse files
committed
rathole: get rid of vergen
Fixes build on darwin. Drops legacy darwin SDK pattern (which is a no-op).
1 parent 3218ced commit c2dd438

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/Cargo.toml b/Cargo.toml
2+
index e7a944e..e6bae43 100644
3+
--- a/Cargo.toml
4+
+++ b/Cargo.toml
5+
@@ -7,7 +7,6 @@ description = "A reverse proxy for NAT traversal"
6+
license = "Apache-2.0"
7+
repository = "https://github.com/rapiz1/rathole"
8+
readme = "README.md"
9+
-build = "build.rs"
10+
include = ["src/**/*", "LICENSE", "README.md", "build.rs"]
11+
12+
[features]
13+
@@ -130,9 +129,4 @@ p12 = { version = "0.6.3", optional = true }
14+
openssl = { version = "0.10", features = ["vendored"], optional = true }
15+
16+
[build-dependencies]
17+
-vergen = { version = "7.4.2", default-features = false, features = [
18+
- "build",
19+
- "git",
20+
- "cargo",
21+
-] }
22+
anyhow = "1.0"

pkgs/by-name/ra/rathole/package.nix

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
stdenv,
44
fetchFromGitHub,
55
rustPlatform,
6+
rustc,
67
pkg-config,
78
openssl,
89
nixosTests,
9-
darwin,
1010
}:
1111

12-
rustPlatform.buildRustPackage {
12+
rustPlatform.buildRustPackage rec {
1313
pname = "rathole";
1414
version = "0.5.0-unstable-2024-06-06";
1515

@@ -20,16 +20,27 @@ rustPlatform.buildRustPackage {
2020
hash = "sha256-C0/G4JOZ4pTAvcKZhRHsGvlLlwAyWBQ0rMScLvaLSuA=";
2121
};
2222

23+
# Get rid of git dependency on vergen. No reason to require libgit2-sys as
24+
# well as libz-sys. Vendored c libraries for libgit2/zlib fail to build on
25+
# darwin and using libs from nixpkgs seems excessive.
26+
patches = [
27+
./0001-no-more-vergen.patch
28+
];
29+
30+
# Build script is only needed for vergen and does nothing when not in a git
31+
# repo.
32+
postPatch = ''
33+
rm build.rs
34+
'';
35+
2336
useFetchCargoVendor = true;
2437
cargoHash = "sha256-IgPDe8kuWzJ6nF2DceUbN7fw0eGkoYhu1IGMdlSMFos=";
2538

2639
nativeBuildInputs = [ pkg-config ];
2740

28-
buildInputs =
29-
[
30-
openssl
31-
]
32-
++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ CoreServices ]);
41+
buildInputs = [
42+
openssl
43+
];
3344

3445
__darwinAllowLocalNetworking = true;
3546

@@ -39,6 +50,18 @@ rustPlatform.buildRustPackage {
3950
(cd examples/tls && chmod +x create_self_signed_cert.sh && ./create_self_signed_cert.sh)
4051
'';
4152

53+
env = {
54+
VERGEN_BUILD_TIMESTAMP = "0";
55+
VERGEN_BUILD_SEMVER = version;
56+
VERGEN_GIT_COMMIT_TIMESTAMP = "0";
57+
VERGEN_GIT_BRANCH = "main";
58+
VERGEN_RUSTC_SEMVER = rustc.version;
59+
VERGEN_RUSTC_CHANNEL = "stable";
60+
VERGEN_CARGO_PROFILE = "release";
61+
VERGEN_CARGO_FEATURES = "";
62+
VERGEN_CARGO_TARGET_TRIPLE = "${stdenv.hostPlatform.rust.rustcTarget}";
63+
};
64+
4265
passthru.tests = {
4366
inherit (nixosTests) rathole;
4467
};

0 commit comments

Comments
 (0)