depot/third_party/nixpkgs/pkgs/servers/moonraker/default.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

57 lines
1.4 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-12-16";
src = fetchFromGitHub {
owner = "Arksine";
repo = "moonraker";
rev = "42357891a3716cd332ef60b28af09f8732dbf67a";
sha256 = "sha256-5w336GaHUkbmhAPvhOO3kNW5q7qTFVw3p0Q+Rv+YdYM=";
};
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 ];
mainProgram = "moonraker";
};
}