about summary refs log tree commit diff
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2020-08-03T10·51+0000
committeredef <edef@edef.eu>2020-08-03T10·58+0000
commit436145a41c9f27ced443c8b50a0ffd8032dd3db5 (patch)
tree93f6f2d02046f753b6598190d31e77dd58bd0566
parentc17be2364eda44a6ccbcb77fc86978fd7fffe6b2 (diff)
fix(nix/fetchGoModule): correctly case-fold mixed-case package paths r/1561
Change-Id: I5a93462a23bf3c9f22fc3de0b173763a9bc8d526
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1591
Tested-by: BuildkiteCI
Reviewed-by: edef <edef@edef.eu>
-rw-r--r--nix/fetchGoModule/default.nix16
1 files changed, 14 insertions, 2 deletions
diff --git a/nix/fetchGoModule/default.nix b/nix/fetchGoModule/default.nix
index e49a5e3a1c5e..3f0784ad8fe7 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;