Merge pull request #82392 from FRidh/octoprint

This commit is contained in:
Gabriel Ebner 2020-05-03 12:11:26 +02:00 committed by GitHub
commit e5c8002bd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 331 additions and 321 deletions

View File

@ -17,9 +17,9 @@ let
cfgUpdate = pkgs.writeText "octoprint-config.yaml" (builtins.toJSON fullConfig);
pluginsEnv = pkgs.python.buildEnv.override {
extraLibs = cfg.plugins pkgs.octoprint-plugins;
};
pluginsEnv = package.python.withPackages (ps: [ps.octoprint] ++ (cfg.plugins ps));
package = pkgs.octoprint;
in
{
@ -106,7 +106,6 @@ in
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
path = [ pluginsEnv ];
environment.PYTHONPATH = makeSearchPathOutput "lib" pkgs.python.sitePackages [ pluginsEnv ];
preStart = ''
if [ -e "${cfg.stateDir}/config.yaml" ]; then
@ -119,7 +118,7 @@ in
'';
serviceConfig = {
ExecStart = "${pkgs.octoprint}/bin/octoprint serve -b ${cfg.stateDir}";
ExecStart = "${pluginsEnv}/bin/octoprint serve -b ${cfg.stateDir}";
User = cfg.user;
Group = cfg.group;
};

View File

@ -1,5 +1,7 @@
{ stdenv, lib, fetchFromGitHub, python2 }:
{ pkgs, stdenv, lib, fetchFromGitHub, python3
# To include additional plugins, pass them here as an overlay.
, packageOverrides ? self: super: {}
}:
let
mkOverride = attrname: version: sha256:
self: super: {
@ -11,17 +13,19 @@ let
});
};
py = python2.override {
py = python3.override {
self = py;
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([
(mkOverride "flask" "0.10.1" "0wrkavjdjndknhp8ya8j850jq7a1cli4g5a93mg8nh1xz2gq50sc")
(mkOverride "flask_login" "0.2.11" "1rg3rsjs1gwi2pw6vr9jmhaqm9b3vc9c4hfcsvp4y8agbh7g3mc3")
(mkOverride "flask" "0.12.5" "fac2b9d443e49f7e7358a444a3db5950bdd0324674d92ba67f8f1f15f876b14f")
(mkOverride "flaskbabel" "0.12.2" "11jwp8vvq1gnm31qh6ihy2h393hy18yn9yjp569g60r0wj1x2sii")
(mkOverride "tornado" "4.5.3" "02jzd23l4r6fswmwxaica9ldlyc2p6q8dk6dyff7j58fmdzf853d")
(mkOverride "psutil" "5.6.7" "ffad8eb2ac614518bbe3c0b8eb9dffdb3a8d2e3a7d5da51c5b974fb723a5c5aa")
# Octoprint holds back jinja2 to 2.8.1 due to breaking changes.
# This old version does not have updated test config for pytest 4,
# and pypi tarball doesn't contain tests dir anyways.
(pself: psuper: {
jinja2 = psuper.jinja2.overridePythonAttrs (oldAttrs: rec {
(self: super: {
jinja2 = super.jinja2.overridePythonAttrs (oldAttrs: rec {
version = "2.8.1";
src = oldAttrs.src.override {
inherit version;
@ -29,74 +33,75 @@ let
};
doCheck = false;
});
httpretty = super.httpretty.overridePythonAttrs (oldAttrs: rec {
doCheck = false;
});
celery = super.celery.overridePythonAttrs (oldAttrs: rec {
doCheck = false;
});
})
(self: super: {
octoprint = self.buildPythonPackage rec {
pname = "OctoPrint";
version = "1.4.0";
src = fetchFromGitHub {
owner = "foosel";
repo = "OctoPrint";
rev = version;
sha256 = "0387228544v28d69dcdg2zr5gp6qavkfr6dydpjgj5awxv3w25d5";
};
propagatedBuildInputs = with super; [
awesome-slugify flask flask_assets rsa requests pkginfo watchdog
semantic-version werkzeug flaskbabel tornado
psutil pyserial flask_login netaddr markdown
pylru pyyaml sarge feedparser netifaces click websocket_client
scandir chainmap future wrapt monotonic emoji jinja2
frozendict cachelib sentry-sdk filetype markupsafe
] ++ lib.optionals stdenv.isDarwin [ py.pkgs.appdirs ];
checkInputs = with super; [ pytestCheckHook mock ddt ];
postPatch = let
ignoreVersionConstraints = [
"sentry-sdk"
];
in ''
sed -r -i \
${lib.concatStringsSep "\n" (map (e:
''-e 's@${e}[<>=]+.*@${e}",@g' \''
) ignoreVersionConstraints)}
setup.py
'';
dontUseSetuptoolsCheck = true;
preCheck = ''
export HOME=$(mktemp -d)
rm pytest.ini
'';
disabledTests = [
"test_check_setup" # Why should it be able to call pip?
] ++ lib.optionals stdenv.isDarwin [
"test_set_external_modification"
];
passthru.python = self.python;
meta = with stdenv.lib; {
homepage = "https://octoprint.org/";
description = "The snappy web interface for your 3D printer";
license = licenses.agpl3;
maintainers = with maintainers; [ abbradar gebner WhittlesJr ];
};
};
})
(import ./plugins.nix {inherit pkgs;})
packageOverrides
]);
};
ignoreVersionConstraints = [
"Click"
"Flask-Assets"
"Flask-Babel"
"Flask-Principal"
"emoji"
"flask"
"future"
"futures"
"monotonic"
"markdown"
"pkginfo"
"psutil"
"pyserial"
"requests"
"rsa"
"sarge"
"scandir"
"semantic_version"
"watchdog"
"websocket-client"
"wrapt"
"sentry-sdk"
"werkzeug" # 0.16 just deprecates some stuff
];
in py.pkgs.buildPythonApplication rec {
pname = "OctoPrint";
version = "1.3.12";
src = fetchFromGitHub {
owner = "foosel";
repo = "OctoPrint";
rev = version;
sha256 = "1lmqssgwjyhknjf3x58g7cr0fqz7fs5a3rl07r69wfpch63ranyd";
};
propagatedBuildInputs = with py.pkgs; [
awesome-slugify flask_assets rsa requests pkginfo watchdog
semantic-version flask_principal werkzeug flaskbabel tornado
psutil pyserial flask_login netaddr markdown sockjs-tornado
pylru pyyaml sarge feedparser netifaces click websocket_client
scandir chainmap future futures wrapt monotonic emoji
frozendict cachelib sentry-sdk typing filetype
] ++ lib.optionals stdenv.isDarwin [ py.pkgs.appdirs ];
checkInputs = with py.pkgs; [ nose mock ddt ];
postPatch = ''
sed -r -i \
${lib.concatStringsSep "\n" (map (e:
''-e 's@${e}[<>=]+.*@${e}",@g' \''
) ignoreVersionConstraints)}
setup.py
'';
checkPhase = ''
HOME=$(mktemp -d) nosetests ${lib.optionalString stdenv.isDarwin "--exclude=test_set_external_modification"}
'';
meta = with stdenv.lib; {
homepage = "https://octoprint.org/";
description = "The snappy web interface for your 3D printer";
license = licenses.agpl3;
maintainers = with maintainers; [ abbradar gebner ];
};
}
in with py.pkgs; toPythonApplication octoprint

View File

@ -1,255 +1,255 @@
{ stdenv, fetchgit, fetchFromGitHub, octoprint, python2Packages, marlin-calc }:
{ pkgs }:
let
buildPlugin = args: python2Packages.buildPythonPackage (args // {
with pkgs;
self: super: let
buildPlugin = args: self.buildPythonPackage (args // {
pname = "OctoPrintPlugin-${args.pname}";
inherit (args) version;
propagatedBuildInputs = (args.propagatedBuildInputs or []) ++ [ octoprint ];
propagatedBuildInputs = (args.propagatedBuildInputs or []) ++ [ super.octoprint ];
# none of the following have tests
doCheck = false;
});
in {
inherit buildPlugin;
self = {
# Deprecated alias
m3d-fio = self.m33-fio; # added 2016-08-13
# Deprecated alias
m3d-fio = self.m33-fio; # added 2016-08-13
m33-fio = buildPlugin rec {
pname = "M33-Fio";
version = "1.21";
m33-fio = buildPlugin rec {
pname = "M33-Fio";
version = "1.21";
src = fetchFromGitHub {
owner = "donovan6000";
repo = "M33-Fio";
rev = "V${version}";
sha256 = "1la3611kkqn8yiwjn6cizc45ri8pnk6ckld1na4nk6mqk88jvjq7";
};
patches = [
./m33-fio-one-library.patch
];
postPatch = ''
rm -rf octoprint_m33fio/static/libraries/*
(
cd 'shared library source'
make
)
'';
meta = with stdenv.lib; {
description = "OctoPrint plugin for the Micro 3D printer";
homepage = "https://github.com/donovan6000/M33-Fio";
license = licenses.gpl3;
maintainers = with maintainers; [ abbradar ];
};
src = fetchFromGitHub {
owner = "donovan6000";
repo = "M33-Fio";
rev = "V${version}";
sha256 = "1la3611kkqn8yiwjn6cizc45ri8pnk6ckld1na4nk6mqk88jvjq7";
};
mqtt = buildPlugin rec {
pname = "MQTT";
version = "0.8.6";
patches = [
./m33-fio-one-library.patch
];
src = fetchFromGitHub {
owner = "OctoPrint";
repo = "OctoPrint-MQTT";
rev = version;
sha256 = "0y1jnfplcy8mh3szrfbbvngl02j49cbdizglrfsry4fvqg50zjxd";
};
postPatch = ''
rm -rf octoprint_m33fio/static/libraries/*
(
cd 'shared library source'
make
)
'';
propagatedBuildInputs = with python2Packages; [ paho-mqtt ];
meta = with stdenv.lib; {
description = "Publish printer status MQTT";
homepage = "https://github.com/OctoPrint/OctoPrint-MQTT";
license = licenses.agpl3;
maintainers = with maintainers; [ peterhoeg ];
};
};
titlestatus = buildPlugin rec {
pname = "TitleStatus";
version = "0.0.4";
src = fetchFromGitHub {
owner = "MoonshineSG";
repo = "OctoPrint-TitleStatus";
rev = version;
sha256 = "1l78xrabn5hcly2mgxwi17nwgnp2s6jxi9iy4wnw8k8icv74ag7k";
};
meta = with stdenv.lib; {
description = "Show printers status in window title";
homepage = "https://github.com/MoonshineSG/OctoPrint-TitleStatus";
license = licenses.agpl3;
maintainers = with maintainers; [ abbradar ];
};
};
stlviewer = buildPlugin rec {
pname = "STLViewer";
version = "0.4.2";
src = fetchFromGitHub {
owner = "jneilliii";
repo = "OctoPrint-STLViewer";
rev = version;
sha256 = "0mkvh44fn2ch4z2avsdjwi1rp353ylmk9j5fln4x7rx8ph8y7g2b";
};
meta = with stdenv.lib; {
description = "A simple stl viewer tab for OctoPrint";
homepage = "https://github.com/jneilliii/Octoprint-STLViewer";
license = licenses.agpl3;
maintainers = with maintainers; [ abbradar ];
};
};
curaenginelegacy = buildPlugin rec {
pname = "CuraEngineLegacy";
version = "1.0.2";
src = fetchFromGitHub {
owner = "OctoPrint";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "1cdb276wfyf3wcfj5g3migd6b6aqmkrxncrqjfcfx4j4k3xac965";
};
meta = with stdenv.lib; {
description = "Plugin for slicing via Cura Legacy from within OctoPrint";
homepage = "https://github.com/OctoPrint/OctoPrint-CuraEngineLegacy";
license = licenses.agpl3;
maintainers = with maintainers; [ gebner ];
};
};
touchui = buildPlugin rec {
pname = "TouchUI";
version = "0.3.13";
src = fetchFromGitHub {
owner = "BillyBlaze";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "0qk12ysabdzy6cna3l4f8v3qcnppppwxxsjx2i0xn1nd0cv6yzwh";
};
meta = with stdenv.lib; {
description = "Touch friendly interface for a small TFT module or phone for OctoPrint";
homepage = "https://github.com/BillyBlaze/OctoPrint-TouchUI";
license = licenses.agpl3;
maintainers = with maintainers; [ gebner ];
};
};
psucontrol = buildPlugin rec {
pname = "PSUControl";
version = "0.1.8";
src = fetchFromGitHub {
owner = "kantlivelong";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "0aj38d7b7d5pzmzq841pip18cpg18wy2vrxq2nd13875597y54b8";
};
preConfigure = ''
# optional; RPi.GPIO is broken on vanilla kernels
sed /RPi.GPIO/d -i requirements.txt
'';
meta = with stdenv.lib; {
description = "OctoPrint plugin to control ATX/AUX power supply";
homepage = "https://github.com/kantlivelong/OctoPrint-PSUControl";
license = licenses.agpl3;
maintainers = with maintainers; [ gebner ];
};
};
printtimegenius = buildPlugin rec {
pname = "PrintTimeGenius";
version = "2.2.1";
src = fetchFromGitHub {
owner = "eyal0";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "1dr93vbpxgxw3b1q4rwam8f4dmiwr5vnfr9796g6jx8xkpfzzy1h";
};
preConfigure = ''
# PrintTimeGenius ships with marlin-calc binaries for multiple architectures
rm */analyzers/marlin-calc*
sed 's@"{}.{}".format(binary_base_name, machine)@"${marlin-calc}/bin/marlin-calc"@' -i */analyzers/analyze_progress.py
'';
patches = [
./printtimegenius-logging.patch
];
meta = with stdenv.lib; {
description = "Better print time estimation for OctoPrint";
homepage = "https://github.com/eyal0/OctoPrint-PrintTimeGenius";
license = licenses.agpl3;
maintainers = with maintainers; [ gebner ];
};
};
abl-expert = buildPlugin rec {
pname = "ABL_Expert";
version = "2019-12-21";
src = fetchgit {
url = "https://framagit.org/razer/Octoprint_ABL_Expert/";
rev = "f11fbe05088ad618bfd9d064ac3881faec223f33";
sha256 = "026r4prkyvwzxag5pv36455q7s3gaig37nmr2nbvhwq3d2lbi5s4";
};
meta = with stdenv.lib; {
description = "Marlin auto bed leveling control, mesh correction, and z probe handling";
homepage = "https://framagit.org/razer/Octoprint_ABL_Expert/";
license = licenses.agpl3;
maintainers = with maintainers; [ WhittlesJr ];
};
};
gcodeeditor = buildPlugin rec {
pname = "GcodeEditor";
version = "0.2.6";
src = fetchFromGitHub {
owner = "ieatacid";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "0c6p78r3vd6ys3kld308pyln09zjbr9yif1ljvcx6wlml2i5l1vh";
};
meta = with stdenv.lib; {
description = "Edit gcode on OctoPrint";
homepage = "https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop";
license = licenses.agpl3;
maintainers = with maintainers; [ WhittlesJr ];
};
};
simpleemergencystop = buildPlugin rec {
pname = "SimpleEmergencyStop";
version = "0.2.5";
src = fetchFromGitHub {
owner = "Sebclem";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "10wadv09wv2h96igvq3byw9hz1si82n3c7v5y0ii3j7hm2d06y8p";
};
meta = with stdenv.lib; {
description = "A simple plugin that add an emergency stop buton on NavBar of OctoPrint";
homepage = "https://github.com/ieatacid/OctoPrint-GcodeEditor";
license = licenses.agpl3;
maintainers = with maintainers; [ WhittlesJr ];
};
meta = with stdenv.lib; {
description = "OctoPrint plugin for the Micro 3D printer";
homepage = "https://github.com/donovan6000/M33-Fio";
license = licenses.gpl3;
maintainers = with maintainers; [ abbradar ];
};
};
in self
mqtt = buildPlugin rec {
pname = "MQTT";
version = "0.8.6";
src = fetchFromGitHub {
owner = "OctoPrint";
repo = "OctoPrint-MQTT";
rev = version;
sha256 = "0y1jnfplcy8mh3szrfbbvngl02j49cbdizglrfsry4fvqg50zjxd";
};
propagatedBuildInputs = with super; [ paho-mqtt ];
meta = with stdenv.lib; {
description = "Publish printer status MQTT";
homepage = "https://github.com/OctoPrint/OctoPrint-MQTT";
license = licenses.agpl3;
maintainers = with maintainers; [ peterhoeg ];
};
};
titlestatus = buildPlugin rec {
pname = "TitleStatus";
version = "0.0.4";
src = fetchFromGitHub {
owner = "MoonshineSG";
repo = "OctoPrint-TitleStatus";
rev = version;
sha256 = "1l78xrabn5hcly2mgxwi17nwgnp2s6jxi9iy4wnw8k8icv74ag7k";
};
meta = with stdenv.lib; {
description = "Show printers status in window title";
homepage = "https://github.com/MoonshineSG/OctoPrint-TitleStatus";
license = licenses.agpl3;
maintainers = with maintainers; [ abbradar ];
};
};
stlviewer = buildPlugin rec {
pname = "STLViewer";
version = "0.4.2";
src = fetchFromGitHub {
owner = "jneilliii";
repo = "OctoPrint-STLViewer";
rev = version;
sha256 = "0mkvh44fn2ch4z2avsdjwi1rp353ylmk9j5fln4x7rx8ph8y7g2b";
};
meta = with stdenv.lib; {
description = "A simple stl viewer tab for OctoPrint";
homepage = "https://github.com/jneilliii/Octoprint-STLViewer";
license = licenses.agpl3;
maintainers = with maintainers; [ abbradar ];
};
};
curaenginelegacy = buildPlugin rec {
pname = "CuraEngineLegacy";
version = "1.0.2";
src = fetchFromGitHub {
owner = "OctoPrint";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "1cdb276wfyf3wcfj5g3migd6b6aqmkrxncrqjfcfx4j4k3xac965";
};
meta = with stdenv.lib; {
description = "Plugin for slicing via Cura Legacy from within OctoPrint";
homepage = "https://github.com/OctoPrint/OctoPrint-CuraEngineLegacy";
license = licenses.agpl3;
maintainers = with maintainers; [ gebner ];
};
};
touchui = buildPlugin rec {
pname = "TouchUI";
version = "0.3.14";
src = fetchFromGitHub {
owner = "BillyBlaze";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "033b9nk3kpnmjw9nggcaxy39hcgfviykcy2cx0j6m411agvmqbzf";
};
meta = with stdenv.lib; {
description = "Touch friendly interface for a small TFT module or phone for OctoPrint";
homepage = "https://github.com/BillyBlaze/OctoPrint-TouchUI";
license = licenses.agpl3;
maintainers = with maintainers; [ gebner ];
};
};
psucontrol = buildPlugin rec {
pname = "PSUControl";
version = "0.1.9";
src = fetchFromGitHub {
owner = "kantlivelong";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "1cn009bdgn6c9ba9an5wfj8z02wi0xcsmbhkqggiqlnqy1fq45ca";
};
preConfigure = ''
# optional; RPi.GPIO is broken on vanilla kernels
sed /RPi.GPIO/d -i requirements.txt
'';
meta = with stdenv.lib; {
description = "OctoPrint plugin to control ATX/AUX power supply";
homepage = "https://github.com/kantlivelong/OctoPrint-PSUControl";
license = licenses.agpl3;
maintainers = with maintainers; [ gebner ];
};
};
printtimegenius = buildPlugin rec {
pname = "PrintTimeGenius";
version = "2.2.1";
src = fetchFromGitHub {
owner = "eyal0";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "1dr93vbpxgxw3b1q4rwam8f4dmiwr5vnfr9796g6jx8xkpfzzy1h";
};
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
'';
patches = [
./printtimegenius-logging.patch
];
meta = with stdenv.lib; {
description = "Better print time estimation for OctoPrint";
homepage = "https://github.com/eyal0/OctoPrint-PrintTimeGenius";
license = licenses.agpl3;
maintainers = with maintainers; [ gebner ];
};
};
abl-expert = buildPlugin rec {
pname = "ABL_Expert";
version = "2019-12-21";
src = fetchgit {
url = "https://framagit.org/razer/Octoprint_ABL_Expert/";
rev = "f11fbe05088ad618bfd9d064ac3881faec223f33";
sha256 = "026r4prkyvwzxag5pv36455q7s3gaig37nmr2nbvhwq3d2lbi5s4";
};
meta = with stdenv.lib; {
description = "Marlin auto bed leveling control, mesh correction, and z probe handling";
homepage = "https://framagit.org/razer/Octoprint_ABL_Expert/";
license = licenses.agpl3;
maintainers = with maintainers; [ WhittlesJr ];
};
};
gcodeeditor = buildPlugin rec {
pname = "GcodeEditor";
version = "0.2.6";
src = fetchFromGitHub {
owner = "ieatacid";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "0c6p78r3vd6ys3kld308pyln09zjbr9yif1ljvcx6wlml2i5l1vh";
};
meta = with stdenv.lib; {
description = "Edit gcode on OctoPrint";
homepage = "https://github.com/ieatacid/OctoPrint-GcodeEditor";
license = licenses.agpl3;
maintainers = with maintainers; [ WhittlesJr ];
};
};
simpleemergencystop = buildPlugin rec {
pname = "SimpleEmergencyStop";
version = "0.2.5";
src = fetchFromGitHub {
owner = "Sebclem";
repo = "OctoPrint-${pname}";
rev = version;
sha256 = "10wadv09wv2h96igvq3byw9hz1si82n3c7v5y0ii3j7hm2d06y8p";
};
meta = with stdenv.lib; {
description = "A simple plugin that add an emergency stop buton on NavBar of OctoPrint";
homepage = "https://github.com/Sebclem/OctoPrint-SimpleEmergencyStop";
license = licenses.agpl3;
maintainers = with maintainers; [ WhittlesJr ];
};
};
}

View File

@ -5,6 +5,8 @@
, pytest
, pytz
, sqlalchemy
, importlib-metadata
, pythonOlder
}:
buildPythonPackage rec {
@ -23,7 +25,11 @@ buildPythonPackage rec {
--replace "amqp==2.5.1" "amqp~=2.5"
'';
propagatedBuildInputs = [ amqp ];
propagatedBuildInputs = [
amqp
] ++ lib.optionals (pythonOlder "3.8") [
importlib-metadata
];
checkInputs = [ pytest case pytz Pyro4 sqlalchemy ];
# test_redis requires fakeredis, which isn't trivial to package

View File

@ -21060,7 +21060,7 @@ in
octoprint = callPackage ../applications/misc/octoprint { };
octoprint-plugins = callPackage ../applications/misc/octoprint/plugins.nix { };
octoprint-plugins = throw ''octoprint-plugins are now part of the octoprint.python.pkgs package set.'';
ocrad = callPackage ../applications/graphics/ocrad { };