terracotta: 0.3.14 -> 0.4.1 (#474151)

This commit is contained in:
Aleksana
2026-01-16 14:56:19 +00:00
committed by GitHub
5 changed files with 582 additions and 202 deletions
@@ -1,4 +1,4 @@
From f89d1d20a773cff73dd5856af4c84bccaea549ac Mon Sep 17 00:00:00 2001
From 6cb38146684743fda3e86f7c64c38f3455dacf0b Mon Sep 17 00:00:00 2001
From: Moraxyc <i@qaq.li>
Date: Sat, 8 Nov 2025 15:18:44 +0800
Subject: [PATCH 1/2] nix: read timestamp from SOURCE_DATE_EPOCH
@@ -31,5 +31,5 @@ index 142abf3..3935272 100644
\ No newline at end of file
+}
--
2.51.0
2.51.2
@@ -1,21 +1,22 @@
From cbf623903a0efdbd9b105f24aae6ac9ce0a4d21e Mon Sep 17 00:00:00 2001
From d16cf03e5cbaa35e74285098cfd95197415f8cfd Mon Sep 17 00:00:00 2001
From: Moraxyc <i@qaq.li>
Date: Sat, 8 Nov 2025 15:22:08 +0800
Subject: [PATCH 2/2] nix: use easytier from nix input
---
build.rs | 3 ++-
src/easytier/executable_impl.rs | 31 +++----------------------------
2 files changed, 5 insertions(+), 29 deletions(-)
src/easytier/executable_impl.rs | 32 +++-----------------------------
src/main.rs | 1 -
3 files changed, 5 insertions(+), 31 deletions(-)
diff --git a/build.rs b/build.rs
index dc6e117..df454d9 100644
index dfbcc4b..d716f28 100644
--- a/build.rs
+++ b/build.rs
@@ -12,7 +12,8 @@ fn main() {
@@ -11,7 +11,8 @@ use std::{
fn main() {
println!("cargo::rerun-if-changed=Cargo.toml");
println!("cargo::rerun-if-changed=.easytier");
- download_easytier();
+ // Use easytier from nix
+ // download_easytier();
@@ -23,12 +24,19 @@ index dc6e117..df454d9 100644
sevenz_rust2::compress_to_path(
"web",
diff --git a/src/easytier/executable_impl.rs b/src/easytier/executable_impl.rs
index 4444060..c534360 100644
index 81ba374..b9894cb 100644
--- a/src/easytier/executable_impl.rs
+++ b/src/easytier/executable_impl.rs
@@ -16,12 +16,6 @@ use std::{
time::Duration,
@@ -1,6 +1,5 @@
use crate::easytier::argument::{Argument, PortForward};
use crate::ports::PortRequest;
-use crate::EASYTIER_DIR;
use parking_lot::Mutex;
use std::ffi::OsString;
use std::fmt::Write;
@@ -17,12 +16,6 @@ use std::{
};
use crate::easytier::{EasyTierMember, NatType};
-static EASYTIER_ARCHIVE: (&str, &str, &[u8]) = (
- include_str!(env!("TERRACOTTA_ET_ENTRY_CONF")),
@@ -37,12 +45,12 @@ index 4444060..c534360 100644
-);
-
lazy_static::lazy_static! {
pub static ref FACTORY: EasytierFactory = create();
static ref FACTORY: EasytierFactory = create_factory();
}
@@ -38,32 +32,13 @@ pub struct Easytier {
@@ -42,32 +35,13 @@ pub struct EasyTier {
}
fn create() -> EasytierFactory {
fn create_factory() -> EasytierFactory {
- let _ = fs::create_dir_all(&*EASYTIER_DIR);
-
logging!(
@@ -75,6 +83,18 @@ index 4444060..c534360 100644
EasytierFactory { exe, cli }
}
diff --git a/src/main.rs b/src/main.rs
index c40b991..a3aecaf 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -132,7 +132,6 @@ lazy_static! {
))
};
static ref LOGGING_FILE: std::path::PathBuf = WORKING_DIR.join("application.log");
- static ref EASYTIER_DIR: std::path::PathBuf = WORKING_DIR.join("embedded-easytier");
}
#[derive(Debug, PartialEq)]
--
2.51.0
2.51.2
+484 -183
View File
File diff suppressed because it is too large Load Diff
+16 -4
View File
@@ -3,21 +3,21 @@
stdenv,
rustPlatform,
fetchFromGitHub,
callPackage,
easytier,
replaceVars,
imagemagick,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "terracotta";
version = "0.3.14";
version = "0.4.1";
src = fetchFromGitHub {
owner = "burningtnt";
repo = "Terracotta";
tag = "v${finalAttrs.version}";
hash = "sha256-zp3Ax0A7Vc6LnZiWu2pWzQTWvYH9NRmqSfmxK756qA8=";
hash = "sha256-AlbztRTHnrEqJCcNeRNssu2M0QHicdRlGCVHOvYglTw=";
# populate values that require us to use git. By doing this in postFetch we
# can delete .git afterwards and maintain better reproducibility of the src.
leaveDotGit = true;
@@ -40,6 +40,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
];
postPatch = ''
# remove android-specific git dependency
sed -i '/EasyTier.git/d' Cargo.toml
ln -s ${./Cargo.lock} Cargo.lock
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
@@ -50,6 +53,15 @@ rustPlatform.buildRustPackage (finalAttrs: {
nativeBuildInputs = [ imagemagick ];
cargoBuildFlags = [
"--bin"
"terracotta"
];
cargoTestFlags = [
"--bin"
"terracotta"
];
cargoLock.lockFile = ./Cargo.lock;
env = {
@@ -90,7 +102,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
--replace-fail '@TERRACOTTA_BIN@' "$out/bin/terracotta"
'';
passthru.updateScript = nix-update-script { extraArgs = [ "--generate-lockfile" ]; };
passthru.updateScript = lib.getExe (callPackage ./update.nix { });
meta = {
description = "Terracotta provides out-of-the-box multiplayer support for Minecraft";
+47
View File
@@ -0,0 +1,47 @@
{
writeShellApplication,
curl,
jq,
common-updater-scripts,
cargo,
}:
writeShellApplication {
name = "update-terracotta";
runtimeInputs = [
curl
jq
common-updater-scripts
cargo
];
text = ''
get_latest_release() {
curl --fail ''${GITHUB_TOKEN:+ -H "Authorization: bearer $GITHUB_TOKEN"} \
-s "https://api.github.com/repos/burningtnt/Terracotta/releases/latest" | jq -r ".tag_name"
}
version=$(get_latest_release)
version="''${version#v}"
if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then
echo "Already up to date!"
exit 0
fi
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
update-source-version terracotta "$version"
cp -r "$(nix-build --no-link -A terracotta.src)" "$tmp/src"
chmod -R +w "$tmp/src"
pushd "$tmp/src"
sed -i '/EasyTier.git/d' Cargo.toml
cargo generate-lockfile
popd
cp "$tmp/src/Cargo.lock" "pkgs/by-name/te/terracotta/Cargo.lock"
'';
}