mirror of
https://github.com/nix-community/home-manager
synced 2024-12-30 13:49:47 +01:00
batsignal: add module
This commit is contained in:
parent
58b8685e47
commit
fa980cc985
4 changed files with 61 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -376,6 +376,8 @@ Makefile @thiagokokada
|
|||
/modules/services/barrier.nix @Kritnich
|
||||
/tests/modules/services/barrier @Kritnich
|
||||
|
||||
/modules/services/batsignal.nix @Kranzes
|
||||
|
||||
/modules/services/betterlockscreen.nix @SebTM
|
||||
|
||||
/modules/programs/borgmatic.nix @DamienCassou
|
||||
|
|
|
@ -979,6 +979,14 @@ in
|
|||
A new module is available: 'programs.hstr'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2023-04-18T06:28:31+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.batsignal'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -208,6 +208,7 @@ let
|
|||
./services/autorandr.nix
|
||||
./services/avizo.nix
|
||||
./services/barrier.nix
|
||||
./services/batsignal.nix
|
||||
./services/betterlockscreen.nix
|
||||
./services/blueman-applet.nix
|
||||
./services/borgmatic.nix
|
||||
|
|
50
modules/services/batsignal.nix
Normal file
50
modules/services/batsignal.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ 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-pre.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" ];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue