add clightning

This commit is contained in:
Jonas Nick 2018-11-22 18:32:26 +00:00
parent 63e2c6d270
commit aec819db81
4 changed files with 30 additions and 11 deletions

View File

@ -11,16 +11,20 @@ in {
imports =
[
./modules/bitcoind.nix
./modules/tor.nix
./modules/nixbitcoin.nix
];
# TODO: does that destroy the channels symlink?
# turn off binary cache by passing the empty list
#nix.binaryCaches = [];
networking.hostName = "nix-bitcoin"; # Define your hostname.
time.timeZone = "UTC";
environment.systemPackages = with pkgs; [
wget vim tmux git nginx nodeinfo
vim tmux clightning bitcoin
nodeinfo
jq
];
nixpkgs.config.packageOverrides = pkgs: {
inherit nodeinfo;
@ -45,8 +49,6 @@ in {
services.nixbitcoin.enable = true;
# turn off binary cache by passing the empty list
nix.binaryCaches = [];
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";

View File

@ -13,6 +13,8 @@ let
addnode=ecoc5q34tmbq54wl.onion
discover=0
${optionalString (cfg.port != null) "port=${toString cfg.port}"}
rpcuser=foo
rpcpassword=bar
'';
in {
options.services.bitcoin = {
@ -40,8 +42,6 @@ in {
port = mkOption {
type = types.nullOr types.ints.u16;
default = null;
# type = types.int;
#default = 8333;
description = "Override the default port on which to listen for connections.";
};

View File

@ -5,6 +5,13 @@ with lib;
let
cfg = config.services.nixbitcoin;
in {
imports =
[
./bitcoind.nix
./tor.nix
./clightning.nix
];
options.services.nixbitcoin = {
enable = mkOption {
type = types.bool;
@ -16,21 +23,30 @@ in {
};
config = mkIf cfg.enable {
services.bitcoin.enable = true;
services.bitcoin.listen = true;
# Tor
services.tor.enable = true;
services.tor.client.enable = true;
services.bitcoin.proxy = config.services.tor.client.socksListenAddress;
services.bitcoin.port = 8333;
services.tor.hiddenServices.bitcoind = {
map = [{
port = config.services.bitcoin.port;
}];
version = 3;
};
# bitcoin
services.bitcoin.enable = true;
services.bitcoin.listen = true;
services.bitcoin.proxy = config.services.tor.client.socksListenAddress;
services.bitcoin.port = 8333;
# clightning
services.clightning.enable = true;
# nodeinfo
systemd.services.nodeinfo = {
description = "Get node info";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.clightning pkgs.jq pkgs.sudo ];
serviceConfig = {
ExecStart = "${pkgs.bash}/bin/bash -c ${pkgs.nodeinfo}/bin/nodeinfo";
user = "root";

View File

@ -4,5 +4,6 @@ rm -f $OUTFILE
{
echo \{
echo " bitcoind_onion = \"$(cat /var/lib/tor/onion/bitcoind/hostname)\";"
echo " clightning_id = \"$(sudo -u clightning lightning-cli getinfo | jq -r '.id')\";"
echo \}
} > $OUTFILE