nixpkgs/pkgs/applications/networking/termius/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

115 lines
3.2 KiB
Nix
Raw Normal View History

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
, fetchurl
, makeDesktopItem
, makeWrapper
, stdenv
, lib
2023-10-03 13:24:55 +00:00
, libsecret
, mesa
, udev
, wrapGAppsHook3
2024-08-13 15:44:54 +00:00
, writeScript
}:
stdenv.mkDerivation rec {
pname = "termius";
2024-10-06 10:00:16 +00:00
version = "9.7.2";
revision = "205";
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==";
};
desktopItem = makeDesktopItem {
categories = [ "Network" ];
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
nativeBuildInputs = [ autoPatchelfHook squashfsTools makeWrapper wrapGAppsHook3 ];
2023-10-03 13:24:55 +00:00
buildInputs = [
alsa-lib
libsecret
mesa
];
2021-08-03 14:25:25 +00:00
unpackPhase = ''
runHook preUnpack
unsquashfs "$src"
runHook postUnpack
'';
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"
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
'';
runtimeDependencies = [ (lib.getLib udev) ];
postFixup = ''
2021-08-03 14:25:25 +00:00
makeWrapper $out/opt/termius/termius-app $out/bin/termius-app \
"''${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
'';
meta = with lib; {
description = "Cross-platform SSH client with cloud data sync and more";
homepage = "https://termius.com/";
downloadPage = "https://termius.com/linux/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
2020-11-21 08:32:55 +00:00
maintainers = with maintainers; [ Br1ght0ne th0rgal ];
platforms = [ "x86_64-linux" ];
2023-11-27 01:17:53 +00:00
mainProgram = "termius-app";
};
2021-01-15 05:42:41 +00:00
}