about summary refs log tree commit diff
path: root/pkgs/servers/klipper/default.nix
diff options
context:
space:
mode:
authorcab <cab404@mailbox.org>2022-06-27 15:54:03 +0400
committercab <cab404@mailbox.org>2022-06-28 18:48:12 +0400
commit387c727f8d78dca84f7c550452bc4678e8bf2cf2 (patch)
tree1fa29e8f913e55018ea1d3bd48e83f8d61d5ae1d /pkgs/servers/klipper/default.nix
parent8cb1790803ce6c6de4e5215a9073895c63e293ac (diff)
downloadnixlib-387c727f8d78dca84f7c550452bc4678e8bf2cf2.tar
nixlib-387c727f8d78dca84f7c550452bc4678e8bf2cf2.tar.gz
nixlib-387c727f8d78dca84f7c550452bc4678e8bf2cf2.tar.bz2
nixlib-387c727f8d78dca84f7c550452bc4678e8bf2cf2.tar.lz
nixlib-387c727f8d78dca84f7c550452bc4678e8bf2cf2.tar.xz
nixlib-387c727f8d78dca84f7c550452bc4678e8bf2cf2.tar.zst
nixlib-387c727f8d78dca84f7c550452bc4678e8bf2cf2.zip
klippy: 2022-03-14 -> 2022-06-18; drop python2
Diffstat (limited to 'pkgs/servers/klipper/default.nix')
-rw-r--r--pkgs/servers/klipper/default.nix28
1 files changed, 17 insertions, 11 deletions
diff --git a/pkgs/servers/klipper/default.nix b/pkgs/servers/klipper/default.nix
index b882bc589c61..c3f97ce779f9 100644
--- a/pkgs/servers/klipper/default.nix
+++ b/pkgs/servers/klipper/default.nix
@@ -1,32 +1,38 @@
 { stdenv
 , lib
 , fetchFromGitHub
-, python2
+, python3
 , unstableGitUpdater
 }:
 stdenv.mkDerivation rec {
   pname = "klipper";
-  version = "unstable-2022-03-14";
+  version = "unstable-2022-06-18";
 
   src = fetchFromGitHub {
     owner = "KevinOConnor";
     repo = "klipper";
-    rev = "30098db22a43274ceb87e078e603889f403a35c4";
-    sha256 = "sha256-ORpXBFGPY6A/HEYX9Hhwb3wP2KcAE+z3pTxf6j7CwGg=";
+    rev = "d3c4ba4839dd7a4339ae024752e6c6424884c185";
+    sha256 = "sha256-2Fq56JIk5qcKpWffz1k/EJ+xYAnUpuxvCryq88l//8E=";
   };
 
   sourceRoot = "source/klippy";
 
-  # there is currently an attempt at moving it to Python 3, but it will remain
-  # Python 2 for the foreseeable future.
-  # c.f. https://github.com/KevinOConnor/klipper/pull/3278
   # NB: This is needed for the postBuild step
-  nativeBuildInputs = [ (python2.withPackages ( p: with p; [ cffi ] )) ];
+  nativeBuildInputs = [ (python3.withPackages ( p: with p; [ cffi ] )) ];
 
-  buildInputs = [ (python2.withPackages (p: with p; [ cffi pyserial greenlet jinja2 numpy ])) ];
+  buildInputs = [ (python3.withPackages (p: with p; [ cffi pyserial greenlet jinja2 markupsafe ])) ];
 
   # we need to run this to prebuild the chelper.
-  postBuild = "python2 ./chelper/__init__.py";
+  postBuild = "python ./chelper/__init__.py";
+
+  # 2022-06-28: Python 3 is already supported in klipper, alas shebangs remained
+  # the same - we replace them in patchPhase.
+  patchPhase = ''
+    for F in klippy.py console.py parsedump.py; do
+      substituteInPlace $F \
+        --replace '/usr/bin/env python2' '/usr/bin/env python'
+    done
+  '';
 
   # NB: We don't move the main entry point into `/bin`, or even symlink it,
   # because it uses relative paths to find necessary modules. We could wrap but
@@ -50,7 +56,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "The Klipper 3D printer firmware";
     homepage = "https://github.com/KevinOConnor/klipper";
-    maintainers = with maintainers; [ lovesegfault zhaofengli ];
+    maintainers = with maintainers; [ lovesegfault zhaofengli cab404 ];
     platforms = platforms.linux;
     license = licenses.gpl3Only;
   };