1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

home-environment: make home.keyboard optional

When set to `null` then the `xsession` module will not attempt to
manage the keyboard settings.
This commit is contained in:
Robert Helgesson 2019-04-11 01:09:27 +02:00
parent 6cd5c8fca5
commit b6e1d82685
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 40 additions and 33 deletions

View file

@ -139,9 +139,12 @@ in
}; };
home.keyboard = mkOption { home.keyboard = mkOption {
type = keyboardSubModule; type = types.nullOr keyboardSubModule;
default = {}; default = {};
description = "Keyboard configuration."; description = ''
Keyboard configuration. Set to <literal>null</literal> to
disable Home Manager keyboard management.
'';
}; };
home.sessionVariables = mkOption { home.sessionVariables = mkOption {

View file

@ -66,7 +66,9 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.user.services.setxkbmap = { systemd.user = {
services = mkIf (config.home.keyboard != null) {
setxkbmap = {
Unit = { Unit = {
Description = "Set up keyboard in X"; Description = "Set up keyboard in X";
After = [ "graphical-session-pre.target" ]; After = [ "graphical-session-pre.target" ];
@ -92,15 +94,17 @@ in
"${pkgs.xorg.setxkbmap}/bin/setxkbmap ${args}"; "${pkgs.xorg.setxkbmap}/bin/setxkbmap ${args}";
}; };
}; };
};
# A basic graphical session target for Home Manager. # A basic graphical session target for Home Manager.
systemd.user.targets.hm-graphical-session = { targets.hm-graphical-session = {
Unit = { Unit = {
Description = "Home Manager X session"; Description = "Home Manager X session";
Requires = [ "graphical-session-pre.target" ]; Requires = [ "graphical-session-pre.target" ];
BindsTo = [ "graphical-session.target" ]; BindsTo = [ "graphical-session.target" ];
}; };
}; };
};
home.file.".xprofile".text = '' home.file.".xprofile".text = ''
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"