how to set custom xkb_keymap in nixos

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I have following layout layouts/en_ru



xkb_keymap 
xkb_keycodes include "evdev+aliases(qwerty)" ;
xkb_geometry include "pc(pc104)" ;
xkb_types include "complete" ;
xkb_compat include "complete" ;

xkb_symbols
include "pc+us+ru:2+inet(evdev)"
include "group(rctrl_rshift_toggle)"
include "capslock(swapescape)"

// swap right alt and left control
replace key <RALT> [ Control_L ] ;
modifier_map Control <RALT> ;

// swap ; and : only in us layout
replace key <AC10> [ colon, semicolon ],
[ Cyrillic_zhe, Cyrillic_ZHE ] ;

// helpers //
// xinput list
// xinput test 16
// xkbcomp $DISPLAY out.xkb
// cat /usr/share/X11/xkb/rules/base.lst
;
;


which is loaded in $HOME/xinitrc like this



xkbcomp $HOME/.config/layouts/en_ru $DISPLAY


How to move all this to configuration.nix?




I have made first part of this happen by adding



xserver = 
enable = true;
layout = "us,ru";
xkbOptions = "caps:swapescape,grp:rctrl_rshift_toggle";
;


to my configuration.nix, but I don't know how to add this part and make it system wide



// swap right alt and left control
replace key <RALT> [ Control_L ] ;
modifier_map Control <RALT> ;

// swap ; and : only in us layout
replace key <AC10> [ colon, semicolon ],
[ Cyrillic_zhe, Cyrillic_ZHE ] ;






share|improve this question


















  • 1




    my first thought is that your swap-Ralt-Lctrl portion is a fairly simple new option to create. the swap-in-us-layout is less so. if altering the system xkb database on nixos is like most linuxes, here's how to make a new option: askubuntu.com/a/969232/669043 ... but i suspect it's a little more like implementing that sort of change as a local patch to a source package that then gets compiled for your particular system, and that's beyond my experience. if you can figure that out, you'd just add your new option to your xkbOptions line like any other option.
    – quixotic
    Oct 29 '17 at 13:04






  • 1




    the swap-in-us-layout probably would need to be added as a separate variant (theoretically it could simply include us and then do your replace key -- without the cyrillic symbols -- see /usr/share/X11/xkb/symbols/us for examples). then instead of layout = "us,ru" you'd specify layout = "us-myvariant,ru".
    – quixotic
    Oct 29 '17 at 13:09















up vote
2
down vote

favorite












I have following layout layouts/en_ru



xkb_keymap 
xkb_keycodes include "evdev+aliases(qwerty)" ;
xkb_geometry include "pc(pc104)" ;
xkb_types include "complete" ;
xkb_compat include "complete" ;

xkb_symbols
include "pc+us+ru:2+inet(evdev)"
include "group(rctrl_rshift_toggle)"
include "capslock(swapescape)"

// swap right alt and left control
replace key <RALT> [ Control_L ] ;
modifier_map Control <RALT> ;

// swap ; and : only in us layout
replace key <AC10> [ colon, semicolon ],
[ Cyrillic_zhe, Cyrillic_ZHE ] ;

// helpers //
// xinput list
// xinput test 16
// xkbcomp $DISPLAY out.xkb
// cat /usr/share/X11/xkb/rules/base.lst
;
;


which is loaded in $HOME/xinitrc like this



xkbcomp $HOME/.config/layouts/en_ru $DISPLAY


How to move all this to configuration.nix?




I have made first part of this happen by adding



xserver = 
enable = true;
layout = "us,ru";
xkbOptions = "caps:swapescape,grp:rctrl_rshift_toggle";
;


to my configuration.nix, but I don't know how to add this part and make it system wide



// swap right alt and left control
replace key <RALT> [ Control_L ] ;
modifier_map Control <RALT> ;

// swap ; and : only in us layout
replace key <AC10> [ colon, semicolon ],
[ Cyrillic_zhe, Cyrillic_ZHE ] ;






share|improve this question


















  • 1




    my first thought is that your swap-Ralt-Lctrl portion is a fairly simple new option to create. the swap-in-us-layout is less so. if altering the system xkb database on nixos is like most linuxes, here's how to make a new option: askubuntu.com/a/969232/669043 ... but i suspect it's a little more like implementing that sort of change as a local patch to a source package that then gets compiled for your particular system, and that's beyond my experience. if you can figure that out, you'd just add your new option to your xkbOptions line like any other option.
    – quixotic
    Oct 29 '17 at 13:04






  • 1




    the swap-in-us-layout probably would need to be added as a separate variant (theoretically it could simply include us and then do your replace key -- without the cyrillic symbols -- see /usr/share/X11/xkb/symbols/us for examples). then instead of layout = "us,ru" you'd specify layout = "us-myvariant,ru".
    – quixotic
    Oct 29 '17 at 13:09













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have following layout layouts/en_ru



xkb_keymap 
xkb_keycodes include "evdev+aliases(qwerty)" ;
xkb_geometry include "pc(pc104)" ;
xkb_types include "complete" ;
xkb_compat include "complete" ;

xkb_symbols
include "pc+us+ru:2+inet(evdev)"
include "group(rctrl_rshift_toggle)"
include "capslock(swapescape)"

// swap right alt and left control
replace key <RALT> [ Control_L ] ;
modifier_map Control <RALT> ;

// swap ; and : only in us layout
replace key <AC10> [ colon, semicolon ],
[ Cyrillic_zhe, Cyrillic_ZHE ] ;

// helpers //
// xinput list
// xinput test 16
// xkbcomp $DISPLAY out.xkb
// cat /usr/share/X11/xkb/rules/base.lst
;
;


which is loaded in $HOME/xinitrc like this



xkbcomp $HOME/.config/layouts/en_ru $DISPLAY


How to move all this to configuration.nix?




I have made first part of this happen by adding



xserver = 
enable = true;
layout = "us,ru";
xkbOptions = "caps:swapescape,grp:rctrl_rshift_toggle";
;


to my configuration.nix, but I don't know how to add this part and make it system wide



// swap right alt and left control
replace key <RALT> [ Control_L ] ;
modifier_map Control <RALT> ;

// swap ; and : only in us layout
replace key <AC10> [ colon, semicolon ],
[ Cyrillic_zhe, Cyrillic_ZHE ] ;






share|improve this question














I have following layout layouts/en_ru



xkb_keymap 
xkb_keycodes include "evdev+aliases(qwerty)" ;
xkb_geometry include "pc(pc104)" ;
xkb_types include "complete" ;
xkb_compat include "complete" ;

xkb_symbols
include "pc+us+ru:2+inet(evdev)"
include "group(rctrl_rshift_toggle)"
include "capslock(swapescape)"

// swap right alt and left control
replace key <RALT> [ Control_L ] ;
modifier_map Control <RALT> ;

// swap ; and : only in us layout
replace key <AC10> [ colon, semicolon ],
[ Cyrillic_zhe, Cyrillic_ZHE ] ;

// helpers //
// xinput list
// xinput test 16
// xkbcomp $DISPLAY out.xkb
// cat /usr/share/X11/xkb/rules/base.lst
;
;


which is loaded in $HOME/xinitrc like this



xkbcomp $HOME/.config/layouts/en_ru $DISPLAY


How to move all this to configuration.nix?




I have made first part of this happen by adding



xserver = 
enable = true;
layout = "us,ru";
xkbOptions = "caps:swapescape,grp:rctrl_rshift_toggle";
;


to my configuration.nix, but I don't know how to add this part and make it system wide



// swap right alt and left control
replace key <RALT> [ Control_L ] ;
modifier_map Control <RALT> ;

// swap ; and : only in us layout
replace key <AC10> [ colon, semicolon ],
[ Cyrillic_zhe, Cyrillic_ZHE ] ;








share|improve this question













share|improve this question




share|improve this question








edited Oct 29 '17 at 12:04

























asked Oct 29 '17 at 9:37









srghma

1296




1296







  • 1




    my first thought is that your swap-Ralt-Lctrl portion is a fairly simple new option to create. the swap-in-us-layout is less so. if altering the system xkb database on nixos is like most linuxes, here's how to make a new option: askubuntu.com/a/969232/669043 ... but i suspect it's a little more like implementing that sort of change as a local patch to a source package that then gets compiled for your particular system, and that's beyond my experience. if you can figure that out, you'd just add your new option to your xkbOptions line like any other option.
    – quixotic
    Oct 29 '17 at 13:04






  • 1




    the swap-in-us-layout probably would need to be added as a separate variant (theoretically it could simply include us and then do your replace key -- without the cyrillic symbols -- see /usr/share/X11/xkb/symbols/us for examples). then instead of layout = "us,ru" you'd specify layout = "us-myvariant,ru".
    – quixotic
    Oct 29 '17 at 13:09













  • 1




    my first thought is that your swap-Ralt-Lctrl portion is a fairly simple new option to create. the swap-in-us-layout is less so. if altering the system xkb database on nixos is like most linuxes, here's how to make a new option: askubuntu.com/a/969232/669043 ... but i suspect it's a little more like implementing that sort of change as a local patch to a source package that then gets compiled for your particular system, and that's beyond my experience. if you can figure that out, you'd just add your new option to your xkbOptions line like any other option.
    – quixotic
    Oct 29 '17 at 13:04






  • 1




    the swap-in-us-layout probably would need to be added as a separate variant (theoretically it could simply include us and then do your replace key -- without the cyrillic symbols -- see /usr/share/X11/xkb/symbols/us for examples). then instead of layout = "us,ru" you'd specify layout = "us-myvariant,ru".
    – quixotic
    Oct 29 '17 at 13:09








1




1




my first thought is that your swap-Ralt-Lctrl portion is a fairly simple new option to create. the swap-in-us-layout is less so. if altering the system xkb database on nixos is like most linuxes, here's how to make a new option: askubuntu.com/a/969232/669043 ... but i suspect it's a little more like implementing that sort of change as a local patch to a source package that then gets compiled for your particular system, and that's beyond my experience. if you can figure that out, you'd just add your new option to your xkbOptions line like any other option.
– quixotic
Oct 29 '17 at 13:04




my first thought is that your swap-Ralt-Lctrl portion is a fairly simple new option to create. the swap-in-us-layout is less so. if altering the system xkb database on nixos is like most linuxes, here's how to make a new option: askubuntu.com/a/969232/669043 ... but i suspect it's a little more like implementing that sort of change as a local patch to a source package that then gets compiled for your particular system, and that's beyond my experience. if you can figure that out, you'd just add your new option to your xkbOptions line like any other option.
– quixotic
Oct 29 '17 at 13:04




1




1




the swap-in-us-layout probably would need to be added as a separate variant (theoretically it could simply include us and then do your replace key -- without the cyrillic symbols -- see /usr/share/X11/xkb/symbols/us for examples). then instead of layout = "us,ru" you'd specify layout = "us-myvariant,ru".
– quixotic
Oct 29 '17 at 13:09





the swap-in-us-layout probably would need to be added as a separate variant (theoretically it could simply include us and then do your replace key -- without the cyrillic symbols -- see /usr/share/X11/xkb/symbols/us for examples). then instead of layout = "us,ru" you'd specify layout = "us-myvariant,ru".
– quixotic
Oct 29 '17 at 13:09
















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401185%2fhow-to-set-custom-xkb-keymap-in-nixos%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401185%2fhow-to-set-custom-xkb-keymap-in-nixos%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?