Shrinking the macOS APFS container freed ~256G, but it landed at a lower disk offset than the Linux partitions, so the ext4 root could never be grown into it — a partition only ever extends into free space that follows it. Rather than relocate the Asahi stub and ESP (the reliable way to brick the boot chain), the root moved into the gap as a new partition: p8 29424896..96687621 256.6G btrfs, subvol @, compress=zstd zstd puts ~70G of data in ~37G, and free space went from 7.3G to 220G. The old ext4 p5 is left intact as a rollback; generations <= 48 still boot it, since each generation carries its own root UUID in its initrd. Also lands the pending work in this tree: postgresql in home.packages, the deepvis cachix substituter with a root-owned netrc, nixbuild.net as a builder for both arches, the caffeine stay-awake unit with its SUPER+A bind, and monthly btrfs autoScrub on the new root. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| config | ||
| firmware | ||
| hosts | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
nixos
One flake, two machines. Hyprland + greetd autologin, Zen+Tridactyl, neovim, zsh+starship.
| host | arch | build |
|---|---|---|
mbp |
aarch64 | MacBook M1 Pro (Asahi) |
pc |
x86_64 | any UEFI x86 |
flake.nix all config (common + home modules, both hosts)
config/ raw configs: hypr eww fuzzel nvim
hosts/*/hardware-configuration.nix mbp: regenerate on Mac · pc: generic, as-is
firmware/ Mac Wi-Fi/BT blobs — git-add at install. KEEP REPO PRIVATE.
Set time.timeZone in common. Rename a host = change the nixosConfigurations.<name> key + its networking.hostName.
Apply
sudo nixos-rebuild switch --flake ~/nixos#mbp # or #pc
nix flake update && sudo nixos-rebuild switch --flake ~/nixos#mbp # update
Roll back = pick an older generation at boot.
Install: MacBook (Asahi)
Full/latest guide: https://github.com/nix-community/nixos-apple-silicon/blob/main/docs/uefi-standalone.md. Back up — a bad partition can brick the Mac.
- macOS Terminal:
curl https://alx.sh | sh→rresize (≥20 GB free) →finstall UEFI environment only, nameNixOS→ recovery: permissive security. Reboots to U-Boot; power off. - Installer USB (on a Linux+Nix box):
nix build github:nix-community/nixos-apple-silicon#installer-bootstrap -o installerthenddthe ISO to USB. - Boot USB →
sudo su:
sgdisk /dev/nvme0n1 -n 0:0 -s && sgdisk /dev/nvme0n1 -p # note new 8300 part, e.g. p5
mkfs.ext4 -L nixos /dev/nvme0n1p5
mount /dev/disk/by-label/nixos /mnt && mkdir -p /mnt/boot
mount /dev/disk/by-partuuid/$(cat /proc/device-tree/chosen/asahi,efi-system-partition) /mnt/boot
nixos-generate-config --root /mnt
git clone <private-remote> /mnt/root/nixos && cd /mnt/root/nixos
cp /mnt/etc/nixos/hardware-configuration.nix hosts/mbp/
mkdir -p firmware && cp /mnt/boot/asahi/{all_firmware.tar.gz,kernelcache*} firmware/
git add -f hosts/mbp/hardware-configuration.nix firmware/*
nixos-install --flake .#mbp && reboot
Install: x86
No hardware generation — hosts/pc/hardware-configuration.nix is generic (mounts by label). Boot the NixOS ISO, sudo -i:
parted /dev/nvme0n1 -- mklabel gpt \
mkpart ESP fat32 1MiB 512MiB set 1 esp on \
mkpart primary 512MiB 100%
mkfs.fat -F32 -n BOOT /dev/nvme0n1p1
mkfs.ext4 -L nixos /dev/nvme0n1p2
mount /dev/disk/by-label/nixos /mnt && mkdir -p /mnt/boot && mount /dev/disk/by-label/BOOT /mnt/boot
git clone <private-remote> /mnt/root/nixos && cd /mnt/root/nixos
nixos-install --flake .#pc && reboot
Exotic storage controller won't boot? Add its module to availableKernelModules in hosts/pc/hardware-configuration.nix (nixos-generate-config --show-hardware-config lists it).
After first boot
passwd (ships initialPassword = "changeme"). If you land on a tty instead of Hyprland, change greetd's uwsm start hyprland → Hyprland in common.