I get:
nix-shell --show-trace
error:
… while calling the ‘derivationStrict’ builtin
at //builtin/derivation.nix:9:12: (source not available)
… while evaluating derivation 'interactive-python3-3.11.4-environment'
whose name attribute is located at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7
… while evaluating attribute 'nativeBuildInputs' of derivation 'interactive-python3-3.11.4-environment'
at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:347:7:
346| depsBuildBuild = lib.elemAt (lib.elemAt dependencies 0) 0;
347| nativeBuildInputs = lib.elemAt (lib.elemAt dependencies 0) 1;
| ^
348| depsBuildTarget = lib.elemAt (lib.elemAt dependencies 0) 2;
… while evaluating derivation 'python3-3.11.4-env'
whose name attribute is located at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7
… while evaluating attribute 'passAsFile' of derivation 'python3-3.11.4-env'
at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/pkgs/build-support/trivial-builders/default.nix:88:7:
87| inherit buildCommand name;
88| passAsFile = [ "buildCommand" ]
| ^
89| ++ (derivationArgs.passAsFile or []);
… from call site
at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/pkgs/development/interpreters/python/wrapper.nix:20:13:
19| env = let
20| paths = requiredPythonModules (extraLibs ++ [ python ] ) ;
| ^
21| pythonPath = "${placeholder "out"}/${python.sitePackages}";
… while calling 'requiredPythonModules'
at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/pkgs/development/interpreters/python/python-packages-base.nix:53:27:
52| # Get list of required Python modules given a list of derivations.
53| requiredPythonModules = drvs: let
| ^
54| modules = lib.filter hasPythonModule drvs;
… while calling anonymous lambda
at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/lib/lists.nix:658:25:
657| */
658| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
| ^
659|
… while evaluating derivation 'python3.11-sourcery-1.6.0'
whose name attribute is located at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7
… while evaluating attribute 'src' of derivation 'python3.11-sourcery-1.6.0'
at /home/me/dev/shell.nix:9:7:
8| version = "1.6.0";
9| src = fetchPypi {
| ^
10| inherit pname version;
… while evaluating derivation 'sourcery-1.6.0.tar.gz'
whose name attribute is located at /nix/store/99669jgbl29z1s6cr3i93m29ab0k55jc-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7
error: invalid SRI hash 'c1c50553de6c5bda05ce49e2b8156a47c75eb2700a02a92fb25ca6cda30a451f'
The files downloaded from Pypi are whl files and the hash obviously doesn’t work.
So how do I get the hash for the zip file? Or just get this to work?
error:
… while calling the ‘derivationStrict’ builtin
at //builtin/derivation.nix:9:12: (source not available)
… while evaluating derivation 'interactive-python3-3.11.4-environment'
whose name attribute is located at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7
… while evaluating attribute 'nativeBuildInputs' of derivation 'interactive-python3-3.11.4-environment'
at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:347:7:
346| depsBuildBuild = lib.elemAt (lib.elemAt dependencies 0) 0;
347| nativeBuildInputs = lib.elemAt (lib.elemAt dependencies 0) 1;
| ^
348| depsBuildTarget = lib.elemAt (lib.elemAt dependencies 0) 2;
… while evaluating derivation 'python3-3.11.4-env'
whose name attribute is located at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7
… while evaluating attribute 'passAsFile' of derivation 'python3-3.11.4-env'
at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/pkgs/build-support/trivial-builders/default.nix:88:7:
87| inherit buildCommand name;
88| passAsFile = [ "buildCommand" ]
| ^
89| ++ (derivationArgs.passAsFile or []);
… from call site
at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/pkgs/development/interpreters/python/wrapper.nix:20:13:
19| env = let
20| paths = requiredPythonModules (extraLibs ++ [ python ] ) ;
| ^
21| pythonPath = "${placeholder "out"}/${python.sitePackages}";
… while calling 'requiredPythonModules'
at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/pkgs/development/interpreters/python/python-packages-base.nix:53:27:
52| # Get list of required Python modules given a list of derivations.
53| requiredPythonModules = drvs: let
| ^
54| modules = lib.filter hasPythonModule drvs;
… while calling anonymous lambda
at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/lib/lists.nix:658:25:
657| */
658| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
| ^
659|
… while evaluating derivation 'python3.11-sourcery-1.6.0'
whose name attribute is located at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7
… while evaluating attribute 'src' of derivation 'python3.11-sourcery-1.6.0'
at /home/me/pathto/shell.nix:9:7:
8| version = "1.6.0";
9| src = fetchPypi {
| ^
10| inherit pname version;
… while evaluating derivation 'sourcery-1.6.0.tar.gz'
whose name attribute is located at /nix/store/s4x0fspf7s2q06vpv0fhqcmgd1a9kcp9-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7
error: invalid SRI hash '0000000000000000000000000000000000000000000000000000000000000000'
That looks as if it was base16 (hex) encoded, though the SRI hashes use some variant of base64 IIRC.
Sadly I do not know, if fetchPypi is one of the fetch-helpers that already got adjustet properly to the “fetcher without hash specified” behaviour or when this happened, nor what commits you base your experiments on.
Therefore my suggestion is that you trie hash = lib.fakeHash; or sha256 = lib.fakeHash respectively.
The way nix determines this hashes is different from how the pypi.org website does. Whenever you need to tell nix any hashes, you have to use nix-prefetch tooling or acquire it the “TOFU” way:
Use lib.fakeHash (or if supported the empty string or leaving of any hash related attributes)
build something related
copy the correct hash from the error message into the hash attribute.
repeat for any missing hash you still have.
Replace the current sha256 = … with one of the lines I gave you, at a time!
edit:
I missed to explain: “TOFU” means “Trust On First Use”, it is not related to soy
Using hash = lib.fakeHash;
… some similar lines before this
copying path ‘/nix/store/v2d4a626bb0qybpy9i2jyr01a4kx9hmf-setuptools-setup-hook’ from ‘https://cache.nixos.org’…
trying https://pypi.io/packages/source/s/sourcery/sourcery-1.6.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 122 100 122 0 0 1156 0 --:–:-- --:–:-- --:–:-- 1150
100 276 100 276 0 0 793 0 --:–:-- --:–:-- --:–:-- 793
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
curl: (22) The requested URL returned error: 404
error: cannot download sourcery-1.6.0.tar.gz from any mirror
error: builder for ‘/nix/store/jsylzh1ii1d50vhvwki89sfkq2v1anrc-sourcery-1.6.0.tar.gz.drv’ failed with exit code 1;
last 10 log lines:
> curl: (22) The requested URL returned error: 404
>
> trying https://pypi.io/packages/source/s/sourcery/sourcery-1.6.0.tar.gz
> % Total % Received % Xferd Average Speed Time Time Time Current
> Dload Upload Total Spent Left Speed
> 100 122 100 122 0 0 1156 0 --:–:-- --:–:-- --:–:-- 1150
> 100 276 100 276 0 0 793 0 --:–:-- --:–:-- --:–:-- 793
> 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
> curl: (22) The requested URL returned error: 404
> error: cannot download sourcery-1.6.0.tar.gz from any mirror
For full logs, run ‘nix log /nix/store/jsylzh1ii1d50vhvwki89sfkq2v1anrc-sourcery-1.6.0.tar.gz.drv’.
error: 1 dependencies of derivation ‘/nix/store/ln5qa37k7xydglqx5pz2n6h5bdj9r440-python3.11-sourcery-1.6.0.drv’ failed to build
error: 1 dependencies of derivation ‘/nix/store/9d2q17v7lx81nfz2h5rxvjlhp0rqr11w-python3-3.11.4-env.drv’ failed to build
Using sha256 = lib.fakeHash;
these 3 derivations will be built:
/nix/store/c00s95f9zv5bzkl32l57n3m30bl7yn4a-sourcery-1.6.0.tar.gz.drv
/nix/store/ajic54if62m45545l5xhdz25b41g99xl-python3.11-sourcery-1.6.0.drv
/nix/store/k4j8j3v23acqxrx0ai2vl4f9vldnxzm5-python3-3.11.4-env.drv
building ‘/nix/store/c00s95f9zv5bzkl32l57n3m30bl7yn4a-sourcery-1.6.0.tar.gz.drv’…
But it’s with awscli that I have an error I don’t understand:
this derivation will be built:
/nix/store/fry91zs4yldgnfr252cpqrma7yw50gkl-python3-3.10.11-env.drv
building '/nix/store/fry91zs4yldgnfr252cpqrma7yw50gkl-python3-3.10.11-env.drv'...
error: collision between `/nix/store/5x83rccvlyw2kck8kyav8ggi824fyp7q-python3.10-docutils-0.16/lib/python3.10/site-packages/docutils/examples.py' and `/nix/store/fhraysjy7q3jgb549b0w9j3c3sg91hh2-python3.10-docutils-0.19/lib/python3.10/site-packages/docutils/examples.py'
error: builder for '/nix/store/fry91zs4yldgnfr252cpqrma7yw50gkl-python3-3.10.11-env.drv' failed with exit code 25;
last 1 log lines:
> error: collision between `/nix/store/5x83rccvlyw2kck8kyav8ggi824fyp7q-python3.10-docutils-0.16/lib/python3.10/site-packages/docutils/examples.py' and `/nix/store/fhraysjy7q3jgb549b0w9j3c3sg91hh2-python3.10-docutils-0.19/lib/python3.10/site-packages/docutils/examples.py'
For full logs, run 'nix-store -l /nix/store/fry91zs4yldgnfr252cpqrma7yw50gkl-python3-3.10.11-env.drv'.
I don’t understand why this collision occurs or how to fix it.
Hi zeec123,
That at least compiles with: … lots of line before this
building ‘/nix/store/41r2hh7yg1vrpimd5vzwqq84mrydqw3b-python3-3.11.4-env.drv’…
created 242 symlinks in user environment
Then when I run: > sourcery review lot.py Traceback (most recent call last): File "/nix/store/7w925ijpr87k2wl02ahm9bwvf317m6sz-python3.11-sourcery-1.6.0/bin/.sourcery-wrapped", line 9, in <module> sys.exit(main()) ^^^^^^ File "/nix/store/46fw4w2vbiad1n0c07jjb63jmnb1p6ab-python3-3.11.4-env/lib/python3.11/site-packages/sourcery/wrapper.py", line 13, in main return subprocess.call([str(command), *sys.argv[1:]], bufsize=0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/d3q49jp0h57dzn4p9rydma2ybgmgazs3-python3-3.11.4/lib/python3.11/subprocess.py", line 389, in call with Popen(*popenargs, **kwargs) as p: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/d3q49jp0h57dzn4p9rydma2ybgmgazs3-python3-3.11.4/lib/python3.11/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/nix/store/d3q49jp0h57dzn4p9rydma2ybgmgazs3-python3-3.11.4/lib/python3.11/subprocess.py", line 1950, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/nix/store/46fw4w2vbiad1n0c07jjb63jmnb1p6ab-python3-3.11.4-env/lib/python3.11/site-packages/sourcery/sourcery'
But if I: ls -al /nix/store/46fw4w2vbiad1n0c07jjb63jmnb1p6ab-python3-3.11.4-env/lib/python3.11/site-packages/sourcery/sourcery -r-xr-xr-x 2 root root 131300952 Jan 1 1970 /nix/store/46fw4w2vbiad1n0c07jjb63jmnb1p6ab-python3-3.11.4-env/lib/python3.11/site-packages/sourcery/sourcery
I see that its actually there! So something went wrong in the build I guess.
With my snippet, there should be no build at all. I also tested it, and it installed on my machine. (I am on nixpkgs-unstable, but that should make difference.)
Hi zeec, so whats different to what you did and myself?
I created a shell.nix as per your suggestion.
Then I entered nix-shell at the command line then I got a build output.
Then I ran sourcery review lot.py
Which gave me the error shown above.
Why did you not get a build response? Second time around I got no build response.
Even if I take out the doCheck I get the same error.
Also, changed shell.nix for sourcery_cli and amended sha256, but same result.