2 Commits

Author SHA1 Message Date
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
Leah Amelia Chen c68c6af86c libglycin: Add setup hook for patching Rust vendor directory
Glycin rust library searches `bwrap` on path. This would require every reverse dependency to add `bubblewrap` to its `PATH`, which would be quite annoying to ensure. Especially when libraries start using glycin.

We provide `passthru.glycinPathsPatch` to perform source-level hardcoding but that doesn't work with apps that use `rustPlatform.cargoSetupHook` since it assumes a setup where snapshots of GNOME sources already contain vendored Rust dependencies under `vendor/`.

The setup hook instead provides a much more flexible approach that uses the `$cargoDepsCopy` variable provided by `cargoSetupHook`, which points to the local, modifiable copy of Cargo dependencies, to patch `src/sandbox.rs` just like `glycinPathsPatch`. If `$cargoDepsCopy` is not found, then the old behavior is used where Cargo dependencies are assumed to be under `vendor/`.

Additionally, the patch requires modifying `Cargo.lock` when using `rustPlatform.fetchCargoVendor`. The setup hook fixes that as well.

Rust programs just need to add `libglycin.patchVendorHook` and it should take care of this.

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