nix-git/modules/gnome-fractional-scaling.home.nix

62 lines
2.4 KiB
Nix
Raw Normal View History

2023-09-06 19:29:51 +02:00
{ config, pkgs, ... }:
{
# https://wiki.archlinux.org/title/HiDPI#Wayland
# Results in blurry font in non-Wayland applications :/
2023-09-07 13:47:44 +02:00
# https://wiki.archlinux.org/title/HiDPI#Xorg
2023-09-06 19:29:51 +02:00
programs.dconf.enable = true;
2023-09-07 13:47:44 +02:00
# Overlays.
# https://nixos.wiki/wiki/Overlays#In_NixOS
nixpkgs.overlays = [
(
# Patched version of mutter.
# Outdated example: https://nixos.wiki/wiki/Overlays#Overriding_a_package_inside_a_scope
#
# On the AUR, they apply only one patch, not three.
# And they pick the patch that corresponds to the mutter version.
# https://aur.archlinux.org/packages/mutter-x11-scaling
#
# New patch URL:
# -> https://salsa.debian.org/gnome-team/mutter/-/blob/ubuntu/master/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch
# For release 44.2:
# -> https://salsa.debian.org/gnome-team/mutter/-/tags?sort=updated_desc&search=ubuntu%2F
# -> https://salsa.debian.org/gnome-team/mutter/-/tags/ubuntu%2F44.2-3ubuntu1
# -> https://salsa.debian.org/gnome-team/mutter/-/raw/ubuntu/44.2-3ubuntu1/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch
#
#=> building '/nix/store/yh0jnwyq5351l1rjspjlkimas3wvpf6g-mutter-44.2.drv'...
# Elements of nixpkgs must be taken from final and prev.
final: prev: {
# Elements of pkgs.gnome must be taken from gfinal and gprev.
gnome = prev.gnome.overrideScope' (gfinal: gprev: {
mutter = gprev.mutter.overrideAttrs (oldAttrs: {
patches = (oldAttrs.patches or []) ++ [
(prev.fetchpatch {
url = "https://salsa.debian.org/gnome-team/mutter/-/raw/ubuntu/44.2-3ubuntu1/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch";
# Determining the hash: https://github.com/NixOS/nixpkgs/issues/191128#issuecomment-1246030431
hash = "sha256-GCtz87C1NgxenYE5nbxcIIxqNhutmdngscnlK10fRyQ=";
})
];
});
});
}
)
];
2023-09-06 19:29:51 +02:00
home-manager.users.yoda = { osConfig, config, pkgs, ... }: {
dconf.settings = {
"org/gnome/mutter" = {
2023-09-07 13:47:44 +02:00
experimental-features = [
# Wayland fractional scaling
"scale-monitor-framebuffer"
# X11 fractional scaling
"x11-randr-fractional-scaling"
];
2023-09-06 19:29:51 +02:00
};
};
};
}