From ade602f995f083a0f05fb6b8ee45b72ba10f35c9 Mon Sep 17 00:00:00 2001 From: jurraca Date: Wed, 20 Nov 2024 14:41:56 +0000 Subject: [PATCH] add asmap-data package and bitcoind module option --- modules/bitcoind.nix | 8 ++++++++ pkgs/asmap-data.nix | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 pkgs/asmap-data.nix diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index 883618a..8571dea 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -254,6 +254,11 @@ let example = "bech32"; description = "The type of addresses to use"; }; + fetchASmap = mkOption { + type = types.nullOr types.bool; + default = null; + description = "Fetch the latest ASmap from the github:asmap/asmap-data repository."; + }; user = mkOption { type = types.str; default = "bitcoin"; @@ -337,6 +342,9 @@ let ${optionalString (cfg.zmqpubrawblock != null) "zmqpubrawblock=${cfg.zmqpubrawblock}"} ${optionalString (cfg.zmqpubrawtx != null) "zmqpubrawtx=${cfg.zmqpubrawtx}"} + # ASmap option + ${optionalString (cfg.fetchASmap != null) "asmap=${pkgs.asmap-data}"} + # Extra options ${cfg.extraConfig} ''; diff --git a/pkgs/asmap-data.nix b/pkgs/asmap-data.nix new file mode 100644 index 0000000..f605fd7 --- /dev/null +++ b/pkgs/asmap-data.nix @@ -0,0 +1,23 @@ +{ stdenv, pkgs, lib, fetchFromGitHub, ... }: + +stdenv.mkDerivation rec { + name = "asmap-data"; + version = "dcce69e48211facdbd52a461cfce333d5800b7de"; + + src = pkgs.fetchFromGitHub { + owner = "asmap"; + repo = "asmap-data"; + rev = version; + sha256 = "sha256-bp93VZX6EF6vwpbA4jqAje/1txfKeqN9BhVRLkdM+94="; + }; + + installPhase = '' + cp -r $src/latest_asmap.dat $out + ''; + + meta = { + description = "Contains an asmap file from the ASMap Data Demo Repository"; + homepage = "https://github.com/asmap/asmap-data"; + license = lib.licenses.mit; + }; +}