diff --git a/machines/modules/malobeo/printing.nix b/machines/modules/malobeo/printing.nix new file mode 100644 index 0000000..ad28215 --- /dev/null +++ b/machines/modules/malobeo/printing.nix @@ -0,0 +1,51 @@ +{ config, lib, pkgs, ... }: +with lib; +let + cfg = config.services.malobeo.printing; + driverFile = pkgs.writeTextDir "share/cups/model/konicaminoltac258.ppd" (builtins.readFile ../KOC658UX.ppd); + + defaultPpdOptions = { + PageSize = "A4"; + SelectColor = "Grayscale"; + Finisher = "FS534"; + SaddleUnit = "SD511"; + Model = "C258"; + InputSlot = "Tray1"; + }; + +in +{ + options.services.malobeo.printing = { + enable = mkOption { + type = types.bool; + default = false; + description = "Setup malobeo printers"; + }; + }; + + config = mkIf (cfg.enable) { + services.printing.enable = true; + services.printing.drivers = [ + driverFile + ]; + + hardware.printers.ensurePrinters = [ { + name = "KonicaDefault"; + model = "konicaminoltac258.ppd"; + location = "Zine Workshop"; + deviceUri = "ipp://192.168.1.42/ipp"; + ppdOptions = defaultPpdOptions; + } + { + name = "KonicaBooklet"; + model = "konicaminoltac258.ppd"; + location = "Zine Workshop"; + deviceUri = "ipp://192.168.1.42/ipp"; + ppdOptions = defaultPpdOptions // { + Fold = "Stitch"; + Staple = "None"; + }; + } + ]; + }; +} diff --git a/outputs.nix b/outputs.nix index b7c2db6..60d04c1 100644 --- a/outputs.nix +++ b/outputs.nix @@ -117,6 +117,7 @@ in (utils.lib.eachSystem (builtins.filter filter_system utils.lib.defaultSystems disko.imports = [ ./machines/modules/disko ]; users.imports = [ ./machines/modules/malobeo/users.nix ]; backup.imports = [ ./machines/modules/malobeo/backup.nix ]; + printing.imports = [ ./machines/modules/malobeo/printing.nix ]; }; hydraJobs = nixpkgs.lib.mapAttrs (_: nixpkgs.lib.hydraJob) (