Skip to content

Instantly share code, notes, and snippets.

@bignaux
Created March 6, 2020 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bignaux/2b2034f22507d40b6bc8dc6ff9398783 to your computer and use it in GitHub Desktop.
Save bignaux/2b2034f22507d40b6bc8dc6ff9398783 to your computer and use it in GitHub Desktop.
{ stdenv, buildFHSUserEnv, writeScript, pkgs
, bash, radare2, jq, squashfsTools
, coreutils, file, libarchive, runtimeShell }:
rec {
/* appimage-exec = stdenv.mkDerivation { */
#inherit pname version;
/* name = "appimage-exec"; */
#inherit radare2 bash jq ;
# i don't know why this has no effect
#buildInputs = [ radare2 libarchive jq squashfsTools coreutils file bash ];
appimage-exec = pkgs.substituteAll {
#name = "appimage-exec";
src = ./appimage-exec.sh;
isExecutable = true;
dir = "bin";
inherit (pkgs) radare2 libarchive jq squashfsTools coreutils file bash;
path = with pkgs; [ radare2 libarchive jq squashfsTools coreutils file bash ];
#path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
#firmware = pkgs.raspberrypifw;
#inherit configTxt;
};
/* buildCommand = ''
set -x
echo $PWD
ls -l
mkdir -p $out/bin/
#install -Dm755 $src/appimage-exec.sh -t $out/bin/
pkgs.substituteAll { dir = "bin"; isExecutable = true; name = "appimage-exec"; src = ${./appimage-exec.sh}; inherit ; }
#substituteAll ${./appimage-exec.sh} $out/bin/appimage-exec.sh
chmod +x $out/bin/appimage-exec.sh
'';
};*/
extract = { name, src }: stdenv.mkDerivation {
name = "${name}-extracted";
inherit src;
buildInputs = [ appimage-exec ];
#runScript = "appimage-exec.sh ${src} ${out}";
buildCommand = ''
appimage-exec.sh $src $out
'';
};
# for compatibility, deprecated
extractType1 = extract;
extractType2 = extract;
#wrapType2 = wrapAppImage;
#wrapType1 = wrapAppImage;
wrapAppImage = args@{ name, src, extraPkgs ? pkgs: [], ... }: buildFHSUserEnv (defaultFhsEnvArgs // {
inherit name;
targetPkgs = pkgs: defaultFhsEnvArgs.targetPkgs pkgs ++ extraPkgs pkgs;
runScript = "appimage-exec.sh ${src}";
} // (removeAttrs args (builtins.attrNames (builtins.functionArgs wrapAppImage))));
wrapType1 = args@{ name, src, extraPkgs , ... }: wrapAppImage (args // {
inherit name extraPkgs;
src = extractType1 { inherit name src; };
});
wrapType2 = args@{ name, src, extraPkgs ? pkgs: [], ... }: wrapAppImage (args // {
inherit name extraPkgs;
src = extractType2 { inherit name src; };
});
defaultFhsEnvArgs = {
name = "appimage-env";
# Most of the packages were taken from the Steam chroot
targetPkgs = pkgs: with pkgs; [
gtk3
bashInteractive
gnome3.zenity
python2
xorg.xrandr
which
perl
xdg_utils
iana-etc
krb5
];
# list of libraries expected in an appimage environment:
# https://github.com/AppImage/pkg2appimage/blob/master/excludelist
multiPkgs = pkgs: with pkgs; [
desktop-file-utils
xorg.libXcomposite
xorg.libXtst
xorg.libXrandr
xorg.libXext
xorg.libX11
xorg.libXfixes
libGL
gst_all_1.gstreamer
gst_all_1.gst-plugins-ugly
libdrm
xorg.xkeyboardconfig
xorg.libpciaccess
glib
gtk2
bzip2
zlib
gdk-pixbuf
xorg.libXinerama
xorg.libXdamage
xorg.libXcursor
xorg.libXrender
xorg.libXScrnSaver
xorg.libXxf86vm
xorg.libXi
xorg.libSM
xorg.libICE
gnome2.GConf
freetype
(curl.override { gnutlsSupport = true; sslSupport = false; })
nspr
nss
fontconfig
cairo
pango
expat
dbus
cups
libcap
SDL2
libusb1
udev
dbus-glib
libav
atk
at-spi2-atk
libudev0-shim
networkmanager098
xorg.libXt
xorg.libXmu
xorg.libxcb
xorg.xcbutil
xorg.xcbutilwm
xorg.xcbutilimage
xorg.xcbutilkeysyms
xorg.xcbutilrenderutil
libGLU
libuuid
libogg
libvorbis
SDL
SDL2_image
glew110
openssl
libidn
tbb
wayland
mesa
libxkbcommon
flac
freeglut
libjpeg
libpng12
libsamplerate
libmikmod
libtheora
libtiff
pixman
speex
SDL_image
SDL_ttf
SDL_mixer
SDL2_ttf
SDL2_mixer
gstreamer
gst-plugins-base
libappindicator-gtk2
libcaca
libcanberra
libgcrypt
libvpx
librsvg
xorg.libXft
libvdpau
alsaLib
harfbuzz
e2fsprogs
libgpgerror
keyutils.lib
libjack2
fribidi
p11-kit
# libraries not on the upstream include list, but nevertheless expected
# by at least one appimage
libtool.lib # for Synfigstudio
at-spi2-core
];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment