From b6e49129d2a3a01dd1ad436e4144bacbe89d1c30 Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Thu, 16 Jul 2020 12:15:25 +0100 Subject: add eth.hardware.printer NixOS module --- nixos/modules/hardware/printer.nix | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 nixos/modules/hardware/printer.nix (limited to 'nixos/modules/hardware/printer.nix') diff --git a/nixos/modules/hardware/printer.nix b/nixos/modules/hardware/printer.nix new file mode 100644 index 0000000..23aa554 --- /dev/null +++ b/nixos/modules/hardware/printer.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, ... }: +with lib; + +let + cfg = config.eth.hardware.printer; + +in { + + options.eth.hardware.printer = { + enable = mkEnableOption "Whether to enable Eth's home printer"; + }; + + config = mkIf cfg.enable { + # Avahi is needed for dnssd (mDNS / Bonjour) printers. + services.avahi = { + enable = true; + nssmdns = true; + }; + + services.printing = { + enable = true; + drivers = with pkgs; [ brlaser ]; + }; + + hardware.printers.ensurePrinters = [ + { + name = "Brother_HL-1210W"; + description = "Brother HL-1210W"; + deviceUri = "dnssd://Brother%20HL-1210W%20series._pdl-datastream._tcp.local/?uuid=e3248000-80ce-11db-8000-d89c67c1755c"; + model = "drv:///brlaser.drv/br1200.ppd"; + } + ]; + }; +} -- cgit v1.2.3