summary refs log tree commit diff
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2025-04-24 04:29:01 +0200
committerMel <mel@rnrd.eu>2025-04-24 04:29:01 +0200
commitdc45779be86c8bc2916b6c1830420e22c8832c16 (patch)
tree13c7be694dc301a38be35d95d60c7dfb00a7ac8e
parent0744b77dd034b7196b4171ea86c3e40301488f50 (diff)
downloadnetwork-dc45779be86c8bc2916b6c1830420e22c8832c16.tar.zst
network-dc45779be86c8bc2916b6c1830420e22c8832c16.zip
Add KlipperScreen kiosk screen to fourmi
Signed-off-by: Mel <mel@rnrd.eu>
-rw-r--r--machines/fourmi/default.nix1
-rw-r--r--modules/klipperscreen.nix35
2 files changed, 36 insertions, 0 deletions
diff --git a/machines/fourmi/default.nix b/machines/fourmi/default.nix
index b6b8712..879e3fd 100644
--- a/machines/fourmi/default.nix
+++ b/machines/fourmi/default.nix
@@ -9,6 +9,7 @@
 
     ../../modules/go2rtc.nix
     ../../modules/klipper.nix
+    ../../modules/klipperscreen.nix
   ];
 
   foundation = {
diff --git a/modules/klipperscreen.nix b/modules/klipperscreen.nix
new file mode 100644
index 0000000..76c9414
--- /dev/null
+++ b/modules/klipperscreen.nix
@@ -0,0 +1,35 @@
+{ config, pkgs, ... }:
+
+let
+  inherit (pkgs) writeText klipperscreen;
+
+  ksConfig =
+    let
+      inherit (config.services.moonraker) address port;
+    in
+    writeText "KlipperScreen.conf" ''
+      [printer fourmi]
+      moonraker_host: ${address}
+      moonraker_port: ${toString port}
+    '';
+in
+{
+  # avoid conflict between console and cage.
+  console.enable = false;
+
+  # without this the kiosk doesn't even want to get loaded :)
+  systemd.defaultUnit = "graphical.target";
+
+  services.cage = {
+    enable = true;
+
+    program = "${klipperscreen}/bin/KlipperScreen -c ${ksConfig}";
+    extraArguments = [ "-d" ];
+
+    environment = {
+      # don't fail with no devices found.
+      "WLR_LIBINPUT_NO_DEVICES" = "1";
+    };
+    user = "klipper";
+  };
+}