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

17 lines
539 B
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{ lib, fetchpatch }:
2024-05-13 21:24:10 +00:00
lib.makeOverridable ({ 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-05-13 21:24:10 +00:00
prefix = substring 0 (if hasPrefix "lib" pname then 4 else 1) pname;
versionString = if debianRevision == null then
version
else
"${version}-${debianRevision}";
2024-05-02 00:46:19 +00:00
in fetchpatch {
inherit name hash;
2024-05-13 21:24:10 +00:00
url = "https://sources.debian.org/data/${area}/${prefix}/"
2024-05-02 00:46:19 +00:00
+ "${pname}/${versionString}/debian/patches/${patch}";
2024-05-13 21:24:10 +00:00
})