Coder Social home page Coder Social logo

3noch / nix-vbox-build-slave Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 3.0 10 KB

Quickly sets up a NixOS build-slave in VirtualBox to ease NixOps deployments from macOS, etc.

Nix 22.51% Shell 77.49%
build linux macos nix nixops nixos virtual-machines virtualbox

nix-vbox-build-slave's Introduction

Quickly Create a VirtualBox Build-Slave for Nix

Before Proceeding: A Better Way

The technique used by this repo works pretty well, but if you are able to install Docker you can get a NixOS build slave much more easily with this script. Just run:

source <(curl -fsSL https://raw.githubusercontent.com/LnL7/nix-docker/master/start-docker-nix-build-slave)

Note that this does not work on Windows.

If You Don't Want to Use Docker

This repository provides a script that can be used to easily create a NixOS 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 on macOS).

Prerequisites: You are not running on Windows and have VirtualBox installed.

Run . ./setup to setup your current shell. This will do the following:

  1. Create a nixops VirtualBox deployment for the build-slave.
  2. Deploy the build-slave.
  3. Create a remote-systems.conf file that tells nix how to SSH into this machine.
  4. Configure NIX_REMOTE_SYSTEMS to use this remote-systems.conf.

After running this, you should be able to use nixops as normal and it will use your build slave.

To shut-down the build-slave, run . ./shutdown which will turn off the VM and unset the environment variables.

Troubleshooting

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 in nixops. The fix is to remove the old IPs from your ~/.ssh/known_hosts file and try the task again.

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:

nix-shell -p nixops  # Start a shell with nixops in the PATH
nixops destroy -d build-slave-vbox
nixops delete -d build-slave-vbox

Now you should be able to run the scripts and have everything start fresh.

nix-vbox-build-slave's People

Contributors

3noch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.