feat(python): manage python with uv via nix-ld
This commit is contained in:
@@ -89,6 +89,10 @@ in
|
||||
PYTHONIOENCODING = "UTF-8";
|
||||
PYTHONSTARTUP = "${config.xdg.configHome}/python/startup";
|
||||
PYTHON_HISTFILE = "${config.xdg.cacheHome}/python/history";
|
||||
# Default interpreter uv picks for `uv run`/`uv venv` without an explicit
|
||||
# -p. Pins throwaway REPLs and new projects to one version across machines
|
||||
# (further steered by uv.toml below). Fetched on demand by uv, not Nix.
|
||||
UV_PYTHON = "3.14";
|
||||
# psql / wget / readline configs, XDG-routed (the rc files are declared
|
||||
# via xdg.configFile below).
|
||||
PSQLRC = "${config.xdg.configHome}/psql/rc";
|
||||
@@ -123,6 +127,8 @@ in
|
||||
# finalPackage) — do NOT also list it here, or buildEnv conflicts on the
|
||||
# wrapper binary.
|
||||
nodejs
|
||||
uv # Python: versions, venvs, deps, lockfile. Runs uv-managed
|
||||
# standalone CPython via nix-ld (see modules/nixos.nix).
|
||||
highlight # `ccat` alias: syntax-highlighted cat
|
||||
jq # JSON on the command line (scripts, ad-hoc inspection)
|
||||
libreoffice
|
||||
@@ -144,6 +150,13 @@ in
|
||||
xdg.configFile = {
|
||||
"python/startup".source = ./assets/python-startup.py;
|
||||
|
||||
# uv global config. "managed" = always use uv's own CPython, never a
|
||||
# system/Nix python — keeps behaviour reproducible regardless of what else
|
||||
# is on PATH. Default version comes from UV_PYTHON above.
|
||||
"uv/uv.toml".text = ''
|
||||
python-preference = "managed"
|
||||
'';
|
||||
|
||||
# psql: unlimited, per-database history file (kept out of $HOME).
|
||||
"psql/rc".text = ''
|
||||
\set HISTFILE ${config.xdg.cacheHome}/psql/history-:DBNAME
|
||||
@@ -325,6 +338,8 @@ in
|
||||
g = "git";
|
||||
e = editor;
|
||||
v = editor;
|
||||
# Throwaway REPL/scripts as if `python` were global; resolves to UV_PYTHON.
|
||||
python = "uv run python";
|
||||
};
|
||||
|
||||
# Interactive bits with no first-class HM option: prompt, autocd,
|
||||
|
||||
Reference in New Issue
Block a user