Nixpkgs/Modifying Packages: Difference between revisions

imported>Roberth
Expand on the options in the introduction
imported>Roberth
m formatting
Line 9: Line 9:
If upstreaming into the official NixPkgs is not an option, consider creating an overlay. This is slightly more involved at first, but is easier to maintain than a NixPkgs fork and, unlike a fork, it can be combined with other overlays. In an overlay, you can also choose not to redefine the package, but only override part of the arguments or derivation attributes. For example, you may only need to change one of the [https://nixos.org/nixpkgs/manual/#sec-stdenv-phases stdenv build phases].
If upstreaming into the official NixPkgs is not an option, consider creating an overlay. This is slightly more involved at first, but is easier to maintain than a NixPkgs fork and, unlike a fork, it can be combined with other overlays. In an overlay, you can also choose not to redefine the package, but only override part of the arguments or derivation attributes. For example, you may only need to change one of the [https://nixos.org/nixpkgs/manual/#sec-stdenv-phases stdenv build phases].


== The Copy Paste Option
== The Copy Paste Option ==


This one is quick and easy to understand, but not something you can build on.
This one is quick and easy to understand, but not something you can build on.
Line 28: Line 28:
So this method of modifying a package is only suited for prototyping a package before refactoring and ad-hoc packages you know you will not re-use.
So this method of modifying a package is only suited for prototyping a package before refactoring and ad-hoc packages you know you will not re-use.


== Upstreaming into NixPkgs
== Upstreaming into NixPkgs ==


Making your changes available as open source has all the benefits of open source. If it's an option for you, fork [https://github.com/NixOS/nixpkgs nixpkgs on github], read the contributing guidelines, edit and test your modified clone and create a pull request.
Making your changes available as open source has all the benefits of open source. If it's an option for you, fork [https://github.com/NixOS/nixpkgs nixpkgs on github], read the contributing guidelines, edit and test your modified clone and create a pull request.


== Create an Overlay
== Create an Overlay ==


Overlays are a composable method of managing packages that are not (or not yet) suitable for upstream NixPkgs. Unlike a fork, you can have multiple active overlays and you can make changes to packages without having to maintain a git fork of the entire repository.
Overlays are a composable method of managing packages that are not (or not yet) suitable for upstream NixPkgs. Unlike a fork, you can have multiple active overlays and you can make changes to packages without having to maintain a git fork of the entire repository.