From 1085ca5c51c281592c9c5b02af07c1b31d5feff0 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 26 Jul 2025 14:17:46 +0200 Subject: modules/printing: Make printer config state-full The printer can be offline when starting the system, or it can be otherwise unreachable. --- modules/by-name/pr/printing/module.nix | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 modules/by-name/pr/printing/module.nix (limited to 'modules/by-name/pr/printing') diff --git a/modules/by-name/pr/printing/module.nix b/modules/by-name/pr/printing/module.nix new file mode 100644 index 00000000..c3283cbf --- /dev/null +++ b/modules/by-name/pr/printing/module.nix @@ -0,0 +1,44 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{ + config, + lib, + ... +}: let + cfg = config.soispha.services.printing; +in { + options.soispha.services.printing = { + enable = lib.mkEnableOption "default printing configuration"; + }; + + config = lib.mkIf cfg.enable { + soispha.impermanence.directories = [ + "/var/lib/cups" + ]; + + services.avahi = { + enable = true; + nssmdns4 = true; + nssmdns6 = true; + openFirewall = true; + }; + + services.printing = { + enable = true; + startWhenNeeded = true; + webInterface = true; + + # deletes `/var/cache/cups`, `/var/lib/cups` and `/var/spool/cups` on cups startup + stateless = false; + + drivers = []; + }; + }; +} -- cgit 1.4.1