2018-12-06 03:33:13 -08:00
|
|
|
let
|
2019-04-12 06:14:00 -07:00
|
|
|
secrets = import ../secrets/secrets.nix;
|
2018-12-06 03:33:13 -08:00
|
|
|
bitcoin-rpcpassword = {
|
|
|
|
text = secrets.bitcoinrpcpassword;
|
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "bitcoin";
|
|
|
|
group = "bitcoinrpc";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
2019-08-05 01:44:38 -07:00
|
|
|
lnd-wallet-password = {
|
|
|
|
text = secrets.lnd-wallet-password;
|
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "lnd";
|
|
|
|
group = "lnd";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
2018-12-06 03:33:13 -08:00
|
|
|
lightning-charge-api-token = {
|
|
|
|
text = "API_TOKEN=" + secrets.lightning-charge-api-token;
|
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "clightning";
|
|
|
|
group = "clightning";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
|
|
|
# variable is called CHARGE_TOKEN instead of API_TOKEN
|
|
|
|
lightning-charge-api-token-for-nanopos = {
|
|
|
|
text = "CHARGE_TOKEN=" + secrets.lightning-charge-api-token;
|
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "nanopos";
|
|
|
|
group = "nanopos";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
|
|
|
liquid-rpcpassword = {
|
|
|
|
text = secrets.liquidrpcpassword;
|
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "liquid";
|
|
|
|
group = "liquid";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
2018-12-10 08:34:41 -08:00
|
|
|
spark-wallet-login = {
|
|
|
|
text = "login=" + "spark-wallet:" + secrets.spark-wallet-password;
|
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "clightning";
|
|
|
|
group = "clightning";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
2019-08-13 13:57:59 -07:00
|
|
|
nginx_key = {
|
2019-11-27 05:04:24 -08:00
|
|
|
keyFile = toString ../../secrets/nginx.key;
|
2019-04-26 02:09:55 -07:00
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "nginx";
|
|
|
|
group = "root";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
2019-08-13 13:57:59 -07:00
|
|
|
nginx_cert = {
|
2019-11-27 05:04:24 -08:00
|
|
|
keyFile = toString ../../secrets/nginx.cert;
|
2019-04-26 02:09:55 -07:00
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "nginx";
|
|
|
|
group = "root";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
2019-08-05 01:44:38 -07:00
|
|
|
lnd_key = {
|
2019-11-27 05:04:24 -08:00
|
|
|
keyFile = toString ../../secrets/lnd.key;
|
2019-08-05 01:44:38 -07:00
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "lnd";
|
|
|
|
group = "lnd";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
|
|
|
lnd_cert = {
|
2019-11-27 05:04:24 -08:00
|
|
|
keyFile = toString ../../secrets/lnd.cert;
|
2019-08-05 01:44:38 -07:00
|
|
|
destDir = "/secrets/";
|
|
|
|
user = "lnd";
|
|
|
|
group = "lnd";
|
|
|
|
permissions = "0440";
|
|
|
|
};
|
2018-12-06 03:33:13 -08:00
|
|
|
in {
|
2018-11-13 15:44:54 -08:00
|
|
|
network.description = "Bitcoin Core node";
|
|
|
|
|
2018-12-06 03:33:13 -08:00
|
|
|
bitcoin-node =
|
2019-11-27 05:04:19 -08:00
|
|
|
{ config, pkgs, lib, ... }: {
|
2019-11-27 05:04:18 -08:00
|
|
|
imports = [ ../configuration.nix ];
|
|
|
|
|
2018-12-06 03:33:13 -08:00
|
|
|
deployment.keys = {
|
2019-04-05 06:49:38 -07:00
|
|
|
inherit bitcoin-rpcpassword;
|
2018-12-06 03:33:13 -08:00
|
|
|
}
|
2019-08-05 01:44:38 -07:00
|
|
|
// (if (config.services.lnd.enable) then { inherit lnd-wallet-password lnd_key lnd_cert; } else { })
|
2019-04-05 06:49:38 -07:00
|
|
|
// (if (config.services.lightning-charge.enable) then { inherit lightning-charge-api-token; } else { })
|
2018-12-06 03:33:13 -08:00
|
|
|
// (if (config.services.nanopos.enable) then { inherit lightning-charge-api-token-for-nanopos; } else { })
|
2018-12-10 08:34:41 -08:00
|
|
|
// (if (config.services.liquidd.enable) then { inherit liquid-rpcpassword; } else { })
|
2019-04-26 02:09:55 -07:00
|
|
|
// (if (config.services.spark-wallet.enable) then { inherit spark-wallet-login; } else { })
|
2019-08-13 13:57:59 -07:00
|
|
|
// (if (config.services.electrs.enable) then { inherit nginx_key nginx_cert; } else { });
|
2019-11-27 05:04:19 -08:00
|
|
|
|
|
|
|
# nixops makes the secrets directory accessible only for users with group 'key'.
|
|
|
|
# For compatibility with other deployment methods besides nixops, we forego the
|
|
|
|
# use of the 'key' group and make the secrets dir world-readable instead.
|
|
|
|
# This is safe because all containing files have their specific private
|
|
|
|
# permissions set.
|
|
|
|
systemd.services.allowSecretsDirAccess = {
|
|
|
|
requires = [ "keys.target" ];
|
|
|
|
after = [ "keys.target" ];
|
|
|
|
script = "chmod o+x /secrets";
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.targets.nix-bitcoin-secrets = {
|
|
|
|
requires = [ "allowSecretsDirAccess.service" ];
|
|
|
|
after = [ "allowSecretsDirAccess.service" ];
|
|
|
|
};
|
2019-11-27 05:04:18 -08:00
|
|
|
};
|
2018-11-13 15:44:54 -08:00
|
|
|
}
|