? Editing: Post:21.body Save Delete Cancel
Content changed Sign & Publish new content

Skw's Blog

Some notes on Linux and functional programming

Follow in NewsfeedFollowing

Latest comments:

Add new post

Title

21 hours ago · 2 min read ·
3 comments
Body
Read more

Not found

Enabling Native OpenSSL in ZeroNet on NixOS

on Mar 08, 2019

Since my last post, the ZeroNet devs have added support for checking the LD_LIBRARY_PATH environment variable. This means we can add the location of our native OpenSSL library to it to achieve optimal performance.

Setting it is pretty easy; all we need to do is override the postFixup phase of the zeronet package, which is where the shell wrapper is created:

postFixup = ''
  makeWrapper "$out/share/zeronet.py" "$out/bin/zeronet" \
    --set PYTHONPATH "$PYTHONPATH" \
    --set PATH ${pkgs.python2Packages.python}/bin \
    --set LD_LIBRARY_PATH ${pkgs.openssl_1_0_2.out}/lib
'';

The only difference between ours and the normal one is that we added that LD_LIBRARY_PATH line, and we prefixed the variable referenced in PATH with pkgs. since we're not inside nixpkgs.

All together, with the current commit info, our override looks like this:

nixpkgs.config.packageOverrides = pkgs: rec {
  zeronet = pkgs.lib.overrideDerivation pkgs.zeronet (attrs: rec {
    buildInputs = with pkgs; [ openssl_1_0_2 ] ++ attrs.buildInputs;
    version = "0.6.5-git";
    src = pkgs.fetchFromGitHub {
      owner = "HelloZeroNet";
      repo = "ZeroNet";
      rev = "1ad44ace0ad178b3f5c514774441f6c3e20eb795";
      sha256 = "02qkj3ilmxvls4c9wxcpf55psnbm1mfjczgg2mxcv42yyz6c1zgc";
    };
    postFixup = ''
      makeWrapper "$out/share/zeronet.py" "$out/bin/zeronet" \
        --set PYTHONPATH "$PYTHONPATH" \
        --set PATH ${pkgs.python2Packages.python}/bin \
        --set LD_LIBRARY_PATH ${pkgs.openssl_1_0_2.out}/lib
    '';
  });
};

Now, when you go to the benchmark page, you should see something like

- openssl verify x 100..........0.053s [x6.97: Insane!!]

instead of

- openssl verify x 100...not avalible :(

0 Comment:

user_name1 day ago
Reply
Body
This page is a snapshot of ZeroNet. Start your own ZeroNet for complete experience. Learn More