anchor.diff:    enableParallelBuilding = true;
   
     postInstall = ''
  -      moveToOutput lib/cups "$out"
  +      libexec=${if stdenv.isDarwin then "libexec/cups" else "lib/cups"}
  +      moveToOutput $libexec "$out"
  +
  +      # $lib contains references to $out/share/cups.
  +      # CUPS is working without them, so they are not vital.
  +      find "$lib" -type f -exec grep -q "$out" {} \; \
  +           -printf "removing references from %p\n" \
  +           -exec remove-references-to -t "$out" {} +
   
         # Delete obsolete stuff that conflicts with cups-filters.
         rm -rf $out/share/cups/banners $out/share/cups/data/testprint
   
  -      # Some outputs in cups-config were unexpanded and some even wrong.
         moveToOutput bin/cups-config "$dev"
  -      sed -e "/^cups_serverbin=/s|\$(lib)|$out|" \
  -          -e "s|\$(out)|$out|" \
  -          -e "s|\$(lib)|$lib|" \
  +      sed -e "/^cups_serverbin=/s|$lib|$out|" \
             -i "$dev/bin/cups-config"
   
         # Rename systemd files provided by CUPS
         for f in "$out"/lib/systemd/system/*; do
           substituteInPlace "$f" \
  +          --replace "$lib/$libexec" "$out/$libexec" \
             --replace "org.cups.cupsd" "cups" \
             --replace "org.cups." ""
   
  
positive.code:   propagatedBuildInputs = [ gmp ];
  
    configureFlags = [
      # Put just lib/* and locale into $lib; this didn't work directly.
      # lib/cups is moved back to $out in postInstall.
      # Beware: some parts of cups probably don't fully respect these.
      "--prefix=$(lib)"
      "--datadir=$(out)/share"
      "--localedir=$(lib)/share/locale"
  
      "--localstatedir=/var"
      "--sysconfdir=/etc"
      "--with-rundir=/run"
      "--with-systemd=\${out}/lib/systemd/system"
      "--enable-raw-printing"
      "--enable-threads"
    ] ++ optionals stdenv.isLinux [
  
negative.code:     })
    ];
  
    nativeBuildInputs = [ pkgconfig removeReferencesTo ];
  
    buildInputs = [ zlib libjpeg libpng libtiff libusb gnutls libpaper ]
      ++ optionals stdenv.isLinux [ avahi pam dbus systemd acl ]
  