summaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchdebianpatch/default.nix
blob: 0f694f9fd52b8e0b2009b997982989da2e33d05f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ 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}";
  }
)