core/pkgs/build-support/fetchdebianpatch/default.nix

25 lines
563 B
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{ lib, fetchpatch }:
lib.makeOverridable (
2024-06-30 08:16:52 +00:00
{
pname,
version,
debianRevision ? null,
area ? "main",
patch,
name ? patch,
hash,
}:
2024-05-02 00:46:19 +00:00
let
inherit (lib.strings) hasPrefix substring;
2024-06-30 08:16:52 +00:00
prefix = substring 0 (if hasPrefix "lib" pname then 4 else 1) pname;
versionString = if debianRevision == null then version else "${version}-${debianRevision}";
in
fetchpatch {
2024-05-02 00:46:19 +00:00
inherit name hash;
url =
"https://sources.debian.org/data/${area}/${prefix}/"
+ "${pname}/${versionString}/debian/patches/${patch}";
}
)