From f7050cc88c479dc137f7b5c02f5012488ca02352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 9 Apr 2023 02:05:58 +0200 Subject: [PATCH 1/6] octoprint.plugins: use callPackage --- pkgs/applications/misc/octoprint/default.nix | 3 ++- pkgs/applications/misc/octoprint/plugins.nix | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/misc/octoprint/default.nix b/pkgs/applications/misc/octoprint/default.nix index 4c740852f6af..40bf9884f705 100644 --- a/pkgs/applications/misc/octoprint/default.nix +++ b/pkgs/applications/misc/octoprint/default.nix @@ -1,5 +1,6 @@ { pkgs , stdenv +, callPackage , lib , fetchFromGitHub , python3 @@ -258,7 +259,7 @@ let }; } ) - (import ./plugins.nix { inherit pkgs; }) + (callPackage ./plugins.nix { }) packageOverrides ] ); diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix index 822f2c13cbea..3f994dbe459e 100644 --- a/pkgs/applications/misc/octoprint/plugins.nix +++ b/pkgs/applications/misc/octoprint/plugins.nix @@ -1,6 +1,8 @@ -{ pkgs }: - -with pkgs; +{ lib +, fetchFromGitHub +, fetchFromGitLab +, marlin-calc +}: self: super: let @@ -246,7 +248,7 @@ in preConfigure = '' # PrintTimeGenius ships with marlin-calc binaries for multiple architectures rm */analyzers/marlin-calc* - sed 's@"{}.{}".format(binary_base_name, machine)@"${pkgs.marlin-calc}/bin/marlin-calc"@' -i */analyzers/analyze_progress.py + sed 's@"{}.{}".format(binary_base_name, machine)@"${marlin-calc}/bin/marlin-calc"@' -i */analyzers/analyze_progress.py ''; meta = with lib; { From b598fea8d26e5ab4b7c6c6df0d8877a8605c0339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 9 Apr 2023 02:06:17 +0200 Subject: [PATCH 2/6] octoprint.tests.plugins.abl-expert: use fetchFromGitLab --- pkgs/applications/misc/octoprint/plugins.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix index 3f994dbe459e..913f01386549 100644 --- a/pkgs/applications/misc/octoprint/plugins.nix +++ b/pkgs/applications/misc/octoprint/plugins.nix @@ -40,8 +40,10 @@ in pname = "ABL_Expert"; version = "0.6"; - src = fetchgit { - url = "https://framagit.org/razer/Octoprint_ABL_Expert/"; + src = fetchFromGitLab { + domain = "framagit.org"; + owner = "razer"; + repo = "Octoprint_ABL_Expert"; rev = version; sha256 = "0ij3rvdwya1sbymwm5swlh2j4jagb6fal945g88zrzh5xf26hzjh"; }; From d779fd8706dc7512730ddca4f4927c51e566f634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 9 Apr 2023 02:09:18 +0200 Subject: [PATCH 3/6] octoprint.plugins.themeify: fix hash --- pkgs/applications/misc/octoprint/plugins.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix index 913f01386549..a58e37620797 100644 --- a/pkgs/applications/misc/octoprint/plugins.nix +++ b/pkgs/applications/misc/octoprint/plugins.nix @@ -356,7 +356,7 @@ in owner = "Birkbjo"; repo = "Octoprint-${pname}"; rev = "v${version}"; - sha256 = "0j1qs6kyh947npdy7pqda25fjkqinpas3sy0qyscqlxi558lhvx2"; + sha256 = "sha256-om9IUSmxU8y0x8DrodW1EU/pilAN3+PbtYck6KfROEg="; }; meta = with lib; { From d89fe68254e49401d8b7ae490c35a4158998f864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 9 Apr 2023 02:10:02 +0200 Subject: [PATCH 4/6] octoprint.plugins.octolabse: 0.4.1 -> 0.4.2, mark broken --- pkgs/applications/misc/octoprint/plugins.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix index a58e37620797..fae093647a20 100644 --- a/pkgs/applications/misc/octoprint/plugins.nix +++ b/pkgs/applications/misc/octoprint/plugins.nix @@ -1,6 +1,7 @@ { lib , fetchFromGitHub , fetchFromGitLab +, fetchpatch , marlin-calc }: @@ -426,25 +427,36 @@ in octolapse = buildPlugin rec { pname = "Octolapse"; - version = "0.4.1"; + version = "0.4.2"; src = fetchFromGitHub { owner = "FormerLurker"; repo = pname; rev = "v${version}"; - sha256 = "13q20g7brabplc198jh67lk65rn140r8217iak9b2jy3in8fggv4"; + sha256 = "sha256-QP6PkKWKUv4uIaYdqTAsZmK7DVes94Q9K/DrBYrWxzY="; }; + patches = [ + # fix version constraint + # https://github.com/FormerLurker/Octolapse/pull/894 + (fetchpatch { + url = "https://github.com/FormerLurker/Octolapse/commit/0bd7db2430aef370f2665c6c7011fc3bb559122e.patch"; + hash = "sha256-z2aEq5sJGarGtIDbTRCvXdSj+kq8HIVvLRWpKutmJNY="; + }) + ]; + # Test fails due to code executed on import, see #136513 #pythonImportsCheck = [ "octoprint_octolapse" ]; - propagatedBuildInputs = with super; [ awesome-slugify setuptools pillow sarge six psutil file-read-backwards ]; + propagatedBuildInputs = with super; [ awesome-slugify setuptools pillow sarge six pillow psutil file-read-backwards ]; meta = with lib; { description = "Stabilized timelapses for Octoprint"; homepage = "https://github.com/FormerLurker/OctoLapse"; license = licenses.agpl3Plus; maintainers = with maintainers; [ illustris j0hax ]; + # requires pillow >=6.2.0,<7.0.0 + broken = true; }; }; From d6e64781367b1149bf8e14f670725f5991b17e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 9 Apr 2023 02:18:13 +0200 Subject: [PATCH 5/6] octoprint: normalize pnames and attrs --- pkgs/applications/misc/octoprint/plugins.nix | 83 ++++++++++---------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix index fae093647a20..b80bf1c09569 100644 --- a/pkgs/applications/misc/octoprint/plugins.nix +++ b/pkgs/applications/misc/octoprint/plugins.nix @@ -1,4 +1,5 @@ { lib +, config , fetchFromGitHub , fetchFromGitLab , fetchpatch @@ -8,7 +9,7 @@ self: super: let buildPlugin = args: self.buildPythonPackage (args // { - pname = "OctoPrintPlugin-${args.pname}"; + pname = "octoprint-plugin-${args.pname}"; inherit (args) version; propagatedBuildInputs = (args.propagatedBuildInputs or [ ]) ++ [ super.octoprint ]; # none of the following have tests @@ -19,7 +20,7 @@ in inherit buildPlugin; m86motorsoff = buildPlugin rec { - pname = "M84MotorsOff"; + pname = "m84motorsoff"; version = "0.1.0"; src = fetchFromGitHub { @@ -38,7 +39,7 @@ in }; abl-expert = buildPlugin rec { - pname = "ABL_Expert"; + pname = "abl-expert"; version = "0.6"; src = fetchFromGitLab { @@ -58,12 +59,12 @@ in }; bedlevelvisualizer = buildPlugin rec { - pname = "BedLevelVisualizer"; + pname = "bedlevelvisualizer"; version = "1.1.0"; src = fetchFromGitHub { owner = "jneilliii"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-BedLevelVisualizer"; rev = version; sha256 = "sha256-SKrhtTGyDuvbDmUCXSx83Y+C83ZzVHA78TwMYwE6tcc="; }; @@ -79,12 +80,12 @@ in }; costestimation = buildPlugin rec { - pname = "CostEstimation"; + pname = "costestimation"; version = "3.4.0"; src = fetchFromGitHub { owner = "OllisGit"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-CostEstimation"; rev = version; sha256 = "sha256-04OPa/RpM8WehUmOp195ocsAjAvKdVY7iD5ybzQO7Dg="; }; @@ -98,12 +99,12 @@ in }; curaenginelegacy = buildPlugin rec { - pname = "CuraEngineLegacy"; + pname = "curaenginelegacy"; version = "1.1.2"; src = fetchFromGitHub { owner = "OctoPrint"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-CuraEngineLegacy"; rev = version; sha256 = "sha256-54siSmzgPlnCRpkpZhXU9theNQ3hqL3j+Ip4Ie2w2vA="; }; @@ -117,12 +118,12 @@ in }; displayprogress = buildPlugin rec { - pname = "DisplayProgress"; + pname = "displayprogress"; version = "0.1.3"; src = fetchFromGitHub { owner = "OctoPrint"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-DisplayProgress"; rev = version; sha256 = "080prvfwggl4vkzyi369vxh1n8231hrl8a44f399laqah3dn5qw4"; }; @@ -136,12 +137,12 @@ in }; displaylayerprogress = buildPlugin rec { - pname = "OctoPrint-DisplayLayerProgress"; + pname = "displaylayerprogress"; version = "1.26.0"; src = fetchFromGitHub { owner = "OllisGit"; - repo = pname; + repo = "OctoPrint-DisplayLayerProgress"; rev = version; sha256 = "sha256-hhHc2SPixZCPJzCP8enMMWNYaYbNZAU0lNSx1B0d++4="; }; @@ -154,8 +155,8 @@ in }; }; - ender3v2tempfix = buildPlugin rec { - pname = "OctoPrintPlugin-ender3v2tempfix"; + ender3v2tempfix = buildPlugin { + pname = "ender3v2tempfix"; version = "unstable-2021-04-27"; src = fetchFromGitHub { @@ -174,12 +175,12 @@ in }; gcodeeditor = buildPlugin rec { - pname = "GcodeEditor"; + pname = "gcodeeditor"; version = "0.2.12"; src = fetchFromGitHub { owner = "ieatacid"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-GcodeEditor"; rev = version; sha256 = "sha256-1Sk2ri3DKW8q8VJ/scFjpRsz65Pwt8OEURP1k70aydE="; }; @@ -193,12 +194,12 @@ in }; marlingcodedocumentation = buildPlugin rec { - pname = "MarlinGcodeDocumentation"; + pname = "marlingcodedocumentation"; version = "0.13.0"; src = fetchFromGitHub { owner = "costas-basdekis"; - repo = pname; + repo = "MarlinGcodeDocumentation"; rev = "v${version}"; sha256 = "sha256-3ay6iCxZk8QkFM/2Y14VTpPoxr6NXq14BFSHofn3q7I="; }; @@ -212,7 +213,7 @@ in }; mqtt = buildPlugin rec { - pname = "MQTT"; + pname = "mqtt"; version = "0.8.10"; src = fetchFromGitHub { @@ -233,12 +234,12 @@ in }; printtimegenius = buildPlugin rec { - pname = "PrintTimeGenius"; + pname = "printtimegenius"; version = "2.2.8"; src = fetchFromGitHub { owner = "eyal0"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-PrintTimeGenius"; rev = version; sha256 = "sha256-Bbpm7y4flzEbUb6Sgkp6hIIHs455A0IsbmzvZwlkbh0="; }; @@ -263,12 +264,12 @@ in }; psucontrol = buildPlugin rec { - pname = "PSUControl"; + pname = "psucontrol"; version = "1.0.6"; src = fetchFromGitHub { owner = "kantlivelong"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-PSUControl"; rev = version; sha256 = "sha256-S+lPm85+ZEO/3BXYsrxE4FU29EGWzWrSw3y1DLdByrM="; }; @@ -291,12 +292,12 @@ in }; simpleemergencystop = buildPlugin rec { - pname = "SimpleEmergencyStop"; + pname = "simpleemergencystop"; version = "1.0.5"; src = fetchFromGitHub { owner = "Sebclem"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-SimpleEmergencyStop"; rev = version; sha256 = "sha256-MbP3cKa9FPElQ/M8ykYh9kVXl8hNvmGiCHDvjgWvm9k="; }; @@ -310,7 +311,7 @@ in }; stlviewer = buildPlugin rec { - pname = "STLViewer"; + pname = "stlviewer"; version = "0.4.2"; src = fetchFromGitHub { @@ -329,12 +330,12 @@ in }; telegram = buildPlugin rec { - pname = "Telegram"; + pname = "telegram"; version = "1.6.5"; src = fetchFromGitHub { owner = "fabianonline"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-Telegram"; rev = version; sha256 = "sha256-SckJCbPNCflgGYLHFiXy0juCtpvo8YS1BQsFpc1f5rg="; }; @@ -350,12 +351,12 @@ in }; themeify = buildPlugin rec { - pname = "Themeify"; + pname = "themeify"; version = "1.2.2"; src = fetchFromGitHub { owner = "Birkbjo"; - repo = "Octoprint-${pname}"; + repo = "Octoprint-Themeify"; rev = "v${version}"; sha256 = "sha256-om9IUSmxU8y0x8DrodW1EU/pilAN3+PbtYck6KfROEg="; }; @@ -369,7 +370,7 @@ in }; titlestatus = buildPlugin rec { - pname = "TitleStatus"; + pname = "titlestatus"; version = "0.0.5"; src = fetchFromGitHub { @@ -388,12 +389,12 @@ in }; touchui = buildPlugin rec { - pname = "TouchUI"; + pname = "touchui"; version = "0.3.18"; src = fetchFromGitHub { owner = "BillyBlaze"; - repo = "OctoPrint-${pname}"; + repo = "OctoPrint-TouchUI"; rev = version; sha256 = "sha256-PNDCjY7FhfnwK7Nd86el9ZQ00G4uMANH2Sk080iMYXw="; }; @@ -407,7 +408,7 @@ in }; octoklipper = buildPlugin rec { - pname = "OctoKlipper"; + pname = "octoklipper"; version = "0.3.8.3"; src = fetchFromGitHub { @@ -426,12 +427,12 @@ in }; octolapse = buildPlugin rec { - pname = "Octolapse"; + pname = "octolapse"; version = "0.4.2"; src = fetchFromGitHub { owner = "FormerLurker"; - repo = pname; + repo = "Octolapse"; rev = "v${version}"; sha256 = "sha256-QP6PkKWKUv4uIaYdqTAsZmK7DVes94Q9K/DrBYrWxzY="; }; @@ -460,13 +461,13 @@ in }; }; - octoprint-dashboard = buildPlugin rec { - pname = "OctoPrint-Dashboard"; + dashboard = buildPlugin rec { + pname = "dashboard"; version = "1.18.3"; src = fetchFromGitHub { owner = "StefanCohen"; - repo = pname; + repo = "OctoPrint-Dashboard"; rev = version; sha256 = "sha256-hLHT3Uze/6PlOCEICVZ2ieFTyXgcqCvgHOlIIEquujg="; }; @@ -478,4 +479,6 @@ in maintainers = with maintainers; [ j0hax ]; }; }; +} // lib.optionalAttrs config.allowAliases { + octoprint-dashboard = self.dashboard; } From 86526d707acef0d854d4f35dcd9b0b2b4dbbb8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 9 Apr 2023 02:18:22 +0200 Subject: [PATCH 6/6] octoprint: test plugins with ofborg --- pkgs/applications/misc/octoprint/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/misc/octoprint/default.nix b/pkgs/applications/misc/octoprint/default.nix index 40bf9884f705..e3c67137243b 100644 --- a/pkgs/applications/misc/octoprint/default.nix +++ b/pkgs/applications/misc/octoprint/default.nix @@ -243,9 +243,10 @@ let ]; passthru = { - python = self.python; + inherit (self) python; updateScript = nix-update-script { }; tests = { + plugins = (callPackage ./plugins.nix { }) super self; inherit (nixosTests) octoprint; }; };