From d309a62ee81faec56dd31a263a0184b0e3227e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Mon, 24 Jul 2023 16:17:31 +0200 Subject: [PATCH] tmate: don't generate empty config file (#4271) --- modules/programs/tmate.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/tmate.nix b/modules/programs/tmate.nix index e895647fb..025421bd3 100644 --- a/modules/programs/tmate.nix +++ b/modules/programs/tmate.nix @@ -65,7 +65,7 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - home.file.".tmate.conf".text = let + home.file.".tmate.conf" = let conf = optional (cfg.host != null) ''set -g tmate-server-host "${cfg.host}"'' ++ optional (cfg.port != null) @@ -75,6 +75,6 @@ in { ++ optional (cfg.rsaFingerprint != null) ''set -g tmate-server-rsa-fingerprint "${cfg.rsaFingerprint}"'' ++ optional (cfg.extraConfig != "") cfg.extraConfig; - in concatStringsSep "\n" conf + "\n"; + in mkIf (conf != [ ]) { text = concatLines conf; }; }; }