isle/nix/appimagetool.nix

51 lines
1.3 KiB
Nix

{ stdenv, fetchurl }:
let
version = "745";
cpuArch = stdenv.buildPlatform.parsed.cpu.name;
src = {
"x86-64" = fetchurl {
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-x86_64.AppImage";
sha256 = "sha256-HQ7d9LQDaPm6sGZ5boWZdmGTNqiGN9NWHUWPiDhl2Xc=";
};
"aarch64" = fetchurl {
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-aarch64.AppImage";
sha256 = "sha256-VvH2qXULliCiyFrisaIJbM0ApXp++ZAtxHiS6FM3XT0=";
};
"armv7l" = fetchurl {
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-armhf.AppImage";
sha256 = "sha256-ytJjN2dLYOSwqCCFZvqnt+wt2wX/lZ1R+nVz5C+Akvo=";
};
"i686" = fetchurl {
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-i686.AppImage";
sha256 = "sha256-GLEhn3dcrwdU3mG0lB6H7PQ5JwEIGqWlGrO1IifeQv4=";
};
}."${cpuArch}";
in stdenv.mkDerivation rec {
pname = "go-appimage";
inherit version src;
sourceRoot = "squashfs-root";
unpackPhase = ''
cp $src appimagetool
chmod u+wx appimagetool
./appimagetool --appimage-extract
'';
installPhase = ''
mkdir -p $out
cp -r usr/* $out
'';
}