1
0
Fork 0
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:
Ilan Joselevich 2023-03-20 01:06:39 +02:00 committed by Robert Helgesson
parent 58b8685e47
commit fa980cc985
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 61 additions and 0 deletions

2
.github/CODEOWNERS vendored
View file

@ -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

View file

@ -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'.
'';
}
];
};
}

View file

@ -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

View 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" ];
};
};
}