devenv
Use this when working in a project with devenv.nix, or when devenv.sh development environment setup, services, dependencies, or Nix packages are relevant.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use this when working in a project with devenv.nix, or when devenv.sh development environment setup, services, dependencies, or Nix packages are relevant.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Write clean, readable Pythonic code. Use this skill any time you write or change a Python file.
Analyze Hacker News thread sentiment from a provided HN thread URL.
Builds Python components using the compone framework for type-safe HTML/XML/RSS generation. Use when working with compone, creating Python components, generating markup in Python, or building framework-agnostic component libraries.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
基于 SOC 职业分类
| name | devenv |
| description | Use this when working in a project with devenv.nix, or when devenv.sh development environment setup, services, dependencies, or Nix packages are relevant. |
Create fast, declarative, reproducible development environments using devenv.sh powered by Nix. Official docs: https://devenv.sh
For setting up specific programming languages, services, package managers, see:
devenv init
This creates:
devenv.yaml - Input configurationdevenv.nix - Environment definition (where you configure everything).envrc - direnv integration.gitignore - Ignores devenv artifactsRemove comments from .gitignore after init.
The generated .envrc from devenv init works as-is now; you no longer need
the old task-running workaround.
Edit devenv.yaml and replace the inputs section:
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
This gives access to the latest packages from nixpkgs.
Add system packages to your environment:
{ pkgs, ... }: {
packages = with pkgs; [
just # always add this
postgresql # For psql CLI
redis # For redis-cli
];
}
Search for packages:
devenv search <package-name>
Only works after devenv init
After changing inputs:
devenv update
This updates devenv.lock with pinned versions.
IMPORTANT: ALWAYS run devenv build after editing devenv.nix to make sure the configuration is working.
Fix any problems that occurs during build.
{
env = {
MY_VAR = "value";
PYTHONUNBUFFERED = "1";
};
}
devenv init - Initialize new environmentdevenv shell - Enter development shelldevenv up - Start services and processes (foreground)devenv up -d - Start services in backgrounddevenv processes stop - Stop all processesdevenv test - Run testsdevenv update - Update dependencies from devenv.yamldevenv search <pkg> - Search for packagesdevenv info - Show environment infoKey files devenv manages:
devenv.nix - Your environment configuration (commit this)devenv.yaml - Input sources (commit this)devenv.lock - Pinned versions (commit this).envrc - direnv integration (commit this).devenv/ - Build artifacts (don't commit){ pkgs, config, ... }: {
# Python with uv
languages.python = {
enable = true;
version = "3.12";
uv = {
enable = true;
sync.enable = true;
};
venv.enable = true; # Activate the synced virtualenv in shell/direnv
libraries = with pkgs; [ postgresql stdenv.cc.cc.lib ];
};
# Services
services = {
postgres = {
enable = true;
package = pkgs.postgresql_15;
initialDatabases = [{ name = "app"; }];
};
redis.enable = true;
};
# Packages
packages = with pkgs; [
git
postgresql
redis
];
# Environment
env = {
DATABASE_URL = "postgresql://localhost/app";
REDIS_URL = "redis://localhost:6379";
};
# Processes (devenv 2.0 native process manager with dependency support)
processes = {
web = {
exec = "python manage.py runserver 0.0.0.0:8000";
after = [ "devenv:processes:postgres" "devenv:processes:redis" ];
};
worker = {
exec = "celery -A myapp worker";
after = [ "devenv:processes:redis" ];
};
};
# Scripts
scripts = {
migrate = {
exec = "python manage.py migrate";
description = "Run migrations";
};
test = {
exec = "pytest";
description = "Run tests";
};
};
# Enable dotenv
dotenv.enable = true;
}
Search for it:
devenv search <package>
Ensure using nixpkgs-unstable in devenv.yaml.
For Python projects using uv, set both languages.python.uv.sync.enable = true and languages.python.venv.enable = true. uv.sync installs dependencies; venv.enable activates the virtualenv so python and console scripts come from the project environment.
Add native dependencies to languages.python.libraries:
{
languages.python.libraries = with pkgs; [
postgresql # For psycopg2
stdenv.cc.cc.lib
];
}