Merge fort-nix/nix-bitcoin#419: Add RTL
030f649009
docs: remove obsolete nixops deploy instructions (nixbitcoin)0a6324e9de
docs: add usage instructions for connecting to RTL (nixbitcoin)41c4dd041e
test: add rtl & cl-rest (nixbitcoin)f569227410
rtl: add module (nixbitcoin)0e1e2a1b3c
cl-rest: init at 0.5.2 (nixbitcoin)83196f5545
rtl: init at 0.11.2 (nixbitcoin) Pull request description: ACKs for top commit: erikarvstedt: ACK030f649009
Tree-SHA512: a6c7694ec945d44f0adfa2e651987301e895d4947dfdd6967cea188c967667f7d97849579189c1043ed9ef6d524c688202ca54a6ce7c2c7ee46b8a59c1c9903d
This commit is contained in:
commit
d5d64ace29
@ -31,10 +31,9 @@ task:
|
|||||||
- environment:
|
- environment:
|
||||||
scenario: netnsRegtest
|
scenario: netnsRegtest
|
||||||
|
|
||||||
# Disabled because this test is currently empty
|
- name: pkgs_unstable
|
||||||
# - name: pkgs_unstable
|
environment:
|
||||||
# environment:
|
nixpkgs: nixpkgs-unstable
|
||||||
# nixpkgs: nixpkgs-unstable
|
|
||||||
|
|
||||||
# This script is run as root
|
# This script is run as root
|
||||||
build_script:
|
build_script:
|
||||||
|
@ -11,6 +11,24 @@ Nodeinfo
|
|||||||
---
|
---
|
||||||
Run `nodeinfo` to see onion addresses and local addresses for enabled services.
|
Run `nodeinfo` to see onion addresses and local addresses for enabled services.
|
||||||
|
|
||||||
|
Connect to RTL
|
||||||
|
---
|
||||||
|
Normally you would connect to RTL via SSH tunneling with a command like this
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh -L 3000:localhost:3000 root@bitcoin-node
|
||||||
|
```
|
||||||
|
|
||||||
|
Or like this, if you are using `netns-isolation`
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh -L 3000:169.254.1.29:3000 root@bitcoin-node
|
||||||
|
```
|
||||||
|
|
||||||
|
Otherwise, you can access it via Tor Browser at `http://<onion-address>`.
|
||||||
|
You can find the `<onion-address>` with command `nodeinfo`.
|
||||||
|
The default password location is `/secrets/rtl-password`.
|
||||||
|
|
||||||
Connect to spark-wallet
|
Connect to spark-wallet
|
||||||
---
|
---
|
||||||
### Requirements
|
### Requirements
|
||||||
@ -79,10 +97,6 @@ Connect to LND with Zeus
|
|||||||
|
|
||||||
2. Deploy new `configuration.nix`
|
2. Deploy new `configuration.nix`
|
||||||
|
|
||||||
```
|
|
||||||
nixops deploy -d bitcoin-node
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Run command `lndconnect-rest-onion` (under `operator` user) to create a QR code for
|
3. Run command `lndconnect-rest-onion` (under `operator` user) to create a QR code for
|
||||||
connecting to LND via the REST onion service.
|
connecting to LND via the REST onion service.
|
||||||
|
|
||||||
|
@ -84,6 +84,24 @@
|
|||||||
# This will allow you to recover off-chain funds, by force-closing channels.
|
# This will allow you to recover off-chain funds, by force-closing channels.
|
||||||
# scp bitcoin-node:/var/lib/lnd/chain/bitcoin/mainnet/channel.backup ./backups/lnd/
|
# scp bitcoin-node:/var/lib/lnd/chain/bitcoin/mainnet/channel.backup ./backups/lnd/
|
||||||
|
|
||||||
|
### RIDE THE LIGHTNING
|
||||||
|
# Set this to enable RTL, a web interface for lnd and clightning.
|
||||||
|
# services.rtl.enable = true;
|
||||||
|
#
|
||||||
|
# Set this to add a clightning node interface.
|
||||||
|
# Automatically enables clightning.
|
||||||
|
# services.rtl.nodes.clightning = true;
|
||||||
|
#
|
||||||
|
# Set this to add a lnd node interface.
|
||||||
|
# Automatically enables lnd.
|
||||||
|
# services.rtl.nodes.lnd = true;
|
||||||
|
#
|
||||||
|
# You can enable both nodes simultaneously.
|
||||||
|
#
|
||||||
|
# Set this option to enable swaps with lightning-loop.
|
||||||
|
# Automatically enables lightning-loop.
|
||||||
|
# services.rtl.loop = true;
|
||||||
|
|
||||||
### SPARK WALLET
|
### SPARK WALLET
|
||||||
# Set this to enable spark-wallet, a minimalistic wallet GUI for
|
# Set this to enable spark-wallet, a minimalistic wallet GUI for
|
||||||
# c-lightning, accessible over the web or through mobile and desktop apps.
|
# c-lightning, accessible over the web or through mobile and desktop apps.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
electrs = ./electrs.nix;
|
electrs = ./electrs.nix;
|
||||||
liquid = ./liquid.nix;
|
liquid = ./liquid.nix;
|
||||||
presets.secure-node = ./presets/secure-node.nix;
|
presets.secure-node = ./presets/secure-node.nix;
|
||||||
|
rtl = ./rtl.nix;
|
||||||
spark-wallet = ./spark-wallet.nix;
|
spark-wallet = ./spark-wallet.nix;
|
||||||
recurring-donations = ./recurring-donations.nix;
|
recurring-donations = ./recurring-donations.nix;
|
||||||
lnd = ./lnd.nix;
|
lnd = ./lnd.nix;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
./bitcoind.nix
|
./bitcoind.nix
|
||||||
./clightning.nix
|
./clightning.nix
|
||||||
./clightning-plugins
|
./clightning-plugins
|
||||||
|
./rtl.nix
|
||||||
./spark-wallet.nix
|
./spark-wallet.nix
|
||||||
./lnd.nix
|
./lnd.nix
|
||||||
./lnd-rest-onion-service.nix # Requires onion-addresses.nix
|
./lnd-rest-onion-service.nix # Requires onion-addresses.nix
|
||||||
|
@ -274,6 +274,12 @@ in {
|
|||||||
id = 28;
|
id = 28;
|
||||||
connections = [ "lnd" "electrs" ];
|
connections = [ "lnd" "electrs" ];
|
||||||
};
|
};
|
||||||
|
rtl = {
|
||||||
|
id = 29;
|
||||||
|
connections = []
|
||||||
|
++ optional (config.services.rtl.nodes.lnd) "lnd"
|
||||||
|
++ optional config.services.rtl.loop "lightning-loop";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.bitcoind = {
|
services.bitcoind = {
|
||||||
@ -324,6 +330,13 @@ in {
|
|||||||
services.joinmarket-ob-watcher.address = netns.joinmarket-ob-watcher.address;
|
services.joinmarket-ob-watcher.address = netns.joinmarket-ob-watcher.address;
|
||||||
|
|
||||||
services.lightning-pool.rpcAddress = netns.lightning-pool.address;
|
services.lightning-pool.rpcAddress = netns.lightning-pool.address;
|
||||||
|
|
||||||
|
services.rtl.address = netns.rtl.address;
|
||||||
|
systemd.services.cl-rest = {
|
||||||
|
serviceConfig.NetworkNamespacePath = "/var/run/netns/nb-rtl";
|
||||||
|
requires = [ "netns-rtl.service" ] ;
|
||||||
|
after = [ "netns-rtl.service" ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ let
|
|||||||
btcpayserver = mkInfo "";
|
btcpayserver = mkInfo "";
|
||||||
liquidd = mkInfo "";
|
liquidd = mkInfo "";
|
||||||
joinmarket-ob-watcher = mkInfo "";
|
joinmarket-ob-watcher = mkInfo "";
|
||||||
|
rtl = mkInfo "";
|
||||||
# Only add sshd when it has an onion service
|
# Only add sshd when it has an onion service
|
||||||
sshd = name: cfg: mkIfOnionPort "sshd" (onionPort: ''
|
sshd = name: cfg: mkIfOnionPort "sshd" (onionPort: ''
|
||||||
add_service("sshd", """set_onion_address(info, "sshd", ${onionPort})""")
|
add_service("sshd", """set_onion_address(info, "sshd", ${onionPort})""")
|
||||||
|
@ -117,6 +117,9 @@ in {
|
|||||||
joinmarket-ob-watcher = {
|
joinmarket-ob-watcher = {
|
||||||
externalPort = 80;
|
externalPort = 80;
|
||||||
};
|
};
|
||||||
|
rtl = {
|
||||||
|
externalPort = 80;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ lib, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
defaultTrue = lib.mkDefault true;
|
defaultTrue = lib.mkDefault true;
|
||||||
in {
|
in {
|
||||||
@ -21,6 +21,7 @@ in {
|
|||||||
spark-wallet.enforceTor = true;
|
spark-wallet.enforceTor = true;
|
||||||
recurring-donations.enforceTor = true;
|
recurring-donations.enforceTor = true;
|
||||||
lightning-pool.enforceTor = true;
|
lightning-pool.enforceTor = true;
|
||||||
|
rtl.enforceTor = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Add onion services for incoming connections
|
# Add onion services for incoming connections
|
||||||
@ -30,5 +31,6 @@ in {
|
|||||||
electrs.enable = defaultTrue;
|
electrs.enable = defaultTrue;
|
||||||
spark-wallet.enable = defaultTrue;
|
spark-wallet.enable = defaultTrue;
|
||||||
joinmarket-ob-watcher.enable = defaultTrue;
|
joinmarket-ob-watcher.enable = defaultTrue;
|
||||||
|
rtl.enable = defaultTrue;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
255
modules/rtl.nix
Normal file
255
modules/rtl.nix
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
options.services.rtl = {
|
||||||
|
enable = mkEnableOption "rtl";
|
||||||
|
address = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "127.0.0.1";
|
||||||
|
description = "HTTP server address.";
|
||||||
|
};
|
||||||
|
port = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 3000;
|
||||||
|
description = "HTTP server port.";
|
||||||
|
};
|
||||||
|
dataDir = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/var/lib/rtl";
|
||||||
|
description = "The data directory for RTL.";
|
||||||
|
};
|
||||||
|
nodes = {
|
||||||
|
clightning = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Add a node interface for clightning.";
|
||||||
|
};
|
||||||
|
lnd = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Add a node interface for lnd.";
|
||||||
|
};
|
||||||
|
reverseOrder = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Reverse the order of nodes shown in the UI.
|
||||||
|
By default, clightning is shown before lnd.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
loop = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to enable swaps with lightning-loop.";
|
||||||
|
};
|
||||||
|
nightTheme = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable the Night UI Theme.";
|
||||||
|
};
|
||||||
|
cl-rest = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = cfg.nodes.clightning;
|
||||||
|
description = "Enable c-lightning-REST server.";
|
||||||
|
};
|
||||||
|
address = mkOption {
|
||||||
|
readOnly = true;
|
||||||
|
default = "0.0.0.0";
|
||||||
|
description = ''
|
||||||
|
Rest server address.
|
||||||
|
Not configurable. The server always listens on all interfaces:
|
||||||
|
https://github.com/Ride-The-Lightning/c-lightning-REST/issues/84
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
port = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 3001;
|
||||||
|
description = "REST server port.";
|
||||||
|
};
|
||||||
|
docPort = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 4001;
|
||||||
|
description = "Swagger API documentation server port.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "rtl";
|
||||||
|
description = "The user as which to run RTL.";
|
||||||
|
};
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = cfg.user;
|
||||||
|
description = "The group as which to run RTL.";
|
||||||
|
};
|
||||||
|
inherit (nbLib) enforceTor;
|
||||||
|
};
|
||||||
|
|
||||||
|
cfg = config.services.rtl;
|
||||||
|
nbLib = config.nix-bitcoin.lib;
|
||||||
|
secretsDir = config.nix-bitcoin.secretsDir;
|
||||||
|
|
||||||
|
node = { isLnd, index }: ''
|
||||||
|
{
|
||||||
|
"index": ${toString index},
|
||||||
|
"lnNode": "Node",
|
||||||
|
"lnImplementation": "${if isLnd then "LND" else "CLT"}",
|
||||||
|
"Authentication": {
|
||||||
|
${optionalString (isLnd && cfg.loop)
|
||||||
|
''"swapMacaroonPath": "${lightning-loop.dataDir}/${bitcoind.network}",''
|
||||||
|
}
|
||||||
|
"macaroonPath": "${if isLnd
|
||||||
|
then "${cfg.dataDir}/macaroons"
|
||||||
|
else "${cl-rest.dataDir}/certs"
|
||||||
|
}"
|
||||||
|
},
|
||||||
|
"Settings": {
|
||||||
|
"userPersona": "OPERATOR",
|
||||||
|
"themeMode": "${if cfg.nightTheme then "NIGHT" else "DAY"}",
|
||||||
|
"themeColor": "PURPLE",
|
||||||
|
${optionalString isLnd
|
||||||
|
''"channelBackupPath": "${cfg.dataDir}/backup/lnd",''
|
||||||
|
}
|
||||||
|
"logLevel": "INFO",
|
||||||
|
"fiatConversion": false,
|
||||||
|
${optionalString (isLnd && cfg.loop)
|
||||||
|
''"swapServerUrl": "https://${nbLib.addressWithPort lightning-loop.restAddress lightning-loop.restPort}",''
|
||||||
|
}
|
||||||
|
"lnServerUrl": "https://${
|
||||||
|
if isLnd
|
||||||
|
then nbLib.addressWithPort lnd.restAddress lnd.restPort
|
||||||
|
else nbLib.addressWithPort cfg.cl-rest.address cfg.cl-rest.port
|
||||||
|
}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
nodes' = optional cfg.nodes.clightning (node { isLnd = false; index = 1; }) ++
|
||||||
|
optional cfg.nodes.lnd (node { isLnd = true; index = 2; });
|
||||||
|
|
||||||
|
nodes = if cfg.nodes.reverseOrder then reverseList nodes' else nodes';
|
||||||
|
|
||||||
|
configFile = builtins.toFile "config" ''
|
||||||
|
{
|
||||||
|
"multiPass": "@multiPass@",
|
||||||
|
"host": "${cfg.address}",
|
||||||
|
"port": "${toString cfg.port}",
|
||||||
|
"SSO": {
|
||||||
|
"rtlSSO": 0
|
||||||
|
},
|
||||||
|
"nodes": [
|
||||||
|
${builtins.concatStringsSep ",\n" nodes}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
cl-rest = {
|
||||||
|
configFile = builtins.toFile "config" ''
|
||||||
|
{
|
||||||
|
"PORT": ${toString cfg.cl-rest.port},
|
||||||
|
"DOCPORT": ${toString cfg.cl-rest.docPort},
|
||||||
|
"LNRPCPATH": "${clightning.dataDir}/${bitcoind.makeNetworkName "bitcoin" "regtest"}/lightning-rpc",
|
||||||
|
"PROTOCOL": "https",
|
||||||
|
"EXECMODE": "production",
|
||||||
|
"RPCCOMMANDS": ["*"]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
# serviceConfig.StateDirectory
|
||||||
|
dataDir = "/var/lib/cl-rest";
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit (config.services)
|
||||||
|
bitcoind
|
||||||
|
lnd
|
||||||
|
clightning
|
||||||
|
lightning-loop;
|
||||||
|
in {
|
||||||
|
inherit options;
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
{ assertion = cfg.nodes.clightning || cfg.nodes.lnd;
|
||||||
|
message = ''
|
||||||
|
RTL: At least one of `nodes.lnd` or `nodes.clightning` must be `true`.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
services.lnd.enable = mkIf cfg.nodes.lnd true;
|
||||||
|
services.lightning-loop.enable = mkIf cfg.loop true;
|
||||||
|
services.clightning.enable = mkIf cfg.nodes.clightning true;
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d '${cfg.dataDir}' 0770 ${cfg.user} ${cfg.group} - -"
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.services.rtl = rec {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
requires = optional cfg.nodes.clightning "cl-rest.service" ++
|
||||||
|
optional cfg.nodes.lnd "lnd.service";
|
||||||
|
after = requires;
|
||||||
|
environment.RTL_CONFIG_PATH = cfg.dataDir;
|
||||||
|
serviceConfig = nbLib.defaultHardening // {
|
||||||
|
ExecStartPre = [
|
||||||
|
(nbLib.script "rtl-setup-config" ''
|
||||||
|
<${configFile} sed "s|@multiPass@|$(cat ${secretsDir}/rtl-password)|" \
|
||||||
|
> '${cfg.dataDir}/RTL-Config.json'
|
||||||
|
'')
|
||||||
|
] ++ optional cfg.nodes.lnd
|
||||||
|
(nbLib.rootScript "rtl-copy-macaroon" ''
|
||||||
|
install -D -o ${cfg.user} -g ${cfg.group} ${lnd.networkDir}/admin.macaroon \
|
||||||
|
'${cfg.dataDir}/macaroons/admin.macaroon'
|
||||||
|
'');
|
||||||
|
ExecStart = "${pkgs.nodejs}/bin/node ${config.nix-bitcoin.pkgs.rtl}/lib/node_modules/rtl/rtl";
|
||||||
|
# Show "rtl" instead of "node" in the journal
|
||||||
|
SyslogIdentifier = "rtl";
|
||||||
|
User = cfg.user;
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "10s";
|
||||||
|
ReadWritePaths = cfg.dataDir;
|
||||||
|
} // nbLib.allowedIPAddresses cfg.enforceTor
|
||||||
|
// nbLib.nodejs;
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.cl-rest = mkIf cfg.cl-rest.enable {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
requires = [ "clightning.service" ];
|
||||||
|
after = [ "clightning.service" ];
|
||||||
|
path = [ pkgs.openssl ];
|
||||||
|
preStart = ''
|
||||||
|
ln -sfn ${cl-rest.configFile} cl-rest-config.json
|
||||||
|
'';
|
||||||
|
environment.CL_REST_STATE_DIR = cl-rest.dataDir;
|
||||||
|
serviceConfig = nbLib.defaultHardening // {
|
||||||
|
StateDirectory = "cl-rest";
|
||||||
|
# cl-rest reads the config file from the working directory
|
||||||
|
WorkingDirectory = cl-rest.dataDir;
|
||||||
|
ExecStart = "${pkgs.nodejs}/bin/node ${config.nix-bitcoin.pkgs.cl-rest}/lib/node_modules/c-lightning-rest/cl-rest";
|
||||||
|
# Show "cl-rest" instead of "node" in the journal
|
||||||
|
SyslogIdentifier = "cl-rest";
|
||||||
|
User = cfg.user;
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "10s";
|
||||||
|
} // nbLib.allowLocalIPAddresses
|
||||||
|
// nbLib.nodejs;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.${cfg.user} = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = cfg.group;
|
||||||
|
extraGroups =
|
||||||
|
# Enable clightning RPC access for cl-rest
|
||||||
|
optional cfg.cl-rest.enable clightning.group ++
|
||||||
|
optional cfg.loop lnd.group;
|
||||||
|
};
|
||||||
|
users.groups.${cfg.group} = {};
|
||||||
|
|
||||||
|
nix-bitcoin.secrets.rtl-password.user = cfg.user;
|
||||||
|
nix-bitcoin.generateSecretsCmds.rtl = ''
|
||||||
|
makePasswordSecret rtl-password
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
17
pkgs/cl-rest/composition.nix
Normal file
17
pkgs/cl-rest/composition.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# This file has been generated by node2nix 1.9.0. Do not edit!
|
||||||
|
|
||||||
|
{pkgs ? import <nixpkgs> {
|
||||||
|
inherit system;
|
||||||
|
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-10_x"}:
|
||||||
|
|
||||||
|
let
|
||||||
|
nodeEnv = import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix" {
|
||||||
|
inherit (pkgs) stdenv lib python2 runCommand writeTextFile;
|
||||||
|
inherit pkgs nodejs;
|
||||||
|
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
import ./node-packages.nix {
|
||||||
|
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
|
||||||
|
inherit nodeEnv;
|
||||||
|
}
|
5
pkgs/cl-rest/default.nix
Normal file
5
pkgs/cl-rest/default.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{ stdenv, pkgs, lib }:
|
||||||
|
lib.head (builtins.attrValues (import ./composition.nix {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (stdenv.hostPlatform) system;
|
||||||
|
}))
|
31
pkgs/cl-rest/generate.sh
Executable file
31
pkgs/cl-rest/generate.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p nodePackages.node2nix gnupg wget jq moreutils
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d -p /tmp)"
|
||||||
|
trap "rm -rf $TMPDIR" EXIT
|
||||||
|
|
||||||
|
# Get/verify source tarball
|
||||||
|
version="0.5.2"
|
||||||
|
export GNUPGHOME=$TMPDIR
|
||||||
|
gpg --keyserver hkps://keyserver.ubuntu.com --recv-key 3E9BD4436C288039CA827A9200C9E2BC2E45666F
|
||||||
|
wget -P $TMPDIR https://github.com/Ride-The-Lightning/c-lightning-REST/archive/refs/tags/v${version}.tar.gz
|
||||||
|
wget -P $TMPDIR https://github.com/Ride-The-Lightning/c-lightning-REST/releases/download/v${version}/v${version}.tar.gz.asc
|
||||||
|
gpg --verify $TMPDIR/v${version}.tar.gz.asc $TMPDIR/v${version}.tar.gz
|
||||||
|
shasum=$(sha256sum $TMPDIR/v${version}.tar.gz | cut -d\ -f1)
|
||||||
|
|
||||||
|
# Run node2nix
|
||||||
|
mkdir $TMPDIR/package && tar xvf $TMPDIR/v${version}.tar.gz -C $TMPDIR/package --strip-components 1
|
||||||
|
cp pkg.json $TMPDIR/pkg.json
|
||||||
|
node2nix --nodejs-10 -i $TMPDIR/pkg.json -c composition.nix --no-copy-node-env
|
||||||
|
|
||||||
|
# Set node env import.
|
||||||
|
# The reason for not providing a custom node-env.nix file is the following:
|
||||||
|
# To be flakes-compatible, we have to locate the nixpgs source via `pkgs.path` instead of `<nixpkgs>`.
|
||||||
|
# This requires the `pkgs` variable which is available only in composition.nix, not in node-env.nix.
|
||||||
|
nodeEnvImport='import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix"'
|
||||||
|
sed -i "s|import ./node-env.nix|$nodeEnvImport|" composition.nix
|
||||||
|
|
||||||
|
# Use verified source in node-packages.nix
|
||||||
|
url="https://github.com/Ride-The-Lightning/c-lightning-REST/archive/refs/tags/v$version.tar.gz"
|
||||||
|
sed -i '/packageName = "c-lightning-rest";/!b;n;n;c\ src = fetchurl {\n url = "'$url'";\n sha256 = "'$shasum'";\n };' node-packages.nix
|
1385
pkgs/cl-rest/node-packages.nix
Normal file
1385
pkgs/cl-rest/node-packages.nix
Normal file
File diff suppressed because it is too large
Load Diff
3
pkgs/cl-rest/pkg.json
Normal file
3
pkgs/cl-rest/pkg.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
{ "c-lightning-REST": "file:./package" }
|
||||||
|
]
|
@ -6,6 +6,8 @@ in
|
|||||||
, pkgsUnstable ? import nixpkgsPinned.nixpkgs-unstable { config = {}; overlays = []; }
|
, pkgsUnstable ? import nixpkgsPinned.nixpkgs-unstable { config = {}; overlays = []; }
|
||||||
}:
|
}:
|
||||||
let self = {
|
let self = {
|
||||||
|
rtl = pkgs.callPackage ./rtl { };
|
||||||
|
cl-rest = pkgs.callPackage ./cl-rest { };
|
||||||
spark-wallet = pkgs.callPackage ./spark-wallet { };
|
spark-wallet = pkgs.callPackage ./spark-wallet { };
|
||||||
liquid-swap = pkgs.python3Packages.callPackage ./liquid-swap { };
|
liquid-swap = pkgs.python3Packages.callPackage ./liquid-swap { };
|
||||||
joinmarket = pkgs.callPackage ./joinmarket { inherit (self) nbPython3Packages; };
|
joinmarket = pkgs.callPackage ./joinmarket { inherit (self) nbPython3Packages; };
|
||||||
|
17
pkgs/rtl/composition.nix
Normal file
17
pkgs/rtl/composition.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# This file has been generated by node2nix 1.9.0. Do not edit!
|
||||||
|
|
||||||
|
{pkgs ? import <nixpkgs> {
|
||||||
|
inherit system;
|
||||||
|
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-10_x"}:
|
||||||
|
|
||||||
|
let
|
||||||
|
nodeEnv = import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix" {
|
||||||
|
inherit (pkgs) stdenv lib python2 runCommand writeTextFile;
|
||||||
|
inherit pkgs nodejs;
|
||||||
|
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
import ./node-packages.nix {
|
||||||
|
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
|
||||||
|
inherit nodeEnv;
|
||||||
|
}
|
5
pkgs/rtl/default.nix
Normal file
5
pkgs/rtl/default.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{ stdenv, pkgs, lib }:
|
||||||
|
lib.head (builtins.attrValues (import ./composition.nix {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (stdenv.hostPlatform) system;
|
||||||
|
}))
|
31
pkgs/rtl/generate.sh
Executable file
31
pkgs/rtl/generate.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p nodePackages.node2nix gnupg wget jq moreutils
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d -p /tmp)"
|
||||||
|
trap "rm -rf $TMPDIR" EXIT
|
||||||
|
|
||||||
|
# Get/verify source tarball
|
||||||
|
version="0.11.2"
|
||||||
|
export GNUPGHOME=$TMPDIR
|
||||||
|
gpg --keyserver hkps://keyserver.ubuntu.com --recv-key 3E9BD4436C288039CA827A9200C9E2BC2E45666F
|
||||||
|
wget -P $TMPDIR https://github.com/Ride-The-Lightning/RTL/archive/refs/tags/v${version}.tar.gz
|
||||||
|
wget -P $TMPDIR https://github.com/Ride-The-Lightning/RTL/releases/download/v${version}/v${version}.tar.gz.asc
|
||||||
|
gpg --verify $TMPDIR/v${version}.tar.gz.asc $TMPDIR/v${version}.tar.gz
|
||||||
|
shasum=$(sha256sum $TMPDIR/v${version}.tar.gz | cut -d\ -f1)
|
||||||
|
|
||||||
|
# Run node2nix
|
||||||
|
mkdir $TMPDIR/package && tar xvf $TMPDIR/v${version}.tar.gz -C $TMPDIR/package --strip-components 1
|
||||||
|
cp pkg.json $TMPDIR/pkg.json
|
||||||
|
node2nix --nodejs-10 -i $TMPDIR/pkg.json -c composition.nix --no-copy-node-env
|
||||||
|
|
||||||
|
# Set node env import.
|
||||||
|
# The reason for not providing a custom node-env.nix file is the following:
|
||||||
|
# To be flakes-compatible, we have to locate the nixpgs source via `pkgs.path` instead of `<nixpkgs>`.
|
||||||
|
# This requires the `pkgs` variable which is available only in composition.nix, not in node-env.nix.
|
||||||
|
nodeEnvImport='import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix"'
|
||||||
|
sed -i "s|import ./node-env.nix|$nodeEnvImport|" composition.nix
|
||||||
|
|
||||||
|
# Use verified source in node-packages.nix
|
||||||
|
url="https://github.com/Ride-The-Lightning/RTL/archive/refs/tags/v$version.tar.gz"
|
||||||
|
sed -i '/packageName = "rtl";/!b;n;n;c\ src = fetchurl {\n url = "'$url'";\n sha256 = "'$shasum'";\n };' node-packages.nix
|
3066
pkgs/rtl/node-packages.nix
Normal file
3066
pkgs/rtl/node-packages.nix
Normal file
File diff suppressed because it is too large
Load Diff
3
pkgs/rtl/pkg.json
Normal file
3
pkgs/rtl/pkg.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
{ "RTL": "file:./package" }
|
||||||
|
]
|
@ -5,6 +5,8 @@ let
|
|||||||
pkgsUnstable = with nbPkgs; [
|
pkgsUnstable = with nbPkgs; [
|
||||||
# Disabled because joinmarket dependencies currently don't build on on unstable.
|
# Disabled because joinmarket dependencies currently don't build on on unstable.
|
||||||
# joinmarket
|
# joinmarket
|
||||||
|
rtl
|
||||||
|
cl-rest
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
pkgs.writeText "pkgs-unstable" (pkgs.lib.concatMapStringsSep "\n" toString pkgsUnstable)
|
pkgs.writeText "pkgs-unstable" (pkgs.lib.concatMapStringsSep "\n" toString pkgsUnstable)
|
||||||
|
@ -59,6 +59,15 @@ let
|
|||||||
systemd.services.clightning.serviceConfig.TimeoutStopSec =
|
systemd.services.clightning.serviceConfig.TimeoutStopSec =
|
||||||
mkIf config.services.clightning.plugins.clboss.enable "500ms";
|
mkIf config.services.clightning.plugins.clboss.enable "500ms";
|
||||||
|
|
||||||
|
tests.rtl = cfg.rtl.enable;
|
||||||
|
services.rtl.nodes.lnd = mkDefault true;
|
||||||
|
services.rtl.nodes.clightning = mkDefault true;
|
||||||
|
services.rtl.loop = mkIf cfg.rtl.nodes.lnd (mkDefault true);
|
||||||
|
# Use a simple, non-random password for manual web interface tests
|
||||||
|
nix-bitcoin.generateSecretsCmds.rtl = mkIf cfg.rtl.enable (mkForce ''
|
||||||
|
echo a > rtl-password
|
||||||
|
'');
|
||||||
|
|
||||||
tests.spark-wallet = cfg.spark-wallet.enable;
|
tests.spark-wallet = cfg.spark-wallet.enable;
|
||||||
|
|
||||||
tests.lnd = cfg.lnd.enable;
|
tests.lnd = cfg.lnd.enable;
|
||||||
@ -149,6 +158,7 @@ let
|
|||||||
|
|
||||||
services.clightning.enable = true;
|
services.clightning.enable = true;
|
||||||
test.features.clightningPlugins = true;
|
test.features.clightningPlugins = true;
|
||||||
|
services.rtl.enable = true;
|
||||||
services.spark-wallet.enable = true;
|
services.spark-wallet.enable = true;
|
||||||
services.lnd.enable = true;
|
services.lnd.enable = true;
|
||||||
services.lnd.restOnionService.enable = true;
|
services.lnd.restOnionService.enable = true;
|
||||||
@ -194,6 +204,7 @@ let
|
|||||||
services.clightning.enable = true;
|
services.clightning.enable = true;
|
||||||
test.features.clightningPlugins = true;
|
test.features.clightningPlugins = true;
|
||||||
services.liquidd.enable = true;
|
services.liquidd.enable = true;
|
||||||
|
services.rtl.enable = true;
|
||||||
services.spark-wallet.enable = true;
|
services.spark-wallet.enable = true;
|
||||||
services.lnd.enable = true;
|
services.lnd.enable = true;
|
||||||
services.lightning-loop.enable = true;
|
services.lightning-loop.enable = true;
|
||||||
|
@ -206,6 +206,17 @@ def _():
|
|||||||
# Test web server response
|
# Test web server response
|
||||||
assert_matches(f"curl -L {ip('btcpayserver')}:23000", "Welcome to your BTCPay Server")
|
assert_matches(f"curl -L {ip('btcpayserver')}:23000", "Welcome to your BTCPay Server")
|
||||||
|
|
||||||
|
@test("rtl")
|
||||||
|
def _():
|
||||||
|
assert_running("rtl")
|
||||||
|
machine.wait_until_succeeds(
|
||||||
|
log_has_string("rtl", "Server is up and running")
|
||||||
|
)
|
||||||
|
assert_running("cl-rest")
|
||||||
|
machine.wait_until_succeeds(
|
||||||
|
log_has_string("cl-rest", "cl-rest api server is ready and listening on port: 3001")
|
||||||
|
)
|
||||||
|
|
||||||
@test("spark-wallet")
|
@test("spark-wallet")
|
||||||
def _():
|
def _():
|
||||||
assert_running("spark-wallet")
|
assert_running("spark-wallet")
|
||||||
|
Loading…
Reference in New Issue
Block a user