isle/nix/appimagetool.nix
2023-09-01 20:24:42 +02:00

41 lines
1.1 KiB
Nix

{ stdenv, fetchurl }:
let
version = "765";
cpuArch = stdenv.buildPlatform.parsed.cpu.name;
srcDir = ./go-appimage;
# https://github.com/probonopd/go-appimage
# The author of go-appimage has set up some crazy continuous integration build
# system with github, which is really cool, except that it doesn't preserve
# any older builds of the project. And it's pretty difficult to build it
# ourselves. So fuck it, just embed the build artifacts directly in this
# project.
src = {
"x86_64" = "${srcDir}/appimagetool-${version}-x86_64.AppImage";
"aarch64" = "${srcDir}/go-appimage/appimagetool-${version}-aarch64.AppImage";
"armv7l" = "${srcDir}/go-appimage/appimagetool-${version}-armhf.AppImage";
"i686" = "${srcDir}/go-appimage/appimagetool-${version}-i686.AppImage";
}."${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
'';
}