Skip to content

jfly/flake-input-patcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flake-input-patcher

Tired of waiting for PRs to land? Stop waiting!

Utility to patch nix flake inputs.

This can go away when nix supports patching flake inputs: NixOS/nix#3920.

Usage

Usage in a flake.nix:

{
  inputs = {
    flake-input-patcher.url = "github:jfly/flake-input-patcher";
    # ... More inputs here ...
  };

  outputs =
    unpatchedInputs:
    let
      # Unfortunately, this utility requires hardcoding a single system. See
      # "Known issues" below.
      patcher = unpatchedInputs.flake-input-patcher.lib.x86_64-linux;

      inputs = patcher.patch unpatchedInputs {
        # Patching a direct dependency:
        nixpkgs.patches = [
          (patcher.fetchpatch {
            name = "k3s: use patched util-linuxMinimal";
            url = "https://github.com/NixOS/nixpkgs/pull/407810.diff";
            hash = "sha256-N8tzwSZB9d4Htvimy00+Jcw8TKRCeV8PJWp80x+VtSk=";
          })
        ];

        # Patching a transitive dependency:
        clan-core.inputs.data-mesher.patches = [
           # ... More patches here ...
        ];
      };
    in
    # Define your flake as normal using `inputs`!
}

Known issues

  • We currently don't understand anything about input following, so you can end up in inconsistent states. For example, if you patch your top level nixpkgs, that doesn't affect transitive dependencies that follow that nixpkgs. Ideally we'd import flake.nix and honor the follows.
  • nix does not (yet) have a patch builtin, so we use system-specific utilities in nixpkgs (fetchpatch and applyPatches), which means you have to hardcode a system to make it work.
  • This depends on Input From Derivation (IFD).

Alternatives

In the wild

Feel free to add a link to your repo here!

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages