1{ lib, fetchpatch }:
2
3lib.makeOverridable (
4 {
5 pname,
6 version,
7 debianRevision ? null,
8 area ? "main",
9 patch,
10 name ? patch,
11 hash,
12 }:
13 let
14 inherit (lib.strings) hasPrefix substring;
15 prefix = substring 0 (if hasPrefix "lib" pname then 4 else 1) pname;
16 versionString = if debianRevision == null then version else "${version}-${debianRevision}";
17 in
18 fetchpatch {
19 inherit name hash;
20 url =
21 "https://sources.debian.org/data/${area}/${prefix}/"
22 + "${pname}/${versionString}/debian/patches/${patch}";
23 }
24)