mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
0cfc319f83
Otherwise the fetcher is unuseable with patches whose filename (in Debian) doesn't end in `.patch`.
20 lines
552 B
Nix
20 lines
552 B
Nix
{ lib, fetchpatch }:
|
|
|
|
lib.makeOverridable (
|
|
{ pname, version, debianRevision ? null, area ? "main",
|
|
patch, name ? patch, hash }:
|
|
let
|
|
inherit (lib.strings) hasPrefix substring;
|
|
prefix =
|
|
substring 0 (if hasPrefix "lib" pname then 4 else 1) pname;
|
|
versionString =
|
|
if debianRevision == null then version
|
|
else "${version}-${debianRevision}";
|
|
in fetchpatch {
|
|
inherit name hash;
|
|
url =
|
|
"https://sources.debian.org/data/${area}/${prefix}/"
|
|
+ "${pname}/${versionString}/debian/patches/${patch}";
|
|
}
|
|
)
|