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

python withPackages will reset/disable override #324974

Open
Nambers opened this issue Jul 6, 2024 · 0 comments
Open

python withPackages will reset/disable override #324974

Nambers opened this issue Jul 6, 2024 · 0 comments

Comments

@Nambers
Copy link

Nambers commented Jul 6, 2024

Describe the bug

Python withPackages will reset/disable override of package.

Steps To Reproduce

Consider following nix scripts:

let
  pkgs = import <nixpkgs> { };
  myPython = ((pkgs.python311.override (oldAttr: {
        sourceVersion = {
          major = "3";
          minor = "11";
          patch = "1";
          suffix = "";
        };
      })).overrideAttrs(oldAttrs: 
        {
          src = pkgs.fetchFromGitHub {
            owner = "python";
            repo = "cpython";
            rev = "v3.11.8";
          };
        }));
  myPythonWithPackages = myPython.withPackages (pypkgs: with pypkgs; [pip]);
in
pkgs.mkShell {
  packages = [
    myPython
  ];
}
let
  pkgs = import <nixpkgs> { };
  myPython = ((pkgs.python311.override (oldAttr: {
        sourceVersion = {
          major = "3";
          minor = "11";
          patch = "1";
          suffix = "";
        };
      })).overrideAttrs(oldAttrs: 
        {
          src = pkgs.fetchFromGitHub {
            owner = "python";
            repo = "cpython";
            rev = "v3.11.8";
          };
        }));
  myPythonWithPackages = myPython.withPackages (pypkgs: with pypkgs; [pip]);
in
pkgs.mkShell {
  packages = [
    myPythonWithPackages
  ];
}

the first one will result in 3.11.8 but the second one is 3.11.9 which is the original one pkgs.python311 (w/o any override)

Expected behavior

Both of above scripts should result in a 3.11.8 python.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/kjhgwsnn7wkacncxhrcgc4mx0v82kbdf-nix-info
copying path '/nix/store/kjhgwsnn7wkacncxhrcgc4mx0v82kbdf-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.7-arch1-1, Arch Linux, noversion, rolling`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.23.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Add a 👍 reaction to issues you find important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants