running bitcoin

This commit is contained in:
Jonas Nick
2018-11-13 23:44:54 +00:00
commit 18dc2304c0
4 changed files with 121 additions and 0 deletions

36
modules/default.nix Normal file
View File

@@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.bitcoin;
datadir = "/var/lib/bitcoin";
in {
options.services.bitcoin = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
If enabled, the bitcoin service will be installed.
'';
};
};
config = mkIf cfg.enable {
users.users.bitcoin =
{
description = "Tor Daemon User";
createHome = true;
home = datadir;
};
systemd.services.bitcoind =
{ description = "Run bitcoind";
path = [ pkgs.bitcoin ];
wantedBy = [ "multi-user.target" ];
serviceConfig =
{ ExecStart = "${pkgs.bitcoin}/bin/bitcoind -datadir=${datadir}";
User = "bitcoin";
};
};
};
}