Commit Graph
100 Commits
Author SHA1 Message Date
Erik Arvstedt 20c0194ade readme: add hint about github table of contents button 2022-05-06 16:26:40 +02:00
Erik Arvstedt e2fee4bf1a lnd-rest-onion-service.nix: move to lndconnect-onion.nix, add clightning support
Option `services.lnd.restOnionService.package` has been removed.
There's not much use in overriding the [lndconnect pkg](https://github.com/LN-Zap/lndconnect).
2022-05-06 16:26:40 +02:00
Erik Arvstedt acf5fe69ad add standalone clightning-rest service
- Rename `services.rtl.cl-rest` to `services.clightning-rest`.
  `clightning-rest` is generally useful for connecting external REST clients
  to clightning.

- Add a dedicated network namespace in netns-isolation.

- Add nodeinfo entry.

- Add datadir (which contains REST auth data) to backups.
2022-05-06 16:26:40 +02:00
Erik Arvstedt c30aa33c15 cl-rest: rename pkg to clightning-rest 2022-05-06 16:24:59 +02:00
Erik Arvstedt f234e59ca5 nbPython3Packages: fix clightning pkgs
Also enable tests for the pyln-* pkgs.
2022-05-06 13:36:06 +00:00
Erik Arvstedt 900836fe0d joinmarket: add private python package set
This is a nonfunctional refactoring commit.

It's needed because pkg `pyln-proto`, which is introduced in the next commit,
requires a different, incompatible version of `cryptography`, which
must be placed in a different python package set.
2022-05-06 13:35:32 +00:00
Erik Arvstedt ca834cce84 joinmarket: simplify pkgs
Remove unused dependencies.
2022-05-06 13:35:32 +00:00
Erik Arvstedt 408486ac9c tests: update nbxplorer 2022-05-06 13:35:28 +00:00
Erik Arvstedt aa21fb454e tests: disable btcpayserver.lbtc for regtest
Previously, in case of btcpayserver.lbtc on regtest, nbxplorer just
printed a log error while trying to generate liquidd regtest blocks.
Now nbxplorer exits with an error, so disable lbtc.
2022-05-06 13:35:27 +00:00
Erik Arvstedt 7de56b019f nbxplorer: use postgresql
The former DBTrie backend has been deprecated.
2022-05-06 13:35:27 +00:00
Erik Arvstedt 29d2ffc111 defaultHardening: allow clone3 system call
clone3 is the latest version of the clone system call, which is already
allowed.
clone3 is required by nbxplorer 2.3.20.
2022-05-06 13:35:23 +00:00
Erik Arvstedt 66b19403a6 clboss: fix clboss being enabled by default 2022-05-05 16:58:16 +02:00
Erik Arvstedt dd2dcad3dc clboss: 0.11E -> 0.12 2022-04-30 13:08:50 +02:00
Erik Arvstedt f08b83bce2 clboss: update module 2022-04-26 12:04:32 +02:00
Erik Arvstedt 3b4cf665e8 clboss: 0.11B -> 0.11E 2022-04-26 11:34:05 +02:00
Erik Arvstedt a4a5c72b01 lnd: use lndinit for wallet creation 2022-04-04 13:59:36 +02:00
Erik Arvstedt e793a3470c lndinit: init at 0.1.3-beta 2022-04-04 13:59:36 +02:00
Erik Arvstedt 77b34954ef cl-rest: 0.6.1 -> 0.7.0 2022-03-29 16:30:47 +02:00
Erik Arvstedt 91203d8d06 secrets: fix secrets setup warning
With newer nixpkgs versions, a type error was shown instead of the
warning message when `secretsSetupMethod` was unset.
2022-03-11 01:34:47 +01:00
Erik Arvstedt 2493c8c201 liquidd: add service timeouts like in bitcoind
Previously, liquidd could fail with error:
liquidd.service: start operation timed out. Terminating.
2022-02-28 14:01:54 +01:00
Erik Arvstedt 59bf0274c0 pkgs: add groups, sort alphabetically 2022-02-28 14:00:23 +01:00
Erik Arvstedt 0bede274a8 clightning-plugins/commando: add module 2022-02-24 08:31:54 -08:00
Erik Arvstedt 1af84e8b7e makeShell: use actual system configuration in generate-secrets
This fixes a bug where the version update message for v0.0.65 is erroneously triggered
because the krops config is not included when evaluating secrets.
2022-02-12 21:33:23 +01:00
Erik Arvstedt d959d5b558 secure-node: don't set nix-bitcoin.secretsDir
This simplifies the docs and the secure-node module.

This change doesn't affect users that deploy via krops.
2022-02-05 21:35:50 +01:00
Erik Arvstedt 7b0c3d48c9 docs/services.md: link to clightning plugin list
The old list was incomplete.

Also update configuration.nix.
2022-02-05 21:34:10 +01:00
Erik Arvstedt 7402212263 examples/configuration.nix: disable passwordAuthentication
This is a sensible default.

Also clarify the pubkey setup.
2022-02-05 21:34:09 +01:00
Erik Arvstedt e093bb64d9 examples/configuration.nix: fix links to docs/services.md 2022-02-05 21:34:09 +01:00
Erik Arvstedt d41a550355 fetch-release: export GNUPGHOME
This approach is less error-prone.
It is also used by our fetcher scripts.
2022-02-05 21:33:54 +01:00
Erik Arvstedt 397b372cf3 bitcoind: improve option rpc.users
- Move description to top
- Improve example
2022-02-03 20:47:25 +01:00
Erik Arvstedt 679e7b6544 bitcoind: remove unneeded tmpfile rule 2022-02-03 20:47:25 +01:00
Erik Arvstedt 98f419233f bitcoind: don't log timestamps
Timestamps are already logged via journald.
2022-02-03 20:47:25 +01:00
Erik Arvstedt 6f8b4d9ebe flake: optimize nixpkgs importing
`nixpkgs.legacyPackages.${system}` allows reusing a single pkgs instance
that is shared among all flakes with the same `nixpkgs` input.
This is relevant when a user overrides the `nixpkgs` input of our flake
or exports our `nixpkgs` input to other flakes.
`import nixpkgs` would create a new pkgs instance instead.
2022-02-03 20:47:25 +01:00
Erik Arvstedt 16e2d4c8b7 flake: remove unneeded indirection in legacyPackages
Example: The nix-bitcoin electrs pkg can now be reached via flake attr
.#modulesPkgs.electrs
instead of
.#nbPkgs.modulesPkgs.electrs
2022-02-03 20:47:24 +01:00
Erik Arvstedt d8af0aca02 lnd: improve service initialization
- Use systemd startup notification.
- Use new option `--wallet-unlock-password-file` instead of
  manual unlocking.
2022-01-15 22:49:05 +01:00
Erik Arvstedt bf92d6094d bitcoind: fix error when defining passwordHMAC for RPC users 2022-01-07 03:32:07 +01:00
Erik Arvstedt 98bc0917d7 run-tests: fix vm cmd
Previously, qemu failed with error
`restrict=on : Parameter 'restrict' expects 'on' or 'off'`
due to the trailing space after `on`.
2022-01-04 22:30:35 +01:00
Erik Arvstedt 53a9f136b9 lib: allow syscall get_mempolicy in default seccomp filter
This syscall is required by an upcoming version of btcpayserver.
Because it is generally safe, we can allow it for all services.
2022-01-01 20:13:42 +00:00
Erik Arvstedt 6be3fb3e77 flake: provide a single NixOS module
Instead of providing two NixOS modules (one for using system pkgs,
one for using locked pkgs), provide a single module with option
`useVersionLockedPkgs`.

This fixes that all nix-bitcoin options are displayed twice
on search.nixos.org:
https://search.nixos.org/flakes?type=options&query=clightning
2021-12-27 16:59:14 +01:00
Erik Arvstedt d69524143b flake: remove nonstandard top-level flake attrs
Silences warnings in `nix flake check`.

- Define `mkNbPkgs` under attr `lib`.
  `lib` still triggers a warning, but it is expected to be a standard
  flake attr in a future Nix release.

- Define `nbPkgs` under attr `legacyPackages`.
  This also has the advantage to make its contents more easily
  accessible via the nix CLI. Example:
  nix eval nix-bitcoin#nbPkgs.modulesPkgs.clightning.version
2021-12-27 16:59:14 +01:00
Erik Arvstedt a31d07d8bf ci: update container image for modules tests
nixos/nix:latest has switched to Nix 2.5, but we should track
2.3.x, the default on NixOS stable.
2021-12-15 15:44:56 +01:00
Erik Arvstedtandnixbitcoin bc7d3a2ed7 fetch-release: check that only one key is imported
Co-authored-by: nixbitcoin <nixbitcoin@i2pmail.org>
2021-12-15 15:44:55 +01:00
Erik Arvstedt 5ab85cb2a5 pkgs: add meta attr
Also add more detailed `enable` option descriptions.
2021-12-15 14:39:31 +01:00
Erik Arvstedt 602281b132 rtl, cl-rest: add /bin to pkg output 2021-12-15 10:58:04 +01:00
Erik Arvstedt f4872f3334 spark-wallet: use node package lockfile 2021-12-15 10:58:04 +01:00
Erik Arvstedt 3091b0a4fb cl-rest: use node package lockfile 2021-12-15 10:58:04 +01:00
Erik Arvstedt fbfb61210a rtl: use node package lockfile 2021-12-15 10:58:04 +01:00
Erik Arvstedt d296b2d1fb charge-lnd: remove unneeded use of literalExample 2021-12-15 10:58:04 +01:00
Erik Arvstedt f13ffe0146 run-tests: make nixosSearch compatible with --copy-src 2021-12-15 10:58:04 +01:00
Erik Arvstedt 2069f62abc krops: -> 1.26.2
Includes https://github.com/krebs/krops/commit/9fc8cbf8e826d4c8a118f37202ab3f335341082a

Add krops/fetch-release.sh
2021-12-14 19:52:17 +01:00
Erik Arvstedt 5e59c784ed flake: remove internal pkg netns-exec from packages 2021-12-12 16:21:12 +01:00
Erik Arvstedt 1ef40ac230 ci: add flake test
- Check flake
- Check nixos-search doc generation
2021-12-12 16:21:12 +01:00
Erik Arvstedt d3c8d7bd6f .cirrus.yml: refactor
Required by the following commit.
2021-12-12 16:21:12 +01:00
Erik Arvstedt 26a53f0d59 ci: simplify test
Remove obsolete features that were required for pkgsUnstable.
2021-12-12 16:21:11 +01:00
Erik Arvstedt 0fd3be5343 move ci/ to test/ 2021-12-12 16:21:11 +01:00
Erik Arvstedt eaf98f92db test: add test nixosSearch
This checks that creating module docs for search.nixos.org succceeds.
Errors can happen when complex `default` values can't be evaluated
or on malformed Docbook XML in descriptions.
2021-12-12 16:21:02 +01:00
Erik Arvstedt 77d8c00c53 run-tests.sh: extract checkFlakeSupport
Required by the following commit.
2021-12-12 16:20:40 +01:00
Erik Arvstedt 96df81a4d0 run-tests: move flake next to other tests 2021-12-12 16:20:40 +01:00
Erik Arvstedt bbebd0b383 treewide: remove invalid docbook XML from option descriptions
NixOS will soon use CommonMark Markdown for option descriptions.
We can then switch back the old, slightly clearer bracket syntax.
2021-12-12 16:20:40 +01:00
Erik Arvstedt 3681f118f7 nix-bitcoin.nix: add defaultText (automatic)
This enables generating module option documentation.

This commit was genereated by running the following script inside the
repo root dir:

def add_default_text(file)
  src = File.read(file)
  src2 = src.gsub(/( = mkOption\s+\{[^{]*?)(\n\s+default = )(.*?);$(.*?\})/m) do |str|
    pre, defaultVar, default, post = Regexp.last_match.captures
    replacement =
      if !post.include?('defaultText =')
        if default =~ /\bpkgs\b/
          defaultText = default.lines.length == 1 ? default : "(See source)"
          "#{pre}#{defaultVar}#{default};#{defaultVar.sub('default', 'defaultText')}#{defaultText.inspect};#{post}"
        end
      end
    replacement or str
  end
  File.write(file, src2) if src2 != src
end

Dir["modules/**/*.nix"].each do |f|
  next if File.basename(f) == "nix-bitcoin.nix"
  add_default_text f
end
2021-12-12 16:20:39 +01:00
Erik Arvstedt d24c029435 treewide: add defaultText (manual)
This enables generating module option documentation.

Add `defaultText` to options where the default value can't be
evaluated during metadata generation.
2021-12-12 16:18:14 +01:00
Erik Arvstedt f0096371bf btcpayserver: expand nbPkgs in option defaults
Required by commit `nix-bitcoin.nix: add `defaultText` (automatic)`.
2021-12-11 13:27:51 +01:00
Erik Arvstedt 349f904e79 secrets: use assertion instead of error in default value
This enables generating module option documentation.
2021-12-11 13:27:48 +01:00
Erik Arvstedt 2f0f1ec15a hardened-extended: define kernelParams as separate strings
This is now checked by the modules.
2021-12-10 12:16:31 +00:00
Erik Arvstedt 71e9864060 netns-isolation: add compatibility with 21.11
`security.wrappers` now requires `group` be defined.
2021-12-10 12:16:09 +00:00
Erik Arvstedt 8f641756ce tests: add TODO-EXTERNAL 2021-12-10 12:15:36 +00:00
Erik Arvstedt b2f7a80f9f tests: add compatibility with 21.11
Adapt to the new test driver and systemd versions.
2021-12-10 12:15:20 +00:00
Erik Arvstedt 6b539627ee add presets/bitcoind-remote.nix
This simplifies integrating a remote bitcoind instance and
makes `bitcoin-cli` work with the remote node.

Add note regarding `whitelistedPort` to docs.
2021-12-07 15:35:33 +01:00
Erik Arvstedt 5915a34891 configuration.md: fixes
- Fix firewall.allowedTCPPorts settings

- Section `Allow bitcoind RPC connections`:
  Set catch-all listen for `rpc.address` instead of `address`.

- rpc.allowip: Set subnet zero to fix allowing all addresses
2021-12-07 15:35:33 +01:00
Erik Arvstedt 1596b3a5d2 minor fixes
- README: fix uppercase

- bitcoind: add whitespace

- hardware-wallets: remove unused variables
2021-12-07 15:35:33 +01:00
Erik Arvstedt 627b11d21b makeShell: use old nix tooling
The `nix` command is an experimental feature and should be avoided in
user-facing code.

I recently saw `nix eval` failing for a user who was asking for help
via Matrix.
2021-12-07 15:35:33 +01:00
Erik Arvstedt def64a73b8 treewide: use TODO-EXTERNAL
Use TODO-EXTERNAL for TODOs that depend on external factors like
upstream fixes.
2021-11-29 13:47:48 +01:00
Erik Arvstedt 6f37bef2a3 netns-isolation: simplify firewall setup
Set all allowed INPUT/OUTPUT addresses in a single `iptables` command.
2021-11-29 13:47:48 +01:00
Erik Arvstedt f52059ce3c docs: add doc 'Configuration and maintenance'
- Move section `updating` from `usage.md` to `configuration.md` and
  rename `usage.md` -> `services.md`.
  `services.md` documents how enable and interact with node services.

- README: Move `docs` below `Get started`. The `docs` section is short and
  should be easily accessible.
2021-11-29 13:47:47 +01:00
Erik Arvstedt 94aee8174d usage.md: add section Managing services 2021-11-29 13:22:44 +01:00
Erik Arvstedt 8cc7b83da1 usage.md: convert to '#' heading syntax
Like in other docs.
2021-11-29 13:22:44 +01:00
Erik Arvstedt 91fbcfcc77 faq.md: reformat
Improves readability in both the rendered and raw formats.

Also, mention that `doas` is enabled only via the `secure-node.nix` template.
2021-11-29 13:22:44 +01:00
Erik Arvstedt 9e4f4d6b0f bitcoind: add option txindex 2021-11-29 13:22:44 +01:00
Erik Arvstedt 10a744a598 rtl: add option extraCurrency 2021-11-29 13:22:44 +01:00
Erik Arvstedt 62a2602e78 electrs: use dataDir for storing extra config
This is simpler and more memory-efficient.
We've also changed other services to use this appraoch.

Also remove unneded `wait_for_unit` in the electrs regtest test.
2021-11-29 13:22:44 +01:00
Erik Arvstedt 9bda7305fd services: add tor.* options
Split `enforceTor` into `tor.proxy` and `tor.enforce`.
By enabling `tor.proxy` without `tor.enforce`, a service can accept
incoming clearnet connections.
E.g., this allows setting up a Tor-proxied bitcoind node that accepts
RPC connections from LAN.
2021-11-29 13:22:43 +01:00
Erik Arvstedt ff24e73ad7 onion-addresses: fix files not being copied
When NixOS is already running and Tor is restarted due to config
changes, `/var/lib/tor/state` may be present even when Tor has not
yet finished setting up onion services.
This caused the previous version of `onion-addresses` to not wait for
Tor and to skip not yet present onion service files.

`onion-addresses` now waits until each required onion service file
has appeared.
2021-11-29 13:22:43 +01:00
Erik Arvstedt c6fe017aeb netns-isolation: avoid creating service files for disabled services
Only set the `serviceConfig` option when the service is enabled.
Otherwise a service file is created.
2021-11-29 13:22:43 +01:00
Erik Arvstedt 017e08ca10 btcpayserver: move nbxplorer options to bottom
These are largely irrelevant to end users.
2021-11-28 21:18:49 +01:00
Erik Arvstedt e1d869d76c modules.nix: move rtl to fix topological sorting
rtl depends on lnd and lightning-loop.
2021-11-28 21:18:47 +01:00
Erik Arvstedt e44cd7ecdc rtl: improve descriptions
Also move cl-rest to the bottom.
2021-11-28 21:18:44 +01:00
Erik Arvstedt bd275d3a9a minor improvements
- README:
  - Add RTL

- examples/configuration.nix:
  - Fix comment

- btcpayserver.nix:
  - Use nbLib.addressWithPort
  - Embed optionalString like the other optionalStrings

- clboss.nix:
  - Improve description

- clightning.nix:
  - Option `extraConfig`: Add example, improve description.
  - Disable `log-timestamps`. Timestamps are already logged via journald.
  - Simplify `preStart` script

- electrs.nix:
  - Use `port` description wording like in other services.
2021-11-28 21:18:40 +01:00
Erik Arvstedt 8aa28da110 remove recurring-donations module
This module has failed to evaluate for quite some time.
We might bring it back someday with bolt12 and LNURL support.
2021-11-28 21:18:39 +01:00
Erik Arvstedt 4a74b7de08 clightning: work around unsupported seccomp syscall 2021-11-10 21:26:56 +01:00
Erik Arvstedt 38a843d005 clightning: update python pkgs to new version 2021-11-10 21:26:11 +01:00
Erik Arvstedt 6ad7107ddb update nixpkgs
btcpayserver: 1.3.1 -> 1.3.3
clightning: 0.10.1 -> 0.10.2
2021-11-10 21:26:10 +01:00
Erik Arvstedt f58d67677e netns-isolation: separate host and netns setup
- Improves readability

- `netns exec ...` (called via `netnsIptables`) incurs a large
  overhead: In addition to netns switching, a mount namespace
  is setup and populated with the contents of /etc/netns/<ns>/.
  Instead, simply run `nsenter`.
2021-11-08 12:46:28 +01:00
Erik Arvstedt cb6e5ef702 netns-isolation: fix routing issues due to netns restarting
Previously, restarting a service implied restarting its netns.
For unknown reasons, this sometimes caused the netns-local address
to not be routable from the root netns for up to 20 s.
I.e., the service was sometimes unreachable after restarting.

Now the netns is no longer stopped when the service is stopped.
2021-11-08 12:46:27 +01:00
Erik Arvstedt 7f77147b60 makeShell: minor improvements
- import pkgs without the global config to avoid pulling in external state
- rename `path` -> `setPath`
- export `nixpkgsUnstable`
  This avoids garbage collection of nixpkgs-unstable for gcrooted
  shell environments (like those created by lorri)
2021-11-08 12:46:27 +01:00
Erik Arvstedt a5730eb736 makeShell: make the help msg a shell derivation variable
- The message is now a nix string, which simplifies formatting.
- The message can be now be modified via overrideAttrs in client shells.
  This is more effective than changing the message in Bash.
2021-11-08 12:46:27 +01:00
Erik Arvstedt b3e868d0af tests/regtest: disable incompatible validatepegin for liquidd
Otherwise liquidd startup fails. This bug was not covered by our tests,
because we're not combining `regtest` with `secure-node`.
But nixbitcoin.org does, which should suffice for now.
2021-11-02 17:40:43 +01:00
Erik Arvstedt c30fe1919b netns-isolation: don't auto-assign IPv6 addrs to peer links
This simplifies the host's address configuration.

This also removes unused addresses that are returned when resolving
container hostnames via nss-mymachines:
`getent ahosts nb-test`
2021-11-02 17:40:43 +01:00
Erik Arvstedt 6584540828 makeShell: make help message extensible
Users can now override help and print more help messages alongside `nixBitcoinHelp`.
2021-11-02 17:40:43 +01:00
Erik Arvstedt 0478354477 versioning: move variable
The variable is an internal implementation detail. Move it close to
where it's used.
2021-11-02 17:40:43 +01:00
Erik Arvstedt 8616254d63 bitcoind-rpc-public-whitelist: remove waitfornewblock
This is an internal testing function and it's no longer used by electrs.
2021-11-02 17:40:43 +01:00
Erik Arvstedt 083e141e3e tests/btcpayserver: test bitcoind P2P connection in regtest
nbxplorer requires at least 100 blocks (coinbase maturity) in regtest.
2021-11-02 17:40:43 +01:00