Add 'minimal' and 'all' profiles
This commit is contained in:
@@ -188,6 +188,7 @@ in {
|
||||
fi
|
||||
cp '${configFile}' '${cfg.dataDir}/bitcoin.conf'
|
||||
chmod o-rw '${cfg.dataDir}/bitcoin.conf'
|
||||
chown '${cfg.user}:${cfg.group}' '${cfg.dataDir}/bitcoin.conf'
|
||||
echo "rpcpassword=$(cat /secrets/bitcoin-rpcpassword)" >> '${cfg.dataDir}/bitcoin.conf'
|
||||
'';
|
||||
serviceConfig = {
|
||||
|
||||
@@ -4,6 +4,18 @@ with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.nixbitcoin;
|
||||
minimalPackages = with pkgs; [
|
||||
bitcoin
|
||||
clightning
|
||||
nodeinfo
|
||||
jq
|
||||
];
|
||||
allPackages = with pkgs; [
|
||||
lightning-charge.package
|
||||
nanopos.package
|
||||
nodejs-8_x
|
||||
nginx
|
||||
];
|
||||
in {
|
||||
imports =
|
||||
[
|
||||
@@ -24,22 +36,16 @@ in {
|
||||
If enabled, the nix-bitcoin service will be installed.
|
||||
'';
|
||||
};
|
||||
modules = mkOption {
|
||||
type = types.enum [ "minimal" "all" ];
|
||||
default = "minimal";
|
||||
description = ''
|
||||
If enabled, the nix-bitcoin service will be installed.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim tmux clightning bitcoin
|
||||
nodeinfo
|
||||
jq
|
||||
lightning-charge.package
|
||||
nanopos.package
|
||||
nodejs-8_x
|
||||
nginx
|
||||
];
|
||||
|
||||
# Add bitcoinrpc group
|
||||
users.groups.bitcoinrpc = {};
|
||||
|
||||
# Tor
|
||||
services.tor.enable = true;
|
||||
services.tor.client.enable = true;
|
||||
@@ -63,6 +69,9 @@ in {
|
||||
version = 3;
|
||||
};
|
||||
|
||||
# Add bitcoinrpc group
|
||||
users.groups.bitcoinrpc = {};
|
||||
|
||||
# clightning
|
||||
services.clightning = {
|
||||
enable = true;
|
||||
@@ -75,11 +84,6 @@ in {
|
||||
version = 3;
|
||||
};
|
||||
|
||||
|
||||
services.lightning-charge.enable = true;
|
||||
services.nanopos.enable = true;
|
||||
services.nixbitcoin-webindex.enable = true;
|
||||
|
||||
# Create user operator which can use bitcoin-cli and lightning-cli
|
||||
users.users.operator = {
|
||||
isNormalUser = true;
|
||||
@@ -107,6 +111,14 @@ in {
|
||||
type = "oneshot";
|
||||
};
|
||||
};
|
||||
# This is required to have the deployment keys copied and chowned even if
|
||||
# nanopos is not enabled
|
||||
users.users.nanopos = {};
|
||||
users.groups.nanopos = {};
|
||||
|
||||
services.lightning-charge.enable = cfg.modules == "all";
|
||||
services.nanopos.enable = cfg.modules == "all";
|
||||
services.nixbitcoin-webindex.enable = cfg.modules == "all";
|
||||
environment.systemPackages = if (cfg.modules == "all") then (minimalPackages ++ allPackages) else minimalPackages;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user