1 { config, lib, pkgs, ... }:
3 cfg = config.services.cpuminer-cryptonight;
5 json = builtins.toJSON (
9 if cfg.threads == 0 then null else toString cfg.threads;
13 confFile = builtins.toFile "cpuminer.json" json;
19 services.cpuminer-cryptonight = {
20 enable = lib.mkOption {
21 type = lib.types.bool;
24 Whether to enable the cpuminer cryptonight miner.
29 description = "URL of mining server";
33 description = "Username for mining server";
38 description = "Password for mining server";
40 threads = lib.mkOption {
43 description = "Number of miner threads, defaults to available processors";
49 config = lib.mkIf config.services.cpuminer-cryptonight.enable {
51 systemd.services.cpuminer-cryptonight = {
52 description = "Cryptonight cpuminer";
53 wantedBy = [ "multi-user.target" ];
54 after = [ "network.target" ];
56 ExecStart = "${pkgs.cpuminer-multi}/bin/minerd --syslog --config=${confFile}";