{ lib, pkgs, ... }: let makebinds = attrs: lib.pipe attrs [ (attr: builtins.mapAttrs (_: keys: (builtins.map (key: "<${key}>") keys)) attr) (attr: (builtins.mapAttrs (_: keys: (builtins.concatStringsSep " " keys)) attr)) (attr: (lib.attrsets.mapAttrsToList (sum: keys: '' ${keys} : "${sum}"'') attr)) (attr: builtins.concatStringsSep "\n" attr) ]; binds = lib.concatStringsSep "\n" [ # ''include "%L"'' (makebinds { "ě" = [ "e" "j" ]; "ѣ" = [ "Cyrillic_ie" "Cyrillic_ie" ]; "Ѣ" = [ "Cyrillic_IE" ]; "ѳ" = [ "Cyrillic_ef" ]; "ѵ" = [ "Cyrillic_i" ]; "ґ" = [ "Cyrillic_ghe" ]; "є" = [ "Cyrillic_ie" "Cyrillic_e" ]; "љ" = [ "Cyrillic_el" "Cyrillic_el" ]; "њ" = [ "Cyrillic_en" "Cyrillic_en" ]; "ѧ" = [ "Cyrillic_e" "Cyrillic_en" ]; "ѩ" = [ "Cyrillic_ie" "Cyrillic_en" ]; "ѫ" = [ "Cyrillic_o" "Cyrillic_en" ]; "ѭ" = [ "Cyrillic_io" "Cyrillic_en" ]; "¨" = [ "Colon" ]; "α" = [ "g" "a" ]; "β" = [ "g" "b" ]; "γ" = [ "g" "g" ]; "λ" = [ "g" "l" ]; }) ]; in { environment.variables.XCOMPOSEFILE = ".XCompose"; hm = { home.file.".XCompose" = { enable = true; target = ".XCompose"; recursive = false; text = binds; }; programs.niri.settings.input.keyboard.xkb.file = toString (pkgs.writeText "compose.xkb" binds); }; }