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";
|
||||
isSystemUser = true;
|
||||
group = "bitcoin";
|
||||
home = /var/lib/bitcoind;
|
||||
createHome = true;
|
||||
};
|
||||
};
|
||||
groups = {
|
||||
|
|
@ -41,9 +43,6 @@ in
|
|||
configFile = /var/lib/bitcoind/bitcoin.conf;
|
||||
|
||||
rpc = {
|
||||
"btcd" = {
|
||||
#passwordHMAC = #CHECK IF THIS IS SAFE TO EXPOSE!!;
|
||||
};
|
||||
port = 8332;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
#TODO: c-lightning config file
|
||||
|
||||
with lib;
|
||||
let cfg = config.modules.system.bitcoin.core-lightning;
|
||||
|
|
@ -6,21 +7,23 @@ with lib;
|
|||
in
|
||||
{ options.modules.system.bitcoin.core-lightning = { enable = mkEnableOption "system.bitcoin.core-lightning"; };
|
||||
config = mkIf cfg.enable {
|
||||
imports = [ ./modules ];
|
||||
imports = [ ./modules ];
|
||||
programs.bash.shellAliases = {
|
||||
cln = "lightningd";
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
environment.systemPackages = with pkgs; [
|
||||
clightning
|
||||
];
|
||||
|
||||
users = {
|
||||
users = {
|
||||
"clightning" = {
|
||||
description = "clightning system user";
|
||||
"c-lightning" = {
|
||||
description = "core-lightning system user";
|
||||
isSystemUser = true;
|
||||
group = "bitcoin";
|
||||
home = /var/lib/c-lightning;
|
||||
createHome = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -33,12 +36,23 @@ in
|
|||
Wants = [ "network-online.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStartPre = "/usr/bin/sleep 10";
|
||||
ExecStart = "${pkgs.clightning}/bin/lightningd --conf=/var/lib/clightning/.lightning/config";
|
||||
ExecStartPre =
|
||||
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";
|
||||
|
||||
User = "clightning";
|
||||
User = "c-lightning";
|
||||
Group = "bitcoin";
|
||||
|
||||
Type = "forking";
|
||||
|
|
@ -49,6 +63,7 @@ in
|
|||
ProtectSystem = "full";
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevies = true;
|
||||
MemoryDenyWriteAccess = false;
|
||||
};
|
||||
Install = {
|
||||
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, ... }:
|
||||
#TODO: electrs configuration file
|
||||
|
||||
with lib;
|
||||
let cfg = config.modules.bitcoin.electrs;
|
||||
|
|
@ -15,6 +16,8 @@ in
|
|||
description = "electrs system user";
|
||||
isSystemUser = true;
|
||||
group = "bitcoin";
|
||||
home = /var/lib/electrs;
|
||||
createHome = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -34,9 +37,9 @@ in
|
|||
Type = "simple";
|
||||
|
||||
KillMode = "process";
|
||||
TimeoutSec = "60";
|
||||
TimeoutSec = 60;
|
||||
Restart = "always";
|
||||
RestartSec = "60";
|
||||
RestartSec = 60;
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "multi-user.target" ];
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.gui.bitcoin.sparrow-server;
|
||||
cfg = config.modules.system.bitcoin.sparrow-server;
|
||||
sparrow-server = import ./derivation.nix { inherit pkgs; };
|
||||
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 {
|
||||
home.packages = with pkgs; [
|
||||
environment.systemPackages = with pkgs; [
|
||||
sparrow-server
|
||||
];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue