tessl i github:YPares/agent-skills --skill nix-profile-managerExpert guidance for agents to manage local Nix profiles for installing tools and dependencies. Covers flakes, profile management, package searching, and registry configuration.
Review Score
66%
Validation Score
13/16
Implementation Score
73%
Activation Score
40%
This skill enables agents to maintain a local Nix profile in a user-provided directory, allowing dynamic installation of tools without requiring system-wide package management or sudo access.
Users should provide a directory in their PATH for the agent to manage, and ensure the AGENT_PROFILE env var contains this directory so the agent knows where it is.
Then the agent just does:
nix profile add --profile "$AGENT_PROFILE" "nixpkgs#git"The --profile flag tells Nix to store the profile metadata in that location.
The bin dir created by Nix in the profile must be in the PATH.
NOTE: on older Nix versions, the add sub-command was called install. Keep this in mind if you get errors saying that "add" does not exist.
A profile is a directory containing:
manifest.json - list of installed packages and their flake referencesbin, lib, share, etc. - folders with symlinks to binaries, libs, docs in the Nix storeWhen you run nix profile add, Nix updates the manifest and recreates symlinks.
A flake is a standardized Nix package collection with:
flake.nix file defining inputs and outputsflake.lockCommon flakes:
nixpkgs - Standard package library (the default registry), usually an alias for github:NixOS/nixpkgs/nixpkgs-unstablegithub:user/repo)git, python311)<flake>#<package>IMPORTANT: In some flakes (like nixpkgs) packages can be nested: <flake>#<scope>.<package>
# Search in nixpkgs flake:
nix search nixpkgs git
# Search in specific (fully qualified) flake
nix search "github:user/repo[/branch]" <package-name>
# Or get a more detailed JSON output
nix search nixpkgs python3 --json | jq '.[].pname'# Add package
nix profile add --profile <profile_path> "<flake>#<package>"
# List installed packages
nix profile list --profile <profile_path>
# Remove by index or element number
nix profile remove --profile <path>/profile 0
# Upgrade packages
nix profile upgrade --profile <profile_path> <package_name>
nix profile upgrade --profile <profile_path> --all # All packages installed in this profile# List available flake aliases
nix registry list
# Add custom registry entry (user-level)
nix registry add myflake github:user/repo/branch# Determine profile path:
echo $AGENT_PROFILE # If not defined, ask the user which profile to use!!
# Search for the package
nix search nixpkgs git
# Add it
nix profile add --profile "$AGENT_PROFILE" "nixpkgs#git"
# Just use it!
tool-cmd ...bin sub-folder should be in PATH: The directory containing the profile must be in $PATH for linked binaries to be accessiblenixpkgs#git resolves to the current nixpkgs version; use github:user/repo/ref#package to pin to specific refsPackage not found:
nix registry list shows available aliasesnix search <flake> <partial-name> to find exact package nameCommand not in PATH after install:
$PATH: echo $PATHls -la $AGENT_PROFILE (adjust path as needed)Permission denied:
references/flakes.md - In-depth flake concepts and GitHub referencesreferences/package-search.md - Advanced package discovery techniquesreferences/profile-internals.md - Profile structure and manifest formatreferences/registry.md - Custom registry configuration and pinningWhen implementing profile management in an agent:
AGENT_PROFILE or function arg--json output for parsing - more reliable than text output