Flake Apps
This reference documents the flake apps provided by the infra repository.
These apps wrap nh (nix-helper) commands for ergonomic configuration activation.
Overview
Section titled “Overview”| App | Purpose | Wraps | Definition |
|---|---|---|---|
darwin | Activate darwin configuration | nh darwin switch | modules/darwin/app.nix |
os | Activate NixOS configuration | nh os switch | modules/nixos/app.nix |
home | Activate home-manager configuration | nh home switch | modules/home/app.nix |
default | Alias for home | - | modules/home/app.nix |
Dispatch chain
Section titled “Dispatch chain”The typical activation flow uses justfile recipes that call flake apps:
just activate └── just activate-darwin hostname └── nix run .#darwin -- hostname . [FLAGS] └── nh darwin switch . -H hostname [FLAGS] └── darwin-rebuild switch --flake .#hostnamedarwin
Section titled “darwin”Builds and activates a nix-darwin configuration for the specified hostname.
Usage:
# Remote usage (default flake)nix run github:cameronraysmith/vanixiets#darwin -- <hostname>
# Local developmentnix run .#darwin -- <hostname> .nix run .#darwin -- <hostname> . --dryArguments:
| Argument | Required | Description |
|---|---|---|
hostname | Yes | Darwin machine hostname (e.g., stibnite, blackphos) |
flake | No | Flake path (default: remote GitHub repo) |
NH_FLAGS | No | Flags passed to nh: --dry, --verbose, --ask |
Examples:
# Preview changes without applyingnix run .#darwin -- stibnite . --dry
# Apply with verbose outputnix run .#darwin -- blackphos . --verbose
# Ask for confirmation before applyingnix run .#darwin -- stibnite . --askJustfile equivalent: just activate-darwin <hostname> [FLAGS]
Builds and activates a NixOS configuration for the specified hostname.
Usage:
# Remote usage (default flake)nix run github:cameronraysmith/vanixiets#os -- <hostname>
# Local developmentnix run .#os -- <hostname> .nix run .#os -- <hostname> . --dryArguments:
| Argument | Required | Description |
|---|---|---|
hostname | Yes | NixOS machine hostname (e.g., cinnabar, electrum) |
flake | No | Flake path (default: remote GitHub repo) |
NH_FLAGS | No | Flags passed to nh: --dry, --verbose, --ask |
Examples:
# Preview changes on NixOS servernix run .#os -- cinnabar . --dry
# Apply configurationnix run .#os -- cinnabar .Justfile equivalent: just activate-os <hostname> [FLAGS]
Builds and activates a home-manager configuration for the specified user. This is also the default app for the flake.
Usage:
# Remote usage (as default app)nix run github:cameronraysmith/vanixiets -- <username>
# Explicit app referencenix run github:cameronraysmith/vanixiets#home -- <username>
# Local developmentnix run .#home -- <username> .nix run . -- <username> . --dryArguments:
| Argument | Required | Description |
|---|---|---|
username | Yes | Username for home-manager (e.g., crs58, cameron) |
flake | No | Flake path (default: remote GitHub repo) |
NH_FLAGS | No | Flags passed to nh: --dry, --verbose, --ask |
Configuration path:
The app constructs the full home-manager configuration path:
homeConfigurations.<system>.<username>.activationPackageFor example, on aarch64-darwin for user crs58:
homeConfigurations.aarch64-darwin.crs58.activationPackageExamples:
# Preview home-manager changesnix run . -- crs58 . --dry
# Apply home-manager configurationnix run .#home -- crs58 .Justfile equivalent: just activate-home <username> [FLAGS]
default
Section titled “default”The default app is an alias for home, enabling ergonomic usage:
# These are equivalent:nix run github:cameronraysmith/vanixiets -- crs58nix run github:cameronraysmith/vanixiets#home -- crs58This makes home-manager activation the most convenient operation since it’s the most common use case.
Common flags
Section titled “Common flags”All apps pass through flags to nh, which supports:
| Flag | Description |
|---|---|
--dry | Preview changes without applying (dry run) |
--ask | Ask for confirmation before applying changes |
--verbose | Show verbose output during build and activation |
These can be combined:
nix run .#darwin -- stibnite . --dry --verboseImplementation notes
Section titled “Implementation notes”All apps use the same pattern:
- Parse hostname/username and optional flake path
- Default to remote GitHub repository if no flake path provided
- Pass remaining arguments to
nhas flags - Always include
--accept-flake-configfor nh’s internal nix calls - Use
execto replace the shell process with nh
The apps use nh (nix-helper) rather than direct darwin-rebuild, nixos-rebuild, or home-manager commands because nh provides:
- Unified interface across all configuration types
- Better diff output showing what will change
- Automatic sudo elevation when needed
- Cleaner progress output
See also
Section titled “See also”- Justfile Recipes - Recipes that wrap these apps
- CI Jobs - How CI validates configurations
- Getting Started - Initial setup guide