mirror of
https://github.com/nix-community/home-manager
synced 2024-11-16 08:09:45 +01:00
072662bd1b
This option causes caffeine to be unable to start via the systemd
service.
(cherry picked from commit 093777ee4a
)
37 lines
769 B
Nix
37 lines
769 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 {
|
|
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 = "${pkgs.caffeine-ng}/bin/caffeine";
|
|
};
|
|
};
|
|
};
|
|
}
|