My network printer, a Brother hll2365dw, responds to pinging its IP, but CUPS can’t see it. This may well be because the driver I installed is for a later model: nix-env -iA nixos.hll2390dw-cups
the closest fit I could see.
For good measure, I restarted CUPS: sudo systemctl restart cups.service
I’ve just arrived from Slackware, which is probably about as far removed as could be from the NixOS philosophy. I got the printer to work there using a script from the Brother webside, for hll2360DW rather than the actual model number ~65. But I hope to work out how to solve problems like this “the NixOS way”.
No, CUPS shows nothing at all, either under Add printer or Find printer.
I have since dug a tiny bit deeper and looked at the brlaser package, which states that it works for hll2360dw. My printer is hll2365dw, but on my Slackware system, it works with the driver for 60 - and that’s the closest the vendor provides. So it ought to work, in theory.
One thing that occurs to me is is there a CUPS/printing group my user should be added to? At the moment, I have just wheel and networkmanager.
EDIT
For good measure, here is my configuration.nix (sorry it’s a bit of a dog’s breakfast - I had some other problems along the way):
[mimosa@nixos:~]$ cat /etc/nixos/configuration.nix
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# boot.loader.generationsDir.enable = true;
# boot.loader.generationsDir.copyKernels = true;
# networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking = {
hostName = "nixos"; # Define your hostname.
# interfaceMonitor.enable = false; # Disable in favour of wicd
wireless.enable = false; # Disable in favour of wicd
# };
# };
useDHCP = false; # Disable in favour of wicd
interfaces.wlan0.useDHCP = true;
# wicd.enable = true;
networkmanager.enable =true;
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget vim pciutils wirelesstools firmwareLinuxNonfree iw
];
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.drivers = [ pkgs.brlaser ];
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.layout = "us";
services.xserver.xkbVariant = "dvp";
# services.xserver.xkbOptions = "eurosign:e";
# Enable the KDE Desktop Environment.
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.mimosa = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ]; # Enable ‘sudo’ for the user.
};
system.stateVersion = "19.09"; # Did you read the commente?
# Enable virtualbox.
virtualisation.virtualbox.host.enable = true;
#
# # Enable the Oracle Extension Pack.
virtualisation.virtualbox.host.enableExtensionPack = true;
}
This was a hack to make the printer not always try to print to A4 paper (or something like that–I forgot the details but if you search my post history you can find the place where I was getting help for this).
I suspect this won’t really help you with your problem, but I hope it does!
What probably makes sense in my situation (no package for my model) is to adapt your build script for my model. But I’m quickly at sea. Here’s the relevant page from the manufacturer’s site (mainly note to self): https://support.brother.com/g/b/downloadlist.aspx?c=us_ot&lang=en&prod=hll2360dw_us&os=128#SelectLanguageType-10032_0_1
Here’s the modified derivation (with the paper size modification commented out, since A4 is all there is in these parts) with a direct link and checksum for the “LPR printer driver (deb package)”, which seems to be the right one:
I’m stumped by the relative path to the derivation in your configuration.nix (…/…/printers/ …). Where should it go? Presumably the only way to test it is by rebuilding the configuration, with everything in place. Fingers crossed the build works without adjustments.
Hi! I should maybe have been more explicit about the way my config files are set up.
Check out my nixos-config repository (and excuse its fledgling nature) and that should clear things up: GitHub - waxlamp/nixos-config: NixOS configuration files. If not, let me know and I’ll do my best to explain (I have been using NixOS for several years now, but still feel like a beginner).
Thanks - I see you can choose whatever path (and the derivation is indeed then called). I’m now stuck again because the needed files for my printer are distributed over two downloads (whereas for the …95 printer, it’s just one item). After some time searching through the documentation, I can’t work out how to specify more than one source file. So I’ve got
which of course doesn’t work. I see that $src is referenced further down the script, which makes me suspect you could just use src0, src1 … srcn, i.e. “src” is just an arbitrary label rather than a reserved name; I thought I’d ask though before trying any more such random experiments. It would make more sense on the face of it for sources to be presented in a list or array.
I see that $src is referenced further down the script, which makes me suspect you could just use src0, src1 … srcn, i.e. “src” is just an arbitrary label rather than a reserved name
In this particular case, I think your idea of creating extra src<N> values will work. In general, I think the src value has special meaning to mkDerivation, since it references the various build phases, one of which is used to unpack the source tarball referenced by src. You can see in this example it is set to :, I think because the src in this case is a .deb file, rather than a tarball that needs to be unrolled.
I guess I’m saying to go ahead and try your approach out; it can’t hurt! And in the meantime, perhaps someone who understands these things better can come by to confirm or disconfirm what I said above
Partial success - the derivation builds and CUPS allows me to install the printer, however, the test page tells me that “If you can read this, you are using the wrong driver for your printer”.
This is probably now a packaging problem rather than a NixOS problem, and lies in the nitty-gritty of the files that make up the “driver”. So to sum up, having two $src variables or labels works; I’ve edited the paths and filenames to match the driver for this model, but may have slipped up. I can try and dig deeper, but can anyone spot any obvious mistakes?
I came across this issue with my brother L23500W(connected over WiF in a private network) and Dymo 450(connected via usb). The settings base is the CUPS daemon that needs to be running. This is how the user sends commands to the printer it has access to. But enabling CUPS is not enough, as it runs under its own user and for you to interact with it you will need to be part of the CUPS group. Without this setting I was unable to send any command to the printer(both of them). Also in case of a printer that does not use IPP you will probably need to add a driver for the printer as I did for the Dymo.
Now if you want to use a printer over the network without the need to install drivers you will need to add avahi to the mix. It is used(among other things) for CUPS to automatically discover IPP printers on the network.