How mic92/dotfiles works
Project type and purpose
• This is not a typical application but a monorepo for “infrastructure-as-code” and personal dotfiles. It uses Nix flakes, Home-Manager, NixOS modules, Terraform, SOPS and other tool-specific submodules (e.g. fish, zsh, GDB, Darwin, OpenWRT).
• Purpose: declare and bootstrap reproducible system configurations (local dev shells, laptops, servers, routers, cloud bots) from a single Git repository.
File-structure analysis
• Top-level:
• flake.nix & flake.lock – entrypoint of Nix flakes
• Readme.md, LICENSE, CI workflows (.github)
• tasks.py – custom orchestration
• Submodules:
• home-manager/ – per-user Nix Home-Manager config
• nixosModules/ – reusable NixOS modules
• darwinModules/ – macOS configuration
• openwrt/ – router provisioning via Nix
• machines/ – host-specific NixOS system configurations
• terraform/ – cloud infrastructure definitions
• sops/ & secrets/ – encrypted secret storage
• devshell/, fish/, zsh/, gdb/ – dev environment helpers
• pkgs/ – in-repo Nix package and image definitions
• CI: GitHub Actions automate dependency updates, submodule sync, auto-merge.
README insights
• Invoking nix run github:Mic92/dotfiles bootstraps everything.
• Describes bootstrapping steps for Nix (single/multi-user), Home-Manager, legacy OS fallback.
a. Git repository (source of truth)
b. CI/CD plane: GitHub Actions
c. IaC plane:
• Nix flakes entrypoint → flake.nix
• Terraform modules under terraform/
• SOPS secrets decrypted into Nix config
• tasks.py orchestrating niche workflows
d. Configuration modules:
• NixOS modules (nixosModules/)
• Home-Manager modules (home-manager/)
• Darwin modules (darwinModules/)
• OpenWRT modules (openwrt/)
• Dev environment modules (devshell/, fish/, zsh/, gdb/)
e. Target nodes:
• Local developer workstation (devshell, interactive shells)
• Remote NixOS hosts (machines/*)
• Cloud services or bots (via terraform/github-bots)
f. Secrets management: SOPS (age keys, group definitions)
Relationships and data flows
• Developer pushes to GitHub → triggers CI workflows (update-deps, auto-merge).
• CI updates flake.lock and may open PRs.
• Developer or CI runs nix flake which:
• Decrypts secrets via SOPS → feeds into Nix evaluation
• Builds Home-Manager profile for user
• Builds NixOS system closures for each machine
• Builds Darwin and OpenWRT configurations
• Builds devshell environments and Nix packages in pkgs/
• Runs Terraform to provision cloud resources and bots
• Outputs:
• System configurations applied via home-manager switch, nixos-rebuild, terraform apply, or manual SSH+flake deploy.
Architectural patterns and principles
• Monorepo: single source for all environments
• Flake-driven reproducibility: pinning all inputs via flake.lock
• Modular config: reusable NixOS modules & Home-Manager modules
• Secrets-as-code: SOPS encryption integrated into Nix
• CI-first: GitHub Actions keep flakes and submodules up-to-date
Detail level
• Per-OS modules (nixosModules/, darwinModules/, openwrt/) into a single “OS modules” component.