nixpkgs/pkgs/servers/moonraker/default.nix
2023-10-02 06:45:16 +04:00

57 lines
1.3 KiB
Nix

{ lib, stdenvNoCC, fetchFromGitHub, python3, makeWrapper, unstableGitUpdater, nixosTests, useGpiod ? false }:
let
pythonEnv = python3.withPackages (packages:
with packages; [
tornado
pyserial-asyncio
pillow
lmdb
streaming-form-data
distro
inotify-simple
libnacl
paho-mqtt
pycurl
zeroconf
preprocess-cancellation
jinja2
dbus-next
apprise
]
++ (lib.optionals useGpiod [ libgpiod ])
);
in stdenvNoCC.mkDerivation rec {
pname = "moonraker";
version = "unstable-2023-08-03";
src = fetchFromGitHub {
owner = "Arksine";
repo = "moonraker";
rev = "fe120952ee06607d039af8f461028e9f5b817395";
sha256 = "sha256-TyhpMHu06YoaV5tZGBcYulUrABW6OFYZLyCoZLRmaUU=";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out $out/bin $out/lib
cp -r moonraker $out/lib
makeWrapper ${pythonEnv}/bin/python $out/bin/moonraker \
--add-flags "$out/lib/moonraker/moonraker.py"
'';
passthru = {
updateScript = unstableGitUpdater { url = meta.homepage; };
tests.moonraker = nixosTests.moonraker;
};
meta = with lib; {
description = "API web server for Klipper";
homepage = "https://github.com/Arksine/moonraker";
license = licenses.gpl3Only;
maintainers = with maintainers; [ zhaofengli ];
};
}