This repository contains configuration for my hosts. It is built around Dendritic Pattern
Key features:
- Declarative encrypted BtrFs using disko
- Minimal NixOS configuration: as much as possible is moved to Home Manager
- Minimal Home Manager configuration: as much as possible is configured in stow-compatible way
- UWSM Hyprland
- Minimal NeoVim configuration:
Where possible tools and services are configured using GNU Stow and Nix is used only for installing packages and their plugins/extensions.
This repository contains three Stow directories each corresponding to it's target directory:
stow-home: target is~/stow-system: target os/etc/stow-servicetarget is/var/lib/
Instead of the usual programs.helix.settings = { ... } what basically happens in Nix code is
this:
# home.nix
xdg.configHome."helix/config.toml".source = "${self}/stow-home/helix/.config/helix/config.toml"But instead of manually linking each configuration file like this a helper functions exist:
packageHomeFiles, packageSystemFiles.
# home.nix
home.file = lib.mkMerge [
(packageHomeFiles "helix")
];So all it takes is just picking the right helper function depending on a target directory and
giving it a package name. The function will walk the entire package and link files to the
right places just like what stow -t ~ -S helix would do.
Here are some advantages of this approach:
- I didn't had to rewrite all my dotfiles when migrating to Nix.
- I don't have to rewrite configuration examples I find on the internet when configuring a new tool.
- I won't have to rewrite all my dotfiles once I decide to leave NixOS for whatever reason.
- I theoretically can reuse parts of my dotfiles on a machines with no Nix whatsoever.
- Combined with impurity.nix I can make parts of nix store point directly at dotfiles repository when debugging which allows me to easily test changes without constant rebuilding.
CAUTION:
DO NOT RUN DISKO ON A HOST WITH SIMILAR SETUP, USE LIVECD ON A FUTURE HOST INSTEAD !!!
Filesystem and partition labels are used, expect conflicts
# Could be: pluto, mars, jupiter, venus
NIXHOST=pluto
NIXUSER=general
echo -n 'main drive encryption password here' > /tmp/secret.key
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount --flake github:aitvann/dotfiles#${NIXHOST}
nixos-generate-config --show-hardware-config --no-filesystems --root /mnt
# Edit configuration.nix accordingly
sudo nixos-install --root /mnt --flake github:aitvann/dotfiles#${NIXHOST}
sudo nixos-enter --root /mnt
chown -R ${USER}:users /home/${USER}/{.local,.snapshots}
su - ${NIXUSER}
# Insert cd with secrets
import-secrets ~/secrets.tar.gpg
restic-jupiter restore -t ~ latest:home/${USER}
mkdir -p {~/.local/share/mpd,~/.config/gtk-2.0}
reboot"Workstation" is a configuration shared between two hosts: mars (laptop), pluto (pc)
- Add theme package to
home.packages - Some files might need to be deleted if they point to
/nix/store, otherwisenwg-lookwon't apply the changes:rm {~/.local/share/icons/default/index.theme,~/.config/xsettingsd/xsettingsd.conf,~/.config/gtk-2.0/gtkrc,~/.config/gtk-3.0/settings.ini,~/.config/gtk-4.0/settings.ini} - Select and apply themes using
nwg-looktool - Run
systemctl --user restart xsettingsd.service - Run
apply-config gtkscript to copy GTK configuration files to the repo
- Add theme package to
home.packages - Set
QT_QPA_PLATFORMTHEME,QT_STYLE_OVERRIDEinuwsm/env
- Do all the changes in a web GUI
- Run
apply-config syncthing-${HOST}to copy new configuration to the repo
docker run --rm -it \
-v $HOME/dotfiles/stow-system/isponsorblocktv/isponsorblocktv:/app/data \
--net=host \
-e TERM=$TERM -e COLORTERM=$COLORTERM \
ghcr.io/dmunozv04/isponsorblocktv \
--setup