1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/modules/services/caffeine.nix
Austin Horstman 03fdb31290
treewide: add missing package options (#7575)
Add options to support more flexible module configurations.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-07-29 12:20:22 -05:00

45 lines
871 B
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.caffeine;
in
{
meta.maintainers = [ lib.maintainers.uvnikita ];
options = {
services.caffeine = {
enable = lib.mkEnableOption "Caffeine service";
package = lib.mkPackageOption pkgs "caffeine-ng" { };
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.caffeine" pkgs lib.platforms.linux)
];
systemd.user.services.caffeine = {
Unit = {
Description = "caffeine";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
Restart = "on-failure";
PrivateTmp = true;
ProtectSystem = "full";
Type = "exec";
Slice = "session.slice";
ExecStart = "${lib.getExe' cfg.package "caffeine"}";
};
};
};
}