Skip to content

ahacop/nixos-config

Repository files navigation

Setup (VM)

You can download the NixOS ISO from the official NixOS download page. There are ISOs for both x86_64 and aarch64 at the time of writing this.

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 23.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.
  • Graphics: Full acceleration, full resolution, maximum graphics RAM.
  • Network: Shared with my Mac.
  • Remove sound card, remove video camera, remove printer.
  • Profile: Disable almost all keybindings
  • Boot Mode: UEFI

Boot the VM, and using the graphical console, change the root password to "root":

$ sudo su
$ passwd
# change to root

At this point, verify /dev/sda exists. This is the expected block device where the Makefile will install the OS. If you setup your VM to use SATA, this should exist. If /dev/nvme or /dev/vda exists instead, you didn't configure the disk properly. Note, these other block device types work fine, but you'll have to modify the bootstrap0 Makefile task to use the proper block device paths.

Also at this point, I recommend making a snapshot in case anything goes wrong. I usually call this snapshot "prebootstrap0". This is entirely optional, but it'll make it super easy to go back and retry if things go wrong.

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>

The Makefile assumes an Intel processor by default. If you are using an ARM-based processor (M1, etc.), you must change NIXNAME so that the ARM-based configuration is used:

$ export NIXNAME=vm-aarch64

Other Hypervisors: If you are using Parallels, use vm-aarch64-prl. If you are using UTM, use vm-aarch64-utm. Note that the environments aren't exactly equivalent between hypervisors but they're very close and they all work.

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.

Setup (macOS/Darwin)

THIS IS OPTIONAL AND UNRELATED TO THE VM WORK. I recommend you ignore this unless you're interested in using Nix to manage your Mac too.

I share some of my Nix configurations with my Mac host and use Nix to manage some aspects of my macOS installation, too. This uses the nix-darwin project. I don't manage everything with Nix, for example I don't manage apps, some of my system settings, Homebrew, etc. I plan to migrate some of those in time.

To utilize the Mac setup, first install Nix using some Nix installer. There are two great installers right now: nix-installer by Determinate Systems and Flox. The point of both for my configs is just to get the nix CLI with flake support installed.

Once installed, clone this repo and run make. If there are any errors, follow the error message (some folders may need permissions changed, some files may need to be deleted). That's it.

WARNING: Don't do this without reading the source. This repository is and always has been my configurations. If you blindly run this, your system may be changed in ways that you don't want. Read my source!

About

My NixOS configurations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published