Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 pkgs, 4 alsa-lib, 5 plugins ? [ pkgs.alsa-plugins ], 6 lndir, 7 symlinkJoin, 8 runCommand, 9}: 10let 11 merged = symlinkJoin { 12 name = "alsa-plugins-merged"; 13 paths = plugins; 14 }; 15in 16runCommand "${alsa-lib.pname}-${alsa-lib.version}" 17 { 18 meta = with lib; { 19 description = "Wrapper to ease access to ALSA plugins"; 20 mainProgram = "aserver"; 21 platforms = platforms.linux; 22 maintainers = with maintainers; [ gm6k ]; 23 }; 24 outputs = alsa-lib.outputs; 25 } 26 ( 27 (lib.concatMapStringsSep "\n" (output: '' 28 mkdir ${builtins.placeholder output} 29 ${lndir}/bin/lndir ${lib.attrByPath [ output ] null alsa-lib} \ 30 ${builtins.placeholder output} 31 '') alsa-lib.outputs) 32 + '' 33 cp -r ${merged}/lib/alsa-lib $out/lib 34 ( 35 echo $out | wc -c 36 echo ${alsa-lib} | wc -c 37 ) | xargs echo | grep -q "^\(.*\) \1$" || ( 38 echo cannot binary patch 39 exit 1 40 ) 41 rm $out/lib/libasound.la 42 rm $out/lib/libasound.so.?.?.? 43 rm $dev/lib/pkgconfig/alsa.pc 44 rm $dev/nix-support/propagated-build-inputs 45 cp ${alsa-lib}/lib/libasound.la $out/lib 46 cp ${alsa-lib}/lib/libasound.so.?.?.? $out/lib 47 cp ${alsa-lib.dev}/lib/pkgconfig/alsa.pc $dev/lib/pkgconfig 48 cp ${alsa-lib.dev}/nix-support/propagated-build-inputs $dev/nix-support 49 sed -i \ 50 $out/lib/libasound.la \ 51 $out/lib/libasound.so.?.?.? \ 52 $dev/lib/pkgconfig/alsa.pc \ 53 $dev/nix-support/propagated-build-inputs \ 54 -e "s@${alsa-lib}@$out@g" 55 '' 56 )