nixpkgs: cleanup patching implementation

This commit is contained in:
Colin 2024-06-09 00:52:01 +00:00
parent 502c9d1db3
commit fbbc0eb294
2 changed files with 3 additions and 18 deletions

View File

@ -41,16 +41,11 @@ let
};
unpatchedNixpkgs = import unpatchedSrc { inherit localSystem; };
patchesFor = unpatchedNixpkgs.callPackage ./list.nix { };
patchedSrc = unpatchedNixpkgs.applyPatches {
name = "nixpkgs-patched-uninsane";
# version = ...
src = unpatchedSrc;
patches = patchesFor {
inherit variant;
date = unpatchedSrc.lastModifiedDate;
};
patches = unpatchedNixpkgs.callPackage ./list.nix { };
# skip applied patches
prePatch = ''
realpatch=$(command -v patch)

View File

@ -1,5 +1,4 @@
{ fetchpatch2, fetchurl, lib }:
{ variant, date }:
let
fetchpatch' = {
saneCommit ? null,
@ -8,7 +7,6 @@ let
hash ? null,
title ? null,
revert ? false,
merged ? {},
}:
let
url = if prUrl != null then
@ -19,21 +17,13 @@ let
else
"https://github.com/NixOS/nixpkgs/commit/${nixpkgsCommit}.patch"
;
isMerged = merged ? "${variant}" && lib.versionAtLeast date merged."${variant}";
in if !isMerged then fetchpatch2 (
in fetchpatch2 (
{ inherit revert url; }
// (if hash != null then { inherit hash; } else {})
// (if title != null then { name = title; } else {})
) else null;
);
in
builtins.filter (p: p != null)
[
# if a patch has been merged, use
# merged.staging = "<date>";
# merged.master = "<date>";
# etc, where "date" is like "20240228181608"
# and can be found with `nix-repl > :lf . > lastModifiedDate`
# TODO: apply this once it's fixed for aarch64
# (fetchpatch' {
# title = "libvpx: fix cross compiling for armv7";