1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

waybar: configurable systemd WantedBy target (#2524)

Before this commit, a user needed to override the systemd target that
would start Waybar with `mkForce`, this is no longer necessary.
This commit is contained in:
Nicolas Berbiche 2021-12-23 17:00:31 -05:00 committed by GitHub
parent 3b9c625b64
commit f15b151ca1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -197,6 +197,20 @@ in {
systemd.enable = mkEnableOption "Waybar systemd integration"; systemd.enable = mkEnableOption "Waybar systemd integration";
systemd.target = mkOption {
type = str;
default = "graphical-session.target";
example = "sway-session.target";
description = ''
The systemd target that will automatically start the Waybar service.
</para>
<para>
When setting this value to <literal>"sway-session.target"</literal>,
make sure to also enable <option>wayland.windowManager.sway.systemdIntegration</option>,
otherwise the service may never be started.
'';
};
style = mkOption { style = mkOption {
type = nullOr (either path str); type = nullOr (either path str);
default = null; default = null;
@ -309,7 +323,7 @@ in {
KillMode = "mixed"; KillMode = "mixed";
}; };
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ cfg.systemd.target ]; };
}; };
}) })
]); ]);

View file

@ -10,6 +10,7 @@ with lib;
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; }; package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
systemd.target = "sway-session.target";
}; };
nmt.script = '' nmt.script = ''

View file

@ -1,5 +1,5 @@
[Install] [Install]
WantedBy=graphical-session.target WantedBy=sway-session.target
[Service] [Service]
ExecReload=kill -SIGUSR2 $MAINPID ExecReload=kill -SIGUSR2 $MAINPID