بنقرة واحدة
nix-shell
Use `nix shell` for ephemeral environments and one-off commands without installing packages globally.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use `nix shell` for ephemeral environments and one-off commands without installing packages globally.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Workflow guidelines for durable Pi package, extension, skill, prompt, and theme changes in Gabs's Nix-managed Pi config. Use before editing ~/.pi/agent or home/gabriel/features/pi.
Manage Gabs's todos (todoman), appointments (khal), contacts (khard), notes (~/Atelier/notes), and email (~/Mail)
Fetch a web page or HTTP(S) URL and read it as text/Markdown. Use when you need the full content of a URL — e.g. a search result from web_search, a changelog, docs, or an API response.
REQUIRED for any VCS operation in jj repositories (`.jj/` directory present). Activate on: commit, push, pull, status, diff, log, branch/bookmark, PR, merge, rebase, stash, conflict, undo, or any version-control task. In jj repos, use jj exclusively — running git commands can corrupt or confuse state.
| name | nix-shell |
| description | Use `nix shell` for ephemeral environments and one-off commands without installing packages globally. |
The canonical form for running a single command in a temporary nix environment:
nix shell nixpkgs#<package> -c <command> [args...]
The -c flag tells nix shell to exec the following arguments as a command.
Everything after -c is passed straight to the shell, so quoting works naturally.
DO NOT, under any circumstances, double-quote "<command> [args...]" together. This will cause bash to treat the entire thing as the executable name:
nix shell nixpkgs#python3 -c "python3 foo.py arg1 arg2"nix shell nixpkgs#python3 -c python3 foo.py arg1 arg2nix shell nixpkgs#jq -c jq '.foo' file.json
nix shell nixpkgs#yq -c yq eval '.foo.bar' file.yml
nix shell nixpkgs#httpie -c https httpbin.org/json
For ephemeral environments with multiple tools (where the "command" is sh):
nix shell nixpkgs#jq nixpkgs#yq nixpkgs#curl -c sh
This drops you into an interactive shell with all three available. Exit with exit or ^D.
nix run insteadnix run is more concise when you just need to run a tool's default binary and
don't need to control the invoked command name:
nix run nixpkgs#jq -- -r '.name' file.json
Use nix run when:
-- is passed to the binary)Use nix shell when:
nixpkgs#nodePackages.prettier)nix shell nixpkgs#python3Packages.<name> doesn't work — the Python binary
won't see the package. Instead, use nix eval --apply to get the
python3.withPackages derivation path, then ask nix shell for its out output:
nix shell "$(
nix eval nixpkgs#python3 --raw --apply \
'py: (py.withPackages (p: [ p.requests ])).drvPath'
)^out" -c python3 -c '
import requests
print(requests.get("https://httpbin.org/json").json()["slideshow"]["title"])
'
For multiple packages/tools, add them to the same shell:
nix shell "$(
nix eval nixpkgs#python3 --raw --apply \
'py: (py.withPackages (p: [ p.playwright ])).drvPath'
)^out" \
nixpkgs#chromium \
-c python3 -c '
from playwright.sync_api import sync_playwright
print("works")
'
Important details:
.drvPath with ^out; plain .outPath may be unrealized.^out outside the command substitution, as part of the installable path.nix shell, use
nix build --no-link --print-out-paths to realize the output first.nix search nixpkgs <query>
If a command fails with "command not found", wrap it with nix shell instead of installing the package globally:
# instead of: apt install jq (never)
# instead of: nix profile install nixpkgs#jq (avoid for one-offs)
nix shell nixpkgs#jq -c jq '.foo' data.json