From e435ce8c48a544517a8aa56c9963833546b47b53 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 8 Dec 2024 04:56:41 +0100 Subject: [PATCH] Prevent unnecessary config values --- lib/modules/programs.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/modules/programs.nix b/lib/modules/programs.nix index 2a6a1eba..69600516 100644 --- a/lib/modules/programs.nix +++ b/lib/modules/programs.nix @@ -5,17 +5,20 @@ let mkUsersOption = programs: osConfig: mkOption { type = types.attrsOf (types.submodule ( - { ... }: { + { config, ... }: { options = { inherit programs; }; config = { - programs = builtins.mapAttrs + programs = lib.attrsets.concatMapAttrs ( - name: config: { - enable = mkDefault config.enable; - } + name: program: + if (builtins.elem name (builtins.attrNames config.programs)) then { + ${name} = { + enable = mkDefault program.enable; + }; + } else { } ) osConfig.programs; };