Files
nixpkgs/doc/hooks/libglycin.section.md
Leah Amelia Chen 1def69720c libglycin: Introduce setup hook for adding loader paths to wrapper
This setup hook discovers glycin loaders in the inputs list it is placed into, and adds them to `gappsWrapperArgs`. This should simplify glycin-dependent programs’ expressions.

Just add `libglycin.setupHook` (for Rust programs) or `libglycin` (for other languages) to `buildInputs`. The latter will also pull in the setup hook.

Note, the setup hook needs to go to the `buildInputs` since we cannot have a different offset when used as standalone hook instead of propagated from `libglycin`. We chose `hostOffset` to make it work with the proper placement of `libglycin` in `buildInputs`.

Co-authored-by: Seth Flynn <getchoo@tuta.io>
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
2026-01-19 02:18:28 +01:00

1.4 KiB

libglycin

Glycin is a library for sandboxed and extendable image loading.

[]{#libglycin-setup-hook} For most applications using it, individual image formats are loaded through binaries provided by glycin-loaders. The paths of these loaders must be injected into the environment, e.g. using wrapGAppsHook. libglycin.setupHook will do that.

[]{#libglycin-patch-vendor-hook} Additionally, for Rust projects glycin Rust crate itself requires a patch to become self-contained. libglycin.patchVendorHook will do that. This is not needed for projects using the ELF library from libglycin package.

Example code snippet

{
  lib,
  rustPlatform,
  libglycin,
  glycin-loaders,
  wrapGAppsHook4,
}:

rustPlatform.buildRustPackage {
  # ...

  cargoHash = "...";

  nativeBuildInputs = [
    wrapGAppsHook4
    libglycin.patchVendorHook
  ];

  buildInputs = [
    libglycin.setupHook
    glycin-loaders
  ];

  # ...
}

Variables controlling glycin-loaders

glycinCargoDepsPath

Path to a directory containing the glycin crate to patch. Defaults to the crate directory created by cargoSetupHook, or ./vendor/.

dontWrapGlycinLoaders

Disable adding the Glycin loaders path XDG_DATA_DIRS with wrapGAppsHook.