Building the staticx package

Hi all.

I’m trying to build and use the staticx package on nix: ( staticx · PyPI )
I’ve got a flake working: GitHub - PicoGeyer/nix_staticx: Flake that builds python staticx

I would appreciate any comments on my approach.
Part of the trouble I had is that scons tries hard to not use anything from environment for reproducibility.
Nix on the other hand seem to depend on the environment variables being present.

I was be able to build things just fine from the shell but as soon as Scons called the command (without the environment setup), there would be linker errors.

So the way I solved it now is to patch the SConstruct file (with nix_scons.patch) to add any environment variable that starts with NIX_ to the build environment.

Is this typically how one would go about solving nix build issues or is there something more elegant?

Any comments would be appreciated.
If there’s nothing wrong with this approach, I may try get a package into nixpkgs.

Regards,
Pico