I added builtins.trace to various places and observed that...
error: function 'anonymous lambda' called with unexpected argument 'x11Support'
In my case, this was coming from tkinter, and python.override.__functionArgs at that point was an attribute set of ["nixpkgs-python", "version"]. My understanding is callPackage ./self.nix { inherit version; } returns an overrideable version of the function defined in self.nix, and that's being passed down as the python object. I changed it to use the bare packages.${version} instead, but I'm not sure if that breaks something else.
error: builder for '/nix/store/jwc3cbbp74lc3krq8ilkhgd7izg8bdxd-Python-3.8.17.tar.xz.drv' failed with exit code 1;
i.e. src and hash not getting overriden - I traced it down to this call chain:
..and I forcefully replaced pkgsBuildHost with an attrset with ${pythonAttr} set to nixpkgs-python's Python package, which worked, but I'm not sure if that's the right or the cleanest way.
Also needed to use newScope to make packages under xorg available in callPackage calls, e.g. xorgproto.
A slightly stripped down version of a `flake.nix` that I wanted to use `withPackage` with, which now works with this patch
I got hit by both #12 and the error noted in #14.
I added
builtins.trace
to various places and observed that...In my case, this was coming from tkinter, and
python.override.__functionArgs
at that point was an attribute set of["nixpkgs-python", "version"]
. My understanding iscallPackage ./self.nix { inherit version; }
returns an overrideable version of the function defined inself.nix
, and that's being passed down as the python object. I changed it to use the barepackages.${version}
instead, but I'm not sure if that breaks something else.i.e.
src
andhash
not getting overriden - I traced it down to this call chain:..and I forcefully replaced
pkgsBuildHost
with an attrset with${pythonAttr}
set to nixpkgs-python's Python package, which worked, but I'm not sure if that's the right or the cleanest way.Also needed to use
newScope
to make packages underxorg
available incallPackage
calls, e.g.xorgproto
.A slightly stripped down version of a `flake.nix` that I wanted to use `withPackage` with, which now works with this patch
```nix { description = "Description for the project"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs-python.url = "github:ento/nixpkgs-python/with-packages-fix"; devenv.url = "github:cachix/devenv"; nix2container.url = "github:nlewo/nix2container"; nix2container.inputs.nixpkgs.follows = "nixpkgs"; mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin"; }; nixConfig = { extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; extra-substituters = "https://devenv.cachix.org"; }; outputs = inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ inputs.devenv.flakeModule ]; systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; perSystem = { config, self', inputs', pkgs, system, lib, ... }: let pythonVersions = [ "3.8" "3.9" "3.10" "3.11" ]; mkShell = v: let isDefaultPython = v == (lib.versions.majorMinor pkgs.python3.version); python = if isDefaultPython then pkgs.python3 else inputs'.nixpkgs-python.packages.${v}; pythonPackages = ps: with ps; [ build pip-tools tox twine ]; pythonWithPackages = (python.withPackages pythonPackages); shell = { name = v; packages = [ pkgs.pre-commit python.pkgs.wrapPython ]; languages.python.enable = true; languages.python.version = v; languages.python.package = lib.mkForce pythonWithPackages; }; in [ { name = lib.replaceStrings ["."] [""] v; value = shell; } ] ++ (lib.optionals isDefaultPython [ { name = "default"; value = shell; }]); in { devenv.shells = lib.trivial.pipe pythonVersions [ (map mkShell) lib.flatten lib.listToAttrs ]; }; }; } ``` ```sh nix develop .#310 --impure ```