@@ -79,6 +79,10 @@ let
7979 };
8080 };
8181
82+ xkb_patched = pkgs.xorg.xkeyboardconfig_custom {
83+ layouts = config.services.xserver.extraLayouts;
84+ };
85+
8286in
8387
8488{
@@ -114,58 +118,14 @@ in
114118
115119 config = mkIf (layouts != { }) {
116120
117− # We don't override xkeyboard_config directly to
118− # reduce the amount of packages to be recompiled.
119− # Only the following packages are necessary to set
120− # a custom layout anyway:
121− nixpkgs.overlays = lib.singleton (self: super: {
122−
123− xkb_patched = self.xorg.xkeyboardconfig_custom {
124− layouts = config.services.xserver.extraLayouts;
125− };
126−
127− xorg = super.xorg // {
128− xorgserver = super.xorg.xorgserver.overrideAttrs (old: {
129− configureFlags = old.configureFlags ++ [
130− "--with-xkb-bin-directory=${self.xorg.xkbcomp}/bin"
131− "--with-xkb-path=${self.xkb_patched}/share/X11/xkb"
132− ];
133− });
134−
135− setxkbmap = super.xorg.setxkbmap.overrideAttrs (old: {
136− postInstall =
137− ''
138− mkdir -p $out/share
139− ln -sfn ${self.xkb_patched}/etc/X11 $out/share/X11
140− '';
141− });
142−
143− xkbcomp = super.xorg.xkbcomp.overrideAttrs (old: {
144− configureFlags = [ "--with-xkb-config-root=${self.xkb_patched}/share/X11/xkb" ];
145− });
146−
147− };
148−
149− ckbcomp = super.ckbcomp.override {
150− xkeyboard_config = self.xkb_patched;
151− };
152−
153− xkbvalidate = super.xkbvalidate.override {
154− libxkbcommon = self.libxkbcommon.override {
155− xkeyboard_config = self.xkb_patched;
156− };
157− };
158−
159− });
160−
161121 environment.sessionVariables = {
162122 # runtime override supported by multiple libraries e. g. libxkbcommon
163123 # https://xkbcommon.org/doc/current/group__include-path.html
164− XKB_CONFIG_ROOT = "${pkgs.xkb_patched}/etc/X11/xkb";
124+ XKB_CONFIG_ROOT = "${xkb_patched}/etc/X11/xkb";
165125 };
166126
167127 services.xserver = {
168− xkbDir = "${pkgs.xkb_patched}/etc/X11/xkb";
128+ xkbDir = "${xkb_patched}/etc/X11/xkb";
169129 exportConfiguration = config.services.xserver.displayManager.startx.enable
170130 || config.services.xserver.displayManager.sx.enable;
171131 };