nixdots/system/roles/workstation/services/printing.nix

31 lines
740 B
Nix
Raw Normal View History

2024-04-13 19:15:25 +00:00
{ pkgs, lib, config, ...}: let
2024-04-13 18:10:01 +00:00
inherit (lib) mkIf;
2024-04-13 19:15:25 +00:00
deviceType = config.myOptions.device.roles.type;
acceptedTypes = ["laptop" "desktop"];
2024-04-13 18:10:01 +00:00
cfg = config.myOptions.workstation.printing;
in {
2024-04-13 19:15:25 +00:00
config = mkIf (builtins.elem deviceType acceptedTypes && cfg.enable) {
2024-04-13 18:10:01 +00:00
# enable cups and add some drivers for common printers
services = {
printing = {
enable = true;
drivers = with pkgs; [
gutenprint
hplip
];
};
# required for network discovery of printers
avahi = {
enable = true;
# resolve .local domains for printers
nssmdns4 = true;
# open the avahi port(s) in the firewall
openFirewall = true;
};
};
};
}