diff options
Diffstat (limited to 'hosts/gnuslashprinter/klipper.nix')
| -rw-r--r-- | hosts/gnuslashprinter/klipper.nix | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/hosts/gnuslashprinter/klipper.nix b/hosts/gnuslashprinter/klipper.nix new file mode 100644 index 0000000..a19261c --- /dev/null +++ b/hosts/gnuslashprinter/klipper.nix @@ -0,0 +1,72 @@ +{ + # Klipper firmware + services.klipper = { + enable = true; + firmwares = { + mcu = { + enable = true; + # Serial port connected to the microcontroller + serial = "/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0"; + # Klipper flash must be enabled in order to build mcu firmware + # The resulting `klipper-flash-mcu` command will show the location of the firmware bin in the nix store + enableKlipperFlash = true; + # Run klipper-genconf to generate this + configFile = ./resources/klipper/mcu/config; + }; + }; + configFile = ./resources/klipper/printer.cfg; + logFile = "/var/lib/klipper/klipper.log"; + }; + # Mutable config + services.klipper.mutableConfig = true; + #configDir = "/var/lib/moonraker/config"; # Accessible by moonraker # TODO + + # Moonraker web-api + services.moonraker = { + user = "root"; + enable = true; + address = "0.0.0.0"; + settings = { + #authorization = { + # force_logins = true; + # cors_domains = [ + # "*.local" + # "*.lan" + # "*://app.fluidd.xyz" + # "*://my.mainsail.xyz" + # ]; + # trusted_clients = [ + # "10.0.0.0/8" + # "127.0.0.0/8" + # "169.254.0.0/16" + # "172.16.0.0/12" + # "192.168.0.0/16" + # "FE80::/10" + # "::1/128" + # ]; + #}; + #file_manager.check_klipper_config_path = false; # Disable warning when klipper config is not accessible by moonraker + # mainsail.cfg + #"update_manager mainsail-config" = { + # type = "git_repo"; + # primary_branch = "master"; + # path = "~/mainsail-config"; + # origin = "https://github.com/mainsail-crew/mainsail-config.git"; + # managed_services = "klipper"; + #}; + }; + }; + + # Mainsail web-interface + services.mainsail = { + enable = true; + hostName = "0.0.0.0"; + nginx.listenAddresses = [ "0.0.0.0" ]; + }; + services.nginx.clientMaxBodySize = "1000m"; # Allow large gcodes, etc. + networking.firewall.allowedTCPPorts = [ 80 ]; # Port for mainsail via nginx + + # Webcam support in mainsail + services.ustreamer.enable = true; + services.mainsail.nginx.locations."/webcam/".proxyPass = "http://localhost:8080/stream"; # Default location for ustreamer stream +} |
