Code Monkey home page Code Monkey logo

nixos-utm's Introduction

NixOS-UTM : Conveniently create UTM VM with NixOS

This repository provides a small wrapper around nixos-anywhere to automate creation of NixOS VMs on MacOS hosts using UTM with the Apple virtualization backend (supporting Rosetta2).

Using the apple virtualsation (insted of qemu) provides access to Rosetta2 and thus efficient x86_64 support within the VM. Unfortunately, the utmctl does not yet provide full functionality (e.g. ip-address) for the appble backend. That complicates automatic vm creation and this repo provides utilities to automate as much as possible for a simple automation setup.

How to create a VM

  • create a nix flake with a nixosConfiguration defined
    • the ./example folder provides a flake with minimal example config
    • use it with nix flake new -t github:ciderale/nixos-utm my-utm-vm
    • adjust ./configuration.nix (atleast set your ssh public key)
  • define an environment variable VM_NAME to name the UTM VM
    • maybe configure this env var within your project/system setup
  • kickoff the installation process with the following command
    • assuming your flake is the current directory . with config utm
export VM_NAME=myVM
nix run github:ciderale/nixos-utm#nixosCreate .#utm

Retrieve the VMs IP address

VM_NAME=myVM nix run github:ciderale/nixos-utm#nixosIP

This command uses the arp cache to lookup the ip address based on the mac address that is found in the VMs configuration folder.

How to rebuild the configuration for an existing configuration

VM_NAME=myVM nix run github:ciderale/nixos-utm#nixosDeploy .#utm

Some aspects that can be improved

  • Make VM configuration configurable (currently hardcoded in nixosCreate)
  • Improve example configuration for simpler onboarding
  • Provide utility to deploy an updated configuration
  • Directory sharing between VM and host system.
    • it's a UTM system configuration, not a VM configuration
    • uses some binary coded "bookmark" format

nixos-utm's People

Contributors

ciderale avatar

Stargazers

 avatar  avatar

Watchers

 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.