nixpkgs/pkgs/applications/misc/octoprint/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

236 lines
6.6 KiB
Nix
Raw Normal View History

2020-08-25 21:29:31 +00:00
{ pkgs
, stdenv
2023-04-09 00:05:58 +00:00
, callPackage
2020-08-25 21:29:31 +00:00
, lib
, fetchFromGitHub
2021-11-02 20:33:17 +00:00
, python3
, substituteAll
2021-02-01 02:43:52 +00:00
, nix-update-script
, nixosTests
2020-08-25 21:29:31 +00:00
# To include additional plugins, pass them here as an overlay.
, packageOverrides ? self: super: { }
}:
let
2021-11-02 20:33:17 +00:00
py = python3.override {
self = py;
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) (
2020-08-25 21:29:31 +00:00
[
# Built-in dependency
(
self: super: {
octoprint-filecheck = self.buildPythonPackage rec {
pname = "OctoPrint-FileCheck";
version = "2021.2.23";
2020-08-25 21:29:31 +00:00
src = fetchFromGitHub {
owner = "OctoPrint";
repo = "OctoPrint-FileCheck";
rev = version;
sha256 = "sha256-e/QGEBa9+pjOdrZq3Zc6ifbSMClIyeTOi0Tji0YdVmI=";
2020-08-25 21:29:31 +00:00
};
doCheck = false;
};
}
)
2020-08-25 21:29:31 +00:00
# Built-in dependency
(
self: super: {
octoprint-firmwarecheck = self.buildPythonPackage rec {
pname = "OctoPrint-FirmwareCheck";
version = "2021.10.11";
2020-08-25 21:29:31 +00:00
src = fetchFromGitHub {
owner = "OctoPrint";
repo = "OctoPrint-FirmwareCheck";
rev = version;
hash = "sha256-wqbD82bhJDrDawJ+X9kZkoA6eqGxqJc1Z5dA0EUwgEI=";
};
doCheck = false;
};
}
)
(
self: super: {
octoprint-pisupport = self.buildPythonPackage rec {
pname = "OctoPrint-PiSupport";
version = "2023.5.24";
format = "setuptools";
src = fetchFromGitHub {
owner = "OctoPrint";
repo = "OctoPrint-PiSupport";
rev = version;
hash = "sha256-KfkZXJ2f02G2ee+J1w+YQRKz+LSWwxVIIwmdevDGhew=";
2020-08-25 21:29:31 +00:00
};
# requires octoprint itself during tests
2020-08-25 21:29:31 +00:00
doCheck = false;
postPatch = ''
substituteInPlace octoprint_pi_support/__init__.py \
--replace /usr/bin/vcgencmd ${self.pkgs.libraspberrypi}/bin/vcgencmd
'';
2020-08-25 21:29:31 +00:00
};
}
)
2016-02-14 11:56:07 +00:00
2020-08-25 21:29:31 +00:00
(
self: super: {
octoprint = self.buildPythonPackage rec {
pname = "OctoPrint";
version = "1.9.2";
2016-02-14 11:56:07 +00:00
2020-08-25 21:29:31 +00:00
src = fetchFromGitHub {
owner = "OctoPrint";
repo = "OctoPrint";
rev = version;
hash = "sha256-DSngV8nWHNqfPEBIfGq3HQeC1p9s6Q+GX+LcJiAiS4E=";
2020-08-25 21:29:31 +00:00
};
2023-01-14 04:24:01 +00:00
propagatedBuildInputs = with self; [
argon2-cffi
2020-12-04 20:09:22 +00:00
blinker
cachelib
click
2021-11-02 20:33:17 +00:00
colorlog
2020-12-04 20:09:22 +00:00
emoji
feedparser
filetype
2020-08-25 21:29:31 +00:00
flask
flask-babel
flask-assets
flask-login
flask-limiter
2020-12-04 20:09:22 +00:00
frozendict
future
2020-08-25 21:29:31 +00:00
itsdangerous
immutabledict
2020-12-04 20:09:22 +00:00
jinja2
markdown
markupsafe
2020-08-25 21:29:31 +00:00
netaddr
netifaces
2020-12-04 20:09:22 +00:00
octoprint-filecheck
octoprint-firmwarecheck
octoprint-pisupport
passlib
2021-11-02 20:33:17 +00:00
pathvalidate
2020-08-25 21:29:31 +00:00
pkginfo
pip
2020-12-04 20:09:22 +00:00
psutil
pylru
pyserial
pyyaml
regex
2020-08-25 21:29:31 +00:00
requests
2020-12-04 20:09:22 +00:00
rsa
sarge
2020-08-25 21:29:31 +00:00
semantic-version
sentry-sdk
setuptools
2020-12-04 20:09:22 +00:00
tornado
2020-08-25 21:29:31 +00:00
unidecode
2020-12-04 20:09:22 +00:00
watchdog
websocket-client
2020-12-04 20:09:22 +00:00
werkzeug
wrapt
2020-12-04 20:08:40 +00:00
zeroconf
zipstream-ng
class-doc
pydantic
] ++ lib.optionals stdenv.isDarwin [
py.pkgs.appdirs
];
2016-02-14 11:56:07 +00:00
nativeCheckInputs = with self; [
ddt
mock
pytestCheckHook
];
patches = [
# substitute pip and let it find out, that it can't write anywhere
(substituteAll {
src = ./pip-path.patch;
2023-01-14 04:24:01 +00:00
pip = "${self.pip}/bin/pip";
})
# hardcore path to ffmpeg and hide related settings
(substituteAll {
src = ./ffmpeg-path.patch;
ffmpeg = "${pkgs.ffmpeg}/bin/ffmpeg";
})
];
postPatch =
let
ignoreVersionConstraints = [
"cachelib"
"colorlog"
"emoji"
"immutabledict"
"PyYAML"
"sarge"
"sentry-sdk"
"watchdog"
"wrapt"
"zeroconf"
"Flask-Login"
"werkzeug"
"flask"
"Flask-Limiter"
"blinker"
];
in
2020-08-25 21:29:31 +00:00
''
sed -r -i \
${lib.concatStringsSep "\n" (
map (
e:
''-e 's@${e}[<>=]+.*@${e}",@g' \''
) ignoreVersionConstraints
)}
setup.py
2020-08-25 21:29:31 +00:00
'';
2020-08-25 21:29:31 +00:00
dontUseSetuptoolsCheck = true;
2020-08-25 21:29:31 +00:00
preCheck = ''
export HOME=$(mktemp -d)
rm pytest.ini
'';
2020-05-03 09:59:18 +00:00
2020-08-25 21:29:31 +00:00
disabledTests = [
"test_check_setup" # Why should it be able to call pip?
] ++ lib.optionals stdenv.isDarwin [
"test_set_external_modification"
];
2021-02-01 02:43:52 +00:00
passthru = {
2023-04-09 00:18:22 +00:00
inherit (self) python;
updateScript = nix-update-script { };
tests = {
2023-04-09 00:18:22 +00:00
plugins = (callPackage ./plugins.nix { }) super self;
inherit (nixosTests) octoprint;
};
2021-02-01 02:43:52 +00:00
};
2020-08-25 21:29:31 +00:00
meta = with lib; {
2020-08-25 21:29:31 +00:00
homepage = "https://octoprint.org/";
description = "The snappy web interface for your 3D printer";
license = licenses.agpl3Only;
maintainers = with maintainers; [ abbradar gebner WhittlesJr gador ];
2020-08-25 21:29:31 +00:00
};
};
}
)
2023-04-09 00:05:58 +00:00
(callPackage ./plugins.nix { })
2020-08-25 21:29:31 +00:00
packageOverrides
]
);
2016-02-14 11:56:07 +00:00
};
2020-08-25 21:29:31 +00:00
in
with py.pkgs; toPythonApplication octoprint