From 436145a41c9f27ced443c8b50a0ffd8032dd3db5 Mon Sep 17 00:00:00 2001 From: edef Date: Mon, 3 Aug 2020 10:51:28 +0000 Subject: [PATCH] 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 --- nix/fetchGoModule/default.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nix/fetchGoModule/default.nix b/nix/fetchGoModule/default.nix index e49a5e3a1..3f0784ad8 100644 --- a/nix/fetchGoModule/default.nix +++ b/nix/fetchGoModule/default.nix @@ -1,10 +1,22 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: + +let + + inherit (lib) + lowerChars + replaceStrings + upperChars + ; + + caseFold = replaceStrings upperChars (map (c: "!" + c) lowerChars); + +in { path, version, sha256 }: (pkgs.fetchurl { 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; recursiveHash = true;