{ pkgs }: let inherit (pkgs) lib; in { mkWrapper = { config, name, enableTui ? false, }: let removeNullAndEmptyAttrs = attrs: let f = lib.filterAttrsRecursive (key: value: value != null && value != { }); in # filterAttrsRecursive doesn't delete the *resulting* empty attrs, so we must # evaluate it again and to get rid of it. lib.pipe attrs [ f f ]; toPCJson = name: attrs: pkgs.writeTextFile { name = "process-compose-${name}.json"; text = builtins.toJSON attrs; }; configFile = toPCJson name ( removeNullAndEmptyAttrs ( config // { is_tui_disabled = !enableTui; } ) ); in pkgs.writeShellApplication { inherit name; text = '' PC_CONFIG_FILES=${configFile} ${pkgs.process-compose}/bin/process-compose "$@" ''; }; mkPostgres = { default_config ? false, ... }: let in { }; }