This commit is contained in:
2026-01-26 02:01:06 -05:00
parent 016520c579
commit 0b01fc3f28
3 changed files with 54 additions and 0 deletions

View File

@@ -39,6 +39,7 @@
./services/bitwarden.nix
./services/monero.nix
./services/xmrig.nix
# KEEP UNTIL 2028
./services/caddy_senior_project.nix

BIN
secrets/xmrig-wallet Normal file

Binary file not shown.

53
services/xmrig.nix Normal file
View File

@@ -0,0 +1,53 @@
{
config,
lib,
pkgs,
hostname,
...
}:
let
walletAddress = lib.strings.trim (builtins.readFile ../secrets/xmrig-wallet);
threadCount = 2;
in
{
services.xmrig = {
enable = true;
package = pkgs.xmrig;
settings = {
autosave = true;
cpu = {
enabled = true;
huge-pages = true;
hw-aes = true;
rx = lib.range 0 (threadCount - 1);
};
opencl = false;
cuda = false;
pools = [
{
url = "gulf.moneroocean.stream:20128";
user = walletAddress;
pass = hostname + "~rx/0";
keepalive = true;
tls = true;
}
];
};
};
systemd.services.xmrig.serviceConfig = {
Nice = 19;
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
};
# Stop mining on UPS battery to conserve power
services.apcupsd.hooks = lib.mkIf config.services.apcupsd.enable {
onbattery = "systemctl stop xmrig";
offbattery = "systemctl start xmrig";
};
}