Jump to content

Overlays: Difference between revisions

m
imported>Mcdonc
(Distinguish between extensible and non-extensible attribute sets)
Tags: Mobile edit Mobile web edit
 
(4 intermediate revisions by 4 users not shown)
Line 18: Line 18:
== Data flow of overlays ==
== Data flow of overlays ==


The data flow around overlays, especially regarding <tt>prev</tt> and <tt>final</tt> arguments can be a bit confusing if you are not familiar with how overlays work. This graph shows the data flow:
The data flow of overlays, especially regarding <tt>prev</tt> and <tt>final</tt> arguments can be a bit confusing if you are not familiar with how overlays work. This graph shows the data flow:


[[File:Dram-overlay-final-prev.png]]
[[File:Dram-overlay-final-prev.png]]
Line 43: Line 43:




And <syntaxhighlight lang="nix">final: prev: firefox = final.firefox.override { ... };</syntaxhighlight> would cause infinite recursion.
And <syntaxhighlight lang="nix">final: prev: { firefox = final.firefox.override { ... }; }</syntaxhighlight> would cause infinite recursion.


== Using overlays ==
== Using overlays ==
Line 148: Line 148:
</syntaxhighlight>
</syntaxhighlight>


Then, add the following contents to <tt>/etc/nixos/overlays-compat/overlays.nix</tt><ref>Based on [https://gitlab.com/samueldr/nixos-configuration/blob/3febd83b15210282d6435932944d426cd0a9e0ca/modules/overlays-compat/overlays.nix [[User:samueldr|@samueldr]]'s configuration: overlays-compat]</ref>:
Then, add the following contents to <tt>/etc/nixos/overlays-compat/overlays.nix</tt><ref>Based on [https://gitlab.com/samueldr/nixos-configuration/blob/3febd83b15210282d6435932944d426cd0a9e0ca/modules/overlays-compat/overlays.nix][[User:Samueldr|@samueldr]]<span>'s configuration: overlays-compat</span></ref>:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 225: Line 225:
final: prev: {
final: prev: {
   # elements of pkgs.gnome must be taken from gfinal and gprev
   # elements of pkgs.gnome must be taken from gfinal and gprev
   gnome = prev.gnome.overrideScope' (gfinal: gprev: {
   gnome = prev.gnome.overrideScope (gfinal: gprev: {
     mutter = gprev.mutter.overrideAttrs (oldAttrs: {
     mutter = gprev.mutter.overrideAttrs (oldAttrs: {
       patches = oldAttrs.patches ++ [
       patches = oldAttrs.patches ++ [
Line 397: Line 397:
* [https://nixos.org/manual/nixpkgs/unstable/#using-community-maintained-rust-toolchains Details in the Nixpkgs manual for using Rust overlays]
* [https://nixos.org/manual/nixpkgs/unstable/#using-community-maintained-rust-toolchains Details in the Nixpkgs manual for using Rust overlays]
* [https://github.com/peter-sa/nixos-rocm Overlay for Radeon Open-Compute packages]
* [https://github.com/peter-sa/nixos-rocm Overlay for Radeon Open-Compute packages]
* [https://github.com/garbas/nixpkgs-python Overlay by Rok Garbas for a set of python packages built by pypi2nix]
* [https://github.com/garbas/nixpkgs-python Overlay by Rok Garbas for a set of python packages built by pypi2nix (archived)]


== See also ==
== See also ==
Line 403: Line 403:
* [https://nixos.org/nixpkgs/manual/#chap-overlays Overlays  in nixpkgs manual]
* [https://nixos.org/nixpkgs/manual/#chap-overlays Overlays  in nixpkgs manual]
* [https://blog.flyingcircus.io/2017/11/07/nixos-the-dos-and-donts-of-nixpkgs-overlays/ Blog post "The DOs and DON’Ts of nixpkgs overlays"]
* [https://blog.flyingcircus.io/2017/11/07/nixos-the-dos-and-donts-of-nixpkgs-overlays/ Blog post "The DOs and DON’Ts of nixpkgs overlays"]
* [https://www.youtube.com/watch?v=s2fkgkN55vk&list=PLgknCdxP89ReD6gxl755B6G_CI65z4J2e Nixpkgs Overlays – A place for all excluded packages] - Talk by Nicolas B. Pierron at NixCon 2017


==== References ====
==== References ====
1

edit