diff --git a/nixos/modules/hardware/printers.nix b/nixos/modules/hardware/printers.nix index 1d18a96fb1cd..f24ca2c358f4 100644 --- a/nixos/modules/hardware/printers.nix +++ b/nixos/modules/hardware/printers.nix @@ -78,11 +78,6 @@ in config.hardware.printers.ensurePrinters. Specifying a symblic name here that does not match any of those printers is considered a hard error. - - ::: {.warning} - Print jobs to this class will quietly fail if there are no - printers in this class. CUPS reports them as pending - ::: ''; }; classes = mkOption { @@ -267,7 +262,14 @@ in ''; } ) - ]; + ] + ++ map (class: { + assertion = cfg.ensureClasses.${class}.printers != [ ] || cfg.ensureClasses.${class}.classes != [ ]; + message = '' + At least one of the lists `config.hardware.printers.ensureClasses.${class}.printers` + and `config.hardware.printers.ensureClasses.${class}.classes` has to be non-empty. + ''; + }) (builtins.attrNames cfg.ensureClasses); systemd.services.cups = { postStart = @@ -333,17 +335,6 @@ in d = cfg.ensureDefaultPrinter; })} - #### CLASS DEFINITIONS #### - lpadmin -p _tmp -v file:/dev/null - ${lib.concatMapStringsSep "\n" ( - className: - lpadmin { - p = "_tmp"; - c = className; - } - ) classNames} - lpadmin -x _tmp - #### ADDING PRINTERS TO CLASSES #### ${lib.concatMapStringsSep "\n" ( className: