What is a right way to create a static linked package?

Hi everyone, I knew about pkgsStatic but not all packages in that attribute set can be built. What kind of package can be built “statically” and what should I do if it won’t built by default?

It looks like nixpkgs just uses the --enable-static autoconf flag in this case. So if everything in your closure supports that flag, you should be good. zlib for instance doesn’t atm. :confused: