Files
tsunagi/nix/package.nix
T
Aleksandr Bogomiakov 66206544b0 Remove the tray dependency on libxdo
The Linux tray is built on Ubuntu and reused in Debian and Arch packages.
Its default tray-icon feature pulls in libxdo through muda, tying the binary
to the builder's libxdo SONAME. Arch now supplies libxdo.so.4 while existing
release binaries can require libxdo.so.3.

Disable tray-icon default features: libxdo only supports predefined clipboard
menu actions, while our tray uses Open, Quit and a separator. Keep GTK support.
Regenerate Cargo.lock without upgrading other packages, and remove libxdo
build/runtime dependencies from both release workflows, Debian/Arch packaging
and Nix. Update the Arch installation notes.

Clarify that static Linux CLI binaries are release artifacts built for musl;
ordinary host-target Cargo builds on glibc Linux are dynamic. Document the
existing musl build command and its output path. Both release workflows still
package the musl tsng independently of the GNU tray. No protocol, persistent
state, crate version or release tag changes.

Validation on macOS:
- cargo fmt --all -- --check
- cargo clippy --locked --workspace --all-targets -- -D warnings
- cargo test --locked --workspace --all-targets: 532 passed, 2 ignored
- bash -n dist/arch/build-pkg.sh dist/deb/build-deb.sh
- Linux-target Cargo dependency graph retains GTK and contains no libxdo;
  resolved metadata contains neither libxdo nor libxdo-sys
- git diff --check

Initial offline resolution lacked smoltcp and sandboxed registry access failed;
resolution succeeded with approved network access. The first sandboxed test
run failed when child agents exited before readiness; the full run outside
the sandbox passed. Linux release binaries, native GUI startup, packages and
Nix builds were not run locally; CI/release execution is left to the user.
2026-11-16 12:55:34 +00:00

100 lines
2.2 KiB
Nix

{
withTray ? true,
lib,
rustPlatform,
pkg-config,
copyDesktopItems,
wrapGAppsHook3,
gtk3,
libayatana-appindicator,
libglvnd,
libxkbcommon,
vulkan-loader,
wayland,
libx11,
libxcursor,
libxi,
libxrandr,
}:
let
# The tray is an egui app that loads graphics, windowing and appindicator
# libraries at run time, so they have to be put on its library path by hand.
trayRuntimeLibs = [
libayatana-appindicator
libglvnd
libxkbcommon
vulkan-loader
wayland
libx11
libxcursor
libxi
libxrandr
];
in
rustPlatform.buildRustPackage {
pname = if withTray then "tsunagi" else "tsunagi-cli";
version = "0.1.0";
src = lib.cleanSource ../.;
cargoLock.lockFile = ../Cargo.lock;
cargoBuildFlags = [
"--bin"
"tsng"
]
++ lib.optionals withTray [
"--bin"
"tsunagi-tray"
];
# The suite opens real sockets and interfaces; it runs in CI instead.
doCheck = false;
nativeBuildInputs = [
pkg-config
]
++ lib.optionals withTray [
copyDesktopItems
wrapGAppsHook3
];
buildInputs = lib.optionals withTray [
gtk3
libayatana-appindicator
];
dontWrapGApps = true;
# The development shell runs unwrapped Cargo binaries and needs the same
# dynamically loaded libraries as the installed tray wrapper.
passthru = { inherit trayRuntimeLibs; };
postInstall = ''
install -Dm644 dist/linux/50-tsunagi-resolved.rules \
"$out/share/doc/tsunagi/50-tsunagi-resolved.rules"
''
+ lib.optionalString withTray ''
install -Dm644 dist/linux/tsunagi.svg \
"$out/share/icons/hicolor/scalable/apps/tsunagi.svg"
install -Dm644 dist/linux/tsunagi-tray.desktop \
"$out/share/applications/tsunagi-tray.desktop"
'';
postFixup = lib.optionalString withTray ''
wrapProgram "$out/bin/tsunagi-tray" \
"''${gappsWrapperArgs[@]}" \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath trayRuntimeLibs}:/run/opengl-driver/lib
'';
meta = {
description = "Serverless mesh VPN: join a network with a name and a secret";
homepage = "https://github.com/house-of-vanity/tsunagi";
license = lib.licenses.wtfpl;
mainProgram = "tsng";
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
}