diff --git a/nix_update/dependency_hashes.py b/nix_update/dependency_hashes.py index f50b346..bedb980 100644 --- a/nix_update/dependency_hashes.py +++ b/nix_update/dependency_hashes.py @@ -164,6 +164,7 @@ def update_dependency_hashes( "pnpm_deps": partial(update_hash_with_prefetch, "pnpmDeps"), "yarn_deps": partial(update_hash_with_prefetch, "yarnOfflineCache"), "yarn_deps_old": partial(update_hash_with_prefetch, "offlineCache"), + "bun_deps": partial(update_hash_with_prefetch, "bunDeps"), "maven_deps": partial(update_hash_with_prefetch, "fetchedMavenDeps"), "mix_deps": partial(update_hash_with_prefetch, "mixFodDeps"), "zig_deps": partial(update_hash_with_prefetch, "zigDeps"), diff --git a/nix_update/eval.nix b/nix_update/eval.nix index b2563eb..109cfde 100644 --- a/nix_update/eval.nix +++ b/nix_update/eval.nix @@ -138,6 +138,7 @@ in pnpm_deps = pkg.pnpmDeps.outputHash or null; yarn_deps = pkg.yarnOfflineCache.outputHash or null; yarn_deps_old = pkg.offlineCache.outputHash or null; + bun_deps = pkg.bunDeps.outputHash or null; maven_deps = pkg.fetchedMavenDeps.outputHash or null; has_nuget_deps = pkg ? nugetDeps; has_gradle_mitm_cache = pkg ? mitmCache; diff --git a/nix_update/eval.py b/nix_update/eval.py index 9af491f..029538d 100644 --- a/nix_update/eval.py +++ b/nix_update/eval.py @@ -61,6 +61,7 @@ class Package: pnpm_deps: str | None yarn_deps: str | None yarn_deps_old: str | None + bun_deps: str | None composer_deps: str | None composer_deps_old: str | None maven_deps: str | None diff --git a/tests/test_bun.py b/tests/test_bun.py new file mode 100644 index 0000000..cad476f --- /dev/null +++ b/tests/test_bun.py @@ -0,0 +1,31 @@ +from __future__ import annotations + +import subprocess +from typing import TYPE_CHECKING + +from nix_update.options import Options +from nix_update.update import update + +if TYPE_CHECKING: + from pathlib import Path + + +def test_update(testpkgs: Path) -> None: + opts = Options(attribute="bun", import_path=str(testpkgs)) + update(opts) + bun_hash = subprocess.run( + [ + "nix", + "eval", + "--raw", + "--extra-experimental-features", + "nix-command", + "-f", + testpkgs, + "pnpm.bunDeps.outputHash", + ], + text=True, + stdout=subprocess.PIPE, + check=True, + ).stdout.strip() + assert bun_hash != "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" diff --git a/tests/testpkgs/bun.nix b/tests/testpkgs/bun.nix new file mode 100644 index 0000000..461e82b --- /dev/null +++ b/tests/testpkgs/bun.nix @@ -0,0 +1,27 @@ +{ + bun, + buildNpmPackage, + fetchFromGitHub, +}: +buildNpmPackage rec { + pname = "goofcord"; + version = "2.0.1"; + + src = fetchFromGitHub { + owner = "Milkshiift"; + repo = "Goofcord"; + tag = "v${version}"; + hash = "sha256-c/NDju5K4DnKLZjE0ZD0TSpm5YWhZUXGmZs/AJhF7Jk="; + }; + + npmConfigHook = bun.configHook; + npmHash = bunDeps; + bunDeps = bun.fetchDeps { + inherit + pname + src + version + ; + hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; + }; +}