Merge #146: lnd: add package option
106dcacb61
lnd: add package option (Jonas Nick)
Pull request description:
Top commit has no ACKs.
Tree-SHA512: 95f4fa40c34421872ca8940c6ad87775a8c7e75e8b3d5df2ed3a348c1f6212ae7b090b889831bc9ee6ddbcb26e9e237bfbd08542a0a5b7f92b06f2591182710f
This commit is contained in:
commit
2d51c722cc
@ -50,19 +50,25 @@ in {
|
|||||||
description = "Port on which to listen for gRPC connections.";
|
description = "Port on which to listen for gRPC connections.";
|
||||||
};
|
};
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
example = ''
|
example = ''
|
||||||
autopilot.active=1
|
autopilot.active=1
|
||||||
'';
|
'';
|
||||||
description = "Additional configurations to be appended to <filename>lnd.conf</filename>.";
|
description = "Additional configurations to be appended to <filename>lnd.conf</filename>.";
|
||||||
};
|
};
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.nix-bitcoin.lnd;
|
||||||
|
defaultText = "pkgs.nix-bitcoin.lnd";
|
||||||
|
description = "The package providing lnd binaries.";
|
||||||
|
};
|
||||||
cli = mkOption {
|
cli = mkOption {
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = pkgs.writeScriptBin "lncli"
|
default = pkgs.writeScriptBin "lncli"
|
||||||
# Switch user because lnd makes datadir contents readable by user only
|
# Switch user because lnd makes datadir contents readable by user only
|
||||||
''
|
''
|
||||||
exec sudo -u lnd ${pkgs.nix-bitcoin.lnd}/bin/lncli --tlscertpath ${secretsDir}/lnd-cert \
|
exec sudo -u lnd ${cfg.package}/bin/lncli --tlscertpath ${secretsDir}/lnd-cert \
|
||||||
--macaroonpath '${cfg.dataDir}/chain/bitcoin/mainnet/admin.macaroon' "$@"
|
--macaroonpath '${cfg.dataDir}/chain/bitcoin/mainnet/admin.macaroon' "$@"
|
||||||
'';
|
'';
|
||||||
description = "Binary to connect with the lnd instance.";
|
description = "Binary to connect with the lnd instance.";
|
||||||
@ -71,6 +77,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
systemd.services.lnd = {
|
systemd.services.lnd = {
|
||||||
description = "Run LND";
|
description = "Run LND";
|
||||||
path = [ pkgs.nix-bitcoin.bitcoind ];
|
path = [ pkgs.nix-bitcoin.bitcoind ];
|
||||||
@ -86,7 +93,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
PermissionsStartOnly = "true";
|
PermissionsStartOnly = "true";
|
||||||
ExecStart = "${pkgs.nix-bitcoin.lnd}/bin/lnd --configfile=${cfg.dataDir}/lnd.conf";
|
ExecStart = "${cfg.package}/bin/lnd --configfile=${cfg.dataDir}/lnd.conf";
|
||||||
User = "lnd";
|
User = "lnd";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "10s";
|
RestartSec = "10s";
|
||||||
|
Loading…
Reference in New Issue
Block a user