{ pkgs ? import {} }: let inherit (pkgs) lib; instances = { foo = "/etc/foo.yaml"; bar = "/etc/lol/xyz.yaml"; baz = "/etc/baz.yaml"; }; script = pkgs.writers.writeBashBin "get-config" '' case "$1" in ${lib.concatStrings (lib.mapAttrsToList (name: value: '' ${name}) echo ${lib.escapeShellArg value} ;; '') instances)} *) echo error: invalid instance >&2 exit 1 ;; esac ''; in script