{ lib, config, pkgs, ... }: let inherit (lib) attrNames concatMapStrings genAttrs filterAttrs makeBinPath mkOptionDefault optionalString ; promptToFile = name: '' cat "$prompts"/${name} > "$out"/${name} ''; promptsToFilesScript = concatMapStrings promptToFile; filePromptNames = attrNames (filterAttrs (_name: prompt: prompt.persist) config.prompts); in { finalScript = mkOptionDefault ( lib.getExe ( pkgs.writeShellApplication { name = "generator-${config.name}"; text = '' in="''${in:?}" out="''${out:?}" ${if config.prompts == { } then "" else ''prompts="''${prompts:?}"''} export PATH="${makeBinPath config.runtimeInputs}:${pkgs.coreutils}/bin" ${optionalString (pkgs.stdenv.hostPlatform.isLinux) '' # prepare sandbox user on platforms where this is supported mkdir -p /etc cat > /etc/group < /etc/passwd < /etc/hosts <