feat: rewrite the package to fetch binary

This commit is contained in:
Ales Tanglmajer
2026-08-21 14:45:57 +02:00
parent 34e68fe7c0
commit 8fee0d193a
+48 -31
View File
@@ -1,10 +1,8 @@
{ lib { lib
, rustPlatform , stdenv
, fetchFromGitHub , fetchurl
, pkg-config , autoPatchelfHook
, makeWrapper , makeWrapper
, openssl
, gtk3
, wayland , wayland
, libxkbcommon , libxkbcommon
, libGL , libGL
@@ -16,6 +14,26 @@
}: }:
let let
version = "0.14.0";
# Upstream publishes prebuilt release tarballs per platform. Each contains
# the `oryxis` binary, its .desktop file, and a 64px icon.
sources = {
x86_64-linux = {
url = "https://github.com/wilsonglasser/oryxis/releases/download/v${version}/oryxis-linux-x86_64.tar.gz";
hash = "sha256-U/8gEXcz3wJ0zk2GJqYnG0XdkU5+J53RloEyX4O2dcE=";
};
aarch64-linux = {
url = "https://github.com/wilsonglasser/oryxis/releases/download/v${version}/oryxis-linux-aarch64.tar.gz";
hash = "sha256-G3kTzci/GZVXVwF52eu/Yg7HERn7m/V3tJigkTA1SUM=";
};
};
source = sources.${stdenv.hostPlatform.system}
or (throw "oryxis: unsupported platform ${stdenv.hostPlatform.system}");
# Graphics/windowing libraries the binary dlopens at runtime (it only links
# libc/libm/libgcc directly), so they must be on LD_LIBRARY_PATH.
runtimeLibs = [ runtimeLibs = [
wayland wayland
libxkbcommon libxkbcommon
@@ -27,47 +45,46 @@ let
libxi libxi
]; ];
in in
rustPlatform.buildRustPackage rec { stdenv.mkDerivation {
pname = "oryxis"; pname = "oryxis";
version = "0.14.0"; inherit version;
src = fetchFromGitHub { src = fetchurl source;
owner = "wilsonglasser";
repo = "oryxis";
rev = "v${version}";
hash = "sha256-2NJ2ELTZ3liuec4OiofMD6/KQLcBCgC+gttpebCeAM0=";
};
cargoHash = "sha256-Rg/FiKjG+44MTnJXNXeXs+pqHRmFq2WBos5uOXUoiJc="; sourceRoot = ".";
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config autoPatchelfHook # fixes the ELF interpreter and rpath of the prebuilt binary
makeWrapper makeWrapper
]; ];
# Needed by autoPatchelfHook to resolve the binary's direct NEEDED entries
# (libgcc_s.so.1, libm, libc).
buildInputs = [ buildInputs = [
openssl stdenv.cc.cc.lib
gtk3
wayland
libxkbcommon
]; ];
# Use the system openssl (from buildInputs) rather than vendoring it. installPhase = ''
OPENSSL_NO_VENDOR = 1; runHook preInstall
postInstall = '' install -Dm755 oryxis $out/bin/oryxis
install -Dm644 resources/oryxis.desktop $out/share/applications/oryxis.desktop install -Dm644 oryxis.desktop $out/share/applications/oryxis.desktop
install -Dm644 resources/logo.svg $out/share/icons/hicolor/scalable/apps/oryxis.svg install -Dm644 logo_64.png $out/share/icons/hicolor/64x64/apps/oryxis.png
for size in 64 128 256; do
install -Dm644 resources/logo_$size.png \ runHook postInstall
$out/share/icons/hicolor/''${size}x''${size}/apps/oryxis.png
done
''; '';
postFixup = '' postFixup = ''
for bin in $out/bin/*; do wrapProgram $out/bin/oryxis \
wrapProgram "$bin" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeLibs}" --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeLibs}"
done
''; '';
meta = {
description = "Modern SSH client built entirely in Rust. Fast, encrypted, native";
homepage = "https://github.com/wilsonglasser/oryxis";
license = lib.licenses.agpl3Only;
mainProgram = "oryxis";
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
platforms = builtins.attrNames sources;
};
} }