1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2025-01-23 09:29:50 +01:00
home-manager/modules/services/trayscale.nix
Sefa Eyeoglu 6a9f87b3aa
treewide: use graphical-session.target for GUI services
As per systemd.special(7)[0] graphical-session-pre.target is strictly
for units that set up things for a graphical session. Most notably,
these are usually started *before* the compositor/session is actually
ready.

While Home Manager's current implementation of graphical-session.target
allows these units to work regardless of what systemd.special(7)
specifies, other setups like ones with uwsm[1] do not allow these units
to start properly.

[0]: https://www.freedesktop.org/software/systemd/man/latest/systemd.special.html#graphical-session-pre.target
[1]: https://github.com/Vladimir-csp/uwsm

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2024-10-29 12:54:22 +01:00

39 lines
1.1 KiB
Nix

{ config, lib, pkgs, ... }:
let cfg = config.services.trayscale;
in {
meta.maintainers = [ lib.hm.maintainers.callumio ];
options.services.trayscale = {
enable = lib.mkEnableOption
"An unofficial GUI wrapper around the Tailscale CLI client.";
package = lib.mkPackageOption pkgs "trayscale" { };
hideWindow = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to hide the trayscale window on startup.";
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.trayscale" pkgs
lib.platforms.linux)
];
systemd.user.services.trayscale = {
Unit = {
Description =
"An unofficial GUI wrapper around the Tailscale CLI client";
Requires = [ "tray.target" ];
After = [ "graphical-session.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service.ExecStart = toString ([ "${cfg.package}/bin/trayscale" ]
++ lib.optional cfg.hideWindow "--hide-window");
};
};
}