summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorZhaofeng Li <hello@zhaofeng.li>2021-07-18 21:34:45 -0700
committerZhaofeng Li <hello@zhaofeng.li>2021-07-19 02:30:25 -0700
commit11313bc65d5c7d15089caf7cef8ecfd037353639 (patch)
tree455d707e885916edc943e547470b8681fab6818f /nixos
parent94536fd6e33afaedab5ddfc36831cfc1c5b87508 (diff)
downloadnixpkgs-11313bc65d5c7d15089caf7cef8ecfd037353639.tar
nixpkgs-11313bc65d5c7d15089caf7cef8ecfd037353639.tar.gz
nixpkgs-11313bc65d5c7d15089caf7cef8ecfd037353639.tar.bz2
nixpkgs-11313bc65d5c7d15089caf7cef8ecfd037353639.tar.lz
nixpkgs-11313bc65d5c7d15089caf7cef8ecfd037353639.tar.xz
nixpkgs-11313bc65d5c7d15089caf7cef8ecfd037353639.tar.zst
nixpkgs-11313bc65d5c7d15089caf7cef8ecfd037353639.zip
nixos/klipper: Allow overriding the Klipper package
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/klipper.nix11
1 files changed, 8 insertions, 3 deletions
diff --git a/nixos/modules/services/misc/klipper.nix b/nixos/modules/services/misc/klipper.nix
index df5b527a069..41f77da3548 100644
--- a/nixos/modules/services/misc/klipper.nix
+++ b/nixos/modules/services/misc/klipper.nix
@@ -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;