fetchGit: work-around bug in Nix 2.4

Another approach to make `poetry2nix` work with dependencies specified
by arbitrary `rev=<hash>` values on newer Nix revisions.

Relates-to: https://github.com/nix-community/poetry2nix/pull/358
Relates-to: https://github.com/NixOS/nix/issues/5128
This commit is contained in:
László Vaskó 2021-10-20 18:33:06 +02:00 committed by adisbladis
parent a47cc109f8
commit 5c06704d45

View file

@ -169,11 +169,18 @@ pythonPackages.callPackage
src =
if isGit then
(
builtins.fetchGit {
builtins.fetchGit ({
inherit (source) url;
rev = source.resolved_reference or source.reference;
ref = sourceSpec.branch or sourceSpec.rev or (if sourceSpec?tag then "refs/tags/${sourceSpec.tag}" else "HEAD");
}
} // (
let
nixVersion = builtins.substring 0 3 builtins.nixVersion;
in
lib.optionalAttrs (lib.versionAtLeast nixVersion "2.4") {
allRefs = true;
}
))
)
else if isUrl then
builtins.fetchTarball