1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
{
lib,
bash,
binutils-unwrapped,
coreutils,
gawk,
libarchive,
pv,
squashfs-tools,
buildFHSEnv,
replaceVarsWith,
runtimeShell,
runCommand,
}:
rec {
appimage-exec = replaceVarsWith {
src = ./appimage-exec.sh;
isExecutable = true;
dir = "bin";
replacements = {
inherit runtimeShell;
path = lib.makeBinPath [
bash
binutils-unwrapped
coreutils
gawk
libarchive
pv
squashfs-tools
];
};
};
extract =
args@{
pname,
version,
name ? null,
postExtract ? "",
src,
...
}:
assert
name == null
|| throw "The `name` argument is deprecated. Use `pname` and `version` instead to construct the name.";
runCommand "${pname}-${version}-extracted"
{
nativeBuildInputs = [ appimage-exec ];
strictDeps = true;
}
''
appimage-exec.sh -x $out ${src}
${postExtract}
'';
# for compatibility, deprecated
extractType1 = lib.warn "'appimageTools.extractType1' is deprecated, use 'appimageTools.extract' instead" extract;
extractType2 = lib.warn "'appimageTools.extractType2' is deprecated, use 'appimageTools.extract' instead" extract;
wrapType1 = lib.warn "'appimageTools.wrapType1' is deprecated, use 'appimageTools.wrapType2' instead" wrapType2;
wrapAppImage = lib.extendMkDerivation {
constructDrv = buildFHSEnv;
excludeDrvArgNames = [ "extraPkgs" ];
extendDrvArgs =
finalAttrs:
prev@{
contents ? prev.src,
extraPkgs ? pkgs: [ ],
meta ? { },
...
}:
defaultFhsEnvArgs
// {
targetPkgs = pkgs: [ appimage-exec ] ++ defaultFhsEnvArgs.targetPkgs pkgs ++ extraPkgs pkgs;
runScript = "appimage-exec.sh -w ${finalAttrs.contents or prev.src} --";
meta = {
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
}
// meta;
};
};
wrapType2 = lib.extendMkDerivation {
constructDrv = wrapAppImage;
extendDrvArgs = finalAttrs: args: {
contents = extract (
lib.filterAttrs (
key: value:
builtins.elem key [
"pname"
"version"
"src"
]
) finalAttrs
);
# passthru src to make nix-update work
# hack to keep the origin position (unsafeGetAttrPos)
passthru =
lib.pipe finalAttrs [
lib.attrNames
(lib.remove "src")
(removeAttrs finalAttrs)
]
// args.passthru or { };
};
};
defaultFhsEnvArgs = {
# Most of the packages were taken from the Steam chroot
targetPkgs =
pkgs: with pkgs; [
gtk3
bashInteractive
zenity
xrandr
which
perl
xdg-user-dirs # flutter desktop apps
xdg-utils
iana-etc
krb5
gsettings-desktop-schemas
hicolor-icon-theme # dont show a gtk warning about hicolor not being installed
# libraries not on the upstream include list, but nevertheless expected
# by at least one appimage
libsecret # For bitwarden, appimage is x86_64 only
];
# list of libraries expected in an appimage environment:
# https://github.com/AppImage/pkg2appimage/blob/master/excludelist
multiPkgs =
pkgs: with pkgs; [
desktop-file-utils
libxcomposite
libxtst
libxrandr
libxext
libx11
libxfixes
libGL
gst_all_1.gstreamer
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugins-base
libdrm
xkeyboard-config
libpciaccess
glib
bzip2
zlib
gdk-pixbuf
libxinerama
libxdamage
libxcursor
libxrender
libxscrnsaver
libxxf86vm
libxi
libsm
libice
freetype
curlWithGnuTls
nspr
nss
fontconfig
cairo
pango
expat
dbus
cups
libcap
SDL2
libusb1
udev
dbus-glib
atk
at-spi2-atk
libudev0-shim
libxt
libxmu
libxcb
libxcb-util
libxcb-wm
libxcb-image
libxcb-keysyms
libxcb-render-util
libGLU
libuuid
libogg
libvorbis
SDL2_image
glew_1_10
openssl
libidn
onetbb
wayland
libgbm
libxkbcommon
vulkan-loader
flac
libglut
libjpeg
libpng12
libpulseaudio
libsamplerate
libmikmod
libthai
libtheora
libtiff
pixman
speex
SDL2_ttf
SDL2_mixer
libcaca
libcanberra
libgcrypt
libvpx
librsvg
libxft
libvdpau
alsa-lib
harfbuzz
e2fsprogs
libgpg-error
keyutils.lib
libjack2
fribidi
p11-kit
gmp
# libraries not on the upstream include list, but nevertheless expected
# by at least one appimage
libtool.lib # for Synfigstudio
at-spi2-core
pciutils # for FreeCAD
pipewire # immersed-vr wayland support
libmpg123 # Slippi launcher
brotli # TwitchDropsMiner
];
};
}
|