From a5e10a82d89d3f486be61ac6902ec86fd64cb6d4 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Mon, 19 Aug 2019 20:39:13 +0000 Subject: [PATCH] Simplify clightning preStart --- modules/clightning.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/clightning.nix b/modules/clightning.nix index ba05966..b7aa4b9 100644 --- a/modules/clightning.nix +++ b/modules/clightning.nix @@ -79,12 +79,10 @@ in { after = [ "bitcoind.service" ]; preStart = '' mkdir -m 0770 -p ${cfg.dataDir} - rm -f ${cfg.dataDir}/config - chown 'clightning:clightning' '${cfg.dataDir}' cp ${configFile} ${cfg.dataDir}/config - chown 'clightning:clightning' '${cfg.dataDir}/config' - chmod +w ${cfg.dataDir}/config - chmod o-rw ${cfg.dataDir}/config + chown -R 'clightning:clightning' '${cfg.dataDir}' + # give group read access to allow using lightning-cli + chmod u=rw,g=r,o= ${cfg.dataDir}/config # The RPC socket has to be removed otherwise we might have stale sockets rm -f ${cfg.dataDir}/lightning-rpc echo "bitcoin-rpcpassword=$(cat /secrets/bitcoin-rpcpassword)" >> '${cfg.dataDir}/config'