mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 00:29:43 -04:00
bigly
This commit is contained in:
parent
0fd73dc8d2
commit
4d6a6b9bc3
6 changed files with 78 additions and 15 deletions
|
|
@ -23,6 +23,8 @@ in
|
||||||
description = "bitcoind system user";
|
description = "bitcoind system user";
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = "bitcoin";
|
group = "bitcoin";
|
||||||
|
home = /var/lib/bitcoind;
|
||||||
|
createHome = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
groups = {
|
groups = {
|
||||||
|
|
@ -41,9 +43,6 @@ in
|
||||||
configFile = /var/lib/bitcoind/bitcoin.conf;
|
configFile = /var/lib/bitcoind/bitcoin.conf;
|
||||||
|
|
||||||
rpc = {
|
rpc = {
|
||||||
"btcd" = {
|
|
||||||
#passwordHMAC = #CHECK IF THIS IS SAFE TO EXPOSE!!;
|
|
||||||
};
|
|
||||||
port = 8332;
|
port = 8332;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{ lib, pkgs, config, ... }:
|
{ lib, pkgs, config, ... }:
|
||||||
|
#TODO: c-lightning config file
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let cfg = config.modules.system.bitcoin.core-lightning;
|
let cfg = config.modules.system.bitcoin.core-lightning;
|
||||||
|
|
@ -6,21 +7,23 @@ with lib;
|
||||||
in
|
in
|
||||||
{ options.modules.system.bitcoin.core-lightning = { enable = mkEnableOption "system.bitcoin.core-lightning"; };
|
{ options.modules.system.bitcoin.core-lightning = { enable = mkEnableOption "system.bitcoin.core-lightning"; };
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
imports = [ ./modules ];
|
imports = [ ./modules ];
|
||||||
programs.bash.shellAliases = {
|
programs.bash.shellAliases = {
|
||||||
cln = "lightningd";
|
cln = "lightningd";
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
clightning
|
clightning
|
||||||
];
|
];
|
||||||
|
|
||||||
users = {
|
users = {
|
||||||
users = {
|
users = {
|
||||||
"clightning" = {
|
"c-lightning" = {
|
||||||
description = "clightning system user";
|
description = "core-lightning system user";
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = "bitcoin";
|
group = "bitcoin";
|
||||||
|
home = /var/lib/c-lightning;
|
||||||
|
createHome = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -33,12 +36,23 @@ in
|
||||||
Wants = [ "network-online.target" ];
|
Wants = [ "network-online.target" ];
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
ExecStartPre = "/usr/bin/sleep 10";
|
ExecStartPre =
|
||||||
ExecStart = "${pkgs.clightning}/bin/lightningd --conf=/var/lib/clightning/.lightning/config";
|
let
|
||||||
|
lightningConf = ''
|
||||||
|
''; #put lightning conf here
|
||||||
|
in
|
||||||
|
"${pkgs.writeShellScript "prepare-clightning-config" ''
|
||||||
|
mkdir -p /var/lib/c-lightning/.lightning
|
||||||
|
chown -R c-lightning:bitcoin /var/lib/c-lightning
|
||||||
|
echo "${lightningConf}" > /var/lib/c-lightning/.lightning/config
|
||||||
|
chmod 600 /var/lib/c-lightning/.lightning/config
|
||||||
|
''}";
|
||||||
|
|
||||||
|
ExecStart = "${pkgs.clightning}/bin/lightningd --conf=/var/lib/c-lightning/.lightning/config";
|
||||||
|
|
||||||
RuntimeDirectory = "lightningd";
|
RuntimeDirectory = "lightningd";
|
||||||
|
|
||||||
User = "clightning";
|
User = "c-lightning";
|
||||||
Group = "bitcoin";
|
Group = "bitcoin";
|
||||||
|
|
||||||
Type = "forking";
|
Type = "forking";
|
||||||
|
|
@ -49,6 +63,7 @@ in
|
||||||
ProtectSystem = "full";
|
ProtectSystem = "full";
|
||||||
NoNewPrivileges = true;
|
NoNewPrivileges = true;
|
||||||
PrivateDevies = true;
|
PrivateDevies = true;
|
||||||
|
MemoryDenyWriteAccess = false;
|
||||||
};
|
};
|
||||||
Install = {
|
Install = {
|
||||||
WantedBy = [ "multi-user.target" ];
|
WantedBy = [ "multi-user.target" ];
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
{ lib, pkgs, config, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.system.bitcoin.core-lightning.REST;
|
||||||
|
cln = config.modules.system.bitcoin.core-lightning;
|
||||||
|
c-lightning-REST = import ./derivation.nix { inherit pkgs; };
|
||||||
|
|
||||||
|
in
|
||||||
|
{ options.modules.system.bitcoin.core-lightning.REST = {
|
||||||
|
enable = mkEnableOption "system.bitcoin.core-lightning.REST";
|
||||||
|
};
|
||||||
|
config = mkIf (cfg.enable && cln.enable) {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
c-lightning-REST
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs;
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "c-lightning-REST";
|
||||||
|
version = "0.10.7";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://github.com/Ride-The-Lightning/c-lightning-REST/archive/refs/tags/v${version}.tar.gz";
|
||||||
|
sha256 = "1swg53vbacsrsgy79lni07dy2h44b0yf2kad7j4fv17az4gwnxk7";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
nodejs
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r * $out/
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "c-lighting REST API";
|
||||||
|
homepage = "https://github.com/Ride-The-Lightning/c-lightning-REST";
|
||||||
|
license = stdenv.lib.licenses.mit;
|
||||||
|
platforms = stdenv.lib.platforms.linux;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{ lib, pkgs, config, ... }:
|
{ lib, pkgs, config, ... }:
|
||||||
|
#TODO: electrs configuration file
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let cfg = config.modules.bitcoin.electrs;
|
let cfg = config.modules.bitcoin.electrs;
|
||||||
|
|
@ -15,6 +16,8 @@ in
|
||||||
description = "electrs system user";
|
description = "electrs system user";
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = "bitcoin";
|
group = "bitcoin";
|
||||||
|
home = /var/lib/electrs;
|
||||||
|
createHome = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -34,9 +37,9 @@ in
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
|
|
||||||
KillMode = "process";
|
KillMode = "process";
|
||||||
TimeoutSec = "60";
|
TimeoutSec = 60;
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = "60";
|
RestartSec = 60;
|
||||||
};
|
};
|
||||||
Install = {
|
Install = {
|
||||||
WantedBy = [ "multi-user.target" ];
|
WantedBy = [ "multi-user.target" ];
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.modules.gui.bitcoin.sparrow-server;
|
cfg = config.modules.system.bitcoin.sparrow-server;
|
||||||
sparrow-server = import ./derivation.nix { inherit pkgs; };
|
sparrow-server = import ./derivation.nix { inherit pkgs; };
|
||||||
in
|
in
|
||||||
{ options.modules.gui.bitcoin.sparrow-server = { enable = mkEnableOption "gui.bitcoin.sparrow-server"; };
|
{ options.modules.system.bitcoin.sparrow-server = { enable = mkEnableOption "system.bitcoin.sparrow-server"; };
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
sparrow-server
|
sparrow-server
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue