Skip to content

How to Run Nvidia Container in NixOS WSL #487

Closed Answered by Fr4nk1inCs
Fr4nk1inCs asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks @shikanime, CDI is the solution:

$ sudo docker run --rm --device nvidia.com/gpu=all --security-opt=label=disable ubuntu nvidia-smi -L
GPU 0: NVIDIA GeForce RTX 4070 SUPER (UUID: ...)
$ # rootless
$ docker run --rm --device nvidia.com/gpu=all --security-opt=label=disable ubuntu nvidia-smi -L
GPU 0: NVIDIA GeForce RTX 4070 SUPER (UUID: ...)

Configuration:

virtualisation.docker = {
  enable = true;
  rootless = {
    enable = true;
    setSocketVariable = true;
    daemon.settings = {
      features.cdi = true;
      cdi-spec-dirs = ["/home/${username}/.cdi"];
    };
  };
  daemon.settings = {
    features.cdi = true;
  };
};
hardware = {
  nvidia = {
    modesetting.enable = true;
    

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Fr4nk1inCs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants