Files
nixos/Droidnix/generated/modules/traveldroid/system/numlock-check.nix
T
2026-04-29 23:05:34 +02:00

39 lines
1.1 KiB
Nix

# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
{ lib, config, pkgs, flakeRoot, ... }:
let
username = config.defaultUser or "henrov";
scriptSrc = "${flakeRoot}/generated/.config/shared/scripts/numlock-check.sh";
in
{
environment.systemPackages = [ pkgs.numlockx pkgs.libinput ];
home-manager.users.${username} = {
home.activation.installNumlockScript = {
after = [ "writeBoundary" ];
before = [];
data = ''
mkdir -p $HOME/.config/shared/scripts
cp ${scriptSrc} $HOME/.config/shared/scripts/numlock-check.sh
chmod u+x $HOME/.config/shared/scripts/numlock-check.sh
'';
};
};
systemd.user.services.numlock-check = {
description = "Check and set numlock based on keyboard count";
serviceConfig = {
Type = "oneshot";
ExecStart = "%h/.config/shared/scripts/numlock-check.sh";
};
};
systemd.user.timers.numlock-check = {
description = "Run numlock check periodically";
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5s";
OnUnitActiveSec = "10s";
};
};
}