Making CMake+Qt5-based derivations cross-platform: SuperCollider and plugins

Hello,

Apologies if this should be obvious but I still have limited experience on the tools involved and reading some of the not-straightforward Nix code can still be challenging at times. I’m interested on making the supercollider derivation able to build and run on macOS. In the nixpkgs source I see the supercollider derivation is called using libsForQt5.callPackage instead of the default callPackage, so buildPhase or installPhase are not defined for the derivation.

In any case, my usual strategy when packaging something for Nix is checking how the original source documents building it for a particular platform and mimic it, and in the case of supercollider seems it’s only a couple of cmake instructions assuming all the dependencies listed on the prerequisites are available. I’m having trouble finding the way to use these build instructions with this libsForQt5.callPackage, specifying what the “target” would be, what the -G Xcode involves for adding the appropriate dependencies, etc.

Is this documented somewhere? I have checked the Qt section on the Nixpkgs manual but I don’t find a clear path, probably it’s due to ignoring how CMake and Qt’s build processes work, so I’d like to have some directions.

I get that the Qt dependency makes it not possible to simply list the dependencies and specify the buildPhase etc, but even if it was possible and I get it working for my case, what about if I want to contribute it while being so different from upstream’s approach? Is it even a good practice to have completely different derivation definitions for different platforms slapping an if-then-else for deciding? Seems wrong to me. In the case of SuperCollider itself, what about the plugins and supercollider-with-plugins? Should the plugins share the same treatment?

Thanks a lot!

1 Like