Merge branch 'electrum-server' of https://github.com/nixbitcoin/nix-bitcoin into nixbitcoin-electrum-server

This commit is contained in:
Jonas Nick 2019-04-02 15:35:09 +00:00
commit c440dfba9f
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
3 changed files with 16 additions and 30 deletions

View File

@ -27,6 +27,11 @@ in {
If enabled, the electrs service will sync faster on high-memory systems ( 8GB). If enabled, the electrs service will sync faster on high-memory systems ( 8GB).
''; '';
}; };
port = mkOption {
type = types.ints.u16;
default = 50001;
description = "Override the default port on which to listen for connections.";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -49,7 +54,7 @@ in {
preStart = '' preStart = ''
mkdir -m 0770 -p ${cfg.dataDir} mkdir -m 0770 -p ${cfg.dataDir}
chown 'electrs:electrs' ${cfg.dataDir} chown 'electrs:electrs' ${cfg.dataDir}
echo "${pkgs.electrs}/bin/electrs -vvv ${index-batch-size} ${jsonrpc-import} --timestamp --db-dir ${cfg.dataDir} --daemon-dir /var/lib/bitcoind --cookie=${config.services.bitcoind.rpcuser}:$(cat /secrets/bitcoin-rpcpassword)" > /var/lib/electrs/startscript.sh echo "${pkgs.electrs}/bin/electrs -vvv ${index-batch-size} ${jsonrpc-import} --timestamp --db-dir ${cfg.dataDir} --daemon-dir /var/lib/bitcoind --cookie=${config.services.bitcoind.rpcuser}:$(cat /secrets/bitcoin-rpcpassword) --electrum-rpc-addr=127.0.0.1:${toString cfg.port}" > /var/lib/electrs/startscript.sh
chown -R 'electrs:electrs' ${cfg.dataDir} chown -R 'electrs:electrs' ${cfg.dataDir}
chmod u+x ${cfg.dataDir}/startscript.sh chmod u+x ${cfg.dataDir}/startscript.sh
''; '';

View File

@ -17,7 +17,6 @@ let
lightning-charge lightning-charge
nanopos nanopos
spark-wallet spark-wallet
electrs
nodejs-8_x nodejs-8_x
nginx nginx
]; ];
@ -174,10 +173,11 @@ in {
services.spark-wallet.enable = cfg.modules == "all"; services.spark-wallet.enable = cfg.modules == "all";
services.spark-wallet.onion-service = true; services.spark-wallet.onion-service = true;
services.electrs.enable = false; services.electrs.enable = false;
services.electrs.port = 50001;
services.electrs.high-memory = false; services.electrs.high-memory = false;
services.tor.hiddenServices.electrs = { services.tor.hiddenServices.electrs = {
map = [{ map = [{
port = 50001; toPort = 50001; port = config.services.electrs.port; toPort = config.services.electrs.port;
}]; }];
version = 3; version = 3;
}; };

View File

@ -1,37 +1,18 @@
let { pkgs }:
overlay = builtins.fetchGit {
url = "https://github.com/mozilla/nixpkgs-mozilla";
ref = "master";
rev = "e37160aaf4de5c4968378e7ce6fe5212f4be239f";
};
defaultPkgs = import <nixpkgs> {overlays = [ (import overlay) ]; };
defaultRust = (defaultPkgs.rustChannelOf { date = "2019-03-05"; channel = "nightly"; }).rust;
defaultCargo = (defaultPkgs.rustChannelOf { date = "2019-03-05"; channel = "nightly"; }).cargo;
defaultBuildRustPackage = defaultPkgs.callPackage (import <nixpkgs/pkgs/build-support/rust>) {
rust = {
rustc = defaultRust;
cargo = defaultCargo;
};
};
in { pkgs ? defaultPkgs, rust ? defaultRust, buildRustPackage ? defaultBuildRustPackage }: with pkgs;
pkgs.lib.flip pkgs.callPackage { inherit buildRustPackage; } ( rustPlatform_1_31.buildRustPackage rec {
{ lib, buildRustPackage, fetchFromGitHub, llvmPackages, clang }:
let
version = "0.4.3";
in buildRustPackage {
name = "electrs-${version}"; name = "electrs-${version}";
version = "0.5.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "romanz"; owner = "romanz";
repo = "electrs"; repo = "electrs";
rev = "5ab3b4648769bf4a421d48fb29c93ef048db7dbf"; rev = "b2b7e1c42acc306df46e97f39d9ab19d2f6f24a8";
sha256 = "1xjjs1j4wm8pv7h0gr7i8xi2j78ss3haai4hyaiavwph8kk5n0ch"; sha256 = "1nz75vc170r6q2hbkyil818y6szrjsas1drxj9vyqls7n5w6whz1";
}; };
cargoSha256 = "0a80i77s3r4nivrrxndadzgxcpnyamrw7xqrrlz1ylwyjz00xcnf"; cargoSha256 = "1rvhgda4mbwpya8snjqh1z7fjzbabkmh44r4g9ibn83wbd4j32mi";
LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
buildInputs = [ clang ]; buildInputs = [ clang ];
@ -43,4 +24,4 @@ pkgs.lib.flip pkgs.callPackage { inherit buildRustPackage; } (
platforms = platforms.all; platforms = platforms.all;
}; };
} }
)