# NixThePlanet - Run macOS, Windows and more via a single Nix command + nixosModules

**URL:** https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634
**Category:** Announcements
**Created:** [December 9, 2023, 3:35am UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634 "2023-12-09T03:35:51Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![matthewcroughan](https://discourse.nixos.org/user_avatar/discourse.nixos.org/matthewcroughan/32/9512_2.png) [@matthewcroughan](https://discourse.nixos.org/u/matthewcroughan)
#### Post date: [December 9, 2023, 3:35am UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/1 "2023-12-09T03:35:51Z")

</div>

![image](https://discourse.nixos.org/uploads/default/original/2X/d/d77b2a88516f167560b231731f7977ee0592759c.png)

> **[GitHub - MatthewCroughan/NixThePlanet: Run macOS, Windows and more via a...](https://github.com/MatthewCroughan/NixThePlanet/)**
>
> Run macOS, Windows and more via a single Nix command, or simple nixosModules - GitHub - MatthewCroughan/NixThePlanet: Run macOS, Windows and more via a single Nix command, or simple nixosModules

I was nerd sniped by @Enzime at [nix.camp](https://nix.camp) into implementing this, and here it is, over two months of painstaking work and reproducibility testing. See the README.md for more details of how it works, but the TL;DR is that it uses TCL Expect and Tesseract OCR together to automate the installation of archaic operating systems and boil them down to a single Nix command, or nixosModule.

The main attraction, I’m sure is going to be macOS, which you can enable from this flake with:

```auto
services.macos-ventura.enable = true

```

CI is implemented to run the macOS installer 10 times whenever it changes, catching any bugs and uploading a replay of what went wrong as screencaptures to IPFS. I’m tempted to increase that number to 100 and to start doing statistics, because VMs are tricky. But I’ve found it’s pretty reliable after 200~ runs without failure on various slow/fast hardware.

NixThePlanet introduces a few image builder functions such as `makeDarwinImage` and `makeWin30Image` which can be used like this for example:

```nix
makeWin30Image {
  dosPostInstall = ''
    c:
    echo win >> AUTOEXEC.BAT
  '';
}

```

```auto
makeDarwinImage { diskSizeBytes = 60000000000; };

```

There’s still plenty left to do in this project as you can see by the TODOs in the README.md, which you should read if you’re interested.

---

<div class="post-metadata">

### Author: ![uep](https://discourse.nixos.org/user_avatar/discourse.nixos.org/uep/32/5167_2.png) [@uep](https://discourse.nixos.org/u/uep)
#### Post date: [December 9, 2023, 5:07am UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/2 "2023-12-09T05:07:37Z")

</div>

Absolutely incredible nerd-sniping result. Amazing.

---

<div class="post-metadata">

### Author: ![matthewcroughan](https://discourse.nixos.org/user_avatar/discourse.nixos.org/matthewcroughan/32/9512_2.png) [@matthewcroughan](https://discourse.nixos.org/u/matthewcroughan)
#### Post date: [December 9, 2023, 1:36pm UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/3 "2023-12-09T13:36:51Z")

</div>

I don’t even like macOS, or Windows. I don’t know why I did this.

---

<div class="post-metadata">

### Author: ![lenny](https://discourse.nixos.org/user_avatar/discourse.nixos.org/lenny/32/27229_2.png) [@lenny](https://discourse.nixos.org/u/lenny)
#### Post date: [December 9, 2023, 7:11pm UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/4 "2023-12-09T19:11:34Z")

</div>

Just tried it and it works like a charm! Thanks for doing this.

Very exited for this in the future:  
`Implement `runInDarwinVM` using the `makeDarwinImage` primitive`

Should make building ios apps from nixos a breeze.

---

<div class="post-metadata">

### Author: ![Carrot](https://discourse.nixos.org/user_avatar/discourse.nixos.org/carrot/32/9648_2.png) [@Carrot](https://discourse.nixos.org/u/Carrot)
#### Post date: [December 10, 2023, 11:48am UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/5 "2023-12-10T11:48:12Z")

</div>

First, Thank you for your contribution.

As far as I can understand, it looks great. But I don’t understand where I can use it.

This morning I needed to run a `Windows 11` application.

I ran:

```sh
quickget windows 11                                                       
quickemu --vm windows-11.conf --display spice

```

How does NixThePlanet compare with the above approach?

note: I know currently it’s only `macOS Ventura`

---

<div class="post-metadata">

### Author: ![matthewcroughan](https://discourse.nixos.org/user_avatar/discourse.nixos.org/matthewcroughan/32/9512_2.png) [@matthewcroughan](https://discourse.nixos.org/u/matthewcroughan)
#### Post date: [December 10, 2023, 2:15pm UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/6 "2023-12-10T14:15:30Z")

</div>

For the moment, there’s [WFVM](https://git.m-labs.hk/M-Labs/wfvm) for that, which I either hope to use as a library in NixThePlanet, or integrate into it, if @astro is up for some hacking 🙂

You can also run Windows 3.0, 3.11 (For Workgroups) or MS DOS 6.22 whilst you’re waiting.

---

<div class="post-metadata">

### Author: ![matthewcroughan](https://discourse.nixos.org/user_avatar/discourse.nixos.org/matthewcroughan/32/9512_2.png) [@matthewcroughan](https://discourse.nixos.org/u/matthewcroughan)
#### Post date: [December 11, 2023, 3:40pm UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/7 "2023-12-11T15:40:11Z")

</div>

If I understand correctly, it’s already a breeze via [https://github.com/NixOS/nixpkgs/blob/0db55faf29f9fd1006d2b1c99c79657e097a6118/doc/languages-frameworks/ios.section.md](https://github.com/NixOS/nixpkgs/blob/0db55faf29f9fd1006d2b1c99c79657e097a6118/doc/languages-frameworks/ios.section.md), although I guess this requires running Darwin as your host. and I guess the XCode stuff isn’t automated.

---

<div class="post-metadata">

### Author: ![quyse](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/q/ac91a4/32.png) [@quyse](https://discourse.nixos.org/u/quyse)
#### Post date: [December 11, 2023, 4:48pm UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/8 "2023-12-11T16:48:53Z")

</div>

Cool project!

I hope it’s OK to share some of my projects similar to this.

[https://github.com/quyse/coil-toolchain-macos](https://github.com/quyse/coil-toolchain-macos) - macOS VM in Nix, with Xcode command line tools, which I’ve been using successfully for CI purposes, for building a macOS version of a C++ video game in a purely Nix pipeline on Linux. Uses startosinstall script as opposed to using GUI OS installer. Some metadata URL hashes are outdated, because with latest metadata the installation script breaks, and I don’t know yet how to fix it (and couldn’t get it working yet for Sonoma).

[https://github.com/quyse/coil-toolchain-msvs](https://github.com/quyse/coil-toolchain-msvs) - infra for installing many versions of MS Visual Studio, in Nix sandbox, to use in Windows VM or Wine. Again, used successfully for the CI purposes of a video game, including Xbox version which required particular version of MSVS.

Unfortunately my repos are not really documented, sorry, has been postponing writing some docs since forever - if anyone’s interested, I’ll write some.

---

<div class="post-metadata">

### Author: ![matthewcroughan](https://discourse.nixos.org/user_avatar/discourse.nixos.org/matthewcroughan/32/9512_2.png) [@matthewcroughan](https://discourse.nixos.org/u/matthewcroughan)
#### Post date: [December 11, 2023, 4:53pm UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/9 "2023-12-11T16:53:27Z")

</div>

Wow! I had no idea, I’m amazed. Thank you so much for sharing.

---

<div class="post-metadata">

### Author: ![hab25](https://discourse.nixos.org/user_avatar/discourse.nixos.org/hab25/32/6573_2.png) [@hab25](https://discourse.nixos.org/u/hab25)
#### Post date: [December 13, 2023, 6:22am UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/10 "2023-12-13T06:22:55Z")

</div>

> [@quyse](#):
>
> Unfortunately my repos are not really documented, sorry, has been postponing writing some docs since forever - if anyone’s interested, I’ll write some.

@quyse, since @matthewcroughan and/or the contributors to `nixtheplanet` seem more inclined to document, maybe you can consider merging your projects into `nixtheplanet`.

---

<div class="post-metadata">

### Author: ![matthewcroughan](https://discourse.nixos.org/user_avatar/discourse.nixos.org/matthewcroughan/32/9512_2.png) [@matthewcroughan](https://discourse.nixos.org/u/matthewcroughan)
#### Post date: [December 13, 2023, 3:08pm UTC](https://discourse.nixos.org/t/nixtheplanet-run-macos-windows-and-more-via-a-single-nix-command-nixosmodules/36634/11 "2023-12-13T15:08:54Z")

</div>

I’ve been looking into `startosinstall`. I’m not 100% sure about it and I’d love to take everything I can get and put it into the repo, I’ve pinged @quyse on Matrix in case we can hack on it together.
