1 { config, lib, pkgs, ... }:
6 cfg = config.services.cpuminer-cryptonight;
8 json = builtins.toJSON (
12 if cfg.threads == 0 then null else toString cfg.threads;
16 confFile = builtins.toFile "cpuminer.json" json;
22 services.cpuminer-cryptonight = {
26 description = lib.mdDoc ''
27 Whether to enable the cpuminer cryptonight miner.
32 description = lib.mdDoc "URL of mining server";
36 description = lib.mdDoc "Username for mining server";
41 description = lib.mdDoc "Password for mining server";
46 description = lib.mdDoc "Number of miner threads, defaults to available processors";
52 config = mkIf config.services.cpuminer-cryptonight.enable {
54 systemd.services.cpuminer-cryptonight = {
55 description = "Cryptonight cpuminer";
56 wantedBy = [ "multi-user.target" ];
57 after = [ "network.target" ];
59 ExecStart = "${pkgs.cpuminer-multi}/bin/minerd --syslog --config=${confFile}";