nixos/klipper: Allow overriding the Klipper package

This commit is contained in:
Zhaofeng Li
2021-07-19 02:30:25 -07:00
parent 94536fd6e3
commit 11313bc65d
+8 -3
View File
@@ -2,7 +2,6 @@
with lib;
let
cfg = config.services.klipper;
package = pkgs.klipper;
format = pkgs.formats.ini { mkKeyValue = generators.mkKeyValueDefault {} ":"; };
in
{
@@ -11,6 +10,12 @@ in
services.klipper = {
enable = mkEnableOption "Klipper, the 3D printer firmware";
package = mkOption {
type = types.package;
default = pkgs.klipper;
description = "The Klipper package.";
};
octoprintIntegration = mkOption {
type = types.bool;
default = false;
@@ -74,10 +79,10 @@ in
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${package}/lib/klipper/klippy.py --input-tty=/run/klipper/tty /etc/klipper.cfg";
ExecStart = "${cfg.package}/lib/klipper/klippy.py --input-tty=/run/klipper/tty /etc/klipper.cfg";
RuntimeDirectory = "klipper";
SupplementaryGroups = [ "dialout" ];
WorkingDirectory = "${package}/lib";
WorkingDirectory = "${cfg.package}/lib";
} // (if cfg.user != null then {
Group = cfg.group;
User = cfg.user;