mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 00:29:43 -04:00
Fixed bitcoin server & modules
This commit is contained in:
parent
6d9d2fe824
commit
290ed823c1
5 changed files with 48 additions and 44 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
''
|
|
||||||
server=1
|
server=1
|
||||||
|
|
||||||
mempoolfullrbf=1
|
mempoolfullrbf=1
|
||||||
|
|
@ -18,4 +17,3 @@ listen=1
|
||||||
listenonion=1
|
listenonion=1
|
||||||
torcontrol=127.0.0.1:9051
|
torcontrol=127.0.0.1:9051
|
||||||
torenablecircuit=1
|
torenablecircuit=1
|
||||||
''
|
|
||||||
|
|
@ -5,11 +5,14 @@ let
|
||||||
cfg = config.modules.system.bitcoin;
|
cfg = config.modules.system.bitcoin;
|
||||||
|
|
||||||
home = "/var/lib/bitcoind";
|
home = "/var/lib/bitcoind";
|
||||||
conf = pkgs.writeText "bitcoin.conf" (import ./config);
|
|
||||||
|
|
||||||
|
bitcoinConf = pkgs.writeTextFile {
|
||||||
|
name = "bitcoin.conf";
|
||||||
|
text = builtins.readFile ./config/bitcoin.conf;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{ options.modules.system.bitcoin = { enable = mkEnableOption "system.bitcoin"; };
|
{ options.modules.system.bitcoin = { enable = mkEnableOption "Bitcoin Server"; };
|
||||||
imports = [ ./modules ];
|
imports = [ ./modules ];
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
|
|
@ -38,7 +41,6 @@ in
|
||||||
"bitcoin" = {
|
"bitcoin" = {
|
||||||
members = [
|
members = [
|
||||||
"btc"
|
"btc"
|
||||||
"electrs"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -55,7 +57,7 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "btc";
|
user = "btc";
|
||||||
group = "bitcoin";
|
group = "bitcoin";
|
||||||
configFile = conf;
|
configFile = bitcoinConf;
|
||||||
dataDir = home;
|
dataDir = home;
|
||||||
pidFile = "${home}/bitcoind.pid";
|
pidFile = "${home}/bitcoind.pid";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
network = "bitcoin"
|
||||||
|
|
||||||
|
electrum_rpc_addr = "127.0.0.1:50001"
|
||||||
|
|
||||||
|
cookie-file = "/var/lib/bitcoind/.cookie"
|
||||||
|
|
||||||
|
db_dir = "/var/lib/electrs"
|
||||||
|
|
||||||
|
log_filters = "INFO"
|
||||||
|
timestamp = true
|
||||||
|
|
||||||
|
daemon-rpc-addr = "127.0.0.1:8332"
|
||||||
|
daemon-p2p-addr = "127.0.0.1:8333"
|
||||||
|
daemon-dir = "/var/lib/bitcoind"
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
let
|
|
||||||
daemonDir = "/var/lib/bitcoin";
|
|
||||||
|
|
||||||
in
|
|
||||||
''
|
|
||||||
network = "bitcoin"
|
|
||||||
|
|
||||||
electrum_rpc_addr = "127.0.0.1:50001"
|
|
||||||
|
|
||||||
cookie-file = "${daemonDir}/.cookie"
|
|
||||||
|
|
||||||
db_dir = "/var/lib/electrs"
|
|
||||||
|
|
||||||
log_filters = "INFO"
|
|
||||||
timestamp = true
|
|
||||||
|
|
||||||
daemon-rpc-addr = "127.0.0.1:8332"
|
|
||||||
daemon-p2p-addr = "127.0.0.1:8333"
|
|
||||||
daemon-dir = "${daemonDir}"
|
|
||||||
''
|
|
||||||
|
|
@ -7,24 +7,27 @@ let
|
||||||
|
|
||||||
btc = config.modules.system.bitcoin;
|
btc = config.modules.system.bitcoin;
|
||||||
|
|
||||||
conf = pkgs.writeText "config.toml" (import ./config);
|
electrsConfig = pkgs.writeTextFile {
|
||||||
|
name = "config.toml";
|
||||||
|
text = builtins.readFile ./config/config.toml;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{ options.modules.system.bitcoin.electrum = { enable = mkEnableOption "system.bitcoin.electrum"; };
|
{ options.modules.system.bitcoin.electrum = { enable = mkEnableOption "Electrs Server"; };
|
||||||
config = mkIf cfg.enable {
|
config = mkIf (cfg.enable && btc.enable) {
|
||||||
#nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
# (final: prev: {
|
(final: prev: {
|
||||||
# electrs = prev.electrs.overrideAttrs (old: rec {
|
electrs = prev.electrs.overrideAttrs (old: rec {
|
||||||
# version = "0.10.4";
|
version = "0.10.4";
|
||||||
# src = fetchFromGithub {
|
src = pkgs.fetchFromGitHub {
|
||||||
# rev = "${version}";
|
owner = "romanz";
|
||||||
# hash = ''
|
repo = "electrs";
|
||||||
# sha256-0xw2532nmaxx9bjdpnnby03b83wc9zs8bv1wdfgv9q1phccqbkz1
|
rev = "${version}";
|
||||||
# '';
|
hash = "sha256-4c+FGYM34LSfazzshfRPjA+0BvDL2tvkSr2rasUognc=";
|
||||||
# };
|
};
|
||||||
# });
|
});
|
||||||
# })
|
})
|
||||||
#];
|
];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
electrs
|
electrs
|
||||||
|
|
@ -34,12 +37,19 @@ in
|
||||||
users = {
|
users = {
|
||||||
"electrs" = {
|
"electrs" = {
|
||||||
inherit home;
|
inherit home;
|
||||||
description = "electrs system user";
|
description = "Electrs system user";
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = "bitcoin";
|
group = "bitcoin";
|
||||||
createHome = true;
|
createHome = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
groups = {
|
||||||
|
"bitcoin" = {
|
||||||
|
members = mkAfter [
|
||||||
|
"electrs"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,7 +57,7 @@ in
|
||||||
description = "Electrs Bitcoin Indexer";
|
description = "Electrs Bitcoin Indexer";
|
||||||
|
|
||||||
script = "${pkgs.electrs}/bin/electrs";
|
script = "${pkgs.electrs}/bin/electrs";
|
||||||
scriptArgs = "--conf=${conf}";
|
scriptArgs = "--conf=${electrsConfig}";
|
||||||
|
|
||||||
after = [
|
after = [
|
||||||
"bitcoind-btc.service"
|
"bitcoind-btc.service"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue