clboss: add module
This commit is contained in:
parent
9423eadcee
commit
f89498d4fc
26
modules/clightning-plugins/clboss.nix
Normal file
26
modules/clightning-plugins/clboss.nix
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let cfg = config.services.clightning.plugins.clboss; in
|
||||||
|
{
|
||||||
|
options.services.clightning.plugins.clboss = {
|
||||||
|
enable = mkEnableOption "CLBOSS (clightning plugin)";
|
||||||
|
min-onchain = mkOption {
|
||||||
|
type = types.ints.positive;
|
||||||
|
default = 30000;
|
||||||
|
description = ''
|
||||||
|
Specify target amount (in satoshi) that CLBOSS will leave onchain.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.clightning.extraConfig = ''
|
||||||
|
plugin=${config.nix-bitcoin.pkgs.clboss}/bin/clboss
|
||||||
|
clboss-min-onchain=${toString cfg.min-onchain}
|
||||||
|
'';
|
||||||
|
systemd.services.clightning.path = [
|
||||||
|
pkgs.dnsutils
|
||||||
|
] ++ optional config.services.clightning.enforceTor (hiPrio config.nix-bitcoin.torify);
|
||||||
|
};
|
||||||
|
}
|
@ -6,6 +6,7 @@ let
|
|||||||
pluginPkgs = config.nix-bitcoin.pkgs.clightning-plugins;
|
pluginPkgs = config.nix-bitcoin.pkgs.clightning-plugins;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
./clboss.nix
|
||||||
./prometheus.nix
|
./prometheus.nix
|
||||||
./summary.nix
|
./summary.nix
|
||||||
./zmq.nix
|
./zmq.nix
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
# Core modules
|
# Core modules
|
||||||
@ -33,15 +34,28 @@
|
|||||||
disabledModules = [ "services/networking/bitcoind.nix" ];
|
disabledModules = [ "services/networking/bitcoind.nix" ];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
nix-bitcoin-services = lib.mkOption {
|
nix-bitcoin-services = mkOption {
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = import ./nix-bitcoin-services.nix lib pkgs;
|
default = import ./nix-bitcoin-services.nix lib pkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
nix-bitcoin.pkgs = lib.mkOption {
|
nix-bitcoin = {
|
||||||
type = lib.types.attrs;
|
pkgs = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
default = (import ../pkgs { inherit pkgs; }).modulesPkgs;
|
default = (import ../pkgs { inherit pkgs; }).modulesPkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Torify binary that works with custom Tor SOCKS addresses
|
||||||
|
# Related issue: https://github.com/NixOS/nixpkgs/issues/94236
|
||||||
|
torify = mkOption {
|
||||||
|
readOnly = true;
|
||||||
|
default = pkgs.writeScriptBin "torify" ''
|
||||||
|
${pkgs.tor}/bin/torify \
|
||||||
|
--address ${head (splitString ":" config.services.tor.client.socksListenAddress)} \
|
||||||
|
"$@"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
Loading…
Reference in New Issue
Block a user