fetchzip and friends: Set "name" to "source" by default
This makes them produce the same store paths as builtins.fetchgit,
builtins.fetchTarball etc. See
65b5f177b5.
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
{ lib }:
|
||||
|
||||
let
|
||||
inherit (lib) removeSuffix hasPrefix removePrefix splitString stringToCharacters concatMapStrings last elem;
|
||||
|
||||
allowedChars = stringToCharacters "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-._?=";
|
||||
sanitizeStoreName = s:
|
||||
let
|
||||
s' = concatMapStrings (c: if elem c allowedChars then c else "") (stringToCharacters s);
|
||||
s'' = if hasPrefix "." s' then "_${removePrefix "." s'}" else s';
|
||||
in
|
||||
s'';
|
||||
in
|
||||
urlOrRepo: rev:
|
||||
let
|
||||
repo' = last (splitString ":" (baseNameOf (removeSuffix ".git" (removeSuffix "/" urlOrRepo))));
|
||||
rev' = baseNameOf rev;
|
||||
in
|
||||
"${sanitizeStoreName repo'}-${sanitizeStoreName rev'}-src"
|
||||
Reference in New Issue
Block a user