mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
nixos/cgminer: fix restarts, set uid
This commit is contained in:
parent
826e7f8a94
commit
ba1bbc2fa8
@ -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.
|
||||
|
||||
|
@ -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";
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user