fix(nix/fetchGoModule): correctly case-fold mixed-case package paths

Change-Id: I5a93462a23bf3c9f22fc3de0b173763a9bc8d526
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1591
Tested-by: BuildkiteCI
Reviewed-by: edef <edef@edef.eu>
This commit is contained in:
edef 2020-08-03 10:51:28 +00:00
parent c17be2364e
commit 436145a41c

View file

@ -1,10 +1,22 @@
{ pkgs, ... }: { lib, pkgs, ... }:
let
inherit (lib)
lowerChars
replaceStrings
upperChars
;
caseFold = replaceStrings upperChars (map (c: "!" + c) lowerChars);
in
{ path, version, sha256 }: { path, version, sha256 }:
(pkgs.fetchurl { (pkgs.fetchurl {
name = "source"; name = "source";
url = "https://proxy.golang.org/${path}/@v/v${version}.zip"; url = "https://proxy.golang.org/${caseFold path}/@v/v${version}.zip";
inherit sha256; inherit sha256;
recursiveHash = true; recursiveHash = true;