From 0f962934edcdead5deb1a6b94ba65e8ddef618fa Mon Sep 17 00:00:00 2001 From: adisbladis Date: Mon, 20 Mar 2023 17:09:35 +1300 Subject: [PATCH] overrides.gdal: disable python bindings in gdal from nixpkgs This collides with the version built from pypi, and if the version mismatches the build process attempts an uninstall of the nixpkgs gdal package. We can avoid this by only building the native library and ignore the Python bindings. --- overrides/default.nix | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/overrides/default.nix b/overrides/default.nix index 0fb0d0a..d7a32da 100644 --- a/overrides/default.nix +++ b/overrides/default.nix @@ -670,15 +670,28 @@ lib.composeManyExtensions [ VERSION = old.version; }); - gdal = super.gdal.overridePythonAttrs ( - old: { - nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.gdal ]; - preBuild = (old.preBuild or "") + '' - substituteInPlace setup.cfg \ - --replace "../../apps/gdal-config" '${pkgs.gdal}/bin/gdal-config' - ''; - } - ); + gdal = + let + # Build gdal without python bindings to prevent version mixing + # We're only interested in the native libraries, not the python ones + # as we build that separately. + gdal = pkgs.gdal.overrideAttrs (old: { + doInstallCheck = false; + doCheck = false; + cmakeFlags = (old.cmakeFlags or [ ]) ++ [ + "-DBUILD_PYTHON_BINDINGS=OFF" + ]; + }); + in + super.gdal.overridePythonAttrs ( + old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ gdal ]; + preBuild = (old.preBuild or "") + '' + substituteInPlace setup.cfg \ + --replace "../../apps/gdal-config" '${gdal}/bin/gdal-config' + ''; + } + ); grandalf = super.grandalf.overridePythonAttrs ( old: {