The layout I want is that of name "us" and variant "carpalx-full-altgr-intl"
modified as follows.
I want the caps lock key to mean left control. That frees up the left control
key, which should mean AltGr (for getting level 3 and with shift level 4). That
frees up the key immediately right of the space bar, which should mean right
alt (making left and right alt symmetric).
My keyboard is European, so there is a key immediately left of the Z key. In US
layouts it is a second backslash. Instead, it should mean what the apostrophe
key usually does, and the apostrophe key should mean right control (making left
and right control symmetric). That frees up the right control key, which should
mean right win.
That is
<CAPS>: left control
<LCTL>: AltGr, for getting level 3 and with shift level 4
<RALT>: right alt
<LSGT>: apostrophe, quotedbl, dead_acute, dead_diaeresis
<AC11>: right control
<RCTL>: right win
On my previous operating system, Ubuntu, I did this by directly editing files
in /usr/share/X11/xkb. How ought it to be done in GNU Guix System, of which I
am a new user? My system and home configuration files are below. Note that it
is not enough to customize the layout for Sway, as I also want to use this
layout in the virtual consoles, at Ctrl+Alt+F2 and so on.
My system configuration file is
```
(use-modules (gnu))
(use-package-modules shells terminals wm)
(use-service-modules cups desktop networking ssh xorg)
(operating-system
(host-name "x2")
(timezone "Europe/London")
(locale "en_GB.utf8")
(keyboard-layout (keyboard-layout "us" "carpalx-full-altgr-intl"))
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
(targets (list "/boot/efi"))
(keyboard-layout keyboard-layout)))
(file-systems
(cons* (file-system
(mount-point "/boot/efi")
(device (uuid "D45B-2352" 'fat32))
(type "vfat"))
(file-system
(mount-point "/")
(device (uuid "a7268d5f-a88d-47a-80c0-c1b77b1b4e33" 'ext4))
(type "ext4"))
%base-file-systems))
(swap-devices
(list (swap-space (target (uuid "cff0b052-c580-4590-9bb1-973388a6735d")))))
(users (cons* (user-account
(name "jd")
(comment "John Dawson")
(group "users")
(supplementary-groups '("wheel" "netdev" "audio" "video"))
(shell (file-append fish "/bin/fish")))
%base-user-accounts))
(packages (cons* fish
foot
sway
wmenu
%base-packages))
(services (cons* (set-xorg-configuration
(xorg-configuration (keyboard-layout keyboard-layout)))
%desktop-services)))
```
My home configuration file is
```
(define-module (guix-home-config)
#:use-module (gnu home)
#:use-module (gnu home services)
#:use-module (gnu home services shells)
#:use-module (gnu home services sway)
#:use-module (gnu services)
#:use-module (gnu system keyboard)
#:use-module (gnu system shadow))
(define home-config
(home-environment
(services
(cons*
(service home-files-service-type
`((".guile" ,%default-dotguile)
(".Xdefaults" ,%default-xdefaults)))
(service home-fish-service-type)
(service home-sway-service-type
(sway-configuration
(inputs (list (sway-input
(identifier "type:keyboard")
(layout (keyboard-layout
"us"
"carpalx-full-altgr-intl")))))
(startup-programs '())))
(service home-xdg-configuration-files-service-type
`(("gdb/gdbinit" ,%default-gdbinit)
("nano/nanorc" ,%default-nanorc)))
%base-home-services))))
home-config
```