From d9297efd3a1c3ebb9027dc68f9da0ac002ae94db Mon Sep 17 00:00:00 2001 From: Moritz Rumpf Date: Wed, 13 Dec 2023 00:21:10 +0100 Subject: [PATCH] awscli: only write config files when not empty --- modules/programs/awscli.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/programs/awscli.nix b/modules/programs/awscli.nix index 678216651..a4cfc108f 100644 --- a/modules/programs/awscli.nix +++ b/modules/programs/awscli.nix @@ -57,11 +57,16 @@ in { config = lib.mkIf cfg.enable { home.packages = [ cfg.package ]; - home.file."${config.home.homeDirectory}/.aws/config".source = - iniFormat.generate "aws-config-${config.home.username}" cfg.settings; + home.file."${config.home.homeDirectory}/.aws/config" = + lib.mkIf (cfg.settings != { }) { + source = + iniFormat.generate "aws-config-${config.home.username}" cfg.settings; + }; - home.file."${config.home.homeDirectory}/.aws/credentials".source = - iniFormat.generate "aws-credentials-${config.home.username}" - cfg.credentials; + home.file."${config.home.homeDirectory}/.aws/credentials" = + lib.mkIf (cfg.credentials != { }) { + source = iniFormat.generate "aws-credentials-${config.home.username}" + cfg.credentials; + }; }; }