From 741ed30e7738656c93b0d0dcb2be45623c8d3c64 Mon Sep 17 00:00:00 2001 From: nicoo Date: Tue, 29 Aug 2023 20:09:47 +0000 Subject: [PATCH] fetchDebianPatch: init --- pkgs/build-support/fetchdebianpatch/default.nix | 13 +++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 pkgs/build-support/fetchdebianpatch/default.nix diff --git a/pkgs/build-support/fetchdebianpatch/default.nix b/pkgs/build-support/fetchdebianpatch/default.nix new file mode 100644 index 000000000000..c1230484f82b --- /dev/null +++ b/pkgs/build-support/fetchdebianpatch/default.nix @@ -0,0 +1,13 @@ +{ lib, fetchpatch }: + +lib.makeOverridable ( + { pname, version, debianRevision ? null, name, hash, area ? "main" }: + let versionString = + if debianRevision == null then version else "${version}-${debianRevision}"; + in fetchpatch { + url = + "https://sources.debian.org/data/${area}/${builtins.substring 0 1 pname}/" + + "${pname}/${versionString}/debian/patches/${name}.patch"; + inherit hash; + } +) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f5575dccdfa4..e53b1fe1c65b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1173,6 +1173,8 @@ with pkgs; tests = pkgs.tests.fetchzip; }; + fetchDebianPatch = callPackage ../build-support/fetchdebianpatch { }; + fetchCrate = callPackage ../build-support/rust/fetchcrate.nix { }; fetchFromGitea = callPackage ../build-support/fetchgitea { };