A Nix flake providing an overlay for the XMRig CUDA plugin, enabling GPU-accelerated cryptocurrency mining on NVIDIA graphics cards.
- ✅ Multi-GPU Support: Compiled for NVIDIA architectures from Maxwell to Ada Lovelace (GTX 900 series through RTX 4000 series)
- ✅ GCC 12 Compatibility: Uses GCC 12 for proper CUDA compilation
- ✅ Reproducible Builds: Fully declarative with Nix flakes
- ✅ Easy Integration: Simple overlay import for NixOS configurations
| Architecture | Compute | GPUs |
|---|---|---|
| Maxwell | 5.0 | GTX 900 series |
| Pascal | 6.1 | GTX 1060/1070/1080 |
| Volta | 7.0 | Titan V |
| Turing | 7.5 | RTX 2000 series |
| Ampere | 8.0 | RTX 3000 series (desktop) |
| Ampere | 8.6 | RTX 3000 series (mobile) |
| Ada Lovelace | 8.9 | RTX 4000 series |
Add to your flake.nix:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
xmrig-cuda.url = "github:pliski/xmrig-cuda-overlay"; # Change to your GitHub username
};
outputs = { self, nixpkgs, xmrig-cuda, ... }: {
nixosConfigurations.your-hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ xmrig-cuda.overlays.default ];
config.allowUnfree = true;
};
modules = [
# Your configuration modules
{
environment.systemPackages = with pkgs; [
xmrig-cuda
];
}
];
};
};
}Install the package directly without modifying your system configuration:
# Install temporarily (current shell only)
nix shell github:pliski/xmrig-cuda-overlay
# Install to user profile
nix profile install github:pliski/xmrig-cuda-overlay
# Build locally
nix build github:pliski/xmrig-cuda-overlayFor reproducibility, pin to a specific commit or tag:
{
inputs = {
xmrig-cuda.url = "github:pliski/xmrig-cuda-overlay/v1.0.0";
# Or by commit:
# xmrig-cuda.url = "github:pliski/xmrig-cuda-overlay/abc123def456...";
};
}Once installed, the plugin library will be available at:
/nix/store/...-xmrig-cuda-6.22.2/lib/libxmrig-cuda.so
Configure XMRig to use the plugin (in your XMRig config.json or systemd service):
{
"cuda": {
"enabled": true,
"loader": "/nix/store/...-xmrig-cuda-6.22.2/lib/libxmrig-cuda.so"
}
}Or use the --cuda-loader command line option:
xmrig --cuda-loader=$(nix build github:pliski/xmrig-cuda-overlay --no-link --print-out-paths)/lib/libxmrig-cuda.soClone the repository and enter the development shell:
git clone https://github.com/pliski/xmrig-cuda-overlay.git
cd xmrig-cuda-overlay
nix develop
# Test the build
nix build
# Format code
nixfmt overlay.nix flake.nix- NixOS or Nix package manager with flakes enabled
- NVIDIA GPU (Maxwell architecture or newer)
- NVIDIA proprietary drivers installed
- Unfree packages allowed in your Nix configuration
If you haven't enabled flakes yet, add to your ~/.config/nix/nix.conf or /etc/nix/nix.conf:
experimental-features = nix-command flakes
Ensure NVIDIA drivers are installed and config.allowUnfree = true is set in your nixpkgs import.
If your GPU isn't listed in the supported architectures, you may need to modify the CUDA_ARCH cmake flags in overlay.nix.
Make sure you're on a compatible NixOS/nixpkgs version. This overlay is tested with nixos-unstable.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test with
nix build - Submit a pull request
This overlay is licensed under GPL-3.0-or-later, matching the upstream XMRig CUDA plugin license.
The XMRig CUDA plugin itself is Copyright (c) 2018-2024 XMRig developers.
- XMRig - The main XMRig mining software
- XMRig CUDA - Upstream CUDA plugin
- nixpkgs - Nix packages collection
- XMRig team for the excellent mining software
- NixOS community for the powerful package management system