core/pkgs/build-support/appimage/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

243 lines
4.7 KiB
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{
lib,
bash,
binutils-unwrapped,
coreutils,
gawk,
libarchive,
pv,
squashfsTools,
buildFHSEnv,
pkgs,
}:
rec {
appimage-exec = pkgs.substituteAll {
src = ./appimage-exec.sh;
isExecutable = true;
dir = "bin";
path = lib.makeBinPath [
bash
binutils-unwrapped
coreutils
gawk
libarchive
pv
squashfsTools
];
};
extract =
args@{
name ? "${args.pname}-${args.version}",
postExtract ? "",
src,
...
}:
pkgs.runCommand "${name}-extracted" { buildInputs = [ appimage-exec ]; } ''
appimage-exec.sh -x $out ${src}
${postExtract}
'';
# for compatibility, deprecated
extractType1 = extract;
extractType2 = extract;
wrapType1 = wrapType2;
wrapAppImage =
args@{
src,
extraPkgs,
meta ? { },
...
}:
buildFHSEnv (
defaultFhsEnvArgs
// {
targetPkgs = pkgs: [ appimage-exec ] ++ defaultFhsEnvArgs.targetPkgs pkgs ++ extraPkgs pkgs;
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
runScript = "appimage-exec.sh -w ${src} --";
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
meta = {
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
} // meta;
}
// (removeAttrs args (builtins.attrNames (builtins.functionArgs wrapAppImage)))
);
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
wrapType2 =
args@{
src,
extraPkgs ? pkgs: [ ],
...
}:
wrapAppImage (
args
// {
inherit extraPkgs;
src = extract (
lib.filterAttrs (
key: value:
builtins.elem key [
"name"
"pname"
"version"
"src"
]
) args
);
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
# passthru src to make nix-update work
# hack to keep the origin position (unsafeGetAttrPos)
passthru =
lib.pipe args [
lib.attrNames
(lib.remove "src")
(removeAttrs args)
]
// args.passthru or { };
}
);
defaultFhsEnvArgs = {
# Most of the packages were taken from the Steam chroot
targetPkgs =
pkgs: with pkgs; [
gtk3
bashInteractive
gnome.zenity
xorg.xrandr
which
perl
xdg-utils
iana-etc
krb5
gsettings-desktop-schemas
hicolor-icon-theme # dont show a gtk warning about hicolor not being installed
];
# 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
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
gst_all_1.gstreamer
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugins-base
libdrm
xorg.xkeyboardconfig
xorg.libpciaccess
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
glib
gtk2
bzip2
zlib
gdk-pixbuf
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
xorg.libXinerama
xorg.libXdamage
xorg.libXcursor
xorg.libXrender
xorg.libXScrnSaver
xorg.libXxf86vm
xorg.libXi
xorg.libSM
xorg.libICE
freetype
curlWithGnuTls
nspr
nss
fontconfig
cairo
pango
expat
dbus
cups
libcap
SDL2
libusb1
udev
dbus-glib
atk
at-spi2-atk
libudev0-shim
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
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
vulkan-loader
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
flac
freeglut
libjpeg
libpng12
libpulseaudio
libsamplerate
libmikmod
libthai
libtheora
libtiff
pixman
speex
SDL_image
SDL_ttf
SDL_mixer
SDL2_ttf
SDL2_mixer
libappindicator-gtk2
libcaca
libcanberra
libgcrypt
libvpx
librsvg
xorg.libXft
libvdpau
alsa-lib
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
harfbuzz
e2fsprogs
libgpg-error
keyutils.lib
libjack2
fribidi
p11-kit
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
gmp
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
# libraries not on the upstream include list, but nevertheless expected
# by at least one appimage
libtool.lib # for Synfigstudio
xorg.libxshmfence # for apple-music-electron
at-spi2-core
pciutils # for FreeCAD
pipewire # immersed-vr wayland support
];
};
}