python311Packages.ipyniivue: fix nativeCheckInputs typo, build js from source

This commit is contained in:
Peder Bergebakken Sundt
2024-09-12 22:39:52 +02:00
parent f9ba61be40
commit 71b3a52bb7
@@ -1,8 +1,11 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
fetchNpmDeps,
pythonOlder,
nodejs,
npmHooks,
hatchling,
hatch-vcs,
anywidget,
@@ -16,15 +19,32 @@ buildPythonPackage rec {
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-C0mYkguN4ZfxSLqETH3dUwXeoNcicrmAgp6e9IIT43s=";
src = fetchFromGitHub {
owner = "niivue";
repo = "ipyniivue";
rev = "v${version}";
hash = "sha256-6DZmHVVxJspjUhJ9pzTmTvwAnQfvTp8OL2xZONz2XbU=";
};
npmDeps = fetchNpmDeps {
name = "${pname}-${version}-npm-deps";
inherit src;
hash = "sha256-ZJRBGMNn5clxMavimfl6Jwqf7M2pRo+WLne0gUWOiJ8=";
};
# We do not need the build hooks, because we do not need to
# build any JS components; these are present already in the PyPI artifact.
env.HATCH_BUILD_NO_HOOKS = true;
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
preBuild = ''
npm run build
'';
build-system = [
hatchling
hatch-vcs
@@ -32,7 +52,7 @@ buildPythonPackage rec {
dependencies = [ anywidget ];
nativeCheckImports = [ pytestCheckHook ];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "ipyniivue" ];
meta = with lib; {