This commit is contained in:
Bryan Ramos 2024-02-28 15:45:10 -05:00
parent 036db0b3b9
commit 203170a88f
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8
66 changed files with 169 additions and 54 deletions

View file

@ -0,0 +1,45 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.modules.bitcoin;
in
{ options.modules.bitcoin = { enable = mkEnableOption "bitcoin"; };
imports = [
./core-lightning
./sparrow-cli
];
config = mkIf cfg.enable {
programs.bash.shellAliases = {
btc = "bitcoin-cli";
};
users = {
users = {
"bitcoind" = {
description = "bitcoind system user";
isSystemUser = true;
group = "bitcoin";
};
};
groups = {
"bitcoin" = {
members = [ "clightning" "electrs" ];
};
};
};
services.bitcoind = {
"bitcoind" = {
enable = true;
testnet = false;
user = "bitcoind";
group = "bitcoin";
#extraConfig = TODO;
};
};
};
}

View file

@ -0,0 +1,40 @@
{ lib, pkgs, config, ... }:
with lib;
let cfg = config.modules.bitcoin.core-lightning;
in
{ options.modules.bitcoin.core-lightning = { enable = mkEnableOption "bitcoin.core-lightning"; };
config = mkIf cfg.enable {
programs.bash.shellAliases = {
cln = "lightningd";
};
home.packages = with pkgs; [
clightning
];
users = {
users = {
"clightning" = {
description = "clightning system user";
isSystemUser = true;
group = "bitcoin";
};
};
};
systemd.services.clightning = {
Unit = {
after = [ "network.target" "bitcoind.service" ];
wantedBy = [ "multi-user.target" ];
};
Service = {
ExecStart = "${pkgs.clightning}/bin/lightningd --conf=...";
Restart = "always";
User = "clightning";
Group = "bitcoin";
};
};
};
}

View file

@ -0,0 +1,7 @@
{
imports = [
./core-lightning
./electrs
./sparrow-cli
];
}

View file

@ -0,0 +1,35 @@
{ lib, pkgs, config, ... }:
with lib;
let cfg = config.modules.bitcoin.electrs;
in
{ options.modules.bitcoin.electrs = { enable = mkEnableOption "bitcoin.electrs"; };
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
electrs
];
users = {
users = {
"electrs" = {
description = "electrs system user";
isSystemUser = true;
group = "bitcoin";
};
};
};
systemd.services.electrs = {
Unit = {
after = [ "network.target" "bitcoind.service" ];
wantedBy = [ "multi-user.target" ];
};
Service = {
ExecStart = "${pkgs.electrs}/bin/electrs --conf=...";
Restart = "always";
User = "electrs";
Group = "bitcoin";
};
};
};
}

View file

@ -0,0 +1,14 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.modules.bitcoin.sparrow-server;
sparrow-server = import ./derivation.nix { inherit pkgs; };
in
{ options.modules.bitcoin.sparrow-server = { enable = mkEnableOption "bitcoin.sparrow-server"; };
config = mkIf cfg.enable {
home.packages = with pkgs; [
sparrow-server
];
};
}

View file

@ -0,0 +1,24 @@
{ pkgs, ... }:
with pkgs;
stdenv.mkDerivation rec {
pname = "sparrow-server";
version = "1.8.2";
src = fetchurl {
url = "https://github.com/sparrowwallet/sparrow/releases/download/${version}/sparrow-server-${version}-x86_64.tar.gz";
sha256 = "16hyrf8j7mv3m1ry7r2k3w70yxbf6smgcm5d35xy2hjqfmahv65m";
};
installPhase = ''
mkdir -p $out/bin
cp -r * $out/bin
'';
meta = {
description = "Sparrow Server";
homepage = "https://sparrowwallet.com/";
license = stdenv.lib.licenses.mit;
platforms = stdenv.lib.platforms.linux;
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./corn
./security
];
}