This configuration is based on @SailorSnow's config. He did an amazing job with it - thank you!
This repository contains my personal NixOS configuration, primarily targeting Apple Silicon via Asahi Linux. Home Manager is integrated directly into the NixOS builds.
I am using this configuration as my daily driver on a MacBook Air M1 (8GB RAM / 256GB Storage). It currently includes the experimental Asahi Linux branch with working external display support via USB-C.
This configuration uses ZFS as the root filesystem along with ZRAM. This setup is extremely helpful for devices with limited RAM and storage.
I will guide you through the entire installation process. Please note that these instructions might not be complete, as I wrote them from memory step-by-step and may have overlooked some details. If you encounter any issues, feel free to contact me on Telegram or Matrix: @pengwius:matrix.org. I will be more than happy to help you and update the instructions.
—
If you no longer rely on macOS and want to shrink it as much as possible, use Disk Utility to do so manually. Do not use the Asahi tool for this step, as it reserves too much space for macOS and will not allow you to minimize the partition size fully.
Follow the steps provided here: https://github.com/nix-community/nixos-apple-silicon/blob/main/docs/uefi-standalone.md.
However, when creating the ext4 partition, only use half of the available free space. Leave the other half unallocated.
You could alternatively use the entire space and shrink the ext4 partition later, but this is unnecessary unless your disk space is so limited that it cannot handle the initial system build (including the kernel). You may want to run nix-collect-garbage -d in the future after the system builds to free up disk space.
Clone my configuration into your user home directory:
git clone https://github.com/pengwius/nixos-config Replace pengwius with your username in the following files:
/flake.nix/home-manager/home.nix/hosts/asahi/configuration.nix/hosts/common/users.nix/modules/home-manager/gui/firefox.nix
Update fileSystems."/" in /hosts/asahi/hardware-configuration.nix to:
fileSystems."/" = {
device = "/dev/disk/by-uuid/<ext4 partition uuid>";
fsType = "ext4";
};Change the disk UUID in fileSystems."/boot" to match yours, and comment out swapDevices and fileSystems."/home".
You can retrieve your UUID by running lsblk -f or blkid.
Now, rebuild your system by running:
sudo nixos-rebuild switch --flake .#asahiThis will likely take some time, as it needs to compile the entire kernel. Once complete, set a password for your user:
passwd <your username>Finally, reboot your system.
Now, create the ZFS partition in the free space you left in Step 1.
Run the following command:
sudo zpool create \
-o ashift=12 \
-O compression=zstd \
-O atime=off \
-O xattr=sa \
-O acltype=posixacl \
-O encryption=aes-256-gcm \
-O keyformat=passphrase \
-O keylocation=prompt \
zroot /dev/<your free partition (likely nvme0n1p6, but verify this yourself!)>You will be prompted to enter a password to encrypt the filesystem.
Next, create the ZFS datasets:
sudo zfs create zroot/nixos
sudo zfs create zroot/nixos/homeAnd set up the mountpoints:
sudo zfs set mountpoint=legacy zroot/nixos
sudo zfs set mountpoint=legacy zroot/nixos/homeFirst, mount the ZFS partition:
sudo mount -t zfs zroot/nixos /mntCopy the entire system to ZFS:
sudo rsync -aAXHv --numeric-ids \
--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
/ /mntThen copy the home directory:
sudo rsync -aAXHv /home/ /mnt/homeChroot into the system on ZFS:
nixos-enter --root /mntEdit /hosts/asahi/hardware-configuration.nix in the config and update fileSystems to:
fileSystems."/" = {
device = "zroot/nixos";
fsType = "zfs";
};
fileSystems."/home" = {
device = "zroot/nixos/home";
fsType = "zfs";
};Mount the EFI partition:
mount /dev/nvme0n1p4 (Check which partition holds YOUR EFI!) /bootProceed with the rebuild:
nixos-rebuild boot --flake .#asahiAfter this, exit the chroot and reboot the system. It should boot into the ZFS installation.
Once booted into your fresh ZFS system, you may want to add the remaining ext4 partition to the pool to utilize the full disk space. There is no need to resize partitions; you can simply wipe the ext4 partition and add it to the zpool.
Run:
sudo wipefs -a /dev/nvme0n1p5 (This might differ for you! Check carefully!)And then:
sudo zpool add zroot /dev/nvme0n1p5Verify that everything went correctly by running:
zpool list
zfs listTo add swap, uncomment swapDevices in /hosts/asahi/hardware-configuration.nix, and create a ZFS Zvol for swap:
sudo zfs create -V 16G -b $(getconf PAGESIZE) -o compression=off -o logbias=throughput -o sync=always -o primarycache=metadata -o secondarycache=none zroot/swapFormat it as swap:
sudo mkswap /dev/zvol/zroot/swapEnable it:
sudo swapon /dev/zvol/zroot/swapFinally, rebuild the system:
sudo nixos-rebuild switch --flake .#asahiYour NixOS Asahi setup on ZFS should now work perfectly!
—
- Evaluate/check flake:
nix flake check
- Build system closure (dry):
nix build .#nixosConfigurations.asahi.config.system.build.toplevel - Update inputs:
nix flake update
—
asahi: Asahi Linux on Apple Silicon (daily driver)
flake.nix/flake.lock: Flake entry and locked inputshosts/asahi/: Host configuration (imports Apple Silicon support)common/: Shared host glue (boot.nix,locale.nix,desktop.nix,users.nix)
home-manager/: User config and assets; applied via system rebuildsmodules/modules/nixos/: Reusable NixOS modules (e.g.,netdata.nix,minecraft-server-*.nix)modules/home-manager/: Reusable HM modules (e.g.,zsh.nix,neovim/,gui/)
overlays/: Overlays including anunstablepackage setpkgs/: Custom packages (e.g.,tentrackule)dotfiles/: Misc dotfiles not managed as HM modules
—
- Wayland compositor: Niri (via
services.greetdsession) - Stylix: Used for theming and fonts
- Podman: Enabled (Docker‑compat) with DNS for compose
- Bluetooth: Via BlueZ + Blueman
- Home Manager modules: Zsh, Neovim (nixCats), GUI apps (Firefox, Ghostty, etc.)
—
This is a personal setup tuned for my hardware and workflow. Feel free to explore and adapt it.


