nixpatches: improve patch conditionality

This commit is contained in:
Colin 2023-12-12 03:22:25 +00:00
parent 4336d68e6f
commit 189eccb01e
2 changed files with 11 additions and 8 deletions

View File

@ -9,10 +9,9 @@
name = "nixpkgs-patched-uninsane";
version = self.lastModifiedDate;
src = nixpkgs;
patches = builtins.filter (p: p != null) (import ./list.nix {
inherit (nixpkgs.legacyPackages.${system}) fetchpatch2 fetchurl;
inherit variant;
});
patches = builtins.filter (p: p != null) (
nixpkgs.legacyPackages."${system}".callPackage ./list.nix { } variant self.lastModifiedDate
);
};
patchedFlakeFor = system: import "${patchedPkgsFor system}/flake.nix";
patchedFlakeOutputsFor = system:

View File

@ -1,4 +1,5 @@
{ fetchpatch2, fetchurl, variant }:
{ fetchpatch2, fetchurl, lib }:
variant: date:
let
fetchpatch' = {
saneCommit ? null,
@ -7,7 +8,7 @@ let
hash ? null,
title ? null,
revert ? false,
applies ? [ "unstable" "master" "staging" "staging-next" ],
merged ? {},
}:
let
url = if prUrl != null then
@ -18,7 +19,8 @@ let
else
"https://github.com/NixOS/nixpkgs/commit/${nixpkgsCommit}.patch"
;
in if (builtins.elem variant applies) then fetchpatch2 (
isMerged = merged ? "${variant}" && lib.versionAtLeast date merged."${variant}";
in if !isMerged then fetchpatch2 (
{ inherit revert url; }
// (if hash != null then { inherit hash; } else {})
// (if title != null then { name = title; } else {})
@ -33,7 +35,9 @@ in [
title = "python3Packages.numpy: fix cross compilation";
prUrl = "https://github.com/NixOS/nixpkgs/pull/268587";
hash = "sha256-GRRLXwUw2JXEV6Ov0QiVTFwoi/ACManG2Qk7D3fzS8E=";
applies = [ "unstable" "master" ];
# probably not correct
merged.staging-next = "20231212000216";
merged.master = "20231212000216";
})
# (fetchpatch' {
# title = "nixos/slskd: allow omitting username from yaml config";