anchor.diff:      ++ optional (gnutls != null) "--enable-ssl"
       ++ optional (avahi != null) "--enable-avahi"
       ++ optional (libpaper != null) "--enable-libpaper"
  -    ++ optionals stdenv.isDarwin [
  -    "--with-bundledir=$out"
  -    "--disable-launchd"
  -  ];
  +    ++ optional stdenv.isDarwin "--disable-launchd";
  +
  +  preConfigure = ''
  +    configureFlagsArray+=(
  +      # 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"
  +
  +      "--with-systemd=$out/lib/systemd/system"
  +
  +      ${optionalString stdenv.isDarwin ''
  +        "--with-bundledir=$out"
  +      ''}
  +    )
  +  '';
   
     installFlags =
       [ # Don't try to write in /var at build time.
  
positive.code:     })
    ];
  
    nativeBuildInputs = [ pkgconfig ];
  
    buildInputs = [ zlib libjpeg libpng libtiff libusb gnutls libpaper ]
      ++ optionals stdenv.isLinux [ avahi pam dbus systemd acl ]
  
negative.code: { stdenv, fetchurl, fetchpatch, pkgconfig, removeReferencesTo
  , zlib, libjpeg, libpng, libtiff, pam, dbus, systemd, acl, gmp, darwin
  , libusb ? null, gnutls ? null, avahi ? null, libpaper ? null
  }:
  
  