summaryrefslogtreecommitdiff
path: root/modules/root/printing.nix
blob: 69ff573c363c0c2a5c15e3fa5e23e64ffc7cee18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ lib, config, pkgs, ... }: {
	options = {
		printing.enable = lib.mkEnableOption "enables printing";
		avahi.enable    = lib.mkEnableOption "enables avahi";
		scanning.enable = lib.mkEnableOption "enables scanning";
	};

	config = lib.mkIf config.printing.enable {
		services.printing = {
			enable = true;
			drivers = [
				pkgs.epson-escpr2
			];
		};

		services.avahi = {
			enable = true;
			nssmdns4 = true;
			openFirewall = true;
		};

		environment.systemPackages = with pkgs; pkgs.lib.optionals config.scanning.enable [
			epsonscan2
		];

		networking.hosts = {
			"192.168.1.35"  = [ "Epson_ET-8500" ];
			"192.168.77.40" = [ "Xerox_WorkCentre_7855" ];
		};

		hardware.printers.ensurePrinters = [
			{
				name = "Epson_ET-8500";
				description = "Epson ET-8500";
				location = "Home";
				deviceUri = "ipp://Epson_ET-8500:631/ipp/print";
				model = "epson-inkjet-printer-escpr2/Epson-ET-8500_Series-epson-escpr2-en.ppd";
			}
			#{
			#	name = "Xerox_WorkCentre_7855";
			#	description = "Xerox WorkCentre 7855";
			#	location = "Office";
			#	deviceUri = "ipp://Xerox_WorkCentre_7855:631/ipp/print";
			#	model = "everywhere IPP Everywhere";
			#}
		];
		hardware.printers.ensureDefaultPrinter = "Epson_ET-8500";
	};
}