diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix index 14bd01c7346e..b17f720e5618 100644 --- a/pkgs/build-support/cabal/default.nix +++ b/pkgs/build-support/cabal/default.nix @@ -46,6 +46,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version; x : (removeAttrs x internalAttrs) // { buildInputs = filter (y : ! (y == null)) x.buildInputs; propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs; + propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs; doCheck = enableCheckPhase && x.doCheck; }; @@ -96,6 +97,10 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version; # have to check for its existence propagatedBuildInputs = if self.isLibrary then self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends else []; + # By default, also propagate all dependencies to the user environment. This is required, otherwise packages would be broken, because + # GHC also needs all dependencies to be available. + propagatedUserEnvPkgs = if self.isLibrary then self.buildDepends else []; + # library directories that have to be added to the Cabal files extraLibDirs = [];