From 83934fced1765e8515b1b76baf00f1b94e1790ff Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 12 Jun 2024 12:44:07 +0200 Subject: [PATCH] doc/haskell: Dedup and edit justStaticExecutables Make sure all relevant info is in the user manual and avoid duplication of efforts, or things going out of sync. (cherry picked from commit ce81cf0ee12fefbb8c93ccaf4efe370ca1087934) --- doc/languages-frameworks/haskell.section.md | 6 ++++-- .../haskell-modules/generic-builder.nix | 16 ++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/doc/languages-frameworks/haskell.section.md b/doc/languages-frameworks/haskell.section.md index 3843f3a36eee..045ee1fc98f8 100644 --- a/doc/languages-frameworks/haskell.section.md +++ b/doc/languages-frameworks/haskell.section.md @@ -929,10 +929,12 @@ for this to work. Haskell dependencies, but will still link dynamically against libc, GMP and other system library dependencies. - If the library being built or its dependencies use their Cabal-generated + If a library or its dependencies use their Cabal-generated `Paths_*` module, this may not work as well if GHC's dead code elimination is unable to remove the references to the dependency's store path that module - contains. (See [nixpkgs#164630][164630] for more information.) + contains. + As a consequence, an unused reference may be created from the static binary to such a _library_ store path. + (See [nixpkgs#164630][164630] for more information.) Nixpkgs unstable and releases from 24.11 onwards will verify that such references are eliminated and fail the build if they are not. diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index e383af0b4228..22a081c41346 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -118,20 +118,8 @@ in # to help prevent static Haskell binaries from having erroneous dependencies # on GHC. # - # Generated `Paths_*` modules include paths for the runtime library - # directory (and similar) of the package being built. If the `Paths_*` - # module is imported, this creates a dependency from the static binary - # being built to the _library_ being built (which is dynamically linked - # and depends on the GHC used to build it). - # - # To avoid this: - # 1. Build the impacted derivation. - # 2. Run `strings` on the built binary of the impacted derivation to - # locate the store paths it depends on. - # 3. Add `remove-references-to -t ${bad-store-path-in-binary}` to the - # impacted derivation's `postInstall`. - # - # See: https://github.com/NixOS/nixpkgs/issues/164630 + # See https://nixos.org/manual/nixpkgs/unstable/#haskell-packaging-helpers + # or its source doc/languages-frameworks/haskell.section.md , disallowGhcReference ? false , # Cabal 3.8 which is shipped by default for GHC >= 9.3 always calls # `pkg-config --libs --static` as part of the configure step. This requires