In a similar spirit as https://github.com/NixOS/nixpkgs/issues/26487 I am trying to test my python packages from an overlay (In this peculiar case it's more practical for me to do it from an overlay than to fork nixpkgs). So in my otherwise (working) overlay, I've added
pythonPackages = super.pythonPackages.override {
# Careful, we're using a different self and super here!
packageOverrides = self: super: {
pygccxml = super.callPackage ../pygccxml.nix {
# pkgs = super.pkgs;
# pythonPackages = self.pkgs.python3Packages;
};
};
};
Then when I run a nix-shell, I get:
nix-shell -p 'python.withPackages(ps: [ ps.pygccxml] )' --show-trace
error: while evaluating the attribute ‘buildInputs’ of the derivation ‘shell’ at /home/teto/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:98:11:
while evaluating the attribute ‘pkgs’ of the derivation ‘python-2.7.14-env’ at /home/teto/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:98:11:
while evaluating ‘closePropagation’ at /home/teto/nixpkgs/lib/deprecated.nix:228:22, called from /home/teto/nixpkgs/pkgs/development/interpreters/python/wrapper.nix:11:13:
while evaluating ‘uniqList’ at /home/teto/nixpkgs/lib/deprecated.nix:159:14, called from /home/teto/nixpkgs/lib/deprecated.nix:228:29:
while evaluating ‘go’ at /home/teto/nixpkgs/lib/deprecated.nix:160:18, called from /home/teto/nixpkgs/lib/deprecated.nix:166:8:
while evaluating ‘innerClosePropagation’ at /home/teto/nixpkgs/lib/deprecated.nix:211:32, called from /home/teto/nixpkgs/lib/deprecated.nix:228:52:
attribute ‘pygccxml’ missing, at (string):1:92
content of pygccxml.nix:
{ stdenv, pkgs, fetchPypi, pythonPackages }:
pythonPackages.buildPythonPackage rec {
name = "${pname}-${version}";
pname = "pygccxml";
version = "1.9.1";
src = fetchPypi {
inherit pname version;
sha256 = "0x1p62ff7ggb172rjr6sbdrjh1gl3ck3bwxsqlsix8i5wycwvnmv";
};
propagatedBuildInputs = [ pkgs.castxml ];
# buildInputs = [ setuptools_scm pytest pkgs.glibcLocales ];
checkPhase = ''
# py.test
'';
meta = with stdenv.lib; {
homepage = https://github.com/gccxml/pygccxml;
description = "Python package for easy C++ declarations navigation";
license = licenses.boost;
maintainers = with maintainers; [ teto ];
};
}
nixos-version=18.03.git.56a5c5f (Impala)
nix version: nix-env (Nix) 1.11.15
Nixpkgs version: "18.03.git.56a5c5fa42"
sandboxing disabled
Check section 9.11.3.2. How to override a Python package?
of the Nixpkgs manual.
I had seen the doc but had missed the pythonPackages = python.pkgs;
This works
python = super.python.override {
# Careful, we're using a different self and super here!
packageOverrides = self: super: {
# if (super.pkgs ? pygccxml) then null else
pygccxml = super.callPackage ../pygccxml.nix {
# pkgs = super.pkgs;
# pythonPackages = self.pkgs.python3Packages;
};
};
};
pythonPackages = python.pkgs;
@teto your example can be simplified with this PR https://github.com/NixOS/nixpkgs/pull/54266#issuecomment-455592425
Most helpful comment
I had seen the doc but had missed the
pythonPackages = python.pkgs;
This works