nixpkgs: cleanup patching implementation

This commit is contained in:
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; }; unpatchedNixpkgs = import unpatchedSrc { inherit localSystem; };
patchesFor = unpatchedNixpkgs.callPackage ./list.nix { };
patchedSrc = unpatchedNixpkgs.applyPatches { patchedSrc = unpatchedNixpkgs.applyPatches {
name = "nixpkgs-patched-uninsane"; name = "nixpkgs-patched-uninsane";
# version = ... # version = ...
src = unpatchedSrc; src = unpatchedSrc;
patches = patchesFor { patches = unpatchedNixpkgs.callPackage ./list.nix { };
inherit variant;
date = unpatchedSrc.lastModifiedDate;
};
# skip applied patches # skip applied patches
prePatch = '' prePatch = ''
realpatch=$(command -v patch) realpatch=$(command -v patch)

View File

@@ -1,5 +1,4 @@
{ fetchpatch2, fetchurl, lib }: { fetchpatch2, fetchurl, lib }:
{ variant, date }:
let let
fetchpatch' = { fetchpatch' = {
saneCommit ? null, saneCommit ? null,
@@ -8,7 +7,6 @@ let
hash ? null, hash ? null,
title ? null, title ? null,
revert ? false, revert ? false,
merged ? {},
}: }:
let let
url = if prUrl != null then url = if prUrl != null then
@@ -19,21 +17,13 @@ let
else else
"https://github.com/NixOS/nixpkgs/commit/${nixpkgsCommit}.patch" "https://github.com/NixOS/nixpkgs/commit/${nixpkgsCommit}.patch"
; ;
isMerged = merged ? "${variant}" && lib.versionAtLeast date merged."${variant}"; in fetchpatch2 (
in if !isMerged then fetchpatch2 (
{ inherit revert url; } { inherit revert url; }
// (if hash != null then { inherit hash; } else {}) // (if hash != null then { inherit hash; } else {})
// (if title != null then { name = title; } else {}) // (if title != null then { name = title; } else {})
) else null; );
in 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 # TODO: apply this once it's fixed for aarch64
# (fetchpatch' { # (fetchpatch' {
# title = "libvpx: fix cross compiling for armv7"; # title = "libvpx: fix cross compiling for armv7";