fetchFromBitBucket: auto-remove an impure file

Also fix the hash in goPackages.inflect, the only user of the fetcher ATM.
Closes #12002 (different `inflect` fix), fixes #12012.
Using fetchzip-derived functions is likely more efficient than fetchhg,
and it's lighter on dependencies (hash is the same as with fetchhg in this case).

+6 -3
+4 -2
pkgs/build-support/fetchzip/default.nix
··· 10 10 { # Optionally move the contents of the unpacked tree up one level. 11 11 stripRoot ? true 12 12 , url 13 + , extraPostFetch ? "" 13 14 , ... } @ args: 14 15 15 16 lib.overrideDerivation (fetchurl ({ ··· 47 48 fi 48 49 '' else '' 49 50 mv "$unpackDir"/* "$out/" 50 - ''); 51 - } // removeAttrs args [ "stripRoot" ])) 51 + '') #*/ 52 + + extraPostFetch; 53 + } // removeAttrs args [ "stripRoot" "extraPostFetch" ])) 52 54 # Hackety-hack: we actually need unzip hooks, too 53 55 (x: {nativeBuildInputs = x.nativeBuildInputs++ [unzip];})
+1
pkgs/top-level/all-packages.nix
··· 372 372 inherit name sha256; 373 373 url = "https://bitbucket.org/${owner}/${repo}/get/${rev}.tar.gz"; 374 374 meta.homepage = "https://bitbucket.org/${owner}/${repo}/"; 375 + extraPostFetch = ''rm -f "$out"/.hg_archival.txt''; # impure file; see #12002 375 376 }; 376 377 377 378 # cgit example, snapshot support is optional in cgit
+1 -1
pkgs/top-level/go-packages.nix
··· 1751 1751 rev = "8961c3750a47b8c0b3e118d52513b97adf85a7e8"; 1752 1752 owner = "pkg"; 1753 1753 repo = "inflect"; 1754 - sha256 = "04iln5b9iyvr6bcn5cj2zq6vqk3a2b4vsy48y2kylhk7qnakip99"; 1754 + sha256 = "11qdyr5gdszy24ai1bh7sf0cgrb4q7g7fsd11kbpgj5hjiigxb9a"; 1755 1755 }; 1756 1756 }; 1757 1757