Skip to content

A Nix flake providing an overlay for the [XMRig CUDA plugin](https://github.com/xmrig/xmrig-cuda), enabling GPU-accelerated cryptocurrency mining on NVIDIA graphics cards.

License

Notifications You must be signed in to change notification settings

pliski/xmrig-cuda-overlay

Repository files navigation

XMRig CUDA Overlay

A Nix flake providing an overlay for the XMRig CUDA plugin, enabling GPU-accelerated cryptocurrency mining on NVIDIA graphics cards.

Features

  • 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

Supported GPU Architectures

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

Quick Start

Using in NixOS Configuration

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
          ];
        }
      ];
    };
  };
}

Direct Installation

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-overlay

Pin to Specific Version

For 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...";
  };
}

Usage with XMRig

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.so

Development

Clone 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

Requirements

  • 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

Enabling Flakes

If you haven't enabled flakes yet, add to your ~/.config/nix/nix.conf or /etc/nix/nix.conf:

experimental-features = nix-command flakes

Troubleshooting

CUDA not found

Ensure NVIDIA drivers are installed and config.allowUnfree = true is set in your nixpkgs import.

Wrong GPU architecture

If your GPU isn't listed in the supported architectures, you may need to modify the CUDA_ARCH cmake flags in overlay.nix.

Build errors

Make sure you're on a compatible NixOS/nixpkgs version. This overlay is tested with nixos-unstable.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with nix build
  5. Submit a pull request

License

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.

Related Projects

Acknowledgments

  • XMRig team for the excellent mining software
  • NixOS community for the powerful package management system

About

A Nix flake providing an overlay for the [XMRig CUDA plugin](https://github.com/xmrig/xmrig-cuda), enabling GPU-accelerated cryptocurrency mining on NVIDIA graphics cards.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published