mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
Some files don't need nesting and can be root level again to reduce conflicts with other PRs. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
54 lines
1.1 KiB
Nix
54 lines
1.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
|
|
cfg = config.services.batsignal;
|
|
|
|
in
|
|
{
|
|
meta.maintainers = with lib.maintainers; [ kranzes ];
|
|
|
|
options = {
|
|
services.batsignal = {
|
|
enable = lib.mkEnableOption "Batsignal Battery Daemon";
|
|
|
|
package = lib.mkPackageOption pkgs "batsignal" { };
|
|
|
|
extraArgs = lib.mkOption {
|
|
type = with lib.types; listOf str;
|
|
default = [ ];
|
|
description = ''
|
|
Extra arguments to be passed to the batsignal executable.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
assertions = [
|
|
(lib.hm.assertions.assertPlatform "services.batsignal" pkgs lib.platforms.linux)
|
|
];
|
|
|
|
systemd.user.services.batsignal = {
|
|
Unit = {
|
|
Description = "batsignal - battery monitor daemon";
|
|
After = [ "graphical-session.target" ];
|
|
PartOf = [ "graphical-session.target" ];
|
|
};
|
|
|
|
Service = {
|
|
Type = "simple";
|
|
ExecStart = "${lib.getExe cfg.package} ${lib.escapeShellArgs cfg.extraArgs}";
|
|
Restart = "on-failure";
|
|
RestartSec = 1;
|
|
};
|
|
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
};
|
|
}
|