nixos/hypridle: init

(cherry picked from commit 353aa12446)
This commit is contained in:
John Titor 2024-05-27 17:41:36 +05:30 committed by github-actions[bot]
parent 0b15e543c6
commit d318a15bca
3 changed files with 28 additions and 8 deletions

View File

@ -1326,6 +1326,7 @@
./services/video/unifi-video.nix
./services/video/v4l2-relayd.nix
./services/wayland/cage.nix
./services/wayland/hypridle.nix
./services/web-apps/akkoma.nix
./services/web-apps/alps.nix
./services/web-apps/anuko-time-tracker.nix

View File

@ -7,22 +7,15 @@ in
options.programs.hyprlock = {
enable = lib.mkEnableOption "hyprlock, Hyprland's GPU-accelerated screen locking utility";
package = lib.mkPackageOption pkgs "hyprlock" { };
hypridlePackage = lib.mkPackageOption pkgs "hypridle" { };
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
cfg.package
cfg.hypridlePackage
];
# Hyprlock needs Hypridle systemd service to be running to detect idle time
systemd.user.services.hypridle = {
description = "Hypridle idle daemon";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
script = lib.getExe cfg.hypridlePackage;
};
services.hypridle.enable = true;
# Hyprlock needs PAM access to authenticate, else it fallbacks to su
security.pam.services.hyprlock = {};

View File

@ -0,0 +1,26 @@
{ lib, pkgs, config, ... }:
let
cfg = config.services.hypridle;
in
{
options.services.hypridle = {
enable = lib.mkEnableOption "hypridle, Hyprland's idle daemon";
package = lib.mkPackageOption pkgs "hypridle" { };
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
cfg.package
];
systemd.user.services.hypridle = {
description = "Hypridle idle daemon";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
script = lib.getExe cfg.package;
};
};
meta.maintainers = with lib.maintainers; [ johnrtitor ];
}