nixos/hosts/common/optional/print-server.nix

62 lines
1.4 KiB
Nix
Raw Normal View History

2025-01-24 13:50:26 +00:00
{pkgs, configVars, ...}: let
2025-01-24 14:07:07 +00:00
subnetIp = configVars.networking.addresses.subnet.ip;
2025-01-24 13:50:26 +00:00
in {
2025-01-24 12:33:21 +00:00
networking.firewall = {
allowedTCPPorts = [631];
allowedUDPPorts = [631];
};
services = {
2025-01-24 13:50:26 +00:00
udev.packages = [pkgs.sane-airscan];
ipp-usb.enable = true;
saned = {
enable = true;
2025-01-24 14:07:07 +00:00
extraConfig = "${subnetIp}/24";
2025-01-24 13:50:26 +00:00
};
2025-01-24 12:33:21 +00:00
printing = {
enable = true;
drivers = [pkgs.hplip];
browsing = true;
defaultShared = true;
listenAddresses = ["*:631"];
allowFrom = ["all"];
extraConf = ''
DefaultPaperSize A4
'';
};
avahi = {
enable = true;
nssmdns = true;
openFirewall = true;
publish = {
enable = true;
userServices = true;
};
};
};
2025-01-24 13:50:26 +00:00
hardware = {
sane = {
enable = true;
extraBackends = [pkgs.sane-airscan pkgs.hplipWithPlugin];
openFirewall = true;
};
printers = {
ensurePrinters = [
{
name = "HP_Envy_6000";
location = "Home";
deviceUri = "usb://HP/ENVY%206000%20series?serial=TH0B93F08W&interface=1";
# deviceUri = "usb://Dell/1250c%20Color%20Printer?serial=YNP023240";
model = "HP/hp-deskjet_plus_6000_series.ppd.gz";
ppdOptions = {
PageSize = "A4";
};
}
];
ensureDefaultPrinter = "HP_Envy_6000";
};
2025-01-24 12:33:21 +00:00
};
}