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