Reputation: 1546
I'm trying to link my project with static openssl. I've noticed that there is flag static
in openssl package: https://github.com/NixOS/nixpkgs/blob/d6a12e8d9e0a4ac35ed401881e0d3160c764ac36/pkgs/development/libraries/openssl/default.nix#L5 but i have no idea how it can be set when using it. (pkgs.openssl ...
?).
Currently I "solved" it by using pkgs.pkgsStatic.openssl
, but it have very annoying side effect on form of gcc
and other not related dependencies being recompiled statically (what the hell?).
How can use openssl
package with static flag enabled?
Upvotes: 3
Views: 1192
Reputation: 7184
You can change the arguments passed to a package with override
. This is enough if you just want to build a static openssl
:
pkgs.openssl.override {
static = true;
}
To build other packages using this customised openssl
, it must be added back into nixpkgs
using an overlay:
self: super: {
openssl = super.openssl.override {
static = true;
};
}
This overlay can be placed in ~/.config/nixpkgs/overlays/openssl-static.nix
or added to configuration.nix
's nixpkgs.overlays
.
Upvotes: 2