mirror of
https://github.com/nix-community/home-manager
synced 2024-11-18 00:59:44 +01:00
33 lines
677 B
Nix
33 lines
677 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.caffeine;
|
|
|
|
in {
|
|
meta.maintainers = [ maintainers.uvnikita ];
|
|
|
|
options = {
|
|
services.caffeine = { enable = mkEnableOption "Caffeine service"; };
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.user.services.caffeine = {
|
|
Unit = { Description = "caffeine"; };
|
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
|
|
|
Service = {
|
|
Restart = "on-failure";
|
|
PrivateTmp = true;
|
|
ProtectSystem = "full";
|
|
ProtectHome = "yes";
|
|
Type = "exec";
|
|
Slice = "session.slice";
|
|
ExecStart = "${pkgs.caffeine-ng}/bin/caffeine";
|
|
};
|
|
};
|
|
};
|
|
}
|