Merge pull request #132713 from ncfavier/cups

cups: 2.3.3 -> 2.3.3op2
main
Luke Granger-Brown 3 years ago committed by GitHub
commit b4b663efc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      nixos/modules/hardware/printers.nix
  2. 12
      nixos/tests/printing.nix
  3. 35
      pkgs/misc/cups/default.nix

@ -116,19 +116,14 @@ in {
description = "Ensure NixOS-configured CUPS printers";
wantedBy = [ "multi-user.target" ];
requires = [ cupsUnit ];
# in contrast to cups.socket, for cups.service, this is actually not enough,
# as the cups service reports its activation before clients can actually interact with it.
# Because of this, commands like `lpinfo -v` will report a bad file descriptor
# due to the missing UNIX socket without sufficient sleep time.
after = [ cupsUnit ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
# sleep 10 is required to wait until cups.service is actually initialized and has created its UNIX socket file
script = (optionalString (!config.services.printing.startWhenNeeded) "sleep 10\n")
+ (concatMapStringsSep "\n" ensurePrinter cfg.ensurePrinters)
script = concatMapStringsSep "\n" ensurePrinter cfg.ensurePrinters
+ optionalString (cfg.ensureDefaultPrinter != null) (ensureDefaultPrinter cfg.ensureDefaultPrinter);
};
};

@ -53,18 +53,10 @@ in {
start_all()
with subtest("Make sure that cups is up on both sides"):
with subtest("Make sure that cups is up on both sides and printers are set up"):
serviceServer.wait_for_unit("cups.service")
serviceClient.wait_for_unit("cups.service")
with subtest(
"Wait until cups is fully initialized and ensure-printers has "
"executed with 10s delay"
):
serviceClient.sleep(20)
socketActivatedClient.wait_until_succeeds(
"systemctl show ensure-printers | grep -q -E 'code=exited ; status=0'"
)
socketActivatedClient.wait_for_unit("ensure-printers.service")
def test_printing(client, server):

@ -28,16 +28,15 @@ stdenv.mkDerivation rec {
pname = "cups";
# After 2.2.6, CUPS requires headers only available in macOS 10.12+
version = if stdenv.isDarwin then "2.2.6" else "2.3.3";
version = if stdenv.isDarwin then "2.2.6" else "2.3.3op2";
passthru = { inherit version; };
src = fetchurl {
src = fetchurl (if stdenv.isDarwin then {
url = "https://github.com/apple/cups/releases/download/v${version}/cups-${version}-source.tar.gz";
sha256 = if version == "2.2.6"
then "16qn41b84xz6khrr2pa2wdwlqxr29rrrkjfi618gbgdkq9w5ff20"
else "1vpk0b2vq830f8fvf9z8qjsm5k141i7pi8djbinpnr78pi4dj7r6";
};
sha256 = "16qn41b84xz6khrr2pa2wdwlqxr29rrrkjfi618gbgdkq9w5ff20";
} else {
url = "https://github.com/OpenPrinting/cups/releases/download/v${version}/cups-${version}-source.tar.gz";
sha256 = "1pwndz4gwkm7311wkhhzlw2diy7wbck7yy026jbaxh3rprdmgcyy";
});
outputs = [ "out" "lib" "dev" "man" ];
@ -49,10 +48,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config removeReferencesTo ];
buildInputs = [ zlib libjpeg libpng libtiff libusb1 gnutls libpaper ]
++ optionals stdenv.isLinux [ avahi pam dbus ]
++ optionals stdenv.isLinux [ avahi pam dbus acl ]
++ optional enableSystemd systemd
# Separate from above only to not modify order, to avoid mass rebuilds; merge this with the above at next big change.
++ optionals stdenv.isLinux [ acl ]
++ optionals stdenv.isDarwin (with darwin; [
configd apple_sdk.frameworks.ApplicationServices
]);
@ -129,18 +126,8 @@ stdenv.mkDerivation rec {
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." ""
if [[ "$f" =~ .*cupsd\..* ]]; then
mv "$f" "''${f/org\.cups\.cupsd/cups}"
else
mv "$f" "''${f/org\.cups\./}"
fi
substituteInPlace "$f" --replace "$lib/$libexec" "$out/$libexec"
done
'' + optionalString stdenv.isLinux ''
# Use xdg-open when on Linux
@ -149,9 +136,9 @@ stdenv.mkDerivation rec {
'';
meta = {
homepage = "https://cups.org/";
homepage = "https://openprinting.github.io/cups/";
description = "A standards-based printing system for UNIX";
license = licenses.gpl2; # actually LGPL for the library and GPL for the rest
license = licenses.asl20;
maintainers = with maintainers; [ matthewbauer ];
platforms = platforms.unix;
};

Loading…
Cancel
Save