59 lines
1.7 KiB
Nix
59 lines
1.7 KiB
Nix
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
let
|
|
printersPerServer = {
|
|
fuuko = [
|
|
{
|
|
name = "etikettierviech";
|
|
deviceUri = "usb://SII/SLP650?serial=32152867B0";
|
|
model = "seiko/siislp650.ppd.gz";
|
|
}
|
|
];
|
|
};
|
|
in
|
|
{
|
|
options.sbruder.printing = {
|
|
server.enable = lib.mkEnableOption "printing server";
|
|
client.enable = (lib.mkEnableOption "printing client") // { default = config.sbruder.gui.enable; };
|
|
};
|
|
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";
|
|
}
|
|
];
|
|
})
|
|
];
|
|
}
|