Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding python package in overlay via callPackage #30267

Closed
teto opened this issue Oct 10, 2017 · 3 comments
Closed

adding python package in overlay via callPackage #30267

teto opened this issue Oct 10, 2017 · 3 comments
Labels
0.kind: question Requests for a specific question to be answered

Comments

@teto
Copy link
Member

teto commented Oct 10, 2017

Issue description

In a similar spirit as #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 ];
  };
}

Technical details

nixos-version=18.03.git.56a5c5f (Impala)
nix version: nix-env (Nix) 1.11.15
Nixpkgs version: "18.03.git.56a5c5fa42"
sandboxing disabled

@FRidh
Copy link
Member

FRidh commented Oct 10, 2017

Check section 9.11.3.2. How to override a Python package? of the Nixpkgs manual.

@FRidh FRidh added the 0.kind: question Requests for a specific question to be answered label Oct 10, 2017
@FRidh FRidh closed this as completed Oct 10, 2017
@teto
Copy link
Member Author

teto commented Oct 10, 2017

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;

@danbst
Copy link
Contributor

danbst commented Jan 18, 2019

@teto your example can be simplified with this PR #54266 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: question Requests for a specific question to be answered
Projects
None yet
Development

No branches or pull requests

3 participants