mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
tailscale-systray: make theme configurable
This commit is contained in:
committed by
Matthieu Coudron
parent
f04b141d1a
commit
4f9cbe4384
@@ -15,6 +15,20 @@ in
|
||||
enable = lib.mkEnableOption "Official Tailscale systray application for Linux";
|
||||
|
||||
package = lib.mkPackageOption pkgs "tailscale" { };
|
||||
|
||||
theme = lib.mkOption {
|
||||
type = lib.types.nullOr (
|
||||
lib.types.enum [
|
||||
"dark"
|
||||
"dark:nobg"
|
||||
"light"
|
||||
"light:nobg"
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
example = "dark:nobg";
|
||||
description = "Color theme to use for the Tailscale icon.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
@@ -26,6 +40,12 @@ in
|
||||
Tailscale systray is available since version 1.88.1
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = cfg.theme != null -> lib.versionAtLeast cfg.package.version "1.98";
|
||||
message = ''
|
||||
Tailscale systray supports themes since version 1.98
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
systemd.user.services.tailscale-systray = {
|
||||
@@ -41,7 +61,12 @@ in
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
Service.ExecStart = "${lib.getExe cfg.package} systray";
|
||||
Service.ExecStart = lib.concatStringsSep " " (
|
||||
[
|
||||
"${lib.getExe cfg.package} systray"
|
||||
]
|
||||
++ lib.optional (cfg.theme != null) "--theme ${cfg.theme}"
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
tailscale-systray-basic = ./basic.nix;
|
||||
tailscale-systray-theme = ./theme.nix;
|
||||
}
|
||||
|
||||
19
tests/modules/services/tailscale-systray/theme.nix
Normal file
19
tests/modules/services/tailscale-systray/theme.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
services.tailscale-systray = {
|
||||
enable = true;
|
||||
theme = "dark:nobg";
|
||||
package = config.lib.test.mkStubPackage {
|
||||
name = "tailscale";
|
||||
version = "1.98.1";
|
||||
outPath = "@tailscale@";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/tailscale-systray.service
|
||||
assertFileExists $serviceFile
|
||||
assertFileRegex $serviceFile \
|
||||
'^ExecStart=@tailscale@/bin/tailscale systray --theme dark:nobg$'
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user