cachix / nixpkgs-python

All Python versions, kept up-to-date on hourly basis using Nix.
Apache License 2.0
176 stars 11 forks source link

cannot use .pkgs of pythons provided here #14

Closed pedohorse closed 8 months ago

pedohorse commented 1 year ago

I'm not sure if using .pkgs.something is intended with these pythons, but i'm surely getting a strange error:

error: builder for '/nix/store/jwc3cbbp74lc3krq8ilkhgd7izg8bdxd-Python-3.8.17.tar.xz.drv' failed with exit code 1;
       last 10 log lines:
       >   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
       >                                  Dload  Upload   Total   Spent    Left  Speed
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: www.python.org
       > Warning: Problem : timeout. Will retry in 1 seconds. 3 retries left.
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: www.python.org
       > Warning: Problem : timeout. Will retry in 2 seconds. 2 retries left.
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: www.python.org
       > Warning: Problem : timeout. Will retry in 4 seconds. 1 retries left.
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: www.python.org
       > error: cannot download Python-3.8.17.tar.xz from any mirror
       For full logs, run 'nix log /nix/store/jwc3cbbp74lc3krq8ilkhgd7izg8bdxd-Python-3.8.17.tar.xz.drv'.
error: 1 dependencies of derivation '/nix/store/idxlik38iac33hicidlf7qhjc4nn494m-python3-3.8.17.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ppgrg13rqs00lsh6mphrhx9nlknq770m-wrap-python-hook.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2lpg8ysd173ifdrbmsd26lrxnkkyqdhj-nix-shell-env.drv' failed to build

to reproduce - just add python.pkgs.wrapPython to buildInputs of a shell (or any derivation), for example:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
    nixpython = {
      url = "github:cachix/nixpkgs-python";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs = { self, nixpkgs, nixpython }:
  let
    pkgs = nixpkgs.legacyPackages.x86_64-linux;
    python = nixpython.packages.x86_64-linux."3.8";
  in {
    packages.x86_64-linux = rec {
      py = python;
      test_python = pkgs.mkShell {
        buildInputs = [
          python.pkgs.wrapPython
        ];
      };
    };
  };
}

and do nix build .#test_python while nix build .#py works fine and builds python from source or removing .pkgs.wrapPython and leaving just python in buildInputs works fine too

I'm relatively new to the whole nix thing, so I have no idea if I'm doing something wrong

It does seem that for some reason it tries to build python38 again, even if i have just built it separately... and it has no network while trying to fetch sources, as if it was called from within build sandbox, but how is this possible??

P.S. my network is fine, i can access the url it tries to fetch, and i can build python38 from this repository from source without any issues

mcdonc commented 1 year ago

FTR, this also happens when using one inside environment.systemPackages:

environment.systemPackages = with pkgs; [
  pkgs.allthepythons.packages.x86_64-linux."3.9.16"
....

Where "allthepythons" is an overlay within a flake:

overlay-nixpkgs-python = final: prev: {
    allthepythons = import nixpkgs-python;
  };
domenkozar commented 1 year ago

For some reason it uses .xz in the url, while it should be https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tgz.

This means something is wrong how overrides are applied, it's not passing the correct hash and the url.

domenkozar commented 8 months ago

Should be fixed on main, can you try?

domenkozar commented 8 months ago

It works now.