From 8df0eff0a21765f3697143ea8883902f7ff4659d Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 3 May 2026 23:49:20 +0200 Subject: [PATCH] python3Packages.mkPythonEditablePackage: keep attrs structured --- pkgs/development/interpreters/python/editable.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/python/editable.nix b/pkgs/development/interpreters/python/editable.nix index f401d1e7f7d5..102a31ac1d4c 100644 --- a/pkgs/development/interpreters/python/editable.nix +++ b/pkgs/development/interpreters/python/editable.nix @@ -39,7 +39,7 @@ let # In editable mode build-system's are considered to be runtime dependencies. dependencies' = dependencies ++ build-system; - pyproject = { + pyprojectContents = { # PEP-621 project table project = { name = pname; @@ -81,7 +81,7 @@ buildPythonPackage ( pyproject = true; unpackPhase = '' - printf "%s" "$pyprojectContents" | python -c "import json, sys, tomli_w; print(tomli_w.dumps(json.load(sys.stdin)))" > pyproject.toml + python -c "import json, os, tomli_w; attrs = json.load(open(os.environ['NIX_ATTRS_JSON_FILE'], 'r')); print(tomli_w.dumps(attrs['pyprojectContents']))" > pyproject.toml echo 'import os.path, sys; sys.path.insert(0, os.path.expandvars("${root}"))' > _${pname}.pth ''; @@ -92,7 +92,7 @@ buildPythonPackage ( # Note: Using formats.toml generates another intermediary derivation that needs to be built. # We inline the same functionality for better UX. nativeBuildInputs = (derivationArgs.nativeBuildInputs or [ ]) ++ [ tomli-w ]; - pyprojectContents = builtins.toJSON pyproject; + inherit pyprojectContents; preferLocalBuild = true; __structuredAttrs = true; }