NixOS / cabal2nix

Generate Nix build instructions from a Cabal file
https://haskell4nix.readthedocs.io
Other
355 stars 154 forks source link

Use lib.get{Lib,Dev} to correctly locate outputs #591

Closed oxalica closed 1 year ago

oxalica commented 1 year ago

This prevent potential breakage when upstream outputs splitting.

Required by NixOS/nixpkgs#209128

sternenseemann commented 1 year ago

Causes the following diff on current nixpkgs:

diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix
index 00f5458ec3d..5037fb8b58d 100644
--- a/pkgs/development/haskell-modules/hackage-packages.nix
+++ b/pkgs/development/haskell-modules/hackage-packages.nix
@@ -8416,7 +8416,7 @@ self: {
        libraryHaskellDepends = [ base bytestring unix ];
        librarySystemDepends = [ fuse ];
        preConfigure = ''
-         sed -i -e "s@  Extra-Lib-Dirs:         /usr/local/lib@  Extra-Lib-Dirs:         ${fuse}/lib@" HFuse.cabal
+         sed -i -e "s@  Extra-Lib-Dirs:         /usr/local/lib@  Extra-Lib-Dirs:         ${lib.getLib fuse}/lib@" HFuse.cabal
        '';
        description = "HFuse is a binding for the Linux FUSE library";
        license = lib.licenses.bsd3;
@@ -111733,7 +111733,7 @@ self: {
        ];
        libraryPkgconfigDepends = [ cairo ];
        preCompileBuildDriver = ''
-         PKG_CONFIG_PATH+=":${cairo}/lib/pkgconfig"
+         PKG_CONFIG_PATH+=":${lib.getDev cairo}/lib/pkgconfig"
          setupCompileFlags+=" $(pkg-config --libs cairo-gobject)"
        '';
        description = "Cairo bindings";
@@ -112750,7 +112750,7 @@ self: {
        ];
        libraryPkgconfigDepends = [ cairo pango ];
        preCompileBuildDriver = ''
-         PKG_CONFIG_PATH+=":${cairo}/lib/pkgconfig"
+         PKG_CONFIG_PATH+=":${lib.getDev cairo}/lib/pkgconfig"
          setupCompileFlags+=" $(pkg-config --libs cairo-gobject)"
        '';
        description = "Pango bindings";
@@ -112777,7 +112777,7 @@ self: {
        ];
        libraryPkgconfigDepends = [ cairo pango ];
        preCompileBuildDriver = ''
-         PKG_CONFIG_PATH+=":${cairo}/lib/pkgconfig"
+         PKG_CONFIG_PATH+=":${lib.getDev cairo}/lib/pkgconfig"
          setupCompileFlags+=" $(pkg-config --libs cairo-gobject)"
        '';
        description = "PangoCairo bindings";
@@ -177449,7 +177449,7 @@ self: {
        version = "0.1.1";
        sha256 = "01zvk86kg726lf2vnlr7dxiz7g3xwi5a4ak9gcfbwyhynkzjmsfi";
        configureFlags = [
-         "--extra-include-dir=${libxml2.dev}/include/libxml2"
+         "--extra-include-dir=${lib.getDev libxml2}/include/libxml2"
        ];
        libraryHaskellDepends = [ base bytestring mtl ];
        librarySystemDepends = [ libxml2 ];

The pkg-config ones are likely not necessary anymore thanks to setup hooks, but that's something for another time.