2023-10-03 13:24:55 +00:00
|
|
|
{ autoPatchelfHook
|
2021-08-03 14:25:25 +00:00
|
|
|
, squashfsTools
|
2023-10-03 13:24:55 +00:00
|
|
|
, alsa-lib
|
2020-01-03 16:43:31 +00:00
|
|
|
, fetchurl
|
|
|
|
, makeDesktopItem
|
|
|
|
, makeWrapper
|
|
|
|
, stdenv
|
2020-08-12 18:29:24 +00:00
|
|
|
, lib
|
2023-10-03 13:24:55 +00:00
|
|
|
, libsecret
|
|
|
|
, mesa
|
2020-01-03 16:43:31 +00:00
|
|
|
, udev
|
2024-04-26 20:24:03 +00:00
|
|
|
, wrapGAppsHook3
|
2024-08-13 15:44:54 +00:00
|
|
|
, writeScript
|
2020-01-03 16:43:31 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "termius";
|
2024-10-06 10:00:16 +00:00
|
|
|
version = "9.7.2";
|
|
|
|
revision = "205";
|
2020-01-03 16:43:31 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-08-03 14:25:25 +00:00
|
|
|
# find the latest version with
|
|
|
|
# curl -H 'X-Ubuntu-Series: 16' https://api.snapcraft.io/api/v1/snaps/details/termius-app | jq '.version'
|
|
|
|
# and the url with
|
|
|
|
# curl -H 'X-Ubuntu-Series: 16' https://api.snapcraft.io/api/v1/snaps/details/termius-app | jq '.download_url' -r
|
2022-02-21 18:28:18 +00:00
|
|
|
# and the sha512 with
|
|
|
|
# curl -H 'X-Ubuntu-Series: 16' https://api.snapcraft.io/api/v1/snaps/details/termius-app | jq '.download_sha512' -r
|
2024-08-13 15:44:54 +00:00
|
|
|
url = "https://api.snapcraft.io/api/v1/snaps/download/WkTBXwoX81rBe3s3OTt3EiiLKBx2QhuS_${revision}.snap";
|
2024-10-06 10:00:16 +00:00
|
|
|
hash = "sha512-LihbkFIFpulewNIHl1oiXJF1npuqNLvVjN8CAmDDf46PAXdpaiMMluHWIJ4NljAACh6d4Uw6m2pKgEDfFN1y6g==";
|
2020-01-03 16:43:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Network" ];
|
2020-01-03 16:43:31 +00:00
|
|
|
comment = "The SSH client that works on Desktop and Mobile";
|
|
|
|
desktopName = "Termius";
|
|
|
|
exec = "termius-app";
|
|
|
|
genericName = "Cross-platform SSH client";
|
|
|
|
icon = "termius-app";
|
|
|
|
name = "termius-app";
|
|
|
|
};
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
dontWrapGApps = true;
|
|
|
|
|
2023-10-03 13:24:55 +00:00
|
|
|
# TODO: migrate off autoPatchelfHook and use nixpkgs' electron
|
2024-04-26 20:24:03 +00:00
|
|
|
nativeBuildInputs = [ autoPatchelfHook squashfsTools makeWrapper wrapGAppsHook3 ];
|
2020-01-03 16:43:31 +00:00
|
|
|
|
2023-10-03 13:24:55 +00:00
|
|
|
buildInputs = [
|
|
|
|
alsa-lib
|
|
|
|
libsecret
|
|
|
|
mesa
|
|
|
|
];
|
2020-01-03 16:43:31 +00:00
|
|
|
|
2021-08-03 14:25:25 +00:00
|
|
|
unpackPhase = ''
|
|
|
|
runHook preUnpack
|
|
|
|
unsquashfs "$src"
|
|
|
|
runHook postUnpack
|
|
|
|
'';
|
2020-01-03 16:43:31 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-07-10 18:17:51 +00:00
|
|
|
runHook preInstall
|
2021-08-03 14:25:25 +00:00
|
|
|
cd squashfs-root
|
|
|
|
mkdir -p $out/opt/termius
|
2022-03-14 20:59:39 +00:00
|
|
|
cp -r ./ $out/opt/termius
|
2021-07-10 18:17:51 +00:00
|
|
|
|
2024-08-13 15:39:58 +00:00
|
|
|
mkdir -p "$out/share/applications" "$out/share/pixmaps"
|
2020-01-03 16:43:31 +00:00
|
|
|
cp "${desktopItem}/share/applications/"* "$out/share/applications"
|
2021-08-03 14:25:25 +00:00
|
|
|
cp meta/gui/icon.png $out/share/pixmaps/termius-app.png
|
2021-07-10 18:17:51 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-01-03 16:43:31 +00:00
|
|
|
'';
|
|
|
|
|
2020-08-12 18:29:24 +00:00
|
|
|
runtimeDependencies = [ (lib.getLib udev) ];
|
2020-01-03 16:43:31 +00:00
|
|
|
|
|
|
|
postFixup = ''
|
2021-08-03 14:25:25 +00:00
|
|
|
makeWrapper $out/opt/termius/termius-app $out/bin/termius-app \
|
2020-01-03 16:43:31 +00:00
|
|
|
"''${gappsWrapperArgs[@]}"
|
|
|
|
'';
|
|
|
|
|
2024-08-13 15:44:54 +00:00
|
|
|
passthru.updateScript = writeScript "update-termius" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p common-updater-scripts curl jq
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
data=$(curl -H 'X-Ubuntu-Series: 16' \
|
|
|
|
'https://api.snapcraft.io/api/v1/snaps/details/termius-app?fields=download_sha512,revision,version')
|
|
|
|
|
|
|
|
version=$(jq -r .version <<<"$data")
|
|
|
|
|
|
|
|
if [[ "x$UPDATE_NIX_OLD_VERSION" != "x$version" ]]; then
|
|
|
|
|
|
|
|
revision=$(jq -r .revision <<<"$data")
|
|
|
|
hash=$(nix hash to-sri "sha512:$(jq -r .download_sha512 <<<"$data")")
|
|
|
|
|
|
|
|
update-source-version "$UPDATE_NIX_ATTR_PATH" "$version" "$hash"
|
|
|
|
update-source-version --ignore-same-hash --version-key=revision "$UPDATE_NIX_ATTR_PATH" "$revision" "$hash"
|
|
|
|
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-01-03 16:43:31 +00:00
|
|
|
description = "Cross-platform SSH client with cloud data sync and more";
|
|
|
|
homepage = "https://termius.com/";
|
|
|
|
downloadPage = "https://termius.com/linux/";
|
2022-06-04 22:19:25 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2020-01-03 16:43:31 +00:00
|
|
|
license = licenses.unfree;
|
2020-11-21 08:32:55 +00:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne th0rgal ];
|
2020-01-03 16:43:31 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2023-11-27 01:17:53 +00:00
|
|
|
mainProgram = "termius-app";
|
2020-01-03 16:43:31 +00:00
|
|
|
};
|
2021-01-15 05:42:41 +00:00
|
|
|
}
|