System configuration for nix-darwin and NixOS, with user space configuration managed by home-manager.
-
First install nix in your system.
-
After that, since we don't have nix-darwin installed yet, we can bootstrap the system using the
nix buildcommand.nix build .#darwinConfigurations.air-m1.system -
After the build is complete, we can call nix-darwin from the result symlink that was created by the build
./result/sw/bin/darwin-rebuild switch --flake . -
Done! The configuration is applied into your system, after that, you can call
darwin-rebuildto apply your configuration changes directly, without the need to prefix it with./result/sw/bin, since its now installed into your system environment.
This setup uses nixos-anywhere for remote installation and nixos-facter for hardware detection.
- Install NixOS on the target machine
- Generate hardware config using facter to automatically detect hardware:
nixos-anywhere --generate-hardware-config nixos-facter ./hosts/x220/facter.json
- Apply configuration:
sudo nixos-rebuild switch --flake .#x220
Similar to X220, this setup uses nixos-anywhere and nixos-facter for hardware detection.
- Install NixOS on the target machine
- Generate hardware config using facter to automatically detect hardware:
nixos-anywhere --generate-hardware-config nixos-facter ./hosts/x1-carbon/facter.json
- Apply configuration:
sudo nixos-rebuild switch --flake .#x1-carbon
This configuration uses disko for declarative disk management, allowing you to create a portable NixOS system on a USB drive that works on any hardware.
- Apply configuration to USB drive (disko will handle partitioning and formatting):
sudo nixos-rebuild switch --flake .#nixos-portable
The disko configuration in ./hosts/portable/disko.nix defines the disk layout, making it reproducible across different machines.
This setup uses nix-on-droid to bring Nix package management to Android devices through Termux.
- Install nix-on-droid following the official setup instructions
- Apply configuration:
nix-on-droid switch --flake .
This allows you to have a consistent development environment on your Android device with the same packages and configurations as your other machines.
Things that I always use (and recommend), regardless of the machine:
- Neovim text editor, you can check my configuration here
- Foot, a fast, lightweight terminal with server mode for instant startup, link to the config
- River, a fast and easy-to-setup dynamic tiling Wayland compositor, link to the config
You can check the home-manager configuration here. It defines packages and setups that are available on all machines.
You can check my desktop configuration here.
The NixOS configuration can be found here.
Desktop configuration for ThinkPad X1 Carbon.
The NixOS configuration can be found here.
Portable NixOS configuration for USB drive using disko for declarative disk management. This setup creates a self-contained NixOS system that can boot on any x86_64 machine with all hardware profiles included.
The NixOS configuration can be found here.
- Yabai for window management
- Janky borders, so you can actually see which window is active at the moment
The MacOS configuration can be found here.
Android configuration using nix-on-droid.
The Android configuration can be found here.
