A declarative Nix flake for machine learning development on remote servers using SSH and Rclone synchronization.
- ⚡ Zero server-side setup - Requires no installation or configuration on the remote server beyond standard SSH key access.
- 🔄 One-way sync and download - Sync your local ML projects to remote servers and selectively download remote files using scp.
- 🚀 Background script execution - Run training scripts in the background and monitor logs
- 📦 Declarative environment - Reproducible local development environment using Nix
- 🖥️ Multi-platform - Supports Linux and macOS (x86_64 and ARM64)
- 🔐 SSH integration - Secure shell access with automatic configuration
- Nix with flakes enabled
- Remote server with SSH access
- SSH key for authentication
-
Initialize the project:
nix flake init -t github:alex-karev/remote-ml-flake
-
Configure your project:
nvim flake.nix
Edit the top part of
flake.nixfor your project (local packages, environment variables and etc.) -
Enter the development environment:
nix develop
-
Setup connection:
server setup
(Optionaly) you may need to copy your ssh id to the remote server if your provider doesn't do this for you:
server sshkey
You may need to enter the password.
server setupsaves environment variables needed for other scripts into gitignored.server.envfile.You can repeat this step if you change your server.
Once inside the development environment, you have access to these commands:
server help — Show help message
server setup — Setup connection to the server
server sshkey — Run ssh-copy-id and send your public key to the server
server command <command> — Run command on server and check the output
server logs <filename> — Show logs of a script
server pkill <filename> — Kill process on server
server pull <filename> — Download a file from server
server push — Sync current project → remote
server run <filename> — Run script in background on remote
server ssh — Open SSH shell
server tail <filename> — Follow logs in real time
- Develop locally - Write your ML code on your local machine
- Sync to remote - Use
server pushto sync code to GPU server - Run training - Use
server run train.pyto start training - Monitor progress - Use
server logs train.pyto read logs orserver tail train.pyto monitor logs real-time - Iterate - Repeat as needed
I was tired of using Jupyter for machine learning on remote GPUs, and was looking for quick and simple solution for running my training scripts on on-demand servers over ssh without any server-side setup.
MIT License - see LICENSE file for details.
Contributions welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.