{ stdenv, zsh, config }: with stdenv.lib; let mkSymlinks = name: '' ln -s $out/libexec/mediaspace $out/bin/mediaspace.${name} ln -s $out/libexec/queue $out/bin/queue.${name} ln -s $out/libexec/queuesize $out/bin/queuesize.${name} ln -s $out/libexec/queuestatus $out/bin/queuestatus.${name} ln -s $out/libexec/update-queuesize $out/bin/update-queuesize.${name} ''; in stdenv.mkDerivation { name = "uucp-mediaserver"; src = ./scripts; phases = [ "installPhase" ]; inherit (config) queueDir; installPhase = '' mkdir -p $out/libexec substituteFile $src/mediaspace $out/libexec/mediaspace substituteFile $src/queue $out/libexec/queue substituteFile $src/queuesize $out/libexec/queuesize substituteFile $src/queuestatus $out/libexec/queuestatus substituteFile $src/update-queuesize $out/libexec/update-queuesize mkdir -p $out/bin ${concatStringsSep "\n" (map mkSymlinks config.remoteNodes)} ''; }