Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rancher desktop support #440

Open
x-0D opened this issue Mar 14, 2024 · 2 comments
Open

Rancher desktop support #440

x-0D opened this issue Mar 14, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@x-0D
Copy link

x-0D commented Mar 14, 2024

Problem

Rancher desktop integration don't work with nixos distro

Solution

Add support for rancher-desktop integration optional feature flag

@x-0D x-0D added the enhancement New feature or request label Mar 14, 2024
@jDmacD
Copy link

jDmacD commented Apr 12, 2024

I tried this after seeing you post. If you have Rancher Desktop installed the docker cli is available at /mnt/c/Program Files/Rancher Desktop/resources/resources/linux/bin/ and the docker socket is at /mnt/wsl/rancher-desktop/run/docker.sock.

You can connect by

  • adding /mnt/c/Program Files/Rancher Desktop/resources/resources/linux/bin/ to your PATH
  • setting the DOCKER_HOST env to unix:///mnt/wsl/rancher-desktop/run/docker.sock
  • chowning the permissions on /mnt/wsl/rancher-desktop/run/docker.sock to your user

Everytime rancher restart the permissions on /mnt/wsl/rancher-desktop/run/docker.sock will reset.

I am using home-manager so I put this in my configuration

  home.sessionVariables = {
    DOCKER_HOST = "unix:///mnt/wsl/rancher-desktop/run/docker.sock";
  };
  home.sessionPath = [
    "/mnt/c/Program Files/Rancher Desktop/resources/resources/linux/bin/"
  ];

 home.packages = [
    (pkgs.writeShellScriptBin "rancher-desktop" ''
      echo "starting rancher.."
      /mnt/c/Program\ Files/Rancher\ Desktop/Rancher\ Desktop.exe&
      echo "setting permissions.."
      sudo chown nixos:users /mnt/wsl/rancher-desktop/run/docker.sock
      echo "done!"
    '') 
]

It's a little clunky, but it seems to work. I haven't tested it thoroughly.

@phma4
Copy link

phma4 commented Jun 11, 2024

Another workaround is to add PATH=$PATH:/run/current-system/sw/bin/

at the beginning of:

C:\Program Files\Rancher Desktop\resources\resources\setup-spin

The write protection needs to be removed before the file can be edited. Afterwards enabling the integration should work the same as with other distros. This should probably be reported to the Rancher Desktop repo and fixed there.

Credit: https://github.com/sonowz/vscode-remote-wsl-nixos/blob/master/server-env-setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants