about summary refs log tree commit diff stats
path: root/modules/by-name/pr
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-07-26 14:17:46 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-07-26 14:17:46 +0200
commit1085ca5c51c281592c9c5b02af07c1b31d5feff0 (patch)
tree11bbcd2d615ab615e0789b6f38018fee2c535028 /modules/by-name/pr
parentmodules/river/keymap: Provide a quicker way to switch between common modes (diff)
downloadnixos-config-1085ca5c51c281592c9c5b02af07c1b31d5feff0.zip
modules/printing: Make printer config state-full
The printer can be offline when starting the system, or it can be
otherwise unreachable.
Diffstat (limited to 'modules/by-name/pr')
-rw-r--r--modules/by-name/pr/printing/module.nix44
1 files changed, 44 insertions, 0 deletions
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 <benedikt.peetz@b-peetz.de>
+# 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 <https://www.gnu.org/licenses/gpl-3.0.txt>.
+{
+  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 = [];
+    };
+  };
+}