How to specify flags for "python setup.py install"

Hello everyone,

I want to add the python package pyo to Nix packages. I want to ask if and if yes how it is possible to add flags to the python setup.py install call of buildPythonPackage. Pyo uses flags to compile the C code with specific settings. I already studied the options of buildPythonPackage, but couldn’t find anything suitable yet.

Best, Levin

(this is what I got so far)

with import <nixpkgs> {};
with pkgs.python3Packages;

buildPythonPackage rec {
  name = "pyo";
  src = fetchFromGitHub {
    owner = "belangeo";
    repo = "pyo";
    rev = "360c429138e170e291a89da605a8dc20f837466f";
    sha256 = "sha256-CRHl+lAdiDXrXVcr9W14XE9lTJ6T7MfE8WeTMm6FpzU=";
  };
  doCheck = true;
  propagatedBuildInputs = with pkgs; [
      # C library dependencies for pyo
      portaudio
      libsndfile
      portmidi
      liblo
      alsa-lib
      alsa-utils
      libjack2
      flac
      libogg
      libvorbis
      # Other pyo dependencies
      python39Packages.wxPython_4_1
    ];
  }

There is setupPyBuildFlags and setupPyGlobalFlags. See 17.27.2.3.1.1. buildPythonPackage parameters of the nixpkgs manual. Nixpkgs 22.05 manual

Thank you @knedlsepp for the fast answer and the reference!

1 Like