Home Explore Blog CI



nixpkgs

2nd chunk of `doc/build-helpers/images/appimagetools.section.md`
f7f827aba70ac77639c1f793aa91c98c368b3b9e757804f90000000100000849
  - Looking through the extracted AppImage files, reading its scripts and running `patchelf` and `ldd` on its executables.
    This can also be done in `appimage-run`, by setting `APPIMAGE_DEBUG_EXEC=bash`.
  - Running `strace -vfefile` on the wrapped executable, looking for libraries that can't be found.

:::{.example #ex-wrapping-appimage-with-extrapkgs}

# Wrapping an AppImage with extra packages

```nix
{ appimageTools, fetchurl }:
let
  pname = "irccloud";
  version = "0.16.0";

  src = fetchurl {
    url = "https://github.com/irccloud/irccloud-desktop/releases/download/v${version}/IRCCloud-${version}-linux-x86_64.AppImage";
    hash = "sha256-/hMPvYdnVB1XjKgU2v47HnVvW4+uC3rhRjbucqin4iI=";
  };
in
appimageTools.wrapType2 {
  inherit pname version src;
  extraPkgs = pkgs: [ pkgs.at-spi2-core ];
}
```

:::

## Extracting {#ssec-pkgs-appimageTools-extracting}

Use `extract` if you need to extract the contents of an AppImage.
This is usually used in Nixpkgs to install extra files in addition to [wrapping](#ssec-pkgs-appimageTools-wrapping) the AppImage.
`extract` expects an argument with the `src` attribute, and either a `name` attribute or `pname` and `version` attributes.

::: {.note}
In the past, `appimageTools` provided both `extractType1` and `extractType2`, to be used depending on the type of AppImage that was being extracted.
However, [those were unified early 2020](https://github.com/NixOS/nixpkgs/pull/81572), meaning that both `extractType1` and `extractType2` have the same behaviour as `extract` now.
:::

:::{.example #ex-extracting-appimage}

# Extracting an AppImage to install extra files

This example was adapted from a real package in Nixpkgs to show how `extract` is usually used in combination with `wrapType2`.
Note how `appimageContents` is used in `extraInstallCommands` to install additional files that were extracted from the AppImage.

```nix
{ appimageTools, fetchurl }:
let
  pname = "irccloud";
  version = "0.16.0";

  src = fetchurl {
    url = "https://github.com/irccloud/irccloud-desktop/releases/download/v${version}/IRCCloud-${version}-linux-x86_64.AppImage";

Title: Extracting AppImages with appimageTools
Summary
The `appimageTools` package provides the `extract` function for extracting the contents of an AppImage, typically used in Nixpkgs alongside `wrapType2` to install extra files. The `extract` function takes the AppImage source and metadata. Previously, there were `extractType1` and `extractType2`, but they have been unified into `extract`.