summary refs log tree commit diff
path: root/pkgs/tools/security/mkp224o/default.nix
blob: 7585fdf22e1a7df037af1a9a60ae935c2e05ff7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ stdenv, lib, fetchFromGitHub, autoreconfHook, libsodium }:

stdenv.mkDerivation rec {
  pname = "mkp224o";
  version = "1.4.0";

  src = fetchFromGitHub {
    owner = "cathugger";
    repo = "mkp224o";
    rev = "v${version}";
    sha256 = "0b7xs4gnyfhdkwl8wkb6mazas88ybnlbxck59p4n2mnlndvd8kb7";
  };

  buildCommand =
    let
      # compile few variants with different implementation of crypto
      # the fastest depends on a particular cpu
      variants = [
        { suffix = "ref10";         configureFlags = ["--enable-ref10"]; }
        { suffix = "donna";         configureFlags = ["--enable-donna"]; }
      ] ++ lib.optionals (stdenv.isi686 || stdenv.isx86_64) [
        { suffix = "donna-sse2";    configureFlags = ["--enable-donna-sse2"]; }
      ] ++ lib.optionals stdenv.isx86_64 [
        { suffix = "amd64-51-30k";  configureFlags = ["--enable-amd64-51-30k"]; }
        { suffix = "amd64-64-20k";  configureFlags = ["--enable-amd64-64-24k"]; }
      ];
    in
      lib.concatMapStrings ({suffix, configureFlags}: ''
        install -D ${
          stdenv.mkDerivation {
            name = "mkp224o-${suffix}-${version}";
            inherit version src configureFlags;
            nativeBuildInputs = [ autoreconfHook ];
            buildInputs = [ libsodium ];
            installPhase = "install -D mkp224o $out";
          }
        } $out/bin/mkp224o-${suffix}
      '') variants;

  meta = with lib; {
    description = "Vanity address generator for tor onion v3 (ed25519) hidden services";
    homepage = http://cathug2kyi4ilneggumrenayhuhsvrgn6qv2y47bgeet42iivkpynqad.onion/;
    license = licenses.cc0;
    platforms = platforms.linux;
    maintainers = with maintainers; [ volth ];
  };
}