Jump to content

Overlays: Difference between revisions

1,189 bytes added ,  15 September 2021
better scope example
imported>C9xl7dq
(correct markup)
imported>Artturin
(better scope example)
Line 203: Line 203:


=== Overriding a package inside a scope ===
=== Overriding a package inside a scope ===
Some packages are not in the top level of nixpkgs but inside a ''scope''. For example all [[GNOME]] packages are in the <code>gnome3</code> attribute set and [[Xfce]] packages inside <code>xfce</code>. These attributes are often ''scopes'' and must be overriden specially. Here is an example of patching <code>xfce.xfce4-terminal</code>.
Some packages are not in the top level of nixpkgs but inside a ''scope''. For example all [[GNOME]] packages are in the <code>gnome</code> attribute set and [[Xfce]] packages inside <code>xfce</code>. These attributes are often ''scopes'' and must be overriden specially. Here is an example of patching <code>gnome.mutter</code> and <code>gnome.gnome-control-center</code>.
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
# elements of nixpkgs must be taken from self and super
# elements of nixpkgs must be taken from self and super
self: super:
self: super: {
{
   # elements of pkgs.gnome must be taken from gself and gsuper
   xfce = super.xfce.overrideScope' (
  gnome = super.gnome.overrideScope' (gself: gsuper: {
    # elements of pkgs.xfce must be taken from selfx and superx
    mutter = gsuper.mutter.overrideAttrs (oldAttrs: {
    selfx: superx: {
      patches = oldAttrs.patches ++ [
      xfce4-terminal = superx.xfce4-terminal.overrideAttrs (
         # https://salsa.debian.org/gnome-team/mutter/-/blob/ubuntu/master/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch
         old: {
        (super.fetchpatch {
           patches = (old.patches or []) ++ [
           url = "https://salsa.debian.org/gnome-team/mutter/-/raw/91d9bdafd5d624fe1f40f4be48663014830eee78/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch";
            (
          sha256 = "m6PKjVxhGVuzsMBVA82UyJ6Cb1s6SMI0eRooa+F2MY8=";
              # https://bugzilla.xfce.org/show_bug.cgi?id=16682
        })
              super.fetchpatch {
    ];
                url = "https://bugzilla.xfce.org/attachment.cgi?id=9709";
    });
                sha256 = "1shxzzvwsybri772lbm17rpd1l0g9y2vc7f7xgqlgkgz72wzr5zp";
    gnome-control-center = gsuper.gnome-control-center.overrideAttrs (oldAttrs: {
              }
      patches = oldAttrs.patches ++ [
            )
        # https://salsa.debian.org/gnome-team/gnome-control-center/-/blob/ubuntu/master/debian/patches/ubuntu/display-Support-UI-scaled-logical-monitor-mode.patch
           ];
        (super.fetchpatch {
         }
          url = "https://salsa.debian.org/gnome-team/gnome-control-center/-/raw/f185f33fb200cc963c062c7a82920a085f696978/debian/patches/ubuntu/display-Support-UI-scaled-logical-monitor-mode.patch";
       );
          sha256 = "XBMD0chaV6GGg3R9/rQnsBejXspomVZz/a4Bvv/AHCA=";
     }
        })
   );
        # https://salsa.debian.org/gnome-team/gnome-control-center/-/blob/ubuntu/master/debian/patches/ubuntu/display-Allow-fractional-scaling-to-be-enabled.patch
        (super.fetchpatch {
          url = "https://salsa.debian.org/gnome-team/gnome-control-center/-/raw/f185f33fb200cc963c062c7a82920a085f696978/debian/patches/ubuntu/display-Allow-fractional-scaling-to-be-enabled.patch";
           sha256 = "Pm6PTmsL2bW9JAHD1u0oUEqD1PCIErOlcuqlwvP593I=";
         })
       ];
     });
   });
}
}
</syntaxhighlight>
</syntaxhighlight>
Anonymous user