Unverified Commit ca74454a authored by lassulus's avatar lassulus Committed by GitHub
Browse files

spoolman: init at 0.22.1 (#316110)

parents bbbdf4b6 c649478e
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
{ lib, fetchFromGitHub }:
let
  version = "0.22.1";
in
{
  inherit version;

  src = fetchFromGitHub {
    owner = "Donkie";
    repo = "Spoolman";
    rev = "v${version}";
    hash = "sha256-EVGpwcjEh4u8Vtgu2LypqMqArYLZe7oh1qYhGZpgjh0=";
  };

  meta = with lib; {
    description = "Keep track of your inventory of 3D-printer filament spools";
    homepage = "https://github.com/Donkie/Spoolman";
    license = licenses.mit;
    maintainers = with maintainers; [
      MayNiklas
      pinpox
    ];
    mainProgram = "spoolman";
  };
}
+23 −0
Original line number Diff line number Diff line
{ buildNpmPackage, callPackage }:
let
  common = callPackage ./common.nix { };
in

buildNpmPackage {
  pname = "spoolman-frontend";

  inherit (common) version;

  src = "${common.src}/client";

  npmDepsHash = "sha256-E4DvEOSHfwwM0C+vTRMDQbCNv2IDyFOFwfqszrI+uOA=";

  VITE_APIURL = "/api/v1";

  installPhase = "cp -r dist $out";

  meta = common.meta // {
    description = "Spoolman frontend";
    mainProgram = "spoolman-frontend";
  };
}
+79 −0
Original line number Diff line number Diff line
{
  python312,
  lib,
  callPackage,
  writeShellScript,
  makeWrapper,
}:

let
  common = callPackage ./common.nix { };
  frontend = callPackage ./frontend.nix { };
  python = python312;
in

python.pkgs.buildPythonPackage rec {

  pname = "spoolman";
  inherit (common) version src;

  pyproject = true;

  nativeBuildInputs = [
    makeWrapper
    python.pkgs.pdm-backend
    python.pkgs.pythonRelaxDepsHook
  ];

  pythonRelaxDeps = [ "setuptools" ];

  postPatch = ''
    substituteInPlace pyproject.toml --replace-fail psycopg2-binary psycopg2
  '';

  propagatedBuildInputs = with python.pkgs; [
    uvloop
    alembic
    asyncpg
    fastapi
    hishel
    httptools
    httpx
    aiosqlite
    platformdirs
    prometheus-client
    psycopg2
    pydantic
    scheduler
    setuptools
    sqlalchemy
    sqlalchemy-cockroachdb
    uvicorn
    websockets
  ];

  pythonImportsCheck = [ "spoolman" ];

  postInstall =
    let
      start_script = writeShellScript "start-spoolman" ''
        ${lib.getExe python.pkgs.uvicorn} "$@" spoolman.main:app;
      '';
    in
    ''
      mkdir -p $out/runpath/client/dist $out/bin
      cp -r $src/* $out/runpath
      cp -r ${frontend}/* $out/runpath/client/dist

      makeWrapper ${start_script} $out/bin/spoolman \
      --chdir $out/runpath \
      --prefix PYTHONPATH : "$out/${python.sitePackages}" \
      --prefix PYTHONPATH : "${python.pkgs.makePythonPath propagatedBuildInputs}" \
      --prefix PATH : "${python.pkgs.alembic}/bin"
    '';

  meta = common.meta // {
    description = "Spoolman server";
    mainProgram = "spoolman";
  };
}
+37 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  wheel,
  typeguard,
}:

buildPythonPackage rec {
  pname = "scheduler";
  version = "0.8.5";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-8t1AUbD6cpETSoqoY88bSZmj7FuaF6c+7kJDJX2Lp4k=";
  };

  nativeBuildInputs = [
    setuptools
    wheel
  ];

  propagatedBuildInputs = [
    typeguard
  ];

  pythonImportsCheck = [ "scheduler" ];

  meta = with lib; {
    description = "A simple in-process python scheduler library with asyncio, threading and timezone support. Use datetime standard library objects for planning of Jobs depending on time cycles, fixed times, weekdays, dates, weights, offsets and execution counts";
    homepage = "https://pypi.org/project/scheduler/";
    license = licenses.lgpl3;
    maintainers = with maintainers; [ pinpox ];
  };
}
+37 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  wheel,
  sqlalchemy,
}:

buildPythonPackage rec {
  pname = "sqlalchemy-cockroachdb";
  version = "2.0.2";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-EZdW65BYVdahE0W5nP6FMDGj/lmKnEvzWo3ayfif6Mw=";
  };

  nativeBuildInputs = [
    setuptools
    wheel
  ];

  propagatedBuildInputs = [
    sqlalchemy
  ];

  pythonImportsCheck = [ "sqlalchemy_cockroachdb" ];

  meta = with lib; {
    description = "CockroachDB dialect for SQLAlchemy";
    homepage = "https://pypi.org/project/sqlalchemy-cockroachdb";
    license = licenses.asl20;
    maintainers = with maintainers; [ pinpox ];
  };
}
Loading