diff --git a/lib/licenses.nix b/lib/licenses.nix index 11b0314e9d707..2c10f931db3f9 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -97,6 +97,14 @@ lib.mapAttrs mkLicense ({ fullName = "Academy of Motion Picture Arts and Sciences BSD"; }; + amulet = { + fullName = "Amulet Team License 1.0.0"; + url = "https://github.com/Amulet-Team/Amulet-NBT/blob/4.0/LICENSE"; + free = false; + # Amulet Team License is based on Polyform Shield which allows non-competitive distribution + redistributable = true; + }; + aom = { fullName = "Alliance for Open Media Patent License 1.0"; url = "https://aomedia.org/license/patent-license/"; diff --git a/pkgs/by-name/am/amulet-map-editor/package.nix b/pkgs/by-name/am/amulet-map-editor/package.nix new file mode 100644 index 0000000000000..34b7756784bfd --- /dev/null +++ b/pkgs/by-name/am/amulet-map-editor/package.nix @@ -0,0 +1,82 @@ +{ + lib, + python3, + fetchFromGitHub, + nix-update-script, + wrapGAppsHook3, + gtk3, +}: +let + version = "0.10.39"; +in +python3.pkgs.buildPythonApplication { + pname = "amulet-map-editor"; + inherit version; + pyproject = true; + + src = fetchFromGitHub { + owner = "Amulet-Team"; + repo = "Amulet-Map-Editor"; + tag = version; + hash = "sha256-6HwASoAi4amPTzAFnUTxn2PCzBRKi0wFXcTN1l10O8U="; + }; + + nativeBuildInputs = [ wrapGAppsHook3 ]; + + build-system = with python3.pkgs; [ + setuptools + wheel + cython + versioneer + numpy + ]; + + buildInputs = [ gtk3 ]; + + dependencies = with python3.pkgs; [ + pillow + wxpython + numpy + pyopengl + packaging + amulet-core + amulet-nbt + pymctranslate + minecraft-resource-pack + platformdirs + ]; + + optional-dependencies = with python3.pkgs; { + dev = [ + black + pre-commit + ]; + docs = [ + sphinx + sphinx-autodoc-typehints + sphinx-rtd-theme + ]; + }; + + pythonRelaxDeps = [ "platformdirs" ]; + + preBuild = '' + export HOME=$(mktemp -d) + ''; + + pythonImportsCheck = [ "amulet_map_editor" ]; + nativeCheckInputs = with python3.pkgs; [ pytestCheckHook ]; + + dontWrapGApps = true; + makeWrapperArgs = [ "\${gappsWrapperArgs[@]}" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Minecraft world editor and converter that supports all versions since Java 1.12 and Bedrock 1.7"; + homepage = "https://github.com/Amulet-Team/Amulet-Map-Editor"; + changelog = "https://github.com/Amulet-Team/Amulet-Map-Editor/releases/tag/${version}"; + license = with lib.licenses; [ amulet ]; + maintainers = with lib.maintainers; [ pluiedev ]; + }; +} diff --git a/pkgs/development/python-modules/amulet-core/default.nix b/pkgs/development/python-modules/amulet-core/default.nix new file mode 100644 index 0000000000000..5f86bc1a1a0f8 --- /dev/null +++ b/pkgs/development/python-modules/amulet-core/default.nix @@ -0,0 +1,105 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pythonOlder, + + # build-system + setuptools, + wheel, + cython, + versioneer, + numpy, + + # dependencies + amulet-nbt, + pymctranslate, + portalocker, + amulet-leveldb, + platformdirs, + lz4, + black, + pre-commit, + sphinx, + sphinx-autodoc-typehints, + sphinx-rtd-theme, + + pytestCheckHook, + nix-update-script, +}: +let + version = "1.9.27"; +in +buildPythonPackage { + pname = "amulet-core"; + inherit version; + pyproject = true; + + src = fetchFromGitHub { + owner = "Amulet-Team"; + repo = "Amulet-Core"; + tag = version; + hash = "sha256-cwk70qg97BIFPTpBnGG5WQElzvS5CYP5HIEIYd0w96I="; + }; + + disabled = pythonOlder "3.9"; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail 'versioneer-518' 'versioneer' + + substituteInPlace setup.py \ + --replace-fail "versioneer.get_version()" "'${version}'" + ''; + + build-system = [ + setuptools + wheel + cython + versioneer + numpy + ]; + + dependencies = [ + numpy + amulet-nbt + pymctranslate + portalocker + amulet-leveldb + platformdirs + lz4 + ]; + + optional-dependencies = { + dev = [ + black + pre-commit + ]; + docs = [ + sphinx + sphinx-autodoc-typehints + sphinx-rtd-theme + ]; + }; + + pythonRelaxDeps = [ "platformdirs" ]; + + pythonImportsCheck = [ "amulet" ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + preCheck = '' + # Required for tests that want to write to the home directory + export HOME=$(mktemp -d) + ''; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Python library for reading and writing the Minecraft save formats"; + homepage = "https://github.com/Amulet-Team/Amulet-Core"; + changelog = "https://github.com/Amulet-Team/Amulet-Core/releases/tag/${version}"; + license = with lib.licenses; [ amulet ]; + maintainers = with lib.maintainers; [ pluiedev ]; + }; +} diff --git a/pkgs/development/python-modules/amulet-leveldb/default.nix b/pkgs/development/python-modules/amulet-leveldb/default.nix new file mode 100644 index 0000000000000..eea58a57363b2 --- /dev/null +++ b/pkgs/development/python-modules/amulet-leveldb/default.nix @@ -0,0 +1,90 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pythonOlder, + zlib, + + # build-system + setuptools, + wheel, + cython, + versioneer, + black, + pre-commit, + sphinx, + sphinx-autodoc-typehints, + sphinx-rtd-theme, + + pytestCheckHook, + nix-update-script, +}: +let + version = "1.0.2"; +in +buildPythonPackage { + pname = "amulet-leveldb"; + inherit version; + pyproject = true; + + src = fetchFromGitHub { + owner = "Amulet-Team"; + repo = "Amulet-LevelDB"; + tag = version; + hash = "sha256-7VJb5TEa3GcwNEZYrnwP3yMWdpxkHeFcydCCeHiB3+w="; + + postFetch = '' + # De-vendor zlib + rm -r $out/zlib + ''; + fetchSubmodules = true; + }; + + disabled = pythonOlder "3.8"; + + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "versioneer.get_version()" "'${version}'" + ''; + + build-system = [ + setuptools + wheel + cython + versioneer + ]; + + buildInputs = [ zlib ]; + + optional-dependencies = { + dev = [ + black + pre-commit + ]; + docs = [ + sphinx + sphinx-autodoc-typehints + sphinx-rtd-theme + ]; + }; + + pythonImportsCheck = [ "leveldb" ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + # FIXME(pluiedev): I... frankly don't know why this fails. + # try: + # self.assertTrue(40_000 <= len(list(db.keys())) < 100_000) + # ^ AssertionError: False is not true + disabledTests = [ "test_corrupt" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Cython wrapper for Mojang's custom LevelDB"; + homepage = "https://github.com/Amulet-Team/Amulet-LevelDB"; + changelog = "https://github.com/Amulet-Team/Amulet-LevelDB/releases/tag/${version}"; + license = with lib.licenses; [ amulet ]; + maintainers = with lib.maintainers; [ pluiedev ]; + }; +} diff --git a/pkgs/development/python-modules/amulet-nbt/default.nix b/pkgs/development/python-modules/amulet-nbt/default.nix new file mode 100644 index 0000000000000..b5dd9de772479 --- /dev/null +++ b/pkgs/development/python-modules/amulet-nbt/default.nix @@ -0,0 +1,97 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pythonOlder, + + # build-system + setuptools, + wheel, + versioneer, + cython, + + # dependencies + numpy, + mutf8, + black, + pre-commit, + sphinx, + sphinx-autodoc-typehints, + sphinx-rtd-theme, + + pytestCheckHook, + nix-update-script, +}: +let + version = "2.1.3"; +in +buildPythonPackage { + pname = "amulet-nbt"; + inherit version; + pyproject = true; + + src = fetchFromGitHub { + owner = "Amulet-Team"; + repo = "Amulet-NBT"; + tag = version; + hash = "sha256-ucN/CFPYWEPPiqrK9v2VZ1l5s2jf0N0tNuxpYoTZQ4s="; + }; + + disabled = pythonOlder "3.9"; + + postPatch = '' + # FIXME: Drop for 4.x + substituteInPlace pyproject.toml \ + --replace-fail 'versioneer-518' 'versioneer' + + substituteInPlace setup.py \ + --replace-fail "versioneer.get_version()" "'${version}'" + ''; + + build-system = [ + setuptools + wheel + cython + versioneer + numpy + ]; + + dependencies = [ + numpy + mutf8 + ]; + + optional-dependencies = { + dev = [ + black + pre-commit + ]; + docs = [ + sphinx + sphinx-autodoc-typehints + sphinx-rtd-theme + ]; + }; + + pythonImportsCheck = [ "amulet_nbt" ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + # Source files interfere with tests :( + preCheck = '' + rm -r amulet_nbt + ''; + + # FIXME: Drop for 4.x, somehow it's just not implemented at all + disabledTestPaths = [ "tests/base_type_test.py" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Python library for reading and writing binary NBT and stringified NBT"; + homepage = "https://github.com/Amulet-Team/Amulet-NBT"; + changelog = "https://github.com/Amulet-Team/Amulet-NBT/releases/tag/${version}"; + license = with lib.licenses; [ amulet ]; + maintainers = with lib.maintainers; [ pluiedev ]; + }; +} diff --git a/pkgs/development/python-modules/minecraft-resource-pack/default.nix b/pkgs/development/python-modules/minecraft-resource-pack/default.nix new file mode 100644 index 0000000000000..82d417e32f224 --- /dev/null +++ b/pkgs/development/python-modules/minecraft-resource-pack/default.nix @@ -0,0 +1,90 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pythonOlder, + + # build-system + setuptools, + wheel, + versioneer, + + # dependencies + pillow, + numpy, + amulet-nbt, + platformdirs, + black, + pre-commit, + sphinx, + sphinx-autodoc-typehints, + sphinx-rtd-theme, + + nix-update-script, +}: +let + version = "1.4.6"; +in +buildPythonPackage { + pname = "minecraft-resource-pack"; + inherit version; + pyproject = true; + + src = fetchFromGitHub { + owner = "gentlegiantJGC"; + repo = "Minecraft-Model-Reader"; + tag = version; + hash = "sha256-i+c5QSvGQeB5APBzN5JJ6uFohR2volX4D9qkuRQeig4="; + }; + + disabled = pythonOlder "3.9"; + + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "versioneer.get_version()" "'${version}'" + ''; + + build-system = [ + setuptools + wheel + versioneer + ]; + + dependencies = [ + pillow + numpy + amulet-nbt + platformdirs + ]; + + optional-dependencies = { + dev = [ + black + pre-commit + ]; + docs = [ + sphinx + sphinx-autodoc-typehints + sphinx-rtd-theme + ]; + }; + + pythonRelaxDeps = [ "platformdirs" ]; + + pythonImportsCheck = [ "minecraft_model_reader" ]; + + # minecraft_model_reader/api/amulet/block.py:132: in __init__ + # assert isinstance(properties, dict) and all( + #E AssertionError: {'age': '0', 'east': 'true', 'north': 'true', 'south': 'false', 'up': 'false', 'west': 'false'} + doCheck = false; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Python library for reading and writing binary NBT and stringified NBT"; + homepage = "https://github.com/Amulet-Team/Amulet-NBT"; + changelog = "https://github.com/Amulet-Team/Amulet-NBT/releases/tag/${version}"; + license = with lib.licenses; [ amulet ]; + maintainers = with lib.maintainers; [ pluiedev ]; + }; +} diff --git a/pkgs/development/python-modules/pymctranslate/default.nix b/pkgs/development/python-modules/pymctranslate/default.nix new file mode 100644 index 0000000000000..e9bbfa8afd6c9 --- /dev/null +++ b/pkgs/development/python-modules/pymctranslate/default.nix @@ -0,0 +1,88 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pythonOlder, + + # build-system + setuptools, + wheel, + versioneer, + + # dependencies + numpy, + amulet-nbt, + black, + pre-commit, + sphinx, + sphinx-autodoc-typehints, + sphinx-rtd-theme, + + pytestCheckHook, + nix-update-script, +}: +let + version = "1.2.30"; +in +buildPythonPackage { + pname = "pymctranslate"; + inherit version; + pyproject = true; + + src = fetchFromGitHub { + owner = "gentlegiantJGC"; + repo = "PyMCTranslate"; + tag = version; + hash = "sha256-ezLByCYaj9OwXXrvpGduQW/E+UhWexK0mFZEnxoy0ZI="; + }; + + disabled = pythonOlder "3.9"; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail 'versioneer-518' 'versioneer' + + substituteInPlace setup.py \ + --replace-fail "versioneer.get_version()" "'${version}'" + ''; + + build-system = [ + setuptools + wheel + versioneer + ]; + + dependencies = [ + numpy + amulet-nbt + ]; + + optional-dependencies = { + dev = [ + black + pre-commit + ]; + docs = [ + sphinx + sphinx-autodoc-typehints + sphinx-rtd-theme + ]; + }; + + pythonImportsCheck = [ "PyMCTranslate" ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + # ¯\_(ツ)_/¯ This uses a nonexistent method for no reason - someone probably just forgot + disabledTestPaths = [ "tests/basic_test.py" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Minecraft data translation system"; + homepage = "https://github.com/gentlegiantJGC/PyMCTranslate"; + changelog = "https://github.com/gentlegiantJGC/PyMCTranslate/releases/tag/${version}"; + license = with lib.licenses; [ amulet ]; + maintainers = with lib.maintainers; [ pluiedev ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b493f35e4161d..7a72aaae46b9e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -586,6 +586,12 @@ self: super: with self; { amqtt = callPackage ../development/python-modules/amqtt { }; + amulet-core = callPackage ../development/python-modules/amulet-core { }; + + amulet-leveldb = callPackage ../development/python-modules/amulet-leveldb { }; + + amulet-nbt = callPackage ../development/python-modules/amulet-nbt { }; + anchor-kr = callPackage ../development/python-modules/anchor-kr { }; ancp-bids = callPackage ../development/python-modules/ancp-bids { }; @@ -8137,6 +8143,8 @@ self: super: with self; { mindsdb-evaluator = callPackage ../development/python-modules/mindsdb-evaluator { }; + minecraft-resource-pack = callPackage ../development/python-modules/minecraft-resource-pack { }; + minexr = callPackage ../development/python-modules/minexr { }; miniaudio = callPackage ../development/python-modules/miniaudio { @@ -11952,6 +11960,8 @@ self: super: with self; { pymc = callPackage ../development/python-modules/pymc { }; + pymctranslate = callPackage ../development/python-modules/pymctranslate { }; + pymdstat = callPackage ../development/python-modules/pymdstat { }; pymdown-extensions = callPackage ../development/python-modules/pymdown-extensions { };