git.iko.soy/typeable/nixpkgs
on master help sign in
appimage-run: init

This adds a best-effort hack to run AppImages, which currently don't work out-of-the-box on NixOS. This is not preferable to using packaged applications, but may help users if the application they want to run is not in nixpkgs. It uses the package list from the Steam chroot, but without Steam packages.

commitf38459442af891bc34237b3e067ece4ffce7e0b5 authortilpner <till@hoeppner.ws> dateSat 9 Jun 2018, 19:10 (8 years ago) parentbc490a4
2 files changed+148
pkgs/tools/package-management/appimage-run/default.nix+146 pkgs/top-level/all-packages.nix+2
pkgs/tools/package-management/appimage-run/default.nixnew file+146
@@ -0,0 +1,146 @@
1+{ stdenv, writeScript, buildFHSUserEnv, coreutils
2+, extraPkgs ? pkgs: [] }:
3+
4+buildFHSUserEnv {
5+ name = "appimage-run";
6+
7+ # Most of the packages were taken from the Steam chroot
8+ targetPkgs = pkgs: with pkgs; [
9+ gtk3
10+ bashInteractive
11+ gnome3.zenity
12+ python2
13+ xorg.xrandr
14+ which
15+ perl
16+ xdg_utils
17+ iana-etc
18+ ] ++ extraPkgs pkgs;
19+
20+ multiPkgs = pkgs: with pkgs; [
21+ desktop-file-utils
22+ xorg.libXcomposite
23+ xorg.libXtst
24+ xorg.libXrandr
25+ xorg.libXext
26+ xorg.libX11
27+ xorg.libXfixes
28+ libGL
29+
30+ gst_all_1.gstreamer
31+ gst_all_1.gst-plugins-ugly
32+ libdrm
33+ xorg.xkeyboardconfig
34+ xorg.libpciaccess
35+
36+ glib
37+ gtk2
38+ bzip2
39+ zlib
40+ gdk_pixbuf
41+
42+ xorg.libXinerama
43+ xorg.libXdamage
44+ xorg.libXcursor
45+ xorg.libXrender
46+ xorg.libXScrnSaver
47+ xorg.libXxf86vm
48+ xorg.libXi
49+ xorg.libSM
50+ xorg.libICE
51+ gnome2.GConf
52+ freetype
53+ (curl.override { gnutlsSupport = true; sslSupport = false; })
54+ nspr
55+ nss
56+ fontconfig
57+ cairo
58+ pango
59+ expat
60+ dbus
61+ cups
62+ libcap
63+ SDL2
64+ libusb1
65+ dbus-glib
66+ libav
67+ atk
68+ libudev0-shim
69+ networkmanager098
70+
71+ xorg.libXt
72+ xorg.libXmu
73+ xorg.libxcb
74+ libGLU
75+ libuuid
76+ libogg
77+ libvorbis
78+ SDL
79+ SDL2_image
80+ glew110
81+ openssl
82+ libidn
83+ tbb
84+ wayland
85+ mesa_noglu
86+ libxkbcommon
87+
88+ flac
89+ freeglut
90+ libjpeg
91+ libpng12
92+ libsamplerate
93+ libmikmod
94+ libtheora
95+ libtiff
96+ pixman
97+ speex
98+ SDL_image
99+ SDL_ttf
100+ SDL_mixer
101+ SDL2_ttf
102+ SDL2_mixer
103+ gstreamer
104+ gst-plugins-base
105+ libappindicator-gtk2
106+ libcaca
107+ libcanberra
108+ libgcrypt
109+ libvpx
110+ librsvg
111+ xorg.libXft
112+ libvdpau
113+ alsaLib
114+ strace
115+ ];
116+
117+ runScript = writeScript "appimage-exec" ''
118+ #!${stdenv.shell}
119+ APPIMAGE="$(realpath "$1")"
120+
121+ if [ ! -x "$APPIMAGE" ]; then
122+ echo "fatal: $APPIMAGE is not executable"
123+ exit 1
124+ fi
125+
126+ SHA256="$(${coreutils}/bin/sha256sum "$APPIMAGE" | cut -d ' ' -f 1)"
127+ SQUASHFS_ROOT="''${XDG_CACHE_HOME:-$HOME/.cache}/appimage-run/$SHA256/"
128+ mkdir -p "$SQUASHFS_ROOT"
129+
130+ export APPDIR="$SQUASHFS_ROOT/squashfs-root"
131+ if [ ! -x "$APPDIR" ]; then
132+ cd "$SQUASHFS_ROOT"
133+ "$APPIMAGE" --appimage-extract 2>/dev/null
134+ fi
135+
136+ cd "$APPDIR"
137+ export PATH="$PATH:$PWD/usr/bin"
138+ export APPIMAGE_SILENT_INSTALL=1
139+
140+ if [ -n "$APPIMAGE_DEBUG_EXEC" ]; then
141+ exec "$APPIMAGE_DEBUG_EXEC"
142+ fi
143+
144+ exec ./AppRun
145+ '';
146+}
pkgs/top-level/all-packages.nix+2
@@ -501,6 +501,8 @@ with pkgs;
501501 buildTools = androidenv.buildTools;
502502 };
503503
504+ appimage-run = callPackage ../tools/package-management/appimage-run {};
505+
504506 apt-cacher-ng = callPackage ../servers/http/apt-cacher-ng { };
505507
506508 apt-offline = callPackage ../tools/misc/apt-offline { };