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