1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

added yambar systemd service

This commit is contained in:
Mads Rumle Nordstrøm 2024-05-29 23:36:19 +02:00
parent a9b36cbe92
commit d3f777e2c4

View file

@ -38,6 +38,21 @@ in {
See {manpage}`yambar(5)` for options.
'';
};
systemd.enable = lib.mkEnableOption "yambar systemd integration";
systemd.target = lib.mkOption {
type = lib.types.str;
default = "graphical-session.target";
example = "sway-session.target";
description = ''
The systemd target that will automatically start the yambar service.
When setting this value to `"sway-session.target"`,
make sure to also enable {option}`wayland.windowManager.sway.systemd.enable`,
otherwise the service may never be started.
'';
};
};
config = lib.mkIf cfg.enable {
@ -51,5 +66,24 @@ in {
xdg.configFile."yambar/config.yml" = lib.mkIf (cfg.settings != { }) {
source = yamlFormat.generate "config.yml" cfg.settings;
};
systemd.user.services.yambar = lib.mkIf cfg.systemd.enable {
Unit = {
Description = "Modular status panel for X11 and Wayland";
Documentation = "man:yambar";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session-pre.target" ];
};
Service = {
ExecStart = "${cfg.package}/bin/yambar";
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
Restart = "on-failure";
RestartSec = 3;
KillMode = "mixed";
};
Install = { WantedBy = [ cfg.systemd.target ]; };
};
};
}