diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
index 753614ea58a1..9581b2afa68e 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
@@ -441,6 +441,14 @@
code-server-module now available
+
+
+ xmrig,
+ a high performance, open source, cross platform RandomX,
+ KawPow, CryptoNight and AstroBWT unified CPU/GPU miner and
+ RandomX benchmark.
+
+
diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md
index 2c27356bfef4..0c603144b644 100644
--- a/nixos/doc/manual/release-notes/rl-2111.section.md
+++ b/nixos/doc/manual/release-notes/rl-2111.section.md
@@ -131,6 +131,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- `code-server`-module now available
+- [xmrig](https://github.com/xmrig/xmrig), a high performance, open source, cross platform RandomX, KawPow, CryptoNight and AstroBWT unified CPU/GPU miner and RandomX benchmark.
+
## Backward Incompatibilities {#sec-release-21.11-incompatibilities}
- The NixOS VM test framework, `pkgs.nixosTest`/`make-test-python.nix`, now requires detaching commands such as `succeed("foo &")` and `succeed("foo | xclip -i")` to close stdout.
diff --git a/nixos/modules/services/misc/xmrig.nix b/nixos/modules/services/misc/xmrig.nix
new file mode 100644
index 000000000000..15c7d2a7b14c
--- /dev/null
+++ b/nixos/modules/services/misc/xmrig.nix
@@ -0,0 +1,71 @@
+{ config, pkgs, lib, ... }:
+
+
+let
+ cfg = config.services.xmrig;
+
+ json = pkgs.formats.json { };
+ configFile = json.generate "config.json" cfg.settings;
+in
+
+with lib;
+
+{
+ options = {
+ services.xmrig = {
+ enable = mkEnableOption "XMRig Mining Software";
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.xmrig;
+ example = literalExpression "pkgs.xmrig-mo";
+ description = "XMRig package to use.";
+ };
+
+ settings = mkOption {
+ default = { };
+ type = json.type;
+ example = literalExpression ''
+ {
+ autosave = true;
+ cpu = true;
+ opencl = false;
+ cuda = false;
+ pools = [
+ {
+ url = "pool.supportxmr.com:443";
+ user = "your-wallet";
+ keepalive = true;
+ tls = true;
+ }
+ ]
+ }
+ '';
+ description = ''
+ XMRig configuration. Refer to
+
+ for details on supported values.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services.xmrig = {
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ description = "XMRig Mining Software Service";
+ serviceConfig = {
+ ExecStartPre = "${cfg.package}/bin/xmrig --config=${configFile} --dry-run";
+ ExecStart = "${cfg.package}/bin/xmrig --config=${configFile}";
+ DynamicUser = true;
+ };
+ };
+ };
+
+ meta = with lib; {
+ description = "XMRig Mining Software Service";
+ license = licenses.gpl3Only;
+ maintainers = with maintainers; [ ratsclub ];
+ };
+}