isle/nix/appimagetool/default.nix

23 lines
844 B
Nix

{ appimagekit, hostSystem, writeScriptBin }: let
arch = builtins.getAttr hostSystem {
"x86_64-linux" = "x86_64";
"aarch64-linux" = "aarch64";
"armv6l-linux" = "armhf";
"i686-linux" = "i686";
};
# https://github.com/AppImage/type2-runtime
# The author 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.
runtimeFileVersion = "81de3e1";
runtimeFile = "${./.}/runtime-${arch}-${runtimeFileVersion}";
in writeScriptBin "appimagetool" ''
export PATH=$PATH:${appimagekit}/bin
export ARCH=${arch}
exec ${appimagekit}/bin/appimagetool --runtime-file ${runtimeFile} "$@"
''