From 565deb770a15a067ca305d3f4ced2518054db93e Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 2 Nov 2022 17:40:44 +0100 Subject: [PATCH 1/4] examples/minimal-vm: add `lightning-cli` demo command --- examples/qemu-vm/minimal-vm.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/qemu-vm/minimal-vm.nix b/examples/qemu-vm/minimal-vm.nix index 25a66c7..a639d0f 100644 --- a/examples/qemu-vm/minimal-vm.nix +++ b/examples/qemu-vm/minimal-vm.nix @@ -43,6 +43,7 @@ rec { - nodeinfo - systemctl status bitcoind - systemctl status clightning + - lightning-cli getinfo ''; # Power off VM when the user exits the shell From 1b5e51b7fe42ada7134b0299b935347f6a357115 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 4 Nov 2022 00:33:53 +0100 Subject: [PATCH 2/4] examples/vm-config: fix syntax error --- examples/qemu-vm/vm-config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/qemu-vm/vm-config.nix b/examples/qemu-vm/vm-config.nix index b3cd0d3..0091d8d 100644 --- a/examples/qemu-vm/vm-config.nix +++ b/examples/qemu-vm/vm-config.nix @@ -3,7 +3,7 @@ # Disable the hardened preset to improve VM performance disabledModules = [ ]; - imports = [ (modulesPath + "/virtualisation/qemu-vm.nix" ]; + imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ]; config = { virtualisation.graphics = false; From d332177d3ec774024a2f2ddf53a3a77fbdc20424 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 4 Nov 2022 11:07:36 +0100 Subject: [PATCH 3/4] clightning: extract var `bitcoind` Follow the default module formatting style. --- modules/clightning.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/clightning.nix b/modules/clightning.nix index 612d57e..56558ca 100644 --- a/modules/clightning.nix +++ b/modules/clightning.nix @@ -102,16 +102,18 @@ let nbLib = config.nix-bitcoin.lib; nbPkgs = config.nix-bitcoin.pkgs; - network = config.services.bitcoind.makeNetworkName "bitcoin" "regtest"; + inherit (config.services) bitcoind; + + network = bitcoind.makeNetworkName "bitcoin" "regtest"; configFile = pkgs.writeText "config" '' network=${network} - bitcoin-datadir=${config.services.bitcoind.dataDir} + bitcoin-datadir=${bitcoind.dataDir} ${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"} always-use-proxy=${boolToString cfg.always-use-proxy} bind-addr=${cfg.address}:${toString cfg.port} - bitcoin-rpcconnect=${nbLib.address config.services.bitcoind.rpc.address} - bitcoin-rpcport=${toString config.services.bitcoind.rpc.port} - bitcoin-rpcuser=${config.services.bitcoind.rpc.users.public.name} + bitcoin-rpcconnect=${nbLib.address bitcoind.rpc.address} + bitcoin-rpcport=${toString bitcoind.rpc.port} + bitcoin-rpcuser=${bitcoind.rpc.users.public.name} rpc-file-mode=0660 log-timestamps=false ${optionalString (cfg.wallet != null) "wallet=${cfg.wallet}"} From 0de16095e15b97085ca4a6b5bceaffd536fe5ec9 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 4 Nov 2022 11:51:44 +0100 Subject: [PATCH 4/4] clightning-replication: switch system before waiting for server sshd This is primarily a cosmetic change. - Increases code clarity because all system test blocks now start with `switch_to_system` - Optimizes dependency ordering because `switch_to_system` has no dependency on the server sshd --- test/clightning-replication.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/clightning-replication.nix b/test/clightning-replication.nix index 70d8102..4ee08b5 100644 --- a/test/clightning-replication.nix +++ b/test/clightning-replication.nix @@ -128,8 +128,8 @@ makeTestVM { # A gocryptfs has been created client.succeed("ls /var/backup/clightning/lightningd-db/gocryptfs.conf") - server.wait_for_unit("sshd.service") switch_to_system("replicationRemote") + server.wait_for_unit("sshd.service") with subtest("remote replication"): replica_db = "/var/cache/clightning-replication/sshfs/lightningd.sqlite3" client.succeed(f"runuser -u clightning -- ls {replica_db}")