Files
ya-vla/devenv.nix

88 lines
1.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
pkgs,
lib,
config,
inputs,
...
}: {
packages = with pkgs; [
mujoco
linuxHeaders
];
languages.c.enable = true;
languages.python = {
enable = true;
version = "3.12";
uv.enable = true;
venv.enable = true;
libraries =
(with pkgs; [
zlib
vulkan-loader
# OpenGL/EGL + DRI
libGL
libGLU
libGLX
libglvnd
mesa
egl-wayland
# Wayland
wayland
libxkbcommon
# Debug Toolseglinfo/glxinfo
mesa-demos
])
++ (
with pkgs.xorg; [
libXScrnSaver
libXrender
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libX11
libXcomposite
libxshmfence
libXtst
libxcb
]
);
};
env = {
CPATH = "${pkgs.linuxHeaders}/include";
KERNEL_DIR = "${pkgs.linuxHeaders}/include";
};
# 创建 .venv 软链接到 .devenv/state/venv
scripts.linkVenv.exec = ''
if [ -L ".venv" ] || [ ! -e ".venv" ]; then
rm -f ".venv" 2>/dev/null || true
ln -s ".devenv/state/venv" ".venv"
echo "Created symlink: .venv -> .devenv/state/venv"
elif [ -e ".venv" ]; then
echo "Warning: .venv exists and is not a symlink. Not replacing it."
echo "If you want to replace it with a symlink, please remove it manually first."
fi
'';
# https://devenv.sh/basics/
enterShell = ''
export NIX_LD_LIBRARY_PATH="$NIX_LD_LIBRARY_PATH:${lib.makeLibraryPath [ pkgs.linuxHeaders ]}";
export LD_LIBRARY_PATH="$NIX_LD_LIBRARY_PATH";
echo "NIX_LD_LIBRARY_PATH set to $NIX_LD_LIBRARY_PATH"
echo "LD_LIBRARY_PATH set to $LD_LIBRARY_PATH"
echo "CPATH set to $CPATH"
echo "KERNEL_DIR set to $KERNEL_DIR"
linkVenv
'';
}