Nixpkgs/Patching Nixpkgs: Difference between revisions

Toastal (talk | contribs)
Add Nixtamal as declarative patching is a major feature
Perchun (talk | contribs)
m Link IFD column name to the Nix manual page
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
{| class="wikitable" style="text-align: center; width: 500px;"
{| class="wikitable" style="text-align: center; width: 500px;"
|-
|-
! Name            !! Method          !! IFD !! Requires Flakes
! Name            !! Method          !! [https://nixos.org/manual/nix/unstable/language/import-from-derivation IFD]!! Requires Flakes
|-
|-
| applyPatch      || .patch files    ||  X  ||
| applyPatch      || .patch files    ||  X  ||
Line 18: Line 18:
|}
|}


Most of the solutions work on the <code>.patch</code> files, but those have a huge disadvantage - they quickly go out of date and have to be constantly rebased. This is especially true for solutions that use Git to apply patches. Another disadvantage may be [https://nixos.org/manual/nix/unstable/language/import-from-derivation IFD], which may result in [https://nixcademy.com/posts/what-is-ifd-ups-and-downs/ performance and runtime issues].
Most of the solutions work on the <code>.patch</code> files, but those have a huge disadvantage - they quickly go out of date and have to be constantly rebased. This is especially true for solutions that use Git to apply patches. Another disadvantage may be [https://nixos.org/manual/nix/stable/language/import-from-derivation IFD], which may result in [https://nixcademy.com/posts/what-is-ifd-ups-and-downs/ performance and runtime issues].


== Usage ==
== Usage ==
Line 156: Line 156:
=== Using [https://nixtamal.toast.al/ Nixtamal] ===
=== Using [https://nixtamal.toast.al/ Nixtamal] ===


Nixtamal uses both <code>fetchPatch2</code> & <code>applyPatches</code> under the hood, but lets users declare the remote or local patches in its <code>manifest.kdl</code> to be locked to any input — including Nixpkgs.
Nixtamal uses both <code>fetchpatch2</code> & <code>applyPatches</code> under the hood, but lets users declare the remote or local patches in its <code>manifest.kdl</code> to be locked to any input — including Nixpkgs.


<syntaxhighlight lang="kdl">
<syntaxhighlight lang="kdl">
Line 179: Line 179:
</syntaxhighlight>
</syntaxhighlight>


After patches are added, the user must relock.
After patches are added, the user must relock:


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
Line 191: Line 191:
</syntaxhighlight>
</syntaxhighlight>


Then the user can seemlessly access their patched Nixpkgs
Then the user can seemlessly access their patched Nixpkgs:


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">