I started to migrate my ARM homeserver to NixOS and was able to configure the printer together with AirPrint enabled network sharing. Here’s a short how-to.

The following excerpt of my NixOS system configuration includes following sections:

  • Firewall rules to open ports for the printing server CUPS. Please note that these ports will be accessable to all interfaces on all networks using this configuration scheme.
  • Printing service CUPS with optional driver specification. listenAddresses and extraConf is required to share the printer on the network without authentication.
  • Avahi daemon for broadcasting zero-conf services on the network, especially configured to announce our network printer. This is what will make your printer appear on your Android or Apple phone.
  • The last section is the device configuration for our USB attached printer. This of course is different depending on the printer model you’ll use.
networking.firewall = {
  allowedTCPPorts = [ 631 ];
  allowedUDPPorts = [ 631 ];

services = {
  printing = {
    enable = true;
    drivers = with pkgs; [
 foo2zjs ];
    browsing = true;
    defaultShared = true;
    listenAddresses = [ "" ];
    extraConf = ''
      <Location />
        Order allow,deny
        Allow all
  avahi = {
    nssmdns = true;
    enable = true;
    ipv4 = true;
    ipv6 = true;
    publish = {
      enable = true;
      addresses = true;
      workstation = true;
    openFirewall = true;
    extraServiceFiles = {
      airprint = "/etc/nixos/airprint.service";

hardware.printers = {
  ensurePrinters = [
    name = "Dell_1250c";
    location = "Home";
    deviceUri = "usb://Dell/1250c%20Color%20Printer?serial=YNP023240";
    model = "Dell-1250c.ppd.gz";
    ppdOptions.PageSize = "A4";
  ensureDefaultPrinter = "Dell_1250c";

The following file defines the network printer for the Avahi daemon and is referenced above. You’ll habe to change name, url and supported printing modes according to your needs.

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
  <name>Dell 1250c</name>
    <txt-record>ty=Dell 1250c</txt-record>
    <txt-record>note=Dell 1250c</txt-record>
    <txt-record>product=(GPL Ghostscript)</txt-record>

I already described how to setup this network printer on Linux, Windows and your phones in an earlier post.

Unfortunately this setup is still too complicated in my opinion. Hopefully native AirPrint support will be available in the upcoming Cups 2.4 version by OpenPrinting as suggested by this pull request.

💬 Are you interested in our work or have some questions? Join us in our public Signal chat pi crew 👋
🪙 If you like our work or want to supprot us, you can donate MobileCoins to our address.