feat(hypridle): define config in home-manager with per-host timeouts

Replace the static hypridle.conf with services.hypridle.settings and add required timeout options so each host tunes its own values:

- idols-ai (PC): 15 min keyboard, 20 min screen-off, 30 min lock.
- 12kingdoms-shoukei (laptop): 3 / 6 / 20 min (previous values).

The options have no defaults because the right values depend on the machine. Update the home-manager eval test to inspect the settings option instead of the old config file text.
This commit is contained in:
Ryan Yin
2026-09-13 23:45:42 +08:00
parent cdfa332970
commit 7131041107
5 changed files with 81 additions and 64 deletions
@@ -13,22 +13,15 @@ lib.genAttrs hosts (
name:
let
hm = outputs.nixosConfigurations.${name}.config.home-manager.users.${username};
hypridleConfig = builtins.readFile hm.xdg.configFile."hypr/hypridle.conf".source;
hasHypridleLines = lines: lib.hasInfix (lib.concatStringsSep "\n" lines) hypridleConfig;
listeners = hm.services.hypridle.settings.listener;
findByAction = action: lib.findFirst (l: (l."on-timeout" or "") == action) { } listeners;
screenOff = findByAction "niri msg action power-off-monitors";
lock = findByAction "noctalia-shell ipc call lockScreen lock";
in
{
homeDirectory = hm.home.homeDirectory;
hypridleScreenOffIgnoresInhibitors = hasHypridleLines [
" timeout = 360 # 6 minutes"
" ignore_inhibit = true"
];
hypridleScreenOffSkipsPlayingMedia = hasHypridleLines [
" condition_cmd = ! playerctl -a status 2>/dev/null | grep -q '^Playing$'"
" condition_retry = 30"
];
hypridleLockIgnoresInhibitors = hasHypridleLines [
" timeout = 1200 # 20 minutes"
" ignore_inhibit = true"
];
hypridleScreenOffIgnoresInhibitors = screenOff.ignore_inhibit or false;
hypridleScreenOffSkipsPlayingMedia = (screenOff.condition_cmd or "") != "";
hypridleLockIgnoresInhibitors = lock.ignore_inhibit or false;
}
)