termius: switch to a snap source

This commit is contained in:
Artturin 2021-08-03 17:25:25 +03:00
parent f0672fa7fb
commit 5ff54697d0

View file

@ -1,6 +1,6 @@
{ atomEnv
, autoPatchelfHook
, dpkg
, squashfsTools
, fetchurl
, makeDesktopItem
, makeWrapper
@ -12,13 +12,15 @@
stdenv.mkDerivation rec {
pname = "termius";
version = "7.16.0";
version = "7.17.1";
src = fetchurl {
# find the latest version by
# curl https://deb.termius.com/dists/squeeze/main/binary-amd64/Packages
url = "https://deb.termius.com/pool/main/t/termius-app/termius-app_${version}_amd64.deb";
sha256 = "013nli61bk4x4hkhr6gcpzm1y8ycmqk3vr7q0w2dn2bfdwjg559v";
# 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
url = "https://api.snapcraft.io/api/v1/snaps/download/WkTBXwoX81rBe3s3OTt3EiiLKBx2QhuS_81.snap";
sha256 = "sha256-jNwWQTjUy8nJ8gHlbP9WgDlARWOhTQAA7KAcQNXKhNg=";
};
desktopItem = makeDesktopItem {
@ -36,22 +38,33 @@ stdenv.mkDerivation rec {
dontPatchELF = true;
dontWrapGApps = true;
nativeBuildInputs = [ autoPatchelfHook dpkg makeWrapper wrapGAppsHook ];
nativeBuildInputs = [ autoPatchelfHook squashfsTools makeWrapper wrapGAppsHook ];
buildInputs = atomEnv.packages;
unpackPhase = "dpkg-deb -x $src .";
unpackPhase = ''
runHook preUnpack
unsquashfs "$src"
runHook postUnpack
'';
installPhase = ''
runHook preInstall
cd squashfs-root
mkdir -p $out/opt/termius
cp -r \
icudtl.dat \
libffmpeg.so \
locales \
resources \
resources.pak \
termius-app \
v8_context_snapshot.bin \
$out/opt/termius
mkdir -p "$out/bin"
cp -R "opt" "$out"
cp -R "usr/share" "$out/share"
chmod -R g-w "$out"
# Desktop file
mkdir -p "$out/share/applications"
mkdir -p "$out/share/applications" "$out/share/pixmaps/termius-app.png"
cp "${desktopItem}/share/applications/"* "$out/share/applications"
cp meta/gui/icon.png $out/share/pixmaps/termius-app.png
runHook postInstall
'';
@ -59,7 +72,7 @@ stdenv.mkDerivation rec {
runtimeDependencies = [ (lib.getLib udev) ];
postFixup = ''
makeWrapper $out/opt/Termius/termius-app $out/bin/termius-app \
makeWrapper $out/opt/termius/termius-app $out/bin/termius-app \
"''${gappsWrapperArgs[@]}"
'';