Nixpkgs/Modifying Packages: Difference between revisions
imported>Roberth m formatting |
imported>Nix link to overlays page |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 26: | Line 26: | ||
It is not as flexible as the original definition though. If you want to reuse hello as a dependency of another package, you will have to work with two methods of injecting dependencies. Instead of just the standard <code>callPackage</code> function, your packages have to specify exactly where their dependencies come from, which can become a burden of its own. Also it is impossible to use this package with something other than the default <code><nixpkgs></code>, default NixPkgs configuration, default system architecture etc. | It is not as flexible as the original definition though. If you want to reuse hello as a dependency of another package, you will have to work with two methods of injecting dependencies. Instead of just the standard <code>callPackage</code> function, your packages have to specify exactly where their dependencies come from, which can become a burden of its own. Also it is impossible to use this package with something other than the default <code><nixpkgs></code>, default NixPkgs configuration, default system architecture etc. | ||
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. Please consider the other options, because they don't have those drawbacks. | ||
== Upstreaming into NixPkgs == | == Upstreaming into NixPkgs == | ||
Line 34: | Line 34: | ||
== 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. | ||
[https://github.com/basvandijk/nixtodo/blob/master/default.nix Nixtodo] has an example of using an overlay to structure the packages in a web application project. | [https://github.com/basvandijk/nixtodo/blob/master/default.nix Nixtodo] has an example of using an overlay to structure the packages in a web application project. | ||
[https://github.com/mozilla/nixpkgs-mozilla Nixpkgs-mozilla] is an example of an overlay containing alternative and extra open source software. | [https://github.com/mozilla/nixpkgs-mozilla Nixpkgs-mozilla] is an example of an overlay containing alternative and extra open source software. |