Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 668 Bytes

README.md

File metadata and controls

47 lines (37 loc) · 668 Bytes

patches4nixpkgs

a small flake that allows adding patches to nixpkgs conditionally

Usage:

Add this to each flake

{
  patches4nixpkgs = nixpkgs: [
    [(condition) ./patch-file.patch]
  ];
}

e.g.:

{
  patches4nixpkgs = nixpkgs: [
    [(! builtins.pathExists "${nixpkgs}/my-file") ./add-my-file.patch]
  ];
}

Then patch nixpkgs

{
  inputs.nixpkgs...

  outputs = { self, flake, other-flake, ... }@inputs: {

  let
    patchPkgs = patches4nixpkgs.patch inputs.nixpkgs [
      flake
      other-flake
      self
    ];
    nixpkgs = patches4nixpkgs.eval patchPkgs; # evaluate flake.nix like it wasn't patched
  in
  {
    ...
  };
}