add 'nix-bitcoin-services' option
1. Makes the content easily accessible for module users 2. Avoids needlessly recalculating the attrset in every client module
This commit is contained in:
parent
7aaf30501c
commit
f0a36fe0c7
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.bitcoind;
|
cfg = config.services.bitcoind;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
pidFile = "${cfg.dataDir}/bitcoind.pid";
|
pidFile = "${cfg.dataDir}/bitcoind.pid";
|
||||||
configFile = pkgs.writeText "bitcoin.conf" ''
|
configFile = pkgs.writeText "bitcoin.conf" ''
|
||||||
${optionalString cfg.testnet "testnet=1"}
|
${optionalString cfg.testnet "testnet=1"}
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.clightning;
|
cfg = config.services.clightning;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
configFile = pkgs.writeText "config" ''
|
configFile = pkgs.writeText "config" ''
|
||||||
autolisten=${if cfg.autolisten then "true" else "false"}
|
autolisten=${if cfg.autolisten then "true" else "false"}
|
||||||
network=bitcoin
|
network=bitcoin
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.electrs;
|
cfg = config.services.electrs;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
index-batch-size = "${if cfg.high-memory then "" else "--index-batch-size=10"}";
|
index-batch-size = "${if cfg.high-memory then "" else "--index-batch-size=10"}";
|
||||||
jsonrpc-import = "${if cfg.high-memory then "" else "--jsonrpc-import"}";
|
jsonrpc-import = "${if cfg.high-memory then "" else "--jsonrpc-import"}";
|
||||||
in {
|
in {
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.lightning-charge;
|
cfg = config.services.lightning-charge;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
in {
|
in {
|
||||||
options.services.lightning-charge = {
|
options.services.lightning-charge = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.liquidd;
|
cfg = config.services.liquidd;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
pidFile = "${cfg.dataDir}/liquidd.pid";
|
pidFile = "${cfg.dataDir}/liquidd.pid";
|
||||||
configFile = pkgs.writeText "elements.conf" ''
|
configFile = pkgs.writeText "elements.conf" ''
|
||||||
chain=liquidv1
|
chain=liquidv1
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.lnd;
|
cfg = config.services.lnd;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
configFile = pkgs.writeText "lnd.conf" ''
|
configFile = pkgs.writeText "lnd.conf" ''
|
||||||
datadir=${cfg.dataDir}
|
datadir=${cfg.dataDir}
|
||||||
logdir=${cfg.dataDir}/logs
|
logdir=${cfg.dataDir}/logs
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
nixpkgs-pinned = import ../pkgs/nixpkgs-pinned.nix;
|
nixpkgs-pinned = import ../pkgs/nixpkgs-pinned.nix;
|
||||||
unstable = import nixpkgs-pinned.nixpkgs-unstable {};
|
unstable = import nixpkgs-pinned.nixpkgs-unstable {};
|
||||||
@ -27,7 +27,16 @@ in {
|
|||||||
|
|
||||||
disabledModules = [ "services/networking/bitcoind.nix" ];
|
disabledModules = [ "services/networking/bitcoind.nix" ];
|
||||||
|
|
||||||
|
options = {
|
||||||
|
nix-bitcoin-services = lib.mkOption {
|
||||||
|
readOnly = true;
|
||||||
|
default = import ./nix-bitcoin-services.nix lib;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
nixpkgs.overlays = [ (self: super: {
|
nixpkgs.overlays = [ (self: super: {
|
||||||
nix-bitcoin = allPackages super;
|
nix-bitcoin = allPackages super;
|
||||||
}) ];
|
}) ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.nanopos;
|
cfg = config.services.nanopos;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
defaultItemsFile = pkgs.writeText "items.yaml" ''
|
defaultItemsFile = pkgs.writeText "items.yaml" ''
|
||||||
tea:
|
tea:
|
||||||
price: 0.02 # denominated in the currency specified by --currency
|
price: 0.02 # denominated in the currency specified by --currency
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# See `man systemd.exec` and `man systemd.resource-control` for an explanation
|
# See `man systemd.exec` and `man systemd.resource-control` for an explanation
|
||||||
# of the various systemd options available through this module.
|
# of the various systemd options available through this module.
|
||||||
|
|
||||||
{ config, lib, pkgs, ... }:
|
lib:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.nix-bitcoin-webindex;
|
cfg = config.services.nix-bitcoin-webindex;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
indexFile = pkgs.writeText "index.html" ''
|
indexFile = pkgs.writeText "index.html" ''
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.onion-chef;
|
cfg = config.services.onion-chef;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
dataDir = "/var/lib/onion-chef/";
|
dataDir = "/var/lib/onion-chef/";
|
||||||
onion-chef-script = pkgs.writeScript "onion-chef.sh" ''
|
onion-chef-script = pkgs.writeScript "onion-chef.sh" ''
|
||||||
# wait until tor is up
|
# wait until tor is up
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.recurring-donations;
|
cfg = config.services.recurring-donations;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
recurring-donations-script = pkgs.writeScript "recurring-donations.sh" ''
|
recurring-donations-script = pkgs.writeScript "recurring-donations.sh" ''
|
||||||
LNCLI="lightning-cli --lightning-dir=${config.services.clightning.dataDir}"
|
LNCLI="lightning-cli --lightning-dir=${config.services.clightning.dataDir}"
|
||||||
pay_tallycoin() {
|
pay_tallycoin() {
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { };
|
|
||||||
cfg = config.services.spark-wallet;
|
cfg = config.services.spark-wallet;
|
||||||
|
inherit (config) nix-bitcoin-services;
|
||||||
dataDir = "/var/lib/spark-wallet/";
|
dataDir = "/var/lib/spark-wallet/";
|
||||||
onion-chef-service = (if cfg.onion-service then [ "onion-chef.service" ] else []);
|
onion-chef-service = (if cfg.onion-service then [ "onion-chef.service" ] else []);
|
||||||
run-spark-wallet = pkgs.writeScript "run-spark-wallet" ''
|
run-spark-wallet = pkgs.writeScript "run-spark-wallet" ''
|
||||||
|
Loading…
Reference in New Issue
Block a user