2018-11-13 23:44:54 +00:00
|
|
|
|
# Edit this configuration file to define what should be installed on
|
|
|
|
|
# your system. Help is available in the configuration.nix(5) man page
|
|
|
|
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
|
|
|
|
|
2020-02-23 19:30:32 +00:00
|
|
|
|
{ config, pkgs, lib, ... }: {
|
2019-04-14 18:38:34 +00:00
|
|
|
|
imports = [
|
2020-04-07 20:47:32 +00:00
|
|
|
|
<nix-bitcoin/modules/presets/secure-node.nix>
|
2020-02-26 16:11:20 +00:00
|
|
|
|
|
2020-02-26 16:11:21 +00:00
|
|
|
|
# FIXME: The hardened kernel profile improves security but
|
|
|
|
|
# decreases performance by ~50%.
|
|
|
|
|
# Turn it off when not needed.
|
|
|
|
|
# Source: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/hardened.nix
|
|
|
|
|
<nixpkgs/nixos/modules/profiles/hardened.nix>
|
2019-04-27 12:19:56 +00:00
|
|
|
|
|
2018-12-28 13:44:32 +00:00
|
|
|
|
# FIXME: Uncomment next line to import your hardware configuration. If so,
|
|
|
|
|
# add the hardware configuration file to the same directory as this file.
|
2019-01-02 14:56:57 +00:00
|
|
|
|
# This is not needed when deploying to a virtual box.
|
2018-12-10 23:24:47 +00:00
|
|
|
|
#./hardware-configuration.nix
|
2018-12-06 15:59:41 +00:00
|
|
|
|
];
|
2019-04-12 08:47:49 +00:00
|
|
|
|
# FIXME: Enable modules by uncommenting their respective line. Disable
|
2020-04-07 20:47:34 +00:00
|
|
|
|
# modules by commenting out their respective line.
|
2019-04-12 09:01:40 +00:00
|
|
|
|
|
2020-02-23 19:30:32 +00:00
|
|
|
|
### BITCOIND
|
|
|
|
|
# Bitcoind is enabled by default if nix-bitcoin is enabled
|
|
|
|
|
#
|
2020-06-02 13:12:04 +00:00
|
|
|
|
# Enable this option to set pruning to a specified MiB value.
|
|
|
|
|
# clightning is compatible with pruning. See
|
|
|
|
|
# https://github.com/ElementsProject/lightning/#pruning for more information.
|
|
|
|
|
# LND and electrs are not compatible with pruning.
|
2020-06-07 11:40:25 +00:00
|
|
|
|
# services.bitcoind.prune = 100000;
|
2020-02-23 19:30:32 +00:00
|
|
|
|
#
|
|
|
|
|
# You can add options that are not defined in modules/bitcoind.nix as follows
|
|
|
|
|
# services.bitcoind.extraConfig = ''
|
|
|
|
|
# maxorphantx=110
|
|
|
|
|
# '';
|
|
|
|
|
|
2019-04-12 09:01:40 +00:00
|
|
|
|
### CLIGHTNING
|
2019-04-12 08:47:49 +00:00
|
|
|
|
# Enable this module to use clightning, a Lightning Network implementation
|
|
|
|
|
# in C.
|
|
|
|
|
services.clightning.enable = true;
|
2020-06-04 08:23:02 +00:00
|
|
|
|
# Enable this option to announce our Tor Hidden Service. By default clightning
|
|
|
|
|
# offers outgoing functionality, but doesn't announce the Tor Hidden Service
|
|
|
|
|
# under which peers can reach us.
|
|
|
|
|
# services.clightning.announce-tor = true;
|
2019-04-12 09:01:40 +00:00
|
|
|
|
|
2019-08-05 08:44:38 +00:00
|
|
|
|
### LND
|
2020-08-04 07:54:01 +00:00
|
|
|
|
# Uncomment the following line in order to enable lnd, a lightning
|
|
|
|
|
# implementation written in Go. In order to avoid collisions with clightning
|
|
|
|
|
# you must disable clightning or change the services.clightning.bindport or
|
|
|
|
|
# services.lnd.listenPort to a port other than 9735.
|
2020-06-15 10:21:18 +00:00
|
|
|
|
# services.lnd.enable = true;
|
2020-06-04 09:30:17 +00:00
|
|
|
|
# Enable this option to announce our Tor Hidden Service. By default lnd
|
|
|
|
|
# offers outgoing functionality, but doesn't announce the Tor Hidden Service
|
|
|
|
|
# under which peers can reach us.
|
|
|
|
|
# services.lnd.announce-tor = true;
|
2019-08-24 23:24:26 +00:00
|
|
|
|
## WARNING
|
|
|
|
|
# If you use lnd, you should manually backup your wallet mnemonic
|
|
|
|
|
# seed. This will allow you to recover on-chain funds. You can run the
|
|
|
|
|
# following command after the lnd service starts:
|
2019-08-05 08:44:38 +00:00
|
|
|
|
# nixops scp --from bitcoin-node /secrets/lnd-seed-mnemonic ./secrets/lnd-seed-mnemonic
|
2019-08-24 23:24:26 +00:00
|
|
|
|
# You should also backup your channel state after opening new channels.
|
|
|
|
|
# This will allow you to recover off-chain funds, by force-closing channels.
|
|
|
|
|
# nixops scp --from bitcoin-node /var/lib/lnd/chain/bitcoin/mainnet/channel.backup /my-backup-path/channel.backup
|
2019-08-05 08:44:38 +00:00
|
|
|
|
|
2019-04-12 09:01:40 +00:00
|
|
|
|
### SPARK WALLET
|
|
|
|
|
# Enable this module to use spark-wallet, a minimalistic wallet GUI for
|
|
|
|
|
# c-lightning, accessible over the web or through mobile and desktop apps.
|
2020-10-18 12:49:20 +00:00
|
|
|
|
# Automatically enables clightning.
|
2019-04-12 09:01:40 +00:00
|
|
|
|
# services.spark-wallet.enable = true;
|
|
|
|
|
|
|
|
|
|
### ELECTRS
|
|
|
|
|
# Enable this module to use electrs, an efficient re-implementation of
|
2020-06-02 13:12:48 +00:00
|
|
|
|
# Electrum Server in Rust.
|
2019-04-12 09:01:40 +00:00
|
|
|
|
# services.electrs.enable = true;
|
2020-04-24 14:21:12 +00:00
|
|
|
|
# If you have more than 8GB memory, enable this option so electrs will
|
2020-06-02 13:12:48 +00:00
|
|
|
|
# sync faster. Only available if hardware wallets are disabled.
|
2019-08-07 11:03:34 +00:00
|
|
|
|
# services.electrs.high-memory = true;
|
2019-04-12 09:01:40 +00:00
|
|
|
|
|
2020-08-12 14:47:56 +00:00
|
|
|
|
### BTCPayServer
|
|
|
|
|
# Enable this module to use BTCPayServer, a self-hosted, open-source
|
|
|
|
|
# cryptocurrency payment processor.
|
|
|
|
|
# Privacy Warning: BTCPayServer currently looks up price rates without
|
|
|
|
|
# proxying them through Tor. This means an outside observer can correlate
|
|
|
|
|
# your BTCPayServer usage, like invoice creation times, with your IP address.
|
|
|
|
|
# services.btcpayserver.enable = true;
|
|
|
|
|
# Enable this option to connect BTCPayServer to clightning.
|
|
|
|
|
# services.btcpayserver.lightningBackend = "clightning";
|
|
|
|
|
# Enable this option to connect BTCPayServert to lnd.
|
|
|
|
|
# services.btcpayserver.lightningBackend = "lnd";
|
2020-10-18 12:49:20 +00:00
|
|
|
|
# The lightning backend service automatically enabled.
|
2020-08-12 14:47:56 +00:00
|
|
|
|
# Afterwards you need to go into Store > General Settings > Lightning Nodes
|
|
|
|
|
# and click to use "the internal lightning node of this BTCPay Server".
|
|
|
|
|
|
2019-04-12 09:01:40 +00:00
|
|
|
|
### LIQUIDD
|
2019-08-05 15:11:27 +00:00
|
|
|
|
# Enable this module to use Liquid, a sidechain for an inter-exchange
|
2019-04-12 09:01:40 +00:00
|
|
|
|
# settlement network linking together cryptocurrency exchanges and
|
2019-08-05 15:11:27 +00:00
|
|
|
|
# institutions around the world. Liquid is accessed with the elements-cli
|
|
|
|
|
# tool run as user operator.
|
2019-08-06 11:55:19 +00:00
|
|
|
|
# services.liquidd.enable = true;
|
2019-04-12 09:01:40 +00:00
|
|
|
|
|
|
|
|
|
### LIGHTNING CHARGE
|
2019-04-12 08:47:49 +00:00
|
|
|
|
# Enable this module to use lightning-charge, a simple drop-in solution for
|
2020-10-18 12:49:20 +00:00
|
|
|
|
# accepting lightning payments.
|
|
|
|
|
# Automatically enables clightning.
|
2019-04-12 09:01:40 +00:00
|
|
|
|
# services.lightning-charge.enable = true;
|
|
|
|
|
|
|
|
|
|
### NANOPOS
|
2019-04-12 08:47:49 +00:00
|
|
|
|
# Enable this module to use nanopos, a simple Lightning point-of-sale
|
2020-10-18 12:49:20 +00:00
|
|
|
|
# system, powered by Lightning Charge.
|
|
|
|
|
# Automatically enables lightning-charge.
|
2019-04-12 09:01:40 +00:00
|
|
|
|
# services.nanopos.enable = true;
|
|
|
|
|
|
|
|
|
|
### WEBINDEX
|
2019-04-12 08:47:49 +00:00
|
|
|
|
# Enable this module to use the nix-bitcoin-webindex, a simple website
|
2020-06-07 11:19:31 +00:00
|
|
|
|
# displaying your node information and link to nanopos store. Only available
|
|
|
|
|
# if clightning, lightning-charge, and nanopos are enabled.
|
2019-04-12 09:01:40 +00:00
|
|
|
|
# services.nix-bitcoin-webindex.enable = true;
|
2019-01-01 19:16:24 +00:00
|
|
|
|
|
2019-04-14 16:55:40 +00:00
|
|
|
|
### RECURRING-DONATIONS
|
2019-04-22 00:38:46 +00:00
|
|
|
|
# Enable this module to send recurring donations. This is EXPERIMENTAL; it's
|
|
|
|
|
# not guaranteed that payments are succeeding or that you will notice payment
|
2020-10-18 12:49:20 +00:00
|
|
|
|
# failure.
|
|
|
|
|
# Automatically enables clightning.
|
2019-04-14 16:55:40 +00:00
|
|
|
|
# services.recurring-donations.enable = true;
|
|
|
|
|
# Specify the receivers of the donations. By default donations are every
|
2019-04-22 17:39:15 +00:00
|
|
|
|
# Monday at a randomized time. Check `journalctl -eu recurring-donations` or
|
|
|
|
|
# `lightning-cli listpayments` for successful lightning donations.
|
2019-04-14 16:55:40 +00:00
|
|
|
|
# services.recurring-donations.tallycoin = {
|
2019-04-22 17:39:15 +00:00
|
|
|
|
# "<receiver name>" = <amount you wish to donate in sat>"
|
|
|
|
|
# "<additional receiver name>" = <amount you wish to donate in sat>;
|
2019-04-14 16:55:40 +00:00
|
|
|
|
# "djbooth007" = 1000;
|
|
|
|
|
# };
|
|
|
|
|
|
2019-04-29 20:39:25 +00:00
|
|
|
|
### Hardware wallets
|
|
|
|
|
# Enable this module to allow using hardware wallets. See https://github.com/bitcoin-core/HWI
|
2020-06-02 13:12:48 +00:00
|
|
|
|
# for more information. Only available if electrs.high-memory is disabled.
|
2019-04-29 20:39:25 +00:00
|
|
|
|
# Ledger must be initialized through the official ledger live app and the Bitcoin app must
|
|
|
|
|
# be installed and running on the device.
|
|
|
|
|
# services.hardware-wallets.ledger = true;
|
2019-05-13 15:13:23 +00:00
|
|
|
|
# Trezor can be initialized with the trezorctl command in nix-bitcoin. More information in
|
|
|
|
|
# `docs/usage.md`.
|
2019-04-29 20:39:25 +00:00
|
|
|
|
# services.hardware-wallets.trezor = true;
|
|
|
|
|
|
2020-05-29 10:53:35 +00:00
|
|
|
|
### netns-isolation (EXPERIMENTAL)
|
|
|
|
|
# Enable this module to use Network Namespace Isolation. This feature places
|
|
|
|
|
# every service in its own network namespace and only allows truly necessary
|
|
|
|
|
# connections between network namespaces, making sure services are isolated on
|
|
|
|
|
# a network-level as much as possible.
|
|
|
|
|
# nix-bitcoin.netns-isolation.enable = true;
|
|
|
|
|
|
2020-07-07 14:22:17 +00:00
|
|
|
|
### lightning-loop
|
|
|
|
|
# Enable this module to use lightninglab's non-custodial off/on chain bridge.
|
|
|
|
|
# loopd (lightning-loop daemon) will be started automatically. Users can
|
|
|
|
|
# interact with off/on chain bridge using `loop in` and `loop out`.
|
2020-10-18 12:49:20 +00:00
|
|
|
|
# Automatically enables lnd.
|
2020-07-07 14:22:17 +00:00
|
|
|
|
# services.lightning-loop.enable = true;
|
|
|
|
|
|
2020-06-11 11:39:17 +00:00
|
|
|
|
### Backups
|
|
|
|
|
# Enable this module to use nix-bitcoin's own backups module. By default, it
|
|
|
|
|
# uses duplicity to incrementally back up all important files in /var/lib to
|
|
|
|
|
# /var/lib/localBackups once a day.
|
|
|
|
|
# services.backups.enable = true;
|
|
|
|
|
# You can pull the localBackups folder with
|
|
|
|
|
# `nixops scp --from bitcoin-node /var/lib/localBackups /my-backup-path/`
|
|
|
|
|
# Alternatively, you can also set a remote target url, for example
|
|
|
|
|
# services.backups.destination = "sftp://user@host[:port]/[relative|/absolute]_path";
|
|
|
|
|
# Supply the sftp password by appending the FTP_PASSWORD environment variable
|
|
|
|
|
# to secrets/backup-encryption-env like so
|
|
|
|
|
# `echo "FTP_PASSWORD=<password>" >> secrets/backup-encryption-env`
|
|
|
|
|
# You many also need to set a ssh host and publickey with
|
|
|
|
|
# programs.ssh.knownHosts."host" = {
|
|
|
|
|
# hostNames = [ "host" ];
|
|
|
|
|
# publicKey = "<ssh public from `ssh-keyscan`>";
|
|
|
|
|
# };
|
|
|
|
|
# If you also want to backup bulk data like the Bitcoin & Liquid blockchains
|
|
|
|
|
# and electrs data directory, enable
|
|
|
|
|
# services.backups.with-bulk-data = true;
|
|
|
|
|
|
2020-04-23 16:18:47 +00:00
|
|
|
|
### JOINMARKET
|
|
|
|
|
# Enable this module to allow using JoinMarket's user interactive scripts (including
|
|
|
|
|
# tumbler.py).
|
|
|
|
|
# Note: JoinMarket has full access to bitcoind, including its wallet functionality.
|
|
|
|
|
# services.joinmarket.enable = true;
|
|
|
|
|
# Enable this option to enable the JoinMarket Yield Generator Bot. You will be able to
|
|
|
|
|
# earn sats by providing CoinJoin liquidity. This makes it impossible to use other
|
|
|
|
|
# scripts that access your wallet.
|
|
|
|
|
# services.joinmarket.yieldgenerator.enable = true;
|
|
|
|
|
|
2019-01-01 19:16:24 +00:00
|
|
|
|
# FIXME: Define your hostname.
|
|
|
|
|
networking.hostName = "nix-bitcoin";
|
|
|
|
|
time.timeZone = "UTC";
|
|
|
|
|
|
2018-12-28 13:44:32 +00:00
|
|
|
|
# FIXME: Add your SSH pubkey
|
2019-01-01 19:16:24 +00:00
|
|
|
|
services.openssh.enable = true;
|
2018-12-28 13:44:32 +00:00
|
|
|
|
users.users.root = {
|
|
|
|
|
openssh.authorizedKeys.keys = [ "" ];
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-01 19:16:24 +00:00
|
|
|
|
# FIXME: add packages you need in your system
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
vim
|
|
|
|
|
];
|
|
|
|
|
|
2019-01-15 23:07:32 +00:00
|
|
|
|
# FIXME: Add custom options (like boot options, output of
|
|
|
|
|
# nixos-generate-config, etc.):
|
2018-12-28 13:44:32 +00:00
|
|
|
|
|
2019-04-27 12:19:56 +00:00
|
|
|
|
# If the hardened profile is imported above, we need to explicitly allow
|
|
|
|
|
# user namespaces to enable sanboxed builds and services.
|
|
|
|
|
security.allowUserNamespaces = true;
|
|
|
|
|
|
2019-01-01 19:16:24 +00:00
|
|
|
|
# This value determines the NixOS release with which your system is to be
|
|
|
|
|
# compatible, in order to avoid breaking some software such as database
|
|
|
|
|
# servers. You should change this only after NixOS release notes say you
|
|
|
|
|
# should.
|
|
|
|
|
system.stateVersion = "18.09"; # Did you read the comment?
|
2020-10-12 11:33:48 +00:00
|
|
|
|
|
|
|
|
|
# The nix-bitcoin release version that your config is compatible with.
|
|
|
|
|
# When upgrading to a backwards-incompatible release, nix-bitcoin will display an
|
|
|
|
|
# an error and provide hints for migrating your config to the new release.
|
|
|
|
|
nix-bitcoin.configVersion = "0.0.18";
|
2018-11-13 23:44:54 +00:00
|
|
|
|
}
|