yambar: add systemd service (#5469)
This commit is contained in:
parent
da282034f4
commit
2f4db1cd5b
1 changed files with 38 additions and 0 deletions
|
|
@ -44,6 +44,23 @@ in
|
|||
See {manpage}`yambar(5)` for options.
|
||||
'';
|
||||
};
|
||||
|
||||
systemd = {
|
||||
enable = lib.mkEnableOption "yambar systemd integration";
|
||||
|
||||
target = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = config.wayland.systemd.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 {
|
||||
|
|
@ -56,5 +73,26 @@ 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 = [ cfg.systemd.target ];
|
||||
After = [ cfg.systemd.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 ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue