silenceLogs is not picked up

Result:
$ cat result/etc/systemd/system/tailscaled.service
[Unit]
Description=Tailscale node agent
Documentation=https://tailscale.com/kb/
Wants=network-pre.target
After=network-pre.target NetworkManager.service systemd-resolved.service

[Service]
ExecStartPre=/nix/store/gr38ww9sj0qbcs8sb17iq9871qvmhfjw-tailscale-1.42.0/bin/tailscaled --cleanup
ExecStart=/nix/store/gr38ww9sj0qbcs8sb17iq9871qvmhfjw-tailscale-1.42.0/bin/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/run/tailscale/tailscaled.sock --port=
ExecStopPost=/nix/store/gr38ww9sj0qbcs8sb17iq9871qvmhfjw-tailscale-1.42.0/bin/tailscaled --cleanup

Restart=on-failure

RuntimeDirectory=tailscale
RuntimeDirectoryMode=0755
StateDirectory=tailscale
StateDirectoryMode=0700
CacheDirectory=tailscale
CacheDirectoryMode=0750
Type=notify

[Install]
WantedBy=multi-user.target
This commit is contained in:
Motiejus Jakštys 2023-09-14 15:03:00 +03:00
parent 76c07129f3
commit b73f671bc0
1 changed files with 14 additions and 10 deletions

View File

@ -4,23 +4,27 @@
pkgs,
myData,
...
}: {
options.mj.services.tailscale = with lib.types; {
enable = lib.mkEnableOption "Enable tailscale";
}: let
cfg = config.mj.services.tailscale;
inherit (lib) mkMerge types mkEnableOption mkOption mkIf;
in {
options.mj.services.tailscale = with types; {
enable = mkEnableOption "Enable tailscale";
# https://github.com/tailscale/tailscale/issues/1548
silenceLogs = lib.mkOption {
silenceLogs = mkOption {
type = bool;
default = false;
};
};
config = with config.mj.services.tailscale;
lib.mkIf enable {
config = mkIf (cfg.enable) (mkMerge [
{
services.tailscale.enable = true;
networking.firewall.checkReversePath = "loose";
networking.firewall.allowedUDPPorts = [myData.ports.tailscale];
#}
#// lib.mkIf silenceLogs {
# systemd.services.tailscaled.serviceConfig."StandardOutput" = "null";
};
}
(mkIf cfg.silenceLogs {
systemd.services.tailscaled.serviceConfig."StandardOutput" = "null";
})
]);
}