diff --git a/configuration.nix b/configuration.nix index 8123b84..66977a7 100644 --- a/configuration.nix +++ b/configuration.nix @@ -18,6 +18,8 @@ ]; services.openssh.enable = true; + services.tor.enable = true; + services.tor.client.enable = true; # users.users.root = { # openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILacgZRwLsiICNHGHY2TG2APeuxFsrw6Cg13ZTMQpNqA nickler@rick" ]; diff --git a/modules/default.nix b/modules/default.nix index b17e551..6fe4e95 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -4,7 +4,14 @@ with lib; let cfg = config.services.bitcoin; - datadir = "/var/lib/bitcoin"; + home = "/var/lib/bitcoin"; + configFile = pkgs.writeText "bitcoin.conf" '' + listen=0 + onlynet=onion + prune=1001 + assumevalid=0000000000000000000726d186d6298b5054b9a5c49639752294b322a305d240 + proxy=127.0.0.1:9050 + ''; in { options.services.bitcoin = { enable = mkOption { @@ -19,16 +26,21 @@ in { config = mkIf cfg.enable { users.users.bitcoin = { - description = "Tor Daemon User"; + description = "Bitcoind User"; createHome = true; - home = datadir; + inherit home; }; systemd.services.bitcoind = { description = "Run bitcoind"; path = [ pkgs.bitcoin ]; wantedBy = [ "multi-user.target" ]; + preStart = '' + mkdir -p ${home}/.bitcoin + ln -sf ${configFile} ${home}/.bitcoin/bitcoin.conf + ''; serviceConfig = - { ExecStart = "${pkgs.bitcoin}/bin/bitcoind -datadir=${datadir}"; + { + ExecStart = "${pkgs.bitcoin}/bin/bitcoind"; User = "bitcoin"; }; };