electrs: formatting

This commit is contained in:
Erik Arvstedt 2020-03-04 18:08:47 +01:00
parent cce9932b62
commit 148327326b
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.electrs; cfg = config.services.electrs;
inherit (config) nix-bitcoin-services; inherit (config) nix-bitcoin-services;
@ -36,18 +35,18 @@ in {
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
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 { port = mkOption {
type = types.ints.u16; type = types.ints.u16;
default = 50001; default = 50001;
description = "RPC port."; description = "RPC port.";
}; };
onionport = mkOption { onionport = mkOption {
type = types.ints.u16; type = types.ints.u16;
default = 50002; default = 50002;
description = "Port on which to listen for tor client connections."; description = "Port on which to listen for tor client connections.";
}; };
nginxport = mkOption { nginxport = mkOption {
type = types.ints.u16; type = types.ints.u16;
@ -59,10 +58,10 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
users.users.${cfg.user} = { users.users.${cfg.user} = {
description = "electrs User"; description = "electrs User";
group = cfg.group; group = cfg.group;
extraGroups = [ "bitcoinrpc" "bitcoin"]; extraGroups = [ "bitcoinrpc" "bitcoin"];
home = cfg.dataDir; home = cfg.dataDir;
}; };
users.groups.${cfg.group} = {}; users.groups.${cfg.group} = {};
@ -76,7 +75,7 @@ in {
mkdir -m 0770 -p ${cfg.dataDir} mkdir -m 0770 -p ${cfg.dataDir}
chown -R '${cfg.user}:${cfg.group}' ${cfg.dataDir} chown -R '${cfg.user}:${cfg.group}' ${cfg.dataDir}
echo "${pkgs.nix-bitcoin.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 ${secretsDir}/bitcoin-rpcpassword) --electrum-rpc-addr=127.0.0.1:${toString cfg.port}" > /run/electrs/startscript.sh echo "${pkgs.nix-bitcoin.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 ${secretsDir}/bitcoin-rpcpassword) --electrum-rpc-addr=127.0.0.1:${toString cfg.port}" > /run/electrs/startscript.sh
''; '';
serviceConfig = rec { serviceConfig = rec {
RuntimeDirectory = "electrs"; RuntimeDirectory = "electrs";
RuntimeDirectoryMode = "700"; RuntimeDirectoryMode = "700";