2019-11-27 16:04:26 +03:00
|
|
|
{
|
2018-11-14 02:44:54 +03:00
|
|
|
network.description = "Bitcoin Core node";
|
|
|
|
|
2018-12-06 14:33:13 +03:00
|
|
|
bitcoin-node =
|
2019-11-27 16:04:19 +03:00
|
|
|
{ config, pkgs, lib, ... }: {
|
2020-02-19 19:37:46 +03:00
|
|
|
imports = [ ../configuration.nix <nix-bitcoin/modules/nix-bitcoin.nix> ];
|
2019-11-27 16:04:18 +03:00
|
|
|
|
2020-01-12 22:52:38 +03:00
|
|
|
deployment.keys = builtins.mapAttrs (n: v: {
|
|
|
|
keyFile = "${toString ../secrets}/${n}";
|
2020-01-12 22:52:39 +03:00
|
|
|
destDir = config.nix-bitcoin.secretsDir;
|
2020-01-12 22:52:38 +03:00
|
|
|
inherit (v) user group permissions;
|
|
|
|
}) config.nix-bitcoin.secrets;
|
2019-11-27 16:04:19 +03: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" ];
|
2020-01-12 22:52:39 +03:00
|
|
|
script = "chmod o+x ${config.nix-bitcoin.secretsDir}";
|
2019-11-27 16:04:19 +03:00
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.targets.nix-bitcoin-secrets = {
|
|
|
|
requires = [ "allowSecretsDirAccess.service" ];
|
|
|
|
after = [ "allowSecretsDirAccess.service" ];
|
|
|
|
};
|
2019-11-27 16:04:18 +03:00
|
|
|
};
|
2018-11-14 02:44:54 +03:00
|
|
|
}
|