Files
dotfiles/.github/copilot-instructions.md
Menno van Leeuwen 2947ea8060
All checks were successful
Ansible Lint Check / check-ansible (push) Successful in 7s
Nix Format Check / check-format (push) Successful in 43s
Python Lint Check / check-python (push) Successful in 7s
Upgrade to Nix 25.11 and migrate configs
Update flake inputs and flake.lock to Nix/nixpkgs and home-manager
release 25.11; bump home.stateVersion and setup script NIXOS_RELEASE.

Migrate git config to new Home Manager layout (programs.git.settings,
aliases under settings.alias), adjust delta config path, and reorganize
SSH into matchBlocks with enableDefaultConfig=false to avoid global
leaks. Simplify snapd session variable handling to avoid recursion.

Misc: tweak Dashy title, replace du-dust->dust and plex-media-player ->
plex-desktop, remove unused hostname arg, and add GitHub Copilot
instructions document.
2025-12-11 16:28:22 +01:00

2.9 KiB

GitHub Copilot Instructions

Project Overview

This repository manages system configurations (dotfiles) using a hybrid approach:

  • Nix (Home Manager): Manages user environment, CLI tools, and dotfile symlinks.
  • Ansible: Manages system-level configurations, services (Docker containers), and secrets.
  • Python (dotf): A custom CLI wrapper to orchestrate updates and maintenance.

Architecture

Nix & Home Manager

  • Entry Point: flake.nix defines homeConfigurations for each host (e.g., mennos-desktop, mennos-server).
  • Configuration: home.nix is the main module, conditionally importing from packages/ and server/ or workstation/ based on the isServer flag.
  • Packages: Defined in packages/{common,server,workstation}/packages.nix.

Ansible

  • Playbook: ansible/playbook.yml is the main entry point.
  • Inventory: ansible/inventory.ini defines host groups (workstations, servers). All connections are local.
  • Tasks: Organized in ansible/tasks/:
    • global/: Applied to all hosts.
    • servers/: Applied to server hosts.
    • workstations/: Applied to workstation hosts.
  • Services: Docker services are defined in ansible/tasks/servers/services/.

CLI Tool (dotf)

  • Location: bin/dotf (entry point) and bin/actions/ (logic).
  • Purpose: Abstracts complex home-manager and ansible-playbook commands.

Critical Workflows

Applying Changes

Do not run home-manager or ansible-playbook directly unless debugging. Use the dotf CLI:

  • Update everything: dotf update
  • Update only Home Manager: dotf update --ha
  • Update only Ansible: dotf update --ansible
  • Run specific Ansible tags: dotf update --tags <tag_name> (e.g., dotf update --tags caddy)

Adding Packages

  1. Identify if the package is for common, server, or workstation.
  2. Edit the corresponding packages/<type>/packages.nix.
  3. Add the package name to the home.packages list.

Adding Services (Servers)

  1. Create a new YAML file in ansible/tasks/servers/services/<service_name>/.
  2. Define the Docker container and related configuration.
  3. Ensure the task is imported in ansible/tasks/servers/server.yml (or the relevant parent file).

Conventions & Patterns

  • Secrets: Use 1Password integration. Secrets are fetched via the custom lookup plugin or op CLI.
  • Host-Specific Logic:
    • Nix: Use the isServer argument or check hostname in modules.
    • Ansible: Use when: inventory_hostname in [...] or group-based imports in playbook.yml.
  • Path References: Use {{ playbook_dir }} in Ansible and relative paths in Nix.
  • Python Scripts: Located in bin/, use helpers.functions for common output formatting (printfe).

Key Files

  • flake.nix: Host definitions.
  • home.nix: Main Home Manager config.
  • ansible/playbook.yml: Main Ansible playbook.
  • bin/actions/update.py: The update logic implementation.