summary refs log tree commit diff
path: root/modules/klipperscreen.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/klipperscreen.nix')
-rw-r--r--modules/klipperscreen.nix35
1 files changed, 35 insertions, 0 deletions
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";
+  };
+}