mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
added yambar systemd service
This commit is contained in:
parent
a9b36cbe92
commit
d3f777e2c4
1 changed files with 34 additions and 0 deletions
|
@ -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 ]; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue