Skip to content

debling/nix-dotfiles

Repository files navigation

nix-dotfiles

System configuration for nix-darwin and NixOS, with user space configuration managed by home-manager.

Portable NixOS

Bootstrap Instructions

MacOS (MacBook Air M1)

  1. First install nix in your system.

  2. After that, since we don't have nix-darwin installed yet, we can bootstrap the system using the nix build command.

    nix build .#darwinConfigurations.air-m1.system
  3. 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 .
  4. Done! The configuration is applied into your system, after that, you can call darwin-rebuild to apply your configuration changes directly, without the need to prefix it with ./result/sw/bin, since its now installed into your system environment.

NixOS (X220)

This setup uses nixos-anywhere for remote installation and nixos-facter for hardware detection.

  1. Install NixOS on the target machine
  2. Generate hardware config using facter to automatically detect hardware:
    nixos-anywhere --generate-hardware-config nixos-facter ./hosts/x220/facter.json
  3. Apply configuration:
    sudo nixos-rebuild switch --flake .#x220

NixOS (X1 Carbon)

Similar to X220, this setup uses nixos-anywhere and nixos-facter for hardware detection.

  1. Install NixOS on the target machine
  2. Generate hardware config using facter to automatically detect hardware:
    nixos-anywhere --generate-hardware-config nixos-facter ./hosts/x1-carbon/facter.json
  3. Apply configuration:
    sudo nixos-rebuild switch --flake .#x1-carbon

NixOS (Portable USB)

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.

  1. 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.

Android (Pixel 6)

This setup uses nix-on-droid to bring Nix package management to Android devices through Termux.

  1. Install nix-on-droid following the official setup instructions
  2. 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.

Configurations

Things that I always use (and recommend), regardless of the machine:

You can check the home-manager configuration here. It defines packages and setups that are available on all machines.

Host Details

NixOS on X220

  • Wayland using dwl compositor
  • dwlb Status bar

You can check my desktop configuration here.

The NixOS configuration can be found here.

NixOS on X1 Carbon

Desktop configuration for ThinkPad X1 Carbon.

The NixOS configuration can be found here.

NixOS on Portable USB

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.

Nix-Darwin on MacBook Air

  • 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.

Nix-on-Droid on Pixel 6

Android configuration using nix-on-droid.

The Android configuration can be found here.

About

System and user config using nix

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors