I am using a custom keyboard layout called gallium, and I would like to use it as a derivation, called in configuration.nix with (callPackage ./gallium.nix {}).
Here is the gallium.nix:
{ pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation {
name = "galliumv2";
src = pkgs.fetchFromGitHub {
owner = "GalileoBlues";
repo = "Gallium";
rev = "21a...1fe";
sha256 = "JrK...Aw=";
};
installPhase = ''
mkdir -p $out/share/keymaps/i386/gallium
mkdir -p ${pkgs.xkeyboardconfig}/etc/X11/xkb
cp ./Linux/console/gallium_rowstag.map $out/share/keymaps/i386/gallium/gallium.map
cp ./Linux/xkb/gallium_rowstag ${pkgs.xkeyboardconfig}/etc/X11/xkb/gallium
'';
}
I have tried setting the xkb keyboard layout to $out, but it seems like only keyboard layouts that are set by services.xserver.xkb are detected by wayland compositors, which is why I used pkgs.xkeyboardconfig as an out path. However, changing the out path for xkb to pkgs.xkeyboardconfig throws the error cp: cannot create regular file '/nix/store/7d...mhh-xkeyboard-config-2.47/etc/X11/xkb/gallium': Permission denied. If there is a way for me to specify custom keyboard layouts as in https://nixos.org/manual/nixos/stable/#custom-xkb-layouts in a derivation, please do tell me how.
I found out that only pkgs.xkeyboardconfig was allowed because xkbcommon threw the error
xkbcommon: ERROR: [XKB-338] Couldn't find file "symbols/gallium" in include paths
xkbcommon: ERROR: [XKB-338] 1 include paths searched:
xkbcommon: ERROR: [XKB-338] /nix/store/7dh...mhh-xkeyboard-config-2.47/etc/X11/xkb
xkbcommon: ERROR: [XKB-338] 3 include paths could not be added:
xkbcommon: ERROR: [XKB-338] /home/-/.config/xkb
xkbcommon: ERROR: [XKB-338] /home/cube/.xkb
xkbcommon: ERROR: [XKB-338] /etc/xkb
xkbcommon: ERROR: [XKB-661] Couldn't process include statement for 'gallium'
...
The reason I would like to use a derivation is so that I can update both console keymap and xkb keyboard layout at the same time, and I would prefer if console keymap does not use xkb keyboards.