This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
bella-nix is a NixOS configuration management system using Nix flakes for declarative, reproducible infrastructure. It manages multiple hosts with shared, composable modules.
Enter the development shell (required for all commands):
nix developThe dev shell automatically loads Nushell with the bnix commands:
bnix host bootstrap <hostname> # Bootstrap new machine (formats disk, sets up Tailscale)
bnix host template <hostname> # Create host template files
bnix host deploy # Deploy config to existing host via deploy-rs
bnix host delete <hostname> # Remove a host from the repoDirect Nix commands:
nix flake check # Validate flake structure
nix build .#nixosConfigurations.<hostname>.config.system.build.toplevelAll modules expose flake.modules.nixos.<name> and are auto-loaded by haumea from src/modules/. Every host automatically imports the base module plus disko and agenix.
Module hierarchy:
base/- Core system defaults (user, home-manager, nix settings, boot)profiles/- Composable feature groups that bundle related modules:cli- Shell tools (nushell, helix, git, etc.)desktop- GUI environment (niri, wezterm, stylix, zen browser)server- Server-specific configdeployer/deployable- Remote deployment capabilities
programs/- Individual application configurationsservices/- System services (tailscale, secrets, preservation)system/- Low-level system config (bluetooth, zram, localization)
Hosts live in src/hosts/<hostname>/ with:
configuration.nix- Main config, imports modules from profiles/programsdisk-configuration.nix- Disko disk layouthardware-configuration.nix- Hardware-specific settingsfacter.json- Hardware facts (generated by nixos-facter)ssh_host_ed25519_key.pub- Host public key for agenix secrets
Module definition pattern (all modules follow this):
{inputs, ...}: {
flake.modules.nixos.<moduleName> = {
imports = with inputs.self.modules.nixos; [ ... ];
# configuration
};
}Host configuration imports profiles and individual modules:
{inputs}: { config, lib, ... }: {
imports = with inputs.self.modules.nixos; [
cli
desktop
discord
# ...
];
}flake.nix- Flake definition, inputs, module loading logicvars.nix- Global variables (username, email, tailscale domain)src/modules/base/constants.nix- ExposessystemConstantsoption set
Key flake inputs: nixpkgs (unstable), home-manager, niri-flake (Wayland compositor), stylix (theming), disko (disk management), agenix/agenix-rekey (secrets), deploy-rs (deployment), preservation (state persistence).
The user's default shell is Nushell. When suggesting shell commands, use Nushell syntax instead of Bash.