From b73f671bc0a4f6a41a341e8a11b66e6498745697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 14 Sep 2023 15:03:00 +0300 Subject: [PATCH] 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 --- modules/services/tailscale/default.nix | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/modules/services/tailscale/default.nix b/modules/services/tailscale/default.nix index b44a870..d78e616 100644 --- a/modules/services/tailscale/default.nix +++ b/modules/services/tailscale/default.nix @@ -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"; + }) + ]); }