Hello,
I have a haskell-flake library bar that has a Rust FFI using the settings.<name>.custom property to link everything.
I have an app foo that depends on bar. When trying to create a Docker image per the docs, the image is huge. When following the instructions in the docs to reduce the size, the Haskell portions get reduced but the image still contains all the Rust deps needed to build bar. Is there a way to avoid packing all the Rust code?
You might have to removeReferencesTo unwanted deps of bar. But first, it would be helpful to see how the image depends on these unwanted deps using nix why-depends
Meta: same question https://github.com/srid/haskell-flake/discussions/433
I am using removeReferencesTo. The original Docker image was much larger and it included ghc and all the Haskell deps. removeReferencesTo did remove all of the Haskell deps, but I am left with all the Rust dependencies still.
The dependencies that remain in the image are the ones brought in by the derivation that the bar lib uses via settings.<name>.custom
I was able to remove these using removeReferencesTo by explicitly calling out the Rust derivations, not just bar.
I should include this use case in https://github.com/shivaraj-bh/haskell-rust-ffi-template and also update https://nixos.asia/en/haskell-rust-ffi
Last updated: Dec 07 2025 at 16:49 UTC