Skip to content

Instantly share code, notes, and snippets.

@yihuang
Last active July 13, 2023 12:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yihuang/f197207bd290b63e639a9116db9e654a to your computer and use it in GitHub Desktop.
Save yihuang/f197207bd290b63e639a9116db9e654a to your computer and use it in GitHub Desktop.
nix remote builder setup with (co)lima
  • install (co)lima

    I haved setup colima already, but you can setup lima vm directly without the (co).

  • prepare the ssh config

    $ limactl show-ssh colima -f config >> ~/.ssh/config
    

    in my case, the host name is lima-colima.

  • install nix in the vm

    run the standard nix install script in the vm: https://nixos.org/download.html

    $ ssh lima-colima
    $ sh <(curl -L https://nixos.org/nix/install) --no-daemon
    
  • create symblic link to nix-store

    $ sudo ln -s $HOME/.nix-profile/bin/nix-store /usr/bin/
    

    this is to make sure the non-interactive ssh shell can find nix-store in PATH.

  • test that it works

    $ nix store ping --store ssh://lima-colima
    Store URL: ssh://lima-colima
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment