Customization of @mitchellh's great basic setup, adopted to my needs.
tig
ag
/ The Silver Searcher- NERDTree
- vim-visual-multi
- vim-expand-region
- vim settings:
relativenumber
,cursorline
and-column
, mapspace
to clear search
Other than that, most of the config felt already familiar or actually was the same.
This repository contains my NixOS system configurations. This repository isn't meant to be a turnkey solution to copying my setup or learning Nix, so I want to apologize to anyone trying to look for something "easy". I've tried to use very simple Nix practices wherever possible, but if you wish to copy from this, you'll have to learn the basics of Nix, NixOS, etc.
I don't claim to be an expert at Nix or NixOS, so there are certainly improvements that could be made! Feel free to suggest them, but please don't be offended if I don't integrate them, I value having my config work over having it be optimal.
I like to use macOS as the host OS and NixOS within a VM as my primary development environment. I use the graphical applications on the host (browser, calendars, mail app, iMessage, etc.) but I do almost everything dev-related in the VM (editor, compilation, databases, etc.).
Inevitably I get asked why? I genuinely like the macOS application ecosystem, and I'm pretty "locked in" to their various products such as iMessage. I like the Apple hardware, and I particularly like that my hardware always Just Works with excellent performance, battery life, and service. However, I prefer the Linux environment for almost all my dev work. I find that modern computers are plenty fast enough for the best of both worlds.
Here is what it ends up looking like:
Note that I usually full screen the VM so there isn't actually a window, and I three-finger swipe or use other keyboard shortcuts to active that window.
How does web application development work? I use the VM's IP. Even
though it isn't strictly static, it never changes since I rarely run
other VMs. You just have to make sure software in the VM listens
on 0.0.0.0
so that it isn't only binding to loopback.
Does copy/paste work? Yes.
Do you use shared folders? I set up a shared folder so I can access the home directory of my host OS user, but I very rarely use it. I primarily only use it to access browser downloads. You can see this setup in these Nix files.
Do you ever launch graphical applications in the VM? Sometimes, but rarely. I'll sometimes do OAuth flows and stuff using FireFox in the VM. Most of the time, I use the host OS browser.
Do you have graphical performance issues? Graphical applications can have framerate issues, particularly animation. I try to avoid doing any of this in the VM and only do terminal UIs. Terminal workflows have no performance issues ever.
This can't actually work! This only works on a powerful workstation! I've been doing this for almost 2 years now, and I've developed a lot of very real software. It works for me. I also use this VM on a MacBook Pro (to be fair, it is maxed out on specs), and I have no issues whatsoever.
Does this work with Apple Silicon Macs? Yes, using the VMware Fusion Public Preview (at the time of writing). There are some issues, but its entirely workable. I'll keep improving this since my primary machine will be an Apple Silicon machine soon.
Video: https://www.youtube.com/watch?v=ubDMLoWz76U
If you need an ISO for NixOS, you can build your own in the iso
folder.
For x86-64, I usually just download the official ISO, but I build the
ISO from scratch for aarch64. There is a make target iso/nixos.iso
you can use for
building an ISO. You'll also need a docker
running on your machine for building an ISO.
$ make iso/nixos.iso
Create a VMware Fusion VM with the following settings. My configurations are made for VMware Fusion exclusively currently and you will have issues on other virtualization solutions without minor changes.
- ISO: NixOS 21.05 or later.
- Disk: SATA 150 GB+
- CPU/Memory: I give at least half my cores and half my RAM, as much as you can.
- Graphcs: Full acceleration, full resolution, maximum graphics RAM.
- Network: Shared with my Mac.
- Remove sound card, remove video camera.
- Profile: Disable almost all keybindings
Boot the VM, and using the graphical console, change the root password to "root":
$ sudo su
$ passwd
# change to root
Run ifconfig
and get the IP address of the first device. It is probably
192.168.58.XXX
, but it can be anything. In a terminal with this repository
set this to the NIXADDR
env var:
$ export NIXADDR=<VM ip address>
Perform the initial bootstrap. This will install NixOS on the VM disk image but will not setup any other configurations yet. This prepares the VM for any NixOS customization:
$ make vm/bootstrap0
After the VM reboots, run the full bootstrap, this will finalize the NixOS customization using this configuration:
$ make vm/bootstrap
You should have a graphical functioning dev VM.
At this point, I never use Mac terminals ever again. I clone this repository
in my VM and I use the other Make tasks such as make test
, make switch
, etc.
to make changes my VM.
I am still transitioning into a fully flaked setup. During this transition (which is indefinite, I'm in no rush), I'm using both.