Overlays: Difference between revisions
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> | 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 | ||
gnome = super.gnome.overrideScope' (gself: gsuper: { | |||
mutter = gsuper.mutter.overrideAttrs (oldAttrs: { | |||
patches = oldAttrs.patches ++ [ | |||
# https://salsa.debian.org/gnome-team/mutter/-/blob/ubuntu/master/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch | |||
(super.fetchpatch { | |||
patches = ( | url = "https://salsa.debian.org/gnome-team/mutter/-/raw/91d9bdafd5d624fe1f40f4be48663014830eee78/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch"; | ||
sha256 = "m6PKjVxhGVuzsMBVA82UyJ6Cb1s6SMI0eRooa+F2MY8="; | |||
}) | |||
]; | |||
}); | |||
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> |