dream2nix
dream2nix copied to clipboard
python devShell build fails
Reproducer:
$ cd examples/python_pip-freeze
$ nix build .#devShells.x86_64-linux.default
warning: Git tree '/home/dream2nix' is dirty
error: builder for '/nix/store/fsxzfadk45m01l46cp8nrm4f4dvrp9ks-python3.10-default.drv' failed with exit code 1;
last 10 log lines:
> Sourcing python-remove-tests-dir-hook
> Sourcing python-catch-conflicts-hook.sh
> Sourcing python-remove-bin-bytecode-hook.sh
> Sourcing python-imports-check-hook.sh
> Using pythonImportsCheckPhase
> Sourcing python-namespaces-hook
> unpacking sources
> unpacking source archive .
> cp: '.' and './.' are the same file
> do not know how to unpack source archive .
For full logs, run 'nix log /nix/store/fsxzfadk45m01l46cp8nrm4f4dvrp9ks-python3.10-default.drv'.
error: 1 dependencies of derivation '/nix/store/j85dcaicg01bkzi8q134sidabc3sbng6-nix-shell.drv' failed to build
Workaround:
I can get out-of-tree python devShells building by commenting out the offending src override in subsystems/python/builders/simple-python/default.nix:
devShell = pkgs.mkShell {
buildInputs = [
# a drv with all dependencies without the main package
(package.overrideAttrs (old: {
# src = ".";
}))
];
};
This doesn't fix the example build for me but I assume that's just because I can't figure out how to break dream2nix out of flake cache hell.
I now see that my workaround fails to exclude the main package as the comment indicates it is supposed to and therefore doesn't not yield a shell with an editable installation. After more digging it appears that the regression was introduced in #397 and a more suitable workaround is to revert the relevant bits:
diff --git a/src/subsystems/python/builders/simple-python/default.nix b/src/subsystems/python/builders/simple-python/default.nix
index d9a80dd..98d3d2b 100644
--- a/src/subsystems/python/builders/simple-python/default.nix
+++ b/src/subsystems/python/builders/simple-python/default.nix
@@ -62,13 +62,12 @@
cp $file dist/$fname
done
${python}/bin/python -m pip install \
- --find-links ./dist/ \
+ ./dist/*.{whl,tar.gz,zip} \
--no-build-isolation \
--no-index \
--no-warn-script-location \
--prefix="$out" \
--no-cache \
- . \
$pipInstallFlags
'';
installPhase = "true";
@@ -79,6 +78,7 @@
# a drv with all dependencies without the main package
(package.overrideAttrs (old: {
src = ".";
+ dontUnpack = true;
}))
];
};
Seems like the bigger question is why nix flake check passes yet nix build .#devShells.x86_64-linux.default fails.