{ 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 = [ "buildPhase" "installPhase" ]; inherit (config) queueDir; buildPhase = '' substituteAllInPlace $out/libexec/mediaspace substituteAllInPlace $out/libexec/queue substituteAllInPlace $out/libexec/queuespace substituteAllInPlace $out/libexec/queuestatus substituteAllInPlace $out/libexec/update-queuesize ''; installPhase = '' mkdir -p $out/libexec install -m 755 -t $out/libexec mediaspace queue queuespace queuestatus update-queuesize mkdir -p $out/bin ${concatStringsSep "\n" (map mkSymlinks config.remoteNodes)} ''; }