From eb79fe19e89fdf83033d983ec7e92c5ca2b07383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 21 Aug 2023 21:33:52 +0100 Subject: [PATCH] add languages.python.manylinux.enable --- src/modules/languages/python.nix | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/modules/languages/python.nix b/src/modules/languages/python.nix index 2b100585b..b344825de 100644 --- a/src/modules/languages/python.nix +++ b/src/modules/languages/python.nix @@ -2,20 +2,26 @@ let cfg = config.languages.python; + libraries = lib.concatStringsSep ":" + ( + (lib.optional cfg.manylinux.enable pkgs.pythonManylinuxPackages.manylinux2014Package) + # Make sure the python interpreter can find the native libraries. + ++ [ "${config.devenv.dotfile}/profile/lib" ] + ); package = cfg.package.override (old: { self = pkgs.callPackage "${pkgs.path}/pkgs/development/interpreters/python/wrapper.nix" { python = old.self; requiredPythonModules = cfg.package.pkgs.requiredPythonModules; makeWrapperArgs = [ "--prefix" + ":" "LIBRARY_PATH" - # Make sure the python interpreter can find the native libraries. - "${config.devenv.dotfile}/profile/lib" + libraries ] ++ lib.optionals pkgs.stdenv.isDarwin [ "--prefix" + ":" "DYLD_LIBRARY_PATH" - # Make sure the python interpreter can find the native libraries. - "${config.devenv.dotfile}/profile/lib" + libraries ]; }; }); @@ -121,6 +127,18 @@ in description = "The Python package to use."; }; + manylinux.enable = lib.mkOption { + type = lib.types.bool; + default = pkgs.stdenv.isLinux; + description = '' + Whether to install manylinux2014 libraries. + + Enabled by default on linux; + + This is useful when you want to use Python wheels that depend on manylinux2014 libraries. + ''; + }; + version = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null;