make printer accessible via network
All checks were successful
Build all NixOS Configurations / nix build (push) Successful in 8m26s

This commit is contained in:
Ingolf Wagner 2025-05-28 22:01:49 +02:00
parent 2aa65490b4
commit 97ca643aad
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
5 changed files with 56 additions and 31 deletions

View file

@ -1,28 +0,0 @@
{ config, lib, ... }:
with lib;
{
options.components.gui.cups.enable = mkOption {
type = lib.types.bool;
default = config.components.gui.enable;
};
config = mkIf (config.components.gui.cups.enable) {
hardware.printers.ensurePrinters = [
{
description = "Lexmark E350d";
deviceUri = "usb://Lexmark/E350d?serial=622Z9ZC";
location = "office";
name = "Lexmark_E350d";
model = "drv:///sample.drv/generic.ppd";
ppdOptions = {
job-sheets = "none, none";
media = "na_letter_8.5x11in";
sides = "one-sided";
};
}
];
};
}

View file

@ -14,7 +14,6 @@ with lib;
# todo : structure with home-manager and such is not cool, create another structure
./audio.nix
./browser.nix
./cups.nix
./home-manager
./kde.nix
./kmonad.nix

View file

@ -33,6 +33,8 @@ with lib;
genpass
tree
killall
nom # nix output monitor
nix-tree
vulnix

View file

@ -46,6 +46,7 @@
./service-atuin.nix
./service-forgejo.nix
./service-cups.nix
./service-paperless-backup.nix
./service-paperless-tika.nix
./service-paperless.nix
@ -78,8 +79,6 @@
healthchecks.closed.wg0.host = "10.100.0.2";
services.printing.enable = false;
networking.hostName = "chungus";
# nix-shell -p speedtest_cli --run speedtest

View file

@ -0,0 +1,53 @@
{
pkgs,
zerotierInterface,
config,
...
}:
{
#networking.firewall.interfaces.${zerotierInterface}.allowedTCPPorts = [ 631 ];
networking.firewall.allowedTCPPorts = [ 631 ];
services.printing = {
enable = true;
listenAddresses = [ "[::]:631" ];
extraConf = "ServerAlias chungus.bear chungus.ingolf-wagner.de";
allowFrom = [ "all" ];
defaultShared = true;
browsing = true;
browsedConf = ''
BrowseRemoteProtocols dnssd
CreateIPPPrinterQueues All
'';
};
hardware.printers.ensureDefaultPrinter = "Lexmark_E350d";
hardware.printers.ensurePrinters = [
{
description = "Lexmark E350d";
deviceUri = "usb://Lexmark/E350d?serial=622Z9ZC";
location = "office";
name = "Lexmark_E350d";
model = "drv:///sample.drv/generic.ppd";
ppdOptions = {
job-sheets = "none, none";
media = "iso_a4_210x297mm"; # ← A4 statt Letter
sides = "two-sided-long-edge"; # ← Doppelseitig, wie ein Buch
};
}
];
# avahi is needed for cups to work nice and smooth
healthchecks.localCommands.test-avahi = pkgs.writers.writeBash "test-avahi" ''
dig @${config.clan.core.vars.generators.zerotier.files.zerotier-ip.value} -p 5353 _ipp._tcp.local. PTR +time=3 +tries=1 +retry=0
'';
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
}