Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nix_update/dependency_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
1 change: 1 addition & 0 deletions nix_update/eval.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions nix_update/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions tests/test_bun.py
Original file line number Diff line number Diff line change
@@ -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="
27 changes: 27 additions & 0 deletions tests/testpkgs/bun.nix
Original file line number Diff line number Diff line change
@@ -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=";
};
}
Loading