From 1fa5d6ceb525b3419e39104f747b580ed0683a03 Mon Sep 17 00:00:00 2001 From: Samuel Rounce Date: Tue, 21 May 2024 20:06:22 +0100 Subject: [PATCH] feat(loom): Add loom.ociImg attribute Loom docker images attribute exposed as passthru field of loom. Fixes #12 --- pkgs/loom/default.nix | 242 ++++++++++++++++++++++-------------------- 1 file changed, 127 insertions(+), 115 deletions(-) diff --git a/pkgs/loom/default.nix b/pkgs/loom/default.nix index 1f3df09..09c8a52 100644 --- a/pkgs/loom/default.nix +++ b/pkgs/loom/default.nix @@ -27,6 +27,8 @@ , zlib , eigen , gperftools +, dockerTools +, basicTools }: let goftests = callPackage ./../goftests { }; @@ -89,125 +91,135 @@ let hash = "sha256-FSx/vKctoFl4NlwzNDa9eDNUXeW1J875/nB6of+5gQk="; }; }); -in -buildPythonPackage { - inherit version; - - src = loom-cpp.dev; - - pname = "loom"; - - nativeBuildInputs = [ - cmake - setuptools - wheel - protobuf - ]; - - buildInputs = [ - cmake - gnumake - - distributions.distributions-shared - distributions - zlib - eigen - gperftools - ]; - - nativeCheckInputs = [ - pyflakes - ]; - - # https://github.com/numba/numba/issues/8698#issuecomment-1584888063 - env.NUMPY_EXPERIMENTAL_DTYPE_API = 1; - - env.DISTRIBUTIONS_USE_PROTOBUF = 1; - - propagatedBuildInputs = [ - loom-cpp - contextlib2 - cpplint - cython_0 - distributions - distributions.distributions-shared - goftests - imageio - matplotlib - mock - nose - numpy - pandas - parsable - pep8 - python3Packages.protobuf - pyflakes - pymetis - scikit-learn - scipy - setuptools - simplejson - pytest - ]; - - # TODO: make tests run in checkPhase - doCheck = false; - - pythonImportsCheck = [ - "loom" - "loom.cleanse" - "loom.crossvalidate" - "loom.datasets" - "loom.format" - "loom.generate" - "loom.preql" - "loom.query" - "loom.schema_pb2" - "loom.store" - "loom.tasks" - "loom.transforms" - "loom.util" - "loom.watch" - ]; - - dontUseCmakeConfigure = true; - - enableParallelBuilding = true; - - prePatch = '' - sed -i 's/-Werror//g' CMakeLists.txt # remove -Werror - ''; - - passthru.loom-cpp = loom-cpp; - - passthru.more_packages = { - inherit + + loom = buildPythonPackage { + inherit version; + + src = loom-cpp.dev; + + pname = "loom"; + + nativeBuildInputs = [ + cmake + setuptools + wheel + protobuf + ]; + + buildInputs = [ + cmake + gnumake + + distributions.distributions-shared + distributions + zlib + eigen + gperftools + ]; + + nativeCheckInputs = [ + pyflakes + ]; + + # https://github.com/numba/numba/issues/8698#issuecomment-1584888063 + env.NUMPY_EXPERIMENTAL_DTYPE_API = 1; + + env.DISTRIBUTIONS_USE_PROTOBUF = 1; + + propagatedBuildInputs = [ + loom-cpp + contextlib2 + cpplint + cython_0 + distributions + distributions.distributions-shared + goftests + imageio + matplotlib + mock + nose + numpy + pandas + parsable + pep8 + python3Packages.protobuf + pyflakes + pymetis + scikit-learn + scipy + setuptools + simplejson + pytest + ]; + + # TODO: make tests run in checkPhase + doCheck = false; + + pythonImportsCheck = [ + "loom" + "loom.cleanse" + "loom.crossvalidate" + "loom.datasets" + "loom.format" + "loom.generate" + "loom.preql" + "loom.query" + "loom.schema_pb2" + "loom.store" + "loom.tasks" + "loom.transforms" + "loom.util" + "loom.watch" + ]; + + dontUseCmakeConfigure = true; + + enableParallelBuilding = true; + + prePatch = '' + sed -i 's/-Werror//g' CMakeLists.txt # remove -Werror + ''; + + passthru.loom-cpp = loom-cpp; + + passthru.more_packages = { + inherit goftests distributions pymetis parsable - ; - }; + ; + }; - passthru.tests.run = callPackage ./test.nix { inherit src; }; - - passthru.test-shell = callPackage ({ - mkShell - , python3 - , loom - , which - }: mkShell { - packages = [ - python3 - loom - which - ]; - }) {}; + passthru.ociImg = dockerTools.buildLayeredImage { + name = "probcomp/loom"; + contents = + with pkgs; [ loom bashInteractive ] ++ + basicTools + ; + }; - meta = with lib; { - description = "A streaming cross-cat inference engine"; - homepage = "https://github.com/emilyfertig/loom"; - license = licenses.bsd3; - maintainers = with maintainers; [ ]; + passthru.tests.run = callPackage ./test.nix { inherit src; }; + + passthru.test-shell = callPackage ({ + mkShell + , python3 + , loom + , which + }: mkShell { + packages = [ + python3 + loom + which + ]; + }) {}; + + meta = with lib; { + description = "A streaming cross-cat inference engine"; + homepage = "https://github.com/emilyfertig/loom"; + license = licenses.bsd3; + maintainers = with maintainers; [ ]; + }; }; -} +in +loom