mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
libpng12 is old, vulnerable to numerous CVEs, and is
also not expected to be present on the host system [1].
Changes to the appimage FHS environment are sadly not
very testable, because it is unfeasible to run all
appimages in and out of tree. If this causes problems,
we may have to readd `libpng` (ideally the 1.6 variant
instead of the 1.2 variant). If anything specifically
requests `libpng12.so` we have a problem.
[1] 19e30b276f/excludelist
250 lines
5.3 KiB
Nix
250 lines
5.3 KiB
Nix
{
|
|
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
|
|
libpulseaudio
|
|
libsamplerate
|
|
libmikmod
|
|
libthai
|
|
libtheora
|
|
libtiff
|
|
pixman
|
|
speex
|
|
SDL2_ttf
|
|
SDL2_mixer
|
|
libcaca
|
|
libcanberra
|
|
libvpx
|
|
librsvg
|
|
libxft
|
|
libvdpau
|
|
alsa-lib
|
|
|
|
harfbuzz
|
|
e2fsprogs
|
|
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
|
|
];
|
|
};
|
|
}
|