From 5c06704d4584cbd17d66c214447d313a896811a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Wed, 20 Oct 2021 18:33:06 +0200 Subject: [PATCH] fetchGit: work-around bug in Nix 2.4 Another approach to make `poetry2nix` work with dependencies specified by arbitrary `rev=` values on newer Nix revisions. Relates-to: https://github.com/nix-community/poetry2nix/pull/358 Relates-to: https://github.com/NixOS/nix/issues/5128 --- mk-poetry-dep.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mk-poetry-dep.nix b/mk-poetry-dep.nix index 5735e320c..fb0ac3cac 100644 --- a/mk-poetry-dep.nix +++ b/mk-poetry-dep.nix @@ -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