cups: Restructure to include SII SLP 650

This commit is contained in:
Simon Bruder 2024-07-14 19:07:00 +02:00
parent 04b54a2ed1
commit 7d23321c0f
Signed by: simon
GPG key ID: 347FF8699CDA0776
3 changed files with 64 additions and 41 deletions

View file

@ -189,11 +189,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1698974481, "lastModified": 1703863825,
"narHash": "sha256-yPncV9Ohdz1zPZxYHQf47S8S0VrnhV7nNhCawY46hDA=", "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-github-actions", "repo": "nix-github-actions",
"rev": "4bb5e752616262457bc7ca5882192a564c0472d2", "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -272,11 +272,11 @@
"poetry2nix": "poetry2nix" "poetry2nix": "poetry2nix"
}, },
"locked": { "locked": {
"lastModified": 1712934106, "lastModified": 1719952130,
"narHash": "sha256-JubHgaV6HUZarwwq4y2rxJaaj2a6euErJfCqpmhrhWk=", "narHash": "sha256-j38XlExNwK4ycmoNEdH/dHUd1QGdNvD3gx/UuLY+04Q=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "2bcb2b6c7b0e04f4ef8e51e00fd93a5e5cb00bf8", "rev": "3487b8ce24d40cc898f3dba0a9af5e028e1d5844",
"revCount": 66, "revCount": 68,
"type": "git", "type": "git",
"url": "https://git.sbruder.de/simon/nixpkgs-overlay" "url": "https://git.sbruder.de/simon/nixpkgs-overlay"
}, },
@ -387,11 +387,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1701399357, "lastModified": 1714509427,
"narHash": "sha256-QSGP2J73HQ4gF5yh+MnClv2KUKzcpTmikdmV8ULfq2E=", "narHash": "sha256-YTcd6n7BeAVxBNhzOgUHMmsgBkfQ2Cz9ZcFotXrpEg8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "poetry2nix", "repo": "poetry2nix",
"rev": "7acb78166a659d6afe9b043bb6fe5cb5e86bb75e", "rev": "184960be60652ca7f865123e8394ece988afb566",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -501,11 +501,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1699786194, "lastModified": 1714058656,
"narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", "narHash": "sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m+whxRYUMiaA=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1", "rev": "c6aaf729f34a36c445618580a9f95a48f5e4e03f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -19,6 +19,7 @@
sbruder = { sbruder = {
wireguard.home.enable = true; wireguard.home.enable = true;
nginx.hardening.enable = true; nginx.hardening.enable = true;
printing.server.enable = true;
restic.system = { restic.system = {
enable = true; enable = true;
qos = true; qos = true;

View file

@ -1,36 +1,58 @@
# SPDX-FileCopyrightText: 2020-2022 Simon Bruder <simon@sbruder.de> # SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
gutenprintWithVersion = "gutenprint.${lib.versions.majorMinor (lib.getVersion pkgs.gutenprint)}"; printersPerServer = {
in fuuko = [
lib.mkIf config.sbruder.gui.enable {
services = {
printing = {
enable = true;
drivers = with pkgs; [
gutenprint
] ++ lib.optional config.sbruder.unfree.allowSoftware (cups-kyocera-ecosys-m552x-p502x.override {
# in Kyocera terms, EU means duplex enabled by default
region = "EU";
});
};
avahi.enable = true;
};
hardware.printers.ensurePrinters = [
{ {
name = "ich_drucke_nicht"; name = "etikettierviech";
deviceUri = "socket://192.168.178.26"; deviceUri = "usb://SII/SLP650?serial=32152867B0";
model = "${gutenprintWithVersion}://bjc-TS3100-series/expert"; model = "seiko/siislp650.ppd.gz";
}
] ++ lib.optionals config.sbruder.unfree.allowSoftware [
{
name = "elma";
deviceUri = "socket://elma.fritz.box";
model = "Kyocera/Kyocera ECOSYS P5021cdn.PPD";
} }
]; ];
};
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";
}
];
})
];
} }