2024-07-14 19:07:00 +02:00
|
|
|
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
|
2024-01-06 01:19:35 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2020-12-05 13:48:06 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2020-10-18 22:25:05 +02:00
|
|
|
let
|
2024-07-14 19:07:00 +02:00
|
|
|
printersPerServer = {
|
|
|
|
fuuko = [
|
|
|
|
{
|
|
|
|
name = "etikettierviech";
|
|
|
|
deviceUri = "usb://SII/SLP650?serial=32152867B0";
|
|
|
|
model = "seiko/siislp650.ppd.gz";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2020-10-18 22:25:05 +02:00
|
|
|
in
|
2024-07-14 19:07:00 +02:00
|
|
|
{
|
|
|
|
options.sbruder.printing = {
|
|
|
|
server.enable = lib.mkEnableOption "printing server";
|
|
|
|
client.enable = (lib.mkEnableOption "printing client") // { default = config.sbruder.gui.enable; };
|
2020-08-29 23:54:35 +02:00
|
|
|
};
|
2024-07-14 19:07:00 +02:00
|
|
|
config = lib.mkMerge [
|
|
|
|
(lib.mkIf (config.sbruder.printing.client.enable || config.sbruder.printing.server.enable) {
|
|
|
|
services.printing = {
|
|
|
|
enable = true;
|
|
|
|
drivers = with pkgs; [
|
|
|
|
cups-sii-slp-400-600
|
|
|
|
gutenprint
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(lib.mkIf config.sbruder.printing.server.enable {
|
|
|
|
services.printing = {
|
|
|
|
stateless = true;
|
|
|
|
startWhenNeeded = false; # cups.socket interferes with cups.service (cups.socket binds to IPv4, so cups.service can only bind to IPv6)
|
|
|
|
listenAddresses = [ "*:631" ];
|
|
|
|
allowFrom = [ "all" ];
|
|
|
|
openFirewall = true;
|
|
|
|
defaultShared = true;
|
|
|
|
extraConf = ''
|
|
|
|
ServerAlias fuuko.lan.shinonome-lab.de
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
hardware.printers.ensurePrinters = printersPerServer.${config.networking.hostName};
|
|
|
|
})
|
|
|
|
(lib.mkIf config.sbruder.printing.client.enable {
|
|
|
|
services.avahi.enable = true;
|
|
|
|
hardware.printers.ensurePrinters = [
|
|
|
|
{
|
|
|
|
name = "etikettierviech";
|
|
|
|
model = "everywhere";
|
|
|
|
deviceUri = "ipps://fuuko.lan.shinonome-lab.de:631/printers/etikettierviech";
|
|
|
|
description = "SII SLP 650";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
})
|
2020-10-18 22:25:05 +02:00
|
|
|
];
|
2020-08-22 17:44:39 +02:00
|
|
|
}
|