mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
caffeine: add service
This commit is contained in:
parent
612afee126
commit
cabf9ddd98
4 changed files with 44 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -136,6 +136,8 @@
|
|||
|
||||
/modules/programs/zsh/prezto.nix @NickHu
|
||||
|
||||
/modules/services/caffeine.nix @uvNikita
|
||||
|
||||
/modules/services/cbatticon.nix @pmiddend
|
||||
|
||||
/modules/services/clipmenu.nix @DamienCassou
|
||||
|
|
|
@ -1720,6 +1720,14 @@ in
|
|||
A new module is available: 'programs.gh'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-11-01T11:17:02+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.caffeine'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@ let
|
|||
(loadModule ./programs/zsh.nix { })
|
||||
(loadModule ./programs/zsh/prezto.nix { })
|
||||
(loadModule ./services/blueman-applet.nix { })
|
||||
(loadModule ./services/caffeine.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/clipmenu.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/compton.nix { })
|
||||
|
|
33
modules/services/caffeine.nix
Normal file
33
modules/services/caffeine.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ 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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue