Install nix-dev-shell plugin for DeepSeek Harness
Input: code repo with flake.nix → Process: install plugin and restart DSH → Output: bash commands automatically run inside Nix devShell
- Who
- Developers using DeepSeek Harness with Nix flake-based dev environments
- You get
- Harness bash commands automatically enter the matching Nix devShell without manual nix develop
- You need
- DeepSeek
Constraints
Prerequisites: DeepSeek Harness and Nix installed; workspace contains a valid flake.nix. Plugin installation requires restarting the DSH process. Default env mode has no per-command overhead; wrap mode has full semantic fidelity but adds ~0.3–1s per command. NIX_CACHE_HOME is auto-injected inside sandboxed workspaces to prevent nix failures from read-only ~/.cache.
What they did
Author running-grass wrote and published dsh-nix-dev-shell, a Host plugin for DeepSeek Harness. The plugin decorates the ctx.shell instance's execute method to automatically locate flake.nix in the working directory or its ancestors, then injects the corresponding devShell environment into spawned processes.
How it went
Author reports: default env mode captures environment once and reuses it with no per-command nix startup overhead; wrap mode matches manual nix develop semantics but adds ~0.3–1s per command. Cold cache (fresh temp directory) yields ~540ms for nix develop --command true; hot cache (persistent workspace directory) yields ~125ms. A 251-step, 9.5-hour session produced only 2 system/message entries. (author_report, not tested by this site)
Worth knowing
Security boundary: ancestor lookup means any flake.nix in $HOME or parent directories affects all bash commands in its subtree; shellHook runs on first command, so only enable in trusted repositories. Capture helper inherits the caller's sandbox policy without extra privileges. Known limitations: only covers ctx.shell (bash tool, subagents, hooks, background jobs); PTY terminal subsystem and tmux sessions are not covered. env mode does not pass functions, aliases, or set -x state; incompatible with plugins that replace the executor. NIX_CACHE_HOME is auto-injected for workspace-write sandboxes to prevent nix failures from read-only ~/.cache, but not injected under danger-full-access. Host SHELL is preserved; plugin always explicitly calls bash.
Steps
Install the nix-dev-shell plugin
Run the install command in terminal to add the plugin to DSH's web profile.
Execution prompt · Source text。Terminal command to install the plugin
dsh plugin --profile web add github:running-grass/dsh-nix-dev-shell
Restart the DSH process
Host plugins are JS modules; you must restart the DSH process after install or update for new code to load.
Verify Nix devShell is active
Run commands in a directory containing flake.nix or its subdirectories to confirm environment variables and tool paths come from the Nix store; run commands in directories without flake.nix (e.g. $HOME) to confirm native environment is preserved.
Execution prompt · Source text。Verify devShell status; expected output: impure
echo $IN_NIX_SHELL
Execution prompt · Source text。Verify tools resolve to /nix/store/… (should not exist on host)
command -v ocaml dune
Execution prompt · Source text。Verify sandbox-writable nix cache directory is injected
echo $NIX_CACHE_HOME
Prompt you can copy
Reference prompt · Editorial suggestion。Confirm the destination, input variables and output format before use.
This block is the prompt. Ads are never placed here.
No prompt needed — just follow the steps.
Execute install command, restart DSH, then verify; no additional prompt required.
Source
安装 nix-dev-shell,让 DSH 在 nix shell 里跑命令 · running-grass · GitHub · 2026-10-31T09:07:36Z
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.