nixos/cgminer: fix restarts, set uid

This commit is contained in:
Jaka Hudoklin 2014-01-13 00:18:05 +01:00
parent 826e7f8a94
commit ba1bbc2fa8
2 changed files with 11 additions and 7 deletions

View File

@ -109,6 +109,7 @@
mongodb = 98;
openldap = 99;
memcached = 100;
cgminer = 101;
# When adding a uid, make sure it doesn't match an existing gid.

View File

@ -108,20 +108,21 @@ in
config = mkIf config.services.cgminer.enable {
users.extraUsers = singleton
{ name = cfg.user;
users.extraUsers = optionalAttrs (cfg.user == "cgminer") (singleton
{ name = "cgminer";
uid = config.ids.uids.cgminer;
description = "Cgminer user";
};
});
environment.systemPackages = [ cfg.package ];
systemd.services.cgminer = {
path = [ pkgs.cgminer ];
after = [ "display-manager.target" "network.target" ];
after = [ "network.target" "display-manager.service" ];
wantedBy = [ "multi-user.target" ];
environment = {
environment = {
LD_LIBRARY_PATH = ''/run/opengl-driver/lib:/run/opengl-driver-32/lib'';
DISPLAY = ":0";
GPU_MAX_ALLOC_PERCENT = "100";
@ -129,9 +130,11 @@ in
};
serviceConfig = {
ExecStart = "${pkgs.cgminer}/bin/cgminer -T -c ${cgminerConfig}";
ExecStart = "${pkgs.cgminer}/bin/cgminer --syslog --text-only --config ${cgminerConfig}";
User = cfg.user;
RestartSec = 10;
RestartSec = "30s";
Restart = "always";
StartLimitInterval = "1m";
};
};