nix: add monero.nix
This commit is contained in:
parent
70c29b42c5
commit
7e90f3dd84
3 changed files with 137 additions and 1 deletions
11
nix/monero-use-system-libraries.patch
Normal file
11
nix/monero-use-system-libraries.patch
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
|
||||
index 5bdd5d9b4..3af6c5f5a 100644
|
||||
--- a/external/CMakeLists.txt
|
||||
+++ b/external/CMakeLists.txt
|
||||
@@ -44,4 +44,5 @@ endif()
|
||||
add_subdirectory(db_drivers)
|
||||
add_subdirectory(easylogging++)
|
||||
add_subdirectory(qrcodegen)
|
||||
-add_subdirectory(randomx EXCLUDE_FROM_ALL)
|
||||
+find_library(RANDOMX_LIBRARY randomx)
|
||||
+find_package(RapidJSON)
|
||||
125
nix/monero.nix
Normal file
125
nix/monero.nix
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
cmake,
|
||||
pkg-config,
|
||||
boost186,
|
||||
libsodium,
|
||||
openssl,
|
||||
python3,
|
||||
randomx,
|
||||
rapidjson,
|
||||
readline,
|
||||
unbound,
|
||||
zeromq,
|
||||
|
||||
trezorSupport ? true,
|
||||
hidapi,
|
||||
libusb1,
|
||||
protobuf_21,
|
||||
udev,
|
||||
}:
|
||||
|
||||
let
|
||||
# submodules; revs are taken from monero repo's `/external`
|
||||
supercop = fetchGit {
|
||||
url = "https://github.com/monero-project/supercop.git";
|
||||
# url = /path/to/repo/supercop.git;
|
||||
rev = "e887b2fb4bfcfcc454b2005472ad1df6f2191f52";
|
||||
shallow = true;
|
||||
};
|
||||
trezor-common = fetchGit {
|
||||
url = "https://github.com/trezor/trezor-common.git";
|
||||
# url = /path/to/repo/trezor-common.git;
|
||||
rev = "9b48064ca38bd6403b9db2727d955325429b0131";
|
||||
shallow = true;
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "monero-cli";
|
||||
version = "0.18.5.4";
|
||||
|
||||
src = fetchGit {
|
||||
url = "https://github.com/monero-project/monero.git";
|
||||
# url = /path/to/repo/monero.git;
|
||||
ref = "refs/tags/v${version}";
|
||||
rev = "85f036ba7019cd36f08e8a38a27c37ea7b522618";
|
||||
shallow = true;
|
||||
};
|
||||
|
||||
patches = [
|
||||
./monero-use-system-libraries.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# manually install submodules
|
||||
rmdir external/{supercop,trezor-common}
|
||||
ln -sf ${supercop} external/supercop
|
||||
ln -sf ${trezor-common} external/trezor-common
|
||||
# export patched source for monero-gui
|
||||
cp -r . $source
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
boost186 # uses boost/asio/io_service.hpp
|
||||
libsodium
|
||||
openssl
|
||||
randomx
|
||||
rapidjson
|
||||
readline
|
||||
unbound
|
||||
zeromq
|
||||
]
|
||||
++ lib.optionals trezorSupport [
|
||||
python3
|
||||
hidapi
|
||||
libusb1
|
||||
protobuf_21
|
||||
]
|
||||
++ lib.optionals (trezorSupport && stdenv.hostPlatform.isLinux) [ udev ];
|
||||
|
||||
cmakeFlags = [
|
||||
# skip submodules init
|
||||
"-DMANUAL_SUBMODULES=ON"
|
||||
"-DBUILD_GUI_DEPS=OFF"
|
||||
"-DReadline_ROOT_DIR=${readline.dev}"
|
||||
"-Wno-dev"
|
||||
]
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin "-DBoost_USE_MULTITHREADED=OFF"
|
||||
++ lib.optionals trezorSupport [
|
||||
"-DUSE_DEVICE_TREZOR=ON"
|
||||
];
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"source"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Private, secure, untraceable currency";
|
||||
homepage = "https://getmonero.org/";
|
||||
license = lib.licenses.bsd3;
|
||||
|
||||
platforms = with lib.platforms; linux;
|
||||
|
||||
# macOS/ARM has a working `monerod` (at least), but `monero-wallet-cli`
|
||||
# segfaults on start after entering the wallet password, when built in release mode.
|
||||
# Building the same revision in debug mode to root-cause the above problem doesn't work
|
||||
# because of https://github.com/monero-project/monero/issues/9486
|
||||
badPlatforms = [ "aarch64-darwin" ];
|
||||
|
||||
maintainers = with lib.maintainers; [
|
||||
pmw
|
||||
rnhmjoj
|
||||
];
|
||||
mainProgram = "monero-wallet-cli";
|
||||
# internal build tool generate_translations_header is tricky to compile for the build platform
|
||||
broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
||||
};
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ rec {
|
|||
# python = pkgs.python313;
|
||||
|
||||
system-packages = with pkgs; {
|
||||
# monero-cli = monero-cli; # Monero daemon
|
||||
# monero-cli = callPackage (bdir + /monero.nix) {}; # Monero daemon
|
||||
# go-ethereum = go-ethereum; # Geth
|
||||
# reth = callPackage (bdir + /reth.nix) {}; # Rust Ethereum daemon
|
||||
# solc = callPackage (bdir + /solc.nix) { old_pkgs=old_pkgs; }; # Solidity compiler
|
||||
|
|
|
|||
Loading…
Reference in a new issue