Skip to content

skyuplam/nixos-config

Repository files navigation

NixOS System Configurations

This repository contains a collection of NixOS system configurations.

Setup macOS with nix-darwin

  • Build the config
nix build ./\#darwinConfigurations.macbook-pro-m2.system
  • Switch to the new setup
./result/sw/bin/darwin-rebuild switch --flake ./\#macbook-pro-m2

Setup a VM with NixOS on a macOS with UTM

  1. Download the Minimal ISO image from the official https://nixos.org/download#nixos-iso e.g. 64-bit ARM
  2. Create a new VM with UTM and setting the OS to Linux as well as applying the ISO image to boot
  3. Once the VM is booted, copy the disko config file
curl -o /tmp/disko-config.nix https://raw.githubusercontent.com/skyuplam/nixos-config/main/machines/disko-config-utm.nix
  1. Run disko to partition, format and mount the disks
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko-config.nix
  1. Complete the NixOS installation
  • Generate initial nixos config
sudo nixos-generate-config --no-filesystems --root /mnt
  • Move the disko config to /mnt/etc/nixos
sudo mv /tmp/disko-config.nix /mnt/etc/nixos
  • Update the nixos configurations to include the disko module and the disko config
imports =
 [ # Include the results of the hardware scan.
   ./hardware-configuration.nix
   "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix"
   ./disko-config.nix
 ];
  1. Finish the installation and reboot
sudo nixos-install
sudo reboot