mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-23 16:29:42 -04:00
clnrest pkg
This commit is contained in:
parent
e74ae46d56
commit
bd9e418e52
1 changed files with 48 additions and 12 deletions
|
|
@ -8,11 +8,48 @@ let
|
||||||
home = "/var/lib/clightning";
|
home = "/var/lib/clightning";
|
||||||
domain = "ramos.codes";
|
domain = "ramos.codes";
|
||||||
|
|
||||||
|
clnrest = pkgs.rustPlatform.buildRustPackage rec {
|
||||||
|
pname = "clnrest";
|
||||||
|
version = "25.02.2";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "ElementsProject";
|
||||||
|
repo = "lightning";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-SiPYB463l9279+zawsxmql1Ui/dTdah5KgJgmrWsR2A=";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoLock.lockFile = "${src}/Cargo.lock";
|
||||||
|
|
||||||
|
cargoBuildFlags = [ "-p" "clnrest" ];
|
||||||
|
cargoTestFlags = [ "-p" "clnrest" ];
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [ pkg-config protobuf ];
|
||||||
|
buildInputs = [ pkgs.openssl ];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p $out/libexec/c-lightning/plugins
|
||||||
|
mv $out/bin/clnrest $out/libexec/c-lightning/plugins/
|
||||||
|
rmdir $out/bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "REST API plugin for Core Lightning";
|
||||||
|
homepage = "https://github.com/ElementsProject/lightning/tree/master/plugins/rest-plugin";
|
||||||
|
license = licenses.mit;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
clnConfig = pkgs.writeTextFile {
|
clnConfig = pkgs.writeTextFile {
|
||||||
name = "lightning.conf";
|
name = "lightning.conf";
|
||||||
text = ''
|
text = ''
|
||||||
${builtins.readFile ./config/lightning.conf}
|
${builtins.readFile ./config/lightning.conf}
|
||||||
bitcoin-cli=${pkgs.bitcoind}/bin/bitcoin-cli
|
bitcoin-cli=${pkgs.bitcoind}/bin/bitcoin-cli
|
||||||
|
|
||||||
|
# CLNRest configuration
|
||||||
|
clnrest-port=3010
|
||||||
|
clnrest-host=127.0.0.1
|
||||||
|
clnrest-protocol=https
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -78,23 +115,22 @@ in
|
||||||
"d ${home} 0750 clightning bitcoin -"
|
"d ${home} 0750 clightning bitcoin -"
|
||||||
"d ${home}/plugins 0750 clightning bitcoin -"
|
"d ${home}/plugins 0750 clightning bitcoin -"
|
||||||
"L+ /home/${config.user.name}/.lightning - - - - ${home}"
|
"L+ /home/${config.user.name}/.lightning - - - - ${home}"
|
||||||
|
"L+ ${home}/plugins/clnrest - - - - ${clnrest}/libexec/c-lightning/plugins/clnrest"
|
||||||
];
|
];
|
||||||
|
|
||||||
modules.system.backup.paths = [
|
modules.system.backup.paths = [
|
||||||
"${home}/bitcoin/hsm_secret"
|
"${home}/bitcoin/hsm_secret"
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO: CLNRest not included in nixpkgs clightning build
|
services.nginx.virtualHosts."ln.${domain}" = mkIf nginx.enable {
|
||||||
# Need to package it separately or use an overlay
|
useACMEHost = domain;
|
||||||
# services.nginx.virtualHosts."ln.${domain}" = mkIf nginx.enable {
|
forceSSL = true;
|
||||||
# useACMEHost = domain;
|
locations."/" = {
|
||||||
# forceSSL = true;
|
proxyPass = "https://127.0.0.1:3010";
|
||||||
# locations."/" = {
|
extraConfig = ''
|
||||||
# proxyPass = "https://127.0.0.1:3010";
|
proxy_ssl_verify off;
|
||||||
# extraConfig = ''
|
'';
|
||||||
# proxy_ssl_verify off;
|
};
|
||||||
# '';
|
};
|
||||||
# };
|
|
||||||
# };
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue