Printing with CUPS in auto-multiple-choice

Hi,

I’m using the auto-multiple-choice NixOS package. auto-multiple-choice is written in Perl, and normally allows printing using CUPS, via the Net::CUPS module. Unfortunately, when I try printing, I get the error:

You chose the printing method ‘CUPS’ but it is not available (Perl module(s) missing: Net::CUPS Net::CUPS::PPD).

I tried installing Net::CUPS (perl540Packages.NetCUPS in nixpkgs), both via

nix-shell -p 'perl.withPackages (p: with p; [                                                       
        NetCUPS
    ])'

and

nix-shell -p perl540Packages.NetCUPS

and then running auto-multiple-choice within that nix-shell, same error.

I also tried installing the package globally adding

    (perl.withPackages (p: with p; [
        NetCUPS
    ]))

to environment.systemPackages in configuration.nix, still the same error. Apparently, the installed auto-multiple-choice executable hardcodes a perl installation that doesn’t have the NetCUPS package installed, and installing it elsewhere doesn’t modify this (which is cool for reproducibility, but here I have a reproducible error :-\).

What can I do to let auto-multiple-choice access the Net::CUPS package? Is this a bug in the auto-multiple-choice nix package (which should perhaps depend on NetCUPS)?

Thanks in advance,

Unlike in most distros, when a bit of software packaged in Nix is missing some optional dependency, you usually don’t fix it by ‘installing’ the dependency. You override the package to include the dependency instead.

Unfortunately, looking at the package definition for auto-multiple-choice, such an override wouldn’t be simple to write (the extra dependency needs to be added to buildInputs, which is simple, and also to the PERL5LIB path used when making the wrapper in the postFixup hook, which is not). This probably should be considered a bug in the packaging; if NetCUPS isn’t a mandatory dependency, there should at least be a package argument to enable it. Make an issue and ping the maintainer, please.

2 Likes

Ah, actually there is already a PR fixing this: auto-multiple-choice: add missing runtime dependencies by Zimmi48 · Pull Request #380878 · NixOS/nixpkgs · GitHub

Waiting for a release, I could download the patched package.nix file and use it locally: together with a default.nix doing

(import <nixpkgs> { }).callPackage ./package.nix { }

I can use nix-shell and get a working auto-multiple-choice executable.

Update: actually the PR wasn’t sufficient, I opened another one here: https://github.com/NixOS/nixpkgs/pull/476948