Gentoo has an amazingly awesome feature where you can maintain your own patches against packages in the Gentoo package system [1]. This feature can be useful when the corresponding upstream project is on life support, obstinate, you have eccentric desires, or otherwise your (or someone else's) patch has not been accepted upstream. The patched package will still continue to automatically receive updates with the patch automatically applied over time (at least as long as the patch can be applied without errors -- some maintenance may be required).[1] https://wiki.gentoo.org/wiki//etc/portage/patches
I wish I knew more about NixOS or Guix -- do they have an equivalent feature?
mananaysiempre|2 years ago
This falls out as a composition of two features. First, the default package build scripts support (and it’s a good practice to make your customization also support) an attribute called “patches”, containing, well, the patches that are applied to the unpacked source before configuring it. Second, Nixpkgs allows you to reach down into any package and mess with its attributes; NixOS further wires that up to a composable option. The result looks something like this:
(Here `prev` is the package set just before the customization in question is applied, useful for obvious reasons; while `final` is the package set after all the customizations have been applied, courtesy of lazy evaluation. Why’s that useful? Suppose you want to refer to some other package, say to add it as a dependency, and don’t want to depend on any customizations to it being applied before yours. What happens if you mess up and the customizations depend on each other? Well, what do you think happens when you mess up recursion in a huge chunk of pervasively recursive, pervasively lazy code, most of which you haven’t read. Ugh.)unknown|2 years ago
[deleted]