summaryrefslogtreecommitdiff
path: root/pkgs/nheqminer/default.nix
blob: ad6b3d406a9d73a6ade9a2b4c680283cb9467bc0 (plain)
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
# build with:
# nix-build --show-trace -E 'with import <nixpkgs> {}; callPackage ./default.nix { boost = boost.override { enableStatic = true; }; }' -K 
{ stdenv, fetchFromGitHub, patchelf, cmake, boost }:
let
  boostStatic = boost.override { enableStatic = true; };
in
stdenv.mkDerivation rec {
  version = "master";
  name = "nheqminer-${version}";

  src = fetchFromGitHub {
    owner = "nicehash";
    repo = "nheqminer";
    rev = "b9900ff8e3c6f8e5a46af18db454f2a2082d9f46";
    sha256 = "06alzgpbwhhavqgin7ds8aza7skhnh8pcz6hqwsj5db6160c6hr5";
  };

  NIX_LDFLAGS="-lpthread";
  cmakeFlags = [
    "-DBOOST_LIBRARYDIR=${boostStatic.out}/lib"
    "-DUSE_CUDA_DJEZO=OFF"
  ];
  buildInputs = [ cmake boost ];

  preConfigure = ''
    pushd cpu_xenoncat/asm_linux
    chmod +x fasm
    bash assemble.sh
    popd

    # the installer looks for this relative path
    mkdir -p nheqminer/cpu_xenoncat/asm_linux
    ln -sf $(pwd)/cpu_xenoncat/asm_linux/equihash_avx1.o nheqminer/cpu_xenoncat/asm_linux/equihash_avx1.o
    ln -sf $(pwd)/cpu_xenoncat/asm_linux/equihash_avx2.o nheqminer/cpu_xenoncat/asm_linux/equihash_avx2.o
  '';

  installPhase = ''
    mkdir -p $out/bin
    pwd
    cp nheqminer $out/bin/
  '';
}