Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set flag in nix package

Tags:

nix

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?

like image 891
majkrzak Avatar asked Dec 02 '25 11:12

majkrzak


1 Answers

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.

like image 59
Etienne Laurin Avatar answered Dec 04 '25 03:12

Etienne Laurin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!