nix-profile-manager
Skill30 starsChanged 10 months agoMITView on GitHub
Expert guidance for agents to manage local Nix profiles for installing tools and dependencies. Covers flakes, profile management, package searching, and registry configuration.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cursor-agent-supervisorSkill
- github-pr-workflowSkill
- jj-todo-workflowSkill
- nushell-plugin-builderSkill
- nushell-usageSkill
- package-npm-nixSkill
- read-bin-docsSkill
- research-assistantSkill
- searxng-searchSkill
- textual-builderSkill
- typst-writerSkill
- working-with-jjSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
When you run nix profile add, Nix updates the manifest and recreates symlinks.
- Distinctive: line 117
Profile locking: Only one agent should modify a profile at a time.
- Very specific: line 123
Ensure flake name is correct: nix registry list shows available aliases
- Very specific: line 124
Search with nix search <flake> <partial-name> to find exact package name
- Very specific: line 127
Check profile directory is in $PATH: echo $PATH
- Very specific: line 128
Verify $AGENT_PROFILE was created: ls -la $AGENT_PROFILE (adjust path as needed)
- Distinctive: line 142
When implementing profile management in an agent:
- Distinctive: line 145
Always search before installing: - verify package exists and name is exact
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Nix Profile Manager for Agents
Overview
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.
Quick Start: Setting Up a Local Profile
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.
Core Concepts
Profiles
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 store
When you run nix profile add, Nix updates the manifest and recreates symlinks.
Flakes
A flake is a standardized Nix package collection with:
- A
flake.nixfile defining inputs and outputs - Deterministic versioning via
flake.lock - Multiple output schemes (packages, overlays, modules, etc.)
Common flakes:
nixpkgs- Standard package library (the default registry), usually an alias forgithub:NixOS/nixpkgs/nixpkgs-unstable- Custom flakes from GitHub (e.g.,
github:user/repo)
Packages vs. Flakes
- Package: A single tool (e.g.,
git,python311) - Flake: A collection of packages, accessed as
<flake>#<package>
IMPORTANT: In some flakes (like nixpkgs) packages can be nested: <flake>#<scope>.<package>
Essential Commands
Search for Packages
# 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'Manage Profile
# 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 profileRegistry Management
# List available flake aliases
nix registry list
# Add custom registry entry (user-level)
nix registry add myflake github:user/repo/branchGeneral Workflow
# 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 ...Important Details
- Profile path
binsub-folder should be in PATH: The directory containing the profile must be in$PATHfor linked binaries to be accessible - Flake references are immutable:
nixpkgs#gitresolves to the current nixpkgs version; usegithub:user/repo/ref#packageto pin to specific refs - Profile locking: Only one agent should modify a profile at a time; locking is not automatic
- Store links don't expire: Nix store paths remain valid even if the flake changes; profiles maintain old package paths if needed
Troubleshooting
Package not found:
- Ensure flake name is correct:
nix registry listshows available aliases - Search with
nix search <flake> <partial-name>to find exact package name
Command not in PATH after install:
- Check profile directory is in
$PATH:echo $PATH - Verify $AGENT_PROFILE was created:
ls -la $AGENT_PROFILE(adjust path as needed)
Permission denied:
- Local profiles DO NOT require sudo. Report to user in case of permission problems
References
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 pinning
For Agent Implementation
When implementing profile management in an agent:
- Accept profile path as environment variable or parameter - e.g.,
AGENT_PROFILEor function arg - Always search before installing - verify package exists and name is exact
- Use
--jsonoutput for parsing - more reliable than text output - Handle errors gracefully - packages may not exist in all flakes
- Notify about profile modifications - help users track what was installed
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

