59 lines
1.3 KiB
Nix
59 lines
1.3 KiB
Nix
# Modified from https://github.com/matthewbauer/nix-bundle/blob/e9fa7e8a118942adafa8592a28b301ee23d37c13/appimagetool.nix
|
|
{ stdenv, lib, fetchurl, fuse, zlib, file, glib, }:
|
|
|
|
# This is from some binaries.
|
|
|
|
# Ideally, this should be source based,
|
|
# but I can't get it to build from GitHub
|
|
|
|
let
|
|
|
|
inherit (stdenv.cc.bintools) dynamicLinker;
|
|
|
|
version = "745";
|
|
|
|
cpuArch = stdenv.buildPlatform.parsed.cpu.arch;
|
|
|
|
src = {
|
|
|
|
"x86-64" = fetchurl {
|
|
url = "https://github.com/probonopd/go-appimage/releases/download/continuous/appimagetool-${version}-x86_64.AppImage";
|
|
sha256 = "sha256-HQ7d9LQDaPm6sGZ5boWZdmGTNqiGN9NWHUWPiDhl2Xc=";
|
|
};
|
|
|
|
# TODO other archs
|
|
|
|
}."${cpuArch}";
|
|
|
|
in stdenv.mkDerivation rec {
|
|
inherit version src;
|
|
|
|
pname = "go-appimage";
|
|
|
|
sourceRoot = "squashfs-root";
|
|
|
|
unpackPhase = ''
|
|
cp $src appimagetool
|
|
chmod u+wx appimagetool
|
|
#patchelf --set-interpreter ${dynamicLinker} \
|
|
# --set-rpath ${fuse}/lib:${zlib}/lib \
|
|
# appimagetool
|
|
./appimagetool --appimage-extract
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
|
|
cp -r usr/* $out
|
|
for x in $out/bin/*; do
|
|
patchelf \
|
|
--set-interpreter ${dynamicLinker} \
|
|
--set-rpath ${lib.makeLibraryPath [ zlib stdenv.glibc.out fuse glib ]} \
|
|
$x || true
|
|
done
|
|
'';
|
|
|
|
dontStrip = true;
|
|
dontPatchELF = true;
|
|
}
|