Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 130 lines 3.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch2, 6 cmake, 7 pkg-config, 8 boost186, 9 libsodium, 10 miniupnpc, 11 openssl, 12 python3, 13 randomx, 14 rapidjson, 15 readline, 16 unbound, 17 zeromq, 18 19 trezorSupport ? true, 20 hidapi, 21 libusb1, 22 protobuf_21, 23 udev, 24}: 25 26let 27 # submodules; revs are taken from monero repo's `/external` at the given monero version tag. 28 supercop = fetchFromGitHub { 29 owner = "monero-project"; 30 repo = "supercop"; 31 rev = "633500ad8c8759995049ccd022107d1fa8a1bbc9"; 32 hash = "sha256-26UmESotSWnQ21VbAYEappLpkEMyl0jiuCaezRYd/sE="; 33 }; 34 trezor-common = fetchFromGitHub { 35 owner = "trezor"; 36 repo = "trezor-common"; 37 rev = "bff7fdfe436c727982cc553bdfb29a9021b423b0"; 38 hash = "sha256-VNypeEz9AV0ts8X3vINwYMOgO8VpNmyUPC4iY3OOuZI="; 39 }; 40in 41stdenv.mkDerivation rec { 42 pname = "monero-cli"; 43 version = "0.18.4.0"; 44 45 src = fetchFromGitHub { 46 owner = "monero-project"; 47 repo = "monero"; 48 rev = "v${version}"; 49 hash = "sha256-0byMtX2f+8FqNhLPN1oLxIUTWg5RSbHfwiL8pUIAcgQ="; 50 }; 51 52 patches = [ 53 ./use-system-libraries.patch 54 ]; 55 56 postPatch = '' 57 # manually install submodules 58 rmdir external/{supercop,trezor-common} 59 ln -sf ${supercop} external/supercop 60 ln -sf ${trezor-common} external/trezor-common 61 # export patched source for monero-gui 62 cp -r . $source 63 ''; 64 65 nativeBuildInputs = [ 66 cmake 67 pkg-config 68 ]; 69 70 buildInputs = [ 71 boost186 # uses boost/asio/io_service.hpp 72 libsodium 73 miniupnpc 74 openssl 75 randomx 76 rapidjson 77 readline 78 unbound 79 zeromq 80 ] 81 ++ lib.optionals trezorSupport [ 82 python3 83 hidapi 84 libusb1 85 protobuf_21 86 ] 87 ++ lib.optionals (trezorSupport && stdenv.hostPlatform.isLinux) [ udev ]; 88 89 cmakeFlags = [ 90 # skip submodules init 91 "-DMANUAL_SUBMODULES=ON" 92 # required by monero-gui 93 "-DBUILD_GUI_DEPS=ON" 94 "-DReadline_ROOT_DIR=${readline.dev}" 95 "-Wno-dev" 96 ] 97 ++ lib.optional stdenv.hostPlatform.isDarwin "-DBoost_USE_MULTITHREADED=OFF" 98 ++ lib.optional trezorSupport [ 99 "-DUSE_DEVICE_TREZOR=ON" 100 # fix build on recent gcc versions 101 "-DCMAKE_CXX_FLAGS=-fpermissive" 102 ]; 103 104 outputs = [ 105 "out" 106 "source" 107 ]; 108 109 meta = { 110 description = "Private, secure, untraceable currency"; 111 homepage = "https://getmonero.org/"; 112 license = lib.licenses.bsd3; 113 114 platforms = with lib.platforms; linux; 115 116 # macOS/ARM has a working `monerod` (at least), but `monero-wallet-cli` 117 # segfaults on start after entering the wallet password, when built in release mode. 118 # Building the same revision in debug mode to root-cause the above problem doesn't work 119 # because of https://github.com/monero-project/monero/issues/9486 120 badPlatforms = [ "aarch64-darwin" ]; 121 122 maintainers = with lib.maintainers; [ 123 pmw 124 rnhmjoj 125 ]; 126 mainProgram = "monero-wallet-cli"; 127 # internal build tool generate_translations_header is tricky to compile for the build platform 128 broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform; 129 }; 130}