Pure Nix dotfile deployment! My descent into Nix continues...
This is a multi-host deployment for NixOS and Home Manager using flakes. Largely influenced by @lovesegfault's Nix config.
- Multi-host configuration with nix-config-modules
- Custom app configurations for building more complex host specs
- Multihead display configuration: Hosts can now specify a monitor
configuration using standard
xrandr
outputs in a much more flexible fashion than what NixOS offers by default. I also include some Home Manager hooks so that display configurations can be applied at login on non-NixOS systems. See ./apps/display/wallpapers/default.nix for more details.
For rebuilding NixOS:
nixos-rebuild switch --flake .#<host>
For rebuilding Home Manager:
home-manager switch --flake .#<host>
For Ubuntu systems, I needed to add one more configuration item to get this working perfectly:
/usr/share/xsessions/xsession.desktop
:
[Desktop Entry]
Name=Nix
Comment=Runs the xsession provided by Nix.
Exec=/etc/X11/Xsession
Type=Application
DesktopNames=GNOME-Flashback;GNOME;
X-Ubuntu-Gettext-Domain=gnome-flashback
This sets up Ubuntu to use the ~/.xsession
generated by Home Manager
rather than its own WM.
- Flake integration tests via GitHub.
- Explicit declarations of nonfree software used. I'll be aiming to eliminate nonfree software from my system entirely.
- Service for my hosts to self-update once a week.
- Entrypoint package to simplify executing
nixos-rebuild
andhome-manager
. - Better QEMU virtual machine configuration. Currently there doesn't seem
to be a way to deploy QEMU virtual machine XML configuration files
via Nix directly, so I just need a script similar to what already
exists for
libvirtd
that copies any machine configurations to/var/lib/libvirtd/qemu.conf
. - Multi-user configuration: Current setup is fairly opinionated about
deploying to systems with a single user. It'd be nice to extend it
for multi-user configurations, perhaps by splitting up the
host
configuration into separatehost
anduser
configurations...
I've been maintaining my own dotfiles repo since around 2015-2016, but my commit history is a bit dishonest because I usually reset the repo from scratch when I decide to do total refactors. For those interested in my historical configurations:
- Generic Nix Setup + Hacky Git Config - Back when I wasn't fully onboard the Nix bandwagon. Abandoned because Flakes are just so much better.
- Pre-Nix chezmoi setup - Generic dotfiles managed with chezmoi. Abandoned because I wanted to be able to capture more system configuration as code (especially my VFIO setup, which took days to replicate btw)
- Even earlier iteration with installation scripts - I wrote my own setup scripts in Python. Abandoned because it was too Ubuntu-specific, and I moved to Arch.