numlock: add module

This adds an option `xsession.numlock` that enable the Num Lock key
when starting a graphical session.

Fixes #651
This commit is contained in:
Evan Stoll 2019-07-28 21:41:02 -04:00 committed by Robert Helgesson
parent 3743e8995a
commit e59b8b0c37
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 35 additions and 0 deletions

34
modules/misc/numlock.nix Normal file
View file

@ -0,0 +1,34 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xsession.numlock;
in
{
options = {
xsession.numlock.enable = mkEnableOption "Num Lock";
};
config = mkIf cfg.enable {
systemd.user.services.numlockx = {
Unit = {
Description = "NumLockX";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.numlockx}/bin/numlockx";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
}

View file

@ -28,6 +28,7 @@ let
(loadModule ./misc/lib.nix { }) (loadModule ./misc/lib.nix { })
(loadModule ./misc/news.nix { }) (loadModule ./misc/news.nix { })
(loadModule ./misc/nixpkgs.nix { }) (loadModule ./misc/nixpkgs.nix { })
(loadModule ./misc/numlock.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/pam.nix { }) (loadModule ./misc/pam.nix { })
(loadModule ./misc/qt.nix { }) (loadModule ./misc/qt.nix { })
(loadModule ./misc/submodule-support.nix { }) (loadModule ./misc/submodule-support.nix { })