Synthèse automatique
Guide interactif pour créer un dépôt de dotfiles basé sur Nix à partir de zéro, en utilisant une architecture de référence.
Points forts
- Approche pas à pas interactive adaptée à l'environnement détecté
- Utilise un template nixos-unified officiel pour une base standard
- Couvre l'installation de Nix, la configuration système et l'ajout de modules
Limites
- Nécessite une connaissance de base de Nix et du terminal
- Ne gère pas les configurations personnalisées avancées ni les flocons Nix
- Peut être long à exécuter en raison de l'étape d'activation
Quand vous souhaitez structurer vos dotfiles avec Nix pour la première fois.
Si vous avez déjà une configuration Nix fonctionnelle et souhaitez seulement y ajouter un module.
Analyse de sécurité
SûrThe skill guides a user through creating Nix dotfiles using local template scripts and standard Nix commands. It does not instruct the execution of any destructive, exfiltrating, or obfuscated actions. The discovery script only gathers local environment information for configuration, and all generated code is transparent and user-reviewed. No external downloads or unsafe commands are invoked.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
I want to set up my dotfiles using Nix from scratch. Use this repo as a reference architecture.Guide me through creating a nixos-unified dotfiles repository. I have a fresh Linux install.I'd like to move away from chezmoi to Nix for my dotfiles on macOS. Help me build a new repo.name: nix-dotfiles description: Guides a developer through building their own nixos-unified dotfiles repository from scratch, using this repo as a reference architecture. Use when someone wants to set up Nix-based system configuration or dotfiles management.
Build Your Own Nix Dotfiles
An interactive skill that guides you through building a nixos-unified dotfiles repository from scratch, using this repo as a reference architecture.
Environment Discovery
The following was detected automatically:
!`${CLAUDE_SKILL_DIR}/scripts/discover.sh`
Instructions
You are guiding a developer through creating their own Nix-based dotfiles from scratch. This repo (scotttrinh/dotfiles) is the reference — the user is NOT forking it, they are building their own.
Work through the phases below in order. Each phase is interactive: ask questions, run discovery commands, and generate files incrementally. Do not dump everything at once.
Use the discovery output above to pre-fill values and suggest sensible defaults throughout.
Phase 1: Confirm Discovery
Summarize the detected environment to the user. Confirm:
- OS and architecture
- Whether Nix is installed (if not, guide them to install it first via the Determinate installer)
- Username and hostname (these become file names in the config)
- What tools are already installed (to suggest modules later)
Phase 2: Identity Setup
Ask the user for:
- Full name — for git commits (e.g., "Jane Smith")
- Email — for git config (e.g., "jane@example.com")
- GitHub username — for the repository name
Store these for use in generated Nix code.
Phase 3: Bootstrap from Template
Use the official nixos-unified template to scaffold the repo. Pick the template based on the detected OS:
- macOS (Darwin):
macos - Linux (NixOS):
linux - Home-manager only (no system config):
home
Run the bootstrap script:
${CLAUDE_SKILL_DIR}/scripts/bootstrap.sh <template> <output-dir>
For example: ${CLAUDE_SKILL_DIR}/scripts/bootstrap.sh macos ~/dotfiles
After bootstrapping, the template provides the standard nixos-unified structure. Walk the user through the generated files and customize them:
configurations/home/<username>.nix— setme.username,me.fullname,me.emailfrom Phase 2configurations/darwin/<hostname>.nix(ornixos/) — setnixpkgs.hostPlatform,networking.hostName,system.primaryUsermodules/home/— review what the template provides, then enhance with modules from Phase 4
See templates.md for reference versions of each file if the template needs adjustment.
Have the user run nix run .#activate to verify the base config works before adding modules.
Phase 4: Incremental Module Interview
After the minimal config is working, walk through each category below one at a time. For each:
- Ask if the user wants it
- If yes, generate the module file(s)
- Explain what the module does
- Have them activate and verify
Use discovery results to suggest sensible defaults (e.g., if ghostty is installed, suggest configuring it).
Category: Packages
Common development packages. Ask what languages and tools they use.
# modules/home/packages.nix
{ pkgs, ... }:
{
home.packages = with pkgs; [
ripgrep
fd
tree
jq
less
];
programs = {
bat.enable = true;
fzf.enable = true;
jq.enable = true;
btop.enable = true;
};
}
Extend home.packages based on what the user needs:
- Node.js:
nodejs_24 corepack_24 - Python:
python312 uv - Rust: add
rust-overlayinput, thenrust-bin.stable.latest.default - Go:
go
Category: Direnv
Automatic environment loading for Nix projects. Strongly recommend this for any Nix user.
# modules/home/direnv.nix
{ ... }:
{
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
config.global.hide_env_diff = true;
};
}
Category: Editor
Ask which editor they use. Only generate the module for their choice.
Emacs:
# modules/home/emacs.nix
{ pkgs, ... }:
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
vterm
treesit-grammars.with-all-grammars
];
};
}
Neovim:
# modules/home/neovim.nix
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
}
VS Code / Cursor: These are typically installed via Homebrew casks on macOS. Add to the darwin module's homebrew.casks list rather than a home-manager module.
Category: Terminal
Ask which terminal they use. Terminals on macOS are typically Homebrew casks.
Ghostty (recommended — already a cask in reference config):
Add "ghostty" to homebrew.casks in modules/darwin/default.nix. Configuration lives at ~/.config/ghostty/config — optionally manage it via home.file.
Kitty:
# modules/home/kitty.nix
{ ... }:
{
programs.kitty = {
enable = true;
settings = {
font_size = 14;
window_padding_width = 4;
};
};
}
Category: Window Manager (macOS only)
AeroSpace — tiling window manager. Uses a TOML config file.
# modules/home/aerospace/default.nix
{ ... }:
{
home.file.".config/aerospace/aerospace.toml".source = ./aerospace.toml;
}
Create modules/home/aerospace/aerospace.toml with the user's preferred keybindings. The reference repo has a working config to draw from.
Category: Homebrew Extras (macOS only)
Ask what GUI apps they want managed via Homebrew. Add to homebrew.casks in the darwin module or the host-specific config.
Common casks: "1password", "slack", "discord", "raycast", "orbstack", "docker".
Category: AI/LLM Tools
Ask if they use any AI coding tools. For simple setups (no secrets), install via packages:
# Add to modules/home/packages.nix:
# First add the input to flake.nix:
# llm-agents.url = "github:numtide/llm-agents.nix";
# Then in packages.nix:
home.packages = [
flake.inputs.llm-agents.packages.${pkgs.system}.claude-code
];
For advanced setups with API keys and custom settings, follow the option-driven pattern from the reference repo's modules/home/claude-code/ module.
Category: Secrets Management
Only offer this if the user has API keys or tokens to manage. Requires sops-nix and age.
- Add inputs to
flake.nix:
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
- Create
modules/home/sops.nix:
{ flake, config, ... }:
{
imports = [ flake.inputs.sops-nix.homeManagerModules.sops ];
sops.age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
}
- Generate an age key:
mkdir -p ~/.config/sops/age
age-keygen -o ~/.config/sops/age/keys.txt
- Create
.sops.yamlwith the public key andsecrets.yamlwith encrypted values.
Walk the user through each step — secrets management is the most error-prone part.
Phase 5: Per-Machine Overrides
If the user has multiple machines (e.g., work + personal), show how to add machine-specific config. The pattern is:
# configurations/darwin/<hostname>.nix
home-manager.users.<username> = { lib, config, ... }: {
# Machine-specific packages
home.packages = with pkgs; [ git-lfs ];
# Machine-specific option overrides
someModule.someSetting = "override-value";
};
Create a new configurations/darwin/<hostname>.nix for each machine. The base user config in configurations/home/<username>.nix is shared across all machines.
Phase 6: Verification
After all modules are set up:
- Run
nix fmtto format all Nix files - Run
nix flake checkto verify evaluation - Run
nix run .#activateto apply the full configuration - Verify key programs are available:
which git,which zsh, etc. - Suggest committing and pushing to GitHub
Reference Patterns
These patterns from the reference repo should be followed when generating Nix code. For detailed templates, see templates.md.
Auto-Import
Every .nix file (and subdirectory with default.nix) in modules/home/ is automatically imported. No manual import list to maintain.
Option-Driven Modules
For complex modules, define typed options and use mkIf for conditional config:
{ config, lib, ... }:
let cfg = config.myModule; in
{
options.myModule = {
enable = lib.mkEnableOption "my module";
setting = lib.mkOption {
type = lib.types.str;
default = "value";
description = "Description of the setting";
};
};
config = lib.mkIf cfg.enable {
home.packages = [ /* ... */ ];
};
}
Flake Input Access
Modules access flake inputs via the flake argument:
{ flake, pkgs, ... }:
let
inherit (flake) inputs;
in
{
home.packages = [
inputs.some-flake.packages.${pkgs.system}.default
];
}
Configuration Hierarchy
configurations/darwin/<host>.nix -> system-level (macOS)
configurations/nixos/<host>.nix -> system-level (Linux)
configurations/home/<user>.nix -> user-level (shared across machines)
host.nix: home-manager.users.<user> -> per-machine user overrides
Activation
nix run .#activate # Apply configuration
nix run .#update # Update flake.lock
nix fmt # Format all .nix files
nix flake check # Verify evaluation
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/build-your-own-nix-dotfiles-mmh8qrws/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/build-your-own-nix-dotfiles-mmh8qrws' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/build-your-own-nix-dotfiles-mmh8qrws/download' --output '.skill-downloads/build-your-own-nix-dotfiles-mmh8qrws/SKILL.md.part' && mv '.skill-downloads/build-your-own-nix-dotfiles-mmh8qrws/SKILL.md.part' '.skill-downloads/build-your-own-nix-dotfiles-mmh8qrws/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/build-your-own-nix-dotfiles-mmh8qrws/SKILL.md' && test -s '.skill-downloads/build-your-own-nix-dotfiles-mmh8qrws/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/nix-dotfiles' && cp -R '.skill-downloads/build-your-own-nix-dotfiles-mmh8qrws' '.claude/skills/nix-dotfiles'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/build-your-own-nix-dotfiles-mmh8qrws'openskills read 'build-your-own-nix-dotfiles-mmh8qrws'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/build-your-own-nix-dotfiles-mmh8qrws/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.