From 66c5d8b62818ec4c1edb3e941f55ef78df8141a8 Mon Sep 17 00:00:00 2001 From: DaRacci Date: Thu, 12 Dec 2024 02:37:04 +0000 Subject: [PATCH] zed-editor: fix always generating settings.json Makes it so settings.json no longer gets made by ensuring it can be empty as expected when there are no extensions or userSettings defined. PR #6201 --- modules/programs/zed-editor.nix | 9 +++++---- tests/modules/programs/zed-editor/settings.nix | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/programs/zed-editor.nix b/modules/programs/zed-editor.nix index a9baebf90..80039a8ca 100644 --- a/modules/programs/zed-editor.nix +++ b/modules/programs/zed-editor.nix @@ -6,10 +6,11 @@ let cfg = config.programs.zed-editor; jsonFormat = pkgs.formats.json { }; - mergedSettings = cfg.userSettings // { - # this part by @cmacrae - auto_install_extensions = lib.genAttrs cfg.extensions (_: true); - }; + mergedSettings = cfg.userSettings + // (lib.optionalAttrs (builtins.length cfg.extensions > 0) { + # this part by @cmacrae + auto_install_extensions = lib.genAttrs cfg.extensions (_: true); + }); in { meta.maintainers = [ hm.maintainers.libewa ]; diff --git a/tests/modules/programs/zed-editor/settings.nix b/tests/modules/programs/zed-editor/settings.nix index 701caab13..e6f077423 100644 --- a/tests/modules/programs/zed-editor/settings.nix +++ b/tests/modules/programs/zed-editor/settings.nix @@ -17,7 +17,6 @@ nmt.script = let expectedContent = builtins.toFile "expected.json" '' { - "auto_install_extensions": {}, "buffer_font_size": 16, "features": { "copilot": false