nix-bitcoin/modules/modules.nix

92 lines
2.4 KiB
Nix
Raw Normal View History

{ config, pkgs, lib, ... }:
2020-12-21 11:19:15 +00:00
with lib;
{
imports = [
2020-09-28 07:41:17 +00:00
# Core modules
./secrets/secrets.nix
2020-09-28 11:09:03 +00:00
./operator.nix
2020-09-28 07:41:17 +00:00
# Main features
./bitcoind.nix
./clightning.nix
2020-11-19 02:01:45 +00:00
./clightning-plugins
./spark-wallet.nix
./lnd.nix
2021-02-03 21:44:43 +00:00
./lnd-rest-onion-service.nix
2020-07-07 14:22:17 +00:00
./lightning-loop.nix
2021-03-01 09:59:23 +00:00
./lightning-pool.nix
2021-06-02 01:11:26 +00:00
./charge-lnd.nix
2020-08-12 14:47:56 +00:00
./btcpayserver.nix
2020-09-28 07:41:17 +00:00
./electrs.nix
./liquid.nix
2020-04-23 16:18:47 +00:00
./joinmarket.nix
2021-01-17 12:24:57 +00:00
./joinmarket-ob-watcher.nix
2020-09-28 07:41:17 +00:00
./hardware-wallets.nix
./recurring-donations.nix
# Support features
2020-10-12 11:33:48 +00:00
./versioning.nix
2020-09-28 07:41:17 +00:00
./security.nix
./onion-addresses.nix
2021-01-14 12:24:17 +00:00
./onion-services.nix
2020-09-28 07:41:17 +00:00
./netns-isolation.nix
./nodeinfo.nix
2020-09-28 07:41:17 +00:00
./backups.nix
];
disabledModules = [ "services/networking/bitcoind.nix" ];
options = {
2020-12-21 11:19:15 +00:00
nix-bitcoin = {
pkgs = mkOption {
type = types.attrs;
default = (import ../pkgs { inherit pkgs; }).modulesPkgs;
};
lib = mkOption {
readOnly = true;
default = import ../pkgs/lib.nix lib pkgs;
};
2021-08-04 22:49:00 +00:00
torClientAddressWithPort = mkOption {
readOnly = true;
default = with config.services.tor.client.socksListenAddress;
"${addr}:${toString port}";
};
2020-12-21 11:19:15 +00:00
# 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 \
2021-08-04 22:49:00 +00:00
--address ${config.services.tor.client.socksListenAddress.addr} \
2020-12-21 11:19:15 +00:00
"$@"
'';
};
# A helper for using doas instead of sudo when doas is enabled
runAsUserCmd = mkOption {
readOnly = true;
default = if config.security.doas.enable
# TODO: Use absolute path until https://github.com/NixOS/nixpkgs/pull/133622 is available.
then "/run/wrappers/bin/doas -u"
else "sudo -u";
};
};
};
config = {
assertions = [
{ assertion = (config.services.lnd.enable -> ( !config.services.clightning.enable || config.services.clightning.port != config.services.lnd.port));
message = ''
LND and clightning can't both bind to lightning port 9735. Either
disable LND/clightning or change services.clightning.bindPort or
services.lnd.port to a port other than 9735.
'';
}
];
};
}