config/modules/laptop-config/gdm-touchpad-config.nix
2022-02-05 20:47:50 +01:00

37 lines
1.1 KiB
Nix

{ pkgs, lib, ... }:
{
programs.dconf.profiles.gdm = lib.mkForce (let
customDconf = pkgs.writeTextFile {
name = "gdm-dconf-touchpad";
destination = "/dconf/gdm-custom";
text = ''
[org/gnome/desktop/peripherals/touchpad]
edge-scrolling-enabled=false
natural-scroll=false
speed=0.375
tap-to-click=true
two-finger-scrolling-enabled=true
'';
};
customDconfDb = pkgs.stdenv.mkDerivation {
name = "gdm-dconf-db";
buildCommand = ''
${pkgs.dconf}/bin/dconf compile $out ${customDconf}/dconf
'';
};
in pkgs.stdenv.mkDerivation {
name = "dconf-gdm-profile";
buildCommand = with { gdm = pkgs.gnome.gdm; }; ''
# Check that the GDM profile starts with what we expect.
if [ $(head -n 1 ${gdm}/share/dconf/profile/gdm) != "user-db:user" ]; then
echo "GDM dconf profile changed, please update gdm.nix"
exit 1
fi
# Insert our custom DB behind it.
sed '2ifile-db:${customDconfDb}' ${gdm}/share/dconf/profile/gdm > $out
'';
});
}