Skip to content

Flake Apps

This reference documents the flake apps provided by the infra repository. These apps wrap nh (nix-helper) commands for ergonomic configuration activation.

AppPurposeWrapsDefinition
darwinActivate darwin configurationnh darwin switchmodules/darwin/app.nix
osActivate NixOS configurationnh os switchmodules/nixos/app.nix
homeActivate home-manager configurationnh home switchmodules/home/app.nix
defaultAlias for home-modules/home/app.nix

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 .#hostname

Builds and activates a nix-darwin configuration for the specified hostname.

Usage:

Terminal window
# Remote usage (default flake)
nix run github:cameronraysmith/vanixiets#darwin -- <hostname>
# Local development
nix run .#darwin -- <hostname> .
nix run .#darwin -- <hostname> . --dry

Arguments:

ArgumentRequiredDescription
hostnameYesDarwin machine hostname (e.g., stibnite, blackphos)
flakeNoFlake path (default: remote GitHub repo)
NH_FLAGSNoFlags passed to nh: --dry, --verbose, --ask

Examples:

Terminal window
# Preview changes without applying
nix run .#darwin -- stibnite . --dry
# Apply with verbose output
nix run .#darwin -- blackphos . --verbose
# Ask for confirmation before applying
nix run .#darwin -- stibnite . --ask

Justfile equivalent: just activate-darwin <hostname> [FLAGS]

Builds and activates a NixOS configuration for the specified hostname.

Usage:

Terminal window
# Remote usage (default flake)
nix run github:cameronraysmith/vanixiets#os -- <hostname>
# Local development
nix run .#os -- <hostname> .
nix run .#os -- <hostname> . --dry

Arguments:

ArgumentRequiredDescription
hostnameYesNixOS machine hostname (e.g., cinnabar, electrum)
flakeNoFlake path (default: remote GitHub repo)
NH_FLAGSNoFlags passed to nh: --dry, --verbose, --ask

Examples:

Terminal window
# Preview changes on NixOS server
nix run .#os -- cinnabar . --dry
# Apply configuration
nix 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:

Terminal window
# Remote usage (as default app)
nix run github:cameronraysmith/vanixiets -- <username>
# Explicit app reference
nix run github:cameronraysmith/vanixiets#home -- <username>
# Local development
nix run .#home -- <username> .
nix run . -- <username> . --dry

Arguments:

ArgumentRequiredDescription
usernameYesUsername for home-manager (e.g., crs58, cameron)
flakeNoFlake path (default: remote GitHub repo)
NH_FLAGSNoFlags passed to nh: --dry, --verbose, --ask

Configuration path:

The app constructs the full home-manager configuration path:

homeConfigurations.<system>.<username>.activationPackage

For example, on aarch64-darwin for user crs58:

homeConfigurations.aarch64-darwin.crs58.activationPackage

Examples:

Terminal window
# Preview home-manager changes
nix run . -- crs58 . --dry
# Apply home-manager configuration
nix run .#home -- crs58 .

Justfile equivalent: just activate-home <username> [FLAGS]

The default app is an alias for home, enabling ergonomic usage:

Terminal window
# These are equivalent:
nix run github:cameronraysmith/vanixiets -- crs58
nix run github:cameronraysmith/vanixiets#home -- crs58

This makes home-manager activation the most convenient operation since it’s the most common use case.

All apps pass through flags to nh, which supports:

FlagDescription
--dryPreview changes without applying (dry run)
--askAsk for confirmation before applying changes
--verboseShow verbose output during build and activation

These can be combined:

Terminal window
nix run .#darwin -- stibnite . --dry --verbose

All apps use the same pattern:

  1. Parse hostname/username and optional flake path
  2. Default to remote GitHub repository if no flake path provided
  3. Pass remaining arguments to nh as flags
  4. Always include --accept-flake-config for nh’s internal nix calls
  5. Use exec to 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