From 1244a6b5ed3109251b32395557dca61bd803c7a0 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sun, 18 Oct 2020 22:25:05 +0200 Subject: [PATCH] cups: Declaratively add printers --- modules/cups.nix | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/modules/cups.nix b/modules/cups.nix index 23f3c0b..5dcc8b3 100644 --- a/modules/cups.nix +++ b/modules/cups.nix @@ -1,5 +1,7 @@ -{ pkgs, ... }: - +{ lib, pkgs, ... }: +let + gutenprintWithVersion = "gutenprint.${lib.versions.majorMinor (lib.getVersion pkgs.gutenprint)}"; +in { services = { printing = { @@ -10,4 +12,28 @@ }; avahi.enable = true; }; + + hardware.printers.ensurePrinters = [ + { + name = "kanna"; + deviceUri = "socket://kanna.home.sbruder.de"; + model = "${gutenprintWithVersion}://kyocera-fs-c5200dn/expert"; + ppdOptions = { + PageSize = "A4"; + }; + } + { + name = "tintenpisser"; + deviceUri = "ipp://tintenpisser.home.sbruder.de:631/ipp/print"; + model = "everywhere"; + ppdOptions = { + PageSize = "A4"; + }; + } + { + name = "ich_drucke_nicht"; + deviceUri = "socket://192.168.178.26"; + model = "${gutenprintWithVersion}://bjc-TS3100-series/expert"; + } + ]; }