2019-07-29 03:41:02 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.xsession.numlock;
|
|
|
|
|
2020-02-02 00:39:17 +01:00
|
|
|
in {
|
2020-09-18 17:20:45 +02:00
|
|
|
meta.maintainers = [ maintainers.evanjs ];
|
|
|
|
|
2023-07-01 01:30:13 +02:00
|
|
|
options = {
|
|
|
|
xsession.numlock.enable = mkEnableOption (lib.mdDoc "Num Lock");
|
|
|
|
};
|
2019-07-29 03:41:02 +02:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2021-07-07 23:24:27 +02:00
|
|
|
assertions = [
|
|
|
|
(hm.assertions.assertPlatform "xsession.numlock" pkgs platforms.linux)
|
|
|
|
];
|
|
|
|
|
2019-07-29 03:41:02 +02:00
|
|
|
systemd.user.services.numlockx = {
|
|
|
|
Unit = {
|
|
|
|
Description = "NumLockX";
|
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
Type = "oneshot";
|
2019-08-14 20:41:19 +02:00
|
|
|
RemainAfterExit = true;
|
2019-07-29 03:41:02 +02:00
|
|
|
ExecStart = "${pkgs.numlockx}/bin/numlockx";
|
|
|
|
};
|
|
|
|
|
2020-02-02 00:39:17 +01:00
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
2019-07-29 03:41:02 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|