{"id":16335777,"url":"https://github.com/3noch/nix-vbox-build-slave","last_synced_at":"2025-03-22T23:32:18.189Z","repository":{"id":141673492,"uuid":"75516077","full_name":"3noch/nix-vbox-build-slave","owner":"3noch","description":"Quickly sets up a NixOS build-slave in VirtualBox to ease NixOps deployments from macOS, etc.","archived":false,"fork":false,"pushed_at":"2017-02-23T20:47:02.000Z","size":10,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T15:47:33.060Z","etag":null,"topics":["build","linux","macos","nix","nixops","nixos","virtual-machines","virtualbox"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3noch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-04T03:55:15.000Z","updated_at":"2024-08-22T00:03:59.000Z","dependencies_parsed_at":"2024-07-14T16:19:27.332Z","dependency_job_id":null,"html_url":"https://github.com/3noch/nix-vbox-build-slave","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fnix-vbox-build-slave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fnix-vbox-build-slave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fnix-vbox-build-slave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3noch%2Fnix-vbox-build-slave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3noch","download_url":"https://codeload.github.com/3noch/nix-vbox-build-slave/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245036113,"owners_count":20550662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build","linux","macos","nix","nixops","nixos","virtual-machines","virtualbox"],"created_at":"2024-10-10T23:42:21.163Z","updated_at":"2025-03-22T23:32:18.165Z","avatar_url":"https://github.com/3noch.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Quickly Create a VirtualBox Build-Slave for Nix\n===============================================\n\n## Before Proceeding: A Better Way\n\nThe technique used by this repo works pretty well, but if you are able to install [Docker](https://www.docker.com/) you can get a NixOS build slave much more easily with [this script](https://github.com/LnL7/nix-docker/blob/master/start-docker-nix-build-slave). Just run:\n\n```bash\nsource \u003c(curl -fsSL https://raw.githubusercontent.com/LnL7/nix-docker/master/start-docker-nix-build-slave)\n```\n\nNote that this does not work on Windows.\n\n\n## If You Don't Want to Use Docker\n\nThis repository provides a script that can be used to easily create a [NixOS](https://nixos.org/) build slave for your needs depending only on Nix and VirtualBox. This is useful where you're trying to deploy to a NixOS system from a non-NixOS host (e.g. using [NixOps](https://nixos.org/nixops/) on macOS).\n\n**Prerequisites:** You are not running on Windows and have [VirtualBox](https://www.virtualbox.org/) installed.\n\nRun `. ./setup` to setup your current shell. This will do the following:\n\n  1. Create a `nixops` VirtualBox deployment for the build-slave.\n  2. Deploy the build-slave.\n  3. Create a `remote-systems.conf` file that tells nix how to SSH into this machine.\n  4. Configure `NIX_REMOTE_SYSTEMS` to use this `remote-systems.conf`.\n\nAfter running this, you should be able to use `nixops` as normal and it will use your build slave.\n\nTo shut-down the build-slave, run `. ./shutdown` which will turn off the VM and unset the environment variables.\n\n### Troubleshooting\n\n**`nixops` can't connect to the virtual machine via SSH.** (Note that the `setup` script attempts to mitigate this problem.) It's not uncommon for VirtualBox to assign a new IP to virtual machines after they've been rebooted, etc. When this happens, `nixops` often tries to connect with the old IP and fails. (If you've deployed another virtual machine since then, it may have stolen the old IP. In this case `nixops` may complain that the SSH keys are not correct.) This is a [known issue](https://github.com/NixOS/nixops/issues/583) in `nixops`. The fix is to remove the old IPs from your `~/.ssh/known_hosts` file and try the task again.\n\n**The scripts stopped working completely.** This can happen if you did a major update to VirtualBox or modified/deleted the VirtualBox machine associated with the build-slave. You can use nixops to start everything from scratch:\n\n```shell\nnix-shell -p nixops  # Start a shell with nixops in the PATH\nnixops destroy -d build-slave-vbox\nnixops delete -d build-slave-vbox\n```\n\nNow you should be able to run the scripts and have everything start fresh.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3noch%2Fnix-vbox-build-slave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3noch%2Fnix-vbox-build-slave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3noch%2Fnix-vbox-build-slave/lists"}