Update appimagetool-ing to something which can theoretically be used on other architectures

main
Brian Picciano 1 year ago
parent 17fb9bbd77
commit 5061fb5670
  1. 21
      default.nix
  2. 65
      nix/appimagetool.nix

@ -65,17 +65,28 @@
name = "cryptic-net-AppImage";
src = appDir;
nativeBuildInputs = [ appimagetool ];
nativeBuildInputs = [
appimagetool
pkgs.file
pkgs.fuse
];
ARCH = "x86_64";
builder = builtins.toFile "build.sh" ''
source $stdenv/setup
cp -rL "$src" cryptic-net
chmod +w cryptic-net -R
cp -rL "$src" cryptic-net.AppDir
chmod +w cryptic-net.AppDir -R
export VERSION=debug
# https://github.com/probonopd/go-appimage/issues/155
unset SOURCE_DATE_EPOCH
appimagetool ./cryptic-net.AppDir
mkdir -p "$out/bin"
appimagetool cryptic-net "$out/bin/cryptic-net"
mkdir -p "$out"/bin
chmod +w "$out" -R
mv Cryptic_Net-* "$out"/bin/cryptic-net
'';
};

@ -1,17 +1,58 @@
{
# Modified from https://github.com/matthewbauer/nix-bundle/blob/e9fa7e8a118942adafa8592a28b301ee23d37c13/appimagetool.nix
{ stdenv, lib, fetchurl, fuse, zlib, file, glib, }:
fetchFromGitHub,
callPackage,
# This is from some binaries.
}: let
# Ideally, this should be source based,
# but I can't get it to build from GitHub
src = fetchFromGitHub {
owner = "matthewbauer";
repo = "nix-bundle";
rev = "223f4ffc4179aa318c34dc873a08cb00090db829";
sha256 = "0pqpx9vnjk9h24h9qlv4la76lh5ykljch6g487b26r1r2s9zg7kh";
};
let
in
inherit (stdenv.cc.bintools) dynamicLinker;
callPackage "${src}/appimagetool.nix" {}
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;
}

Loading…
Cancel
Save