[Desktop/Printing] Move printing related config to dedicated file

This commit is contained in:
Antoine Viallon 2023-06-26 12:04:34 +02:00
parent c449ec13c9
commit c4cf38ceb3
Signed by: aviallon
GPG key ID: 186FC35EDEB25716
3 changed files with 79 additions and 66 deletions

74
desktop/printing.nix Normal file
View file

@ -0,0 +1,74 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.aviallon.desktop;
generalCfg = config.aviallon.general;
in {
config = mkIf (cfg.enable && !generalCfg.minimal) {
services.printing = {
enable = true;
defaultShared = mkDefault true;
browsing = mkDefault true;
listenAddresses = [ "0.0.0.0:631" ];
drivers = with pkgs; []
++ (optionals (!generalCfg.minimal) [
hplipWithPlugin
gutenprint
splix
brlaser
cups-bjnp
# cups-dymo
# cups-zj-58
# cups-kyocera
cups-filters
carps-cups
# cups-kyodialog3
cups-brother-hl1110
cups-toshiba-estudio
cups-brother-hl1210w
hll2390dw-cups
cups-brother-hl3140cw
cups-brother-hll2340dw
cups-drv-rastertosag-gdi
# cups-kyocera-ecosys-m552x-p502x
canon-cups-ufr2
]);
webInterface = mkDefault true;
};
services.system-config-printer.enable = true;
hardware.sane = {
enable = true;
netConf = "192.168.0.0/24";
extraBackends = with pkgs; [
hplipWithPlugin
];
};
networking.firewall.allowedTCPPorts = optionals config.services.printing.enable [ 631 139 445 ];
networking.firewall.allowedUDPPorts = optionals config.services.printing.enable [ 137 ];
aviallon.programs.allowUnfreeList = [
"hplip"
"hplipWithPlugin"
"cups-bjnp"
"cups-dymo"
"cups-zj-58"
"cups-kyocera"
"cups-filters"
"carps-cups"
"cups-kyodialog3"
"cups-brother-hl1110"
"cups-toshiba-estudio"
"cups-brother-hl1210w"
"cups-brother-hl1210W"
"hll2390dw-cups"
"cups-brother-hl3140cw"
"cups-brother-hll2340dw"
"cups-drv-rastertosag-gdi"
"cups-kyocera-ecosys-m552x-p502x"
"canon-cups-ufr2"
];
};
}