Skip to content

4evy/nix-dotfiles

Repository files navigation

nix-dotfiles 🌸

Personal NixOS, nix-darwin, Ansible, chezmoi, and Bluefin setup

GHCR Bluefin image Bluefin NixOS nix-darwin chezmoi Ansible Catppuccin Latte and Frappe

Important

This is my personal setup

Bootstrap

git clone https://github.com/FlameFlag/nix-dotfiles.git ~/nix-dotfiles
cd ~/nix-dotfiles

Install

NixOS

sudo nixos-generate-config --show-hardware-config > hosts/linux/hardware-configuration.nix
sudo nixos-rebuild switch --flake .#lenovo-legion
nix run .#immutable-activate -- --backend auto --flake "$PWD" --reset-containers

chezmoi init --source "$PWD/dotfiles"
chezmoi apply --refresh-externals=always --force

macOS

nix run nix-darwin -- switch --flake .#FlameFlags-Mac-mini
sudo darwin-rebuild switch --flake .#FlameFlags-Mac-mini
ansible-playbook ansible/playbooks/userland.yml

chezmoi init --source "$PWD/dotfiles"
chezmoi apply --refresh-externals=always --force

Portable Linux

./ansible/bootstrap.sh
env CGO_ENABLED=0 go run ./cmd/immutable-activate --backend auto --flake "$PWD" --reset-containers

chezmoi init --source "$PWD/dotfiles"
chezmoi apply --refresh-externals=always --force

Host bits:

ansible-playbook ansible/playbooks/host.yml

Spectrum / Bluefin

Spectrum is the Bluefin host path: bootc image first, userland after reboot.

Published image:

https://github.com/FlameFlag/nix-dotfiles/pkgs/container/nix-dotfiles-bluefin

sudo bootc switch ghcr.io/flameflag/nix-dotfiles-bluefin:latest
systemctl reboot

After reboot:

git clone https://github.com/FlameFlag/nix-dotfiles.git ~/nix-dotfiles
cd ~/nix-dotfiles

env CGO_ENABLED=0 go run ./cmd/immutable-activate --backend auto --flake "$PWD" --reset-containers

chezmoi init --source "$PWD/dotfiles"
chezmoi apply --refresh-externals=always --force

ansible-playbook ansible/playbooks/host.yml

Local image instead of GHCR:

sudo podman build --pull=newer --tag localhost/nix-dotfiles-bluefin:local --file spectrum/Containerfile .
sudo bootc switch --transport containers-storage localhost/nix-dotfiles-bluefin:local
systemctl reboot

After changing spectrum/ or anything copied by spectrum/Containerfile, rebuild the same local tag and upgrade into it:

sudo podman build --pull=newer --tag localhost/nix-dotfiles-bluefin:local --file spectrum/Containerfile .
sudo bootc upgrade
systemctl reboot

Use bootc switch when changing to a different image reference, such as first moving from stock Bluefin to Spectrum or moving from the local image to GHCR. Use bootc upgrade after rebuilding or republishing the image reference that the machine already tracks.

UBlue automatic updates do not run Ansible. Use update for userland, and run ansible-playbook ansible/playbooks/host.yml for host bits.

Daily

update
rebuild
check
cza

Check

nix fmt
nix flake check

ansible-playbook --syntax-check ansible/playbooks/bootstrap.yml
ansible-playbook --syntax-check ansible/playbooks/userland.yml
ansible-playbook --syntax-check ansible/playbooks/host.yml
ansible-playbook --syntax-check ansible/playbooks/site.yml

ansible-lint ansible
yamllint .

docker compose build
docker compose run --rm alpine
docker compose run --rm fedora-44
docker compose --profile nix-profile build nix-profile
docker compose --profile nix-profile run --rm nix-profile

License

LICENSE.txt