3D Printing: Difference between revisions
No edit summary |
extensions |
||
| Line 107: | Line 107: | ||
The stream URL for your webcam will be http://<YOUR_IP>:8080/stream. The snapshot URL will be http://<YOUR_IP>:8080/snapshot. | The stream URL for your webcam will be http://<YOUR_IP>:8080/stream. The snapshot URL will be http://<YOUR_IP>:8080/snapshot. | ||
== Extensions == | |||
=== Installing extensions === | |||
Add the repo with your extension as a flake input: <syntaxhighlight lang="nix"> | |||
inputs = { | |||
kiauh = { | |||
url = "github:dw-0/kiauh/master"; | |||
flake = false; | |||
}; | |||
}; | |||
</syntaxhighlight>Override klipper's postInstall to add your extensions to extras. The example below install the gcode_shell_command extension:<syntaxhighlight lang="nix"> | |||
services.klipper.package = = pkgs.klipper.overrideAttrs ({ postInstall ? "", ... }: { | |||
postInstall = postInstall + '' | |||
chmod +rw $out/lib/klippy -R | |||
cp ${inputs.kiauh}/kiauh/extensions/gcode_shell_cmd/assets/gcode_shell_command.py $out/lib/klipper/extras | |||
''; | |||
}); | |||
</syntaxhighlight> | |||
=== gcode_shell_command === | |||
To run custom scripts with gcode_shell_command, you need to add your programs to the PATH of the Klipper service. You may do so using systemd.services.klipper.path:<syntaxhighlight lang="nix"> | |||
systemd.services.klipper.path = [pkgs.<YOUR_PACKAGE> pkgs.<YOUR_SECOND_PACKAGE>]; | |||
</syntaxhighlight> | |||
[[Category:Guide]] | [[Category:Guide]] | ||
[[Category:Web Applications]] | [[Category:Web Applications]] | ||
Revision as of 11:08, 19 September 2026
NixOS can be used as a Klipper host. This is a great alternative to a KIAUH installation.
Installation
Below is a basic configuration example that can be used to install Klipper, Moonraker and Mainsail/Fluidd:
users.users.klipper = {
group = "klipper";
extraGroups = [ "dialout" ];
isSystemUser = true;
};
users.groups.klipper = {};
systemd.tmpfiles.settings = {
"klipper" = {
"/srv/printer_data" = {
d = {
group = "klipper";
mode = "0755";
user = "klipper";
};
};
};
};
services.mainsail.enable = true;
#services.fluidd.enable = true;
systemd.services.klipper.serviceConfig = {
ReadWritePaths = [
"/srv/printer_data"
];
};
services.klipper = {
configFile = "/srv/printer_data/config/printer.cfg";
enable = true;
configDir = "/srv/printer_data/config";
mutableConfig = true;
};
services.moonraker = {
enable = true;
user = "klipper";
stateDir = "/srv/printer_data";
settings = {
authorization = {
trusted_clients = [
"127.0.0.1"
"::1"
"10.0.0.0/8"
"192.168.0.0/16"
"172.16.0.0/12"
"fe80::/10"
];
cors_domains = [
"http://*.lan"
"http://*.local"
"https://*.local"
"https://*.lan"
"https://my.mainsail.xyz"
"http://my.mainsail.xyz"
"https://app.fluidd.xyz"
"http://app.fluidd.xyz"
];
};
};
};
This configuration, similarly to KIAUH, sets up a printer_data directory at /srv/printer_data. Copy your printer.cfg into /srv/printer_data/config.
Klipper can also be configured declaratively:
services.klipper = {
enable = true;
mutableConfig = false;
settings = {
mcu = {
baud = 250000;
};
};
};
Webcam
Ustreamer can be configured for access to a webcam in Mainsail or Fluidd. Below is an example configuration of a 720p webcam.
services.ustreamer = {
enable = true;
autoStart = true;
device = "/dev/v4l/by-id/YOUR_DEVICE_HERE";
extraArgs = [
"-r 1280x720"
"--encoder=HW"
"--persistent"
];
listenAddress = "0.0.0.0:8080";
};
The stream URL for your webcam will be http://<YOUR_IP>:8080/stream. The snapshot URL will be http://<YOUR_IP>:8080/snapshot.
Extensions
Installing extensions
Add the repo with your extension as a flake input:
inputs = {
kiauh = {
url = "github:dw-0/kiauh/master";
flake = false;
};
};
Override klipper's postInstall to add your extensions to extras. The example below install the gcode_shell_command extension:
services.klipper.package = = pkgs.klipper.overrideAttrs ({ postInstall ? "", ... }: {
postInstall = postInstall + ''
chmod +rw $out/lib/klippy -R
cp ${inputs.kiauh}/kiauh/extensions/gcode_shell_cmd/assets/gcode_shell_command.py $out/lib/klipper/extras
'';
});
gcode_shell_command
To run custom scripts with gcode_shell_command, you need to add your programs to the PATH of the Klipper service. You may do so using systemd.services.klipper.path:
systemd.services.klipper.path = [pkgs.<YOUR_PACKAGE> pkgs.<YOUR_SECOND_PACKAGE>];