From 4b8ca52647accf351afd7416253576c27424e5a5 Mon Sep 17 00:00:00 2001 From: nixbitcoin Date: Thu, 18 Jun 2020 10:19:04 +0000 Subject: [PATCH] lnd: add netns cli script --- modules/lnd.nix | 1 - modules/netns-isolation.nix | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/lnd.nix b/modules/lnd.nix index 80c592d..8e5ccc3 100644 --- a/modules/lnd.nix +++ b/modules/lnd.nix @@ -107,7 +107,6 @@ in { description = "The package providing lnd binaries."; }; cli = mkOption { - readOnly = true; default = pkgs.writeScriptBin "lncli" # Switch user because lnd makes datadir contents readable by user only '' diff --git a/modules/netns-isolation.nix b/modules/netns-isolation.nix index f99bc84..fb100ef 100644 --- a/modules/netns-isolation.nix +++ b/modules/netns-isolation.nix @@ -207,6 +207,12 @@ in { "127.0.0.1" ]; bitcoind-host = netns.bitcoind.address; + cli = pkgs.writeScriptBin "lncli" + # Switch user because lnd makes datadir contents readable by user only + '' + netns-exec nb-lnd sudo -u lnd ${config.services.lnd.package}/bin/lncli --tlscertpath ${config.nix-bitcoin.secretsDir}/lnd-cert \ + --macaroonpath '${config.services.lnd.dataDir}/chain/bitcoin/mainnet/admin.macaroon' "$@" + ''; }; })