Merge pull request #4211 from ehmry/cpuminer-cryptonight
Cpuminer cryptonight
This commit is contained in:
commit
cd5f4e7f85
@ -158,6 +158,7 @@
|
|||||||
./services/mail/postfix.nix
|
./services/mail/postfix.nix
|
||||||
./services/mail/spamassassin.nix
|
./services/mail/spamassassin.nix
|
||||||
#./services/misc/autofs.nix
|
#./services/misc/autofs.nix
|
||||||
|
./services/misc/cpuminer-cryptonight.nix
|
||||||
./services/misc/cgminer.nix
|
./services/misc/cgminer.nix
|
||||||
./services/misc/dictd.nix
|
./services/misc/dictd.nix
|
||||||
./services/misc/disnix.nix
|
./services/misc/disnix.nix
|
||||||
|
66
nixos/modules/services/misc/cpuminer-cryptonight.nix
Normal file
66
nixos/modules/services/misc/cpuminer-cryptonight.nix
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.cpuminer-cryptonight;
|
||||||
|
|
||||||
|
json = builtins.toJSON (
|
||||||
|
cfg // {
|
||||||
|
enable = null;
|
||||||
|
threads =
|
||||||
|
if cfg.threads == 0 then null else toString cfg.threads;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
confFile = builtins.toFile "cpuminer.json" json;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.cpuminer-cryptonight = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable the cpuminer cryptonight miner.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
url = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
description = "URL of mining server";
|
||||||
|
};
|
||||||
|
user = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
description = "Username for mining server";
|
||||||
|
};
|
||||||
|
pass = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
default = "x";
|
||||||
|
description = "Password for mining server";
|
||||||
|
};
|
||||||
|
threads = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 0;
|
||||||
|
description = "Number of miner threads, defaults to available processors";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf config.services.cpuminer-cryptonight.enable {
|
||||||
|
|
||||||
|
systemd.services.cpuminer-cryptonight = {
|
||||||
|
description = "Cryptonight cpuminer";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${pkgs.cpuminer-multi}/bin/minerd --syslog --config=${confFile}";
|
||||||
|
User = "nobody";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
{ stdenv, fetchgit, curl, jansson, autoconf, automake, openssl
|
{ stdenv, fetchgit, curl, jansson, autoconf, automake
|
||||||
, aesni ? true }:
|
, aesni ? true }:
|
||||||
|
|
||||||
let
|
let
|
||||||
rev = "4230012da5d1cc491976c6f5e45da36db6d9f576";
|
rev = "977dad27e18627e5b723800f5f4201e385fe0d2e";
|
||||||
date = "20140619";
|
date = "20140723";
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "cpuminer-multi-${date}-${stdenv.lib.strings.substring 0 7 rev}";
|
name = "cpuminer-multi-${date}-${stdenv.lib.strings.substring 0 7 rev}";
|
||||||
@ -11,16 +11,16 @@ stdenv.mkDerivation rec {
|
|||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
inherit rev;
|
inherit rev;
|
||||||
url = https://github.com/wolf9466/cpuminer-multi.git;
|
url = https://github.com/wolf9466/cpuminer-multi.git;
|
||||||
sha256 = "c19a5dd1bfdbbaec3729f61248e858a5d8701424fffe67fdabf8179ced9c110b";
|
sha256 = "9c438c6cd9f40273822f3d3103a370e43e8a40368695ed5e01ae87297dce7843";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ autoconf automake curl jansson openssl ];
|
buildInputs = [ autoconf automake curl jansson ];
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configureFlags = if aesni then [ "--disable-aes-ni" ] else [ ];
|
configureFlags = [ (if aesni then "--enable-aes-ni" else "--disable-aes-ni") ];
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Multi-algo CPUMiner";
|
description = "Multi-algo CPUMiner";
|
||||||
|
Loading…
Reference in New Issue
Block a user