Is there static version of Qt?

I do some development with nixpkgs/release-22.05. I need static Qt5 library.

  • is there static Qt in nixpkgs?
  • in the church of nix is it blasphemous to expect static Qt in nixpkgs?
  • (optional) how should I go about adding static Qt to nixpkgs?

You can try to build just about any package statically with the static nixpkgs overlay. Basically, prefix the attribute name with pkgsStatic. and you get a static variant.
I say try because, as for cross compilation, the build systems of a lot of software is broken and will not build without some further tweaking.

1 Like

Static Qt packages already exist in upstream Nixpkgs (not an overlay): pkgsStatic.qt5

As @rnhmjoj said though, they might not work. Either Qt itself or (more likely) a dependency is likely broken when built statically. pkgsStatic is considered an “exotic platform” and not well maintained because few people care about them.

If you’re willing to help improve the situation, feel free to submit PRs. You’ll quickly find the broken packages by simply trying to build a Qt library and then you can go about fixing whatever makes it not work when built statically in each package’s declaration. Consult the Nixpkgs manual and other packages on how to add patches etc. to a derivation.