{ config, options, lib, pkgs, ... }: let defaultApps = config.modules.desktop.defaultApplications; in { options.modules.desktop.defaultApplications = { enable = lib.mkOption { type = lib.types.bool; default = true; }; apps = lib.mkOption { type = lib.types.attrsOf (lib.types.submodule ({name, ...}: { options = { package = lib.mkOption {type = lib.types.package;}; install = lib.mkOption {type = lib.types.bool; default = true;}; cmd = lib.mkOption {type = lib.types.path;}; desktop = lib.mkOption {type = lib.types.str;}; }; })); }; }; config = lib.mkIf (defaultApps.enable) { modules.desktop.apps.terminals.kitty.enable = true; modules.desktop.apps.editors.neovim.enable = true; modules.desktop.apps.mpv.enable = true; env = { EDITOR = defaultApps.apps.editor.desktop; TERM = defaultApps.apps.terminal.desktop; VIDEO = defaultApps.apps.video.desktop; }; home.packages = lib.filter (elem: elem != null) (lib.mapAttrsToList (name: value: if value.install then value.package else null) defaultApps.apps); }; }