I’m trying to make a package for Sui, so far I have this:
{
lib,
rustPlatform,
fetchFromGitHub,
}:
rustPlatform.buildRustPackage {
pname = "sui";
version = "1.48.4";
src = fetchFromGitHub {
owner = "MystenLabs";
repo = "sui";
rev = "822bae445bd363cff97196abef338a7f3795893c";
sha256 = "sha256-HxvSHDMriH8gl64h7xdTx5j+xUlNicKCCB5DdRJqA6E=";
};
cargoHash = "sha256-wdTk1LB/9TiHS0VYz/cuWwa9GWVK7tKbuR4A+emmFsY=";
cargoBuildFlags = [
"--package"
"sui"
];
cargoInstallFlags = [
"--path"
"crates/sui"
];
nativeBuildInputs = with rustPlatform; [ cargoSetupHook ];
meta = with lib; {
description = "Sui blockchain CLI tool";
homepage = "https://github.com/MystenLabs/sui";
license = licenses.asl20;
maintainers = with maintainers; [ shackra ];
platforms = platforms.unix;
};
}
however, when I build it (or ran nix flake check
) I stumble upon this weird error:
➜ nix build .\#sui-mainnet
warning: Git tree '/home/jorge/code/nix/nur' is dirty
error: builder for '/nix/store/n6dpns7b3d3whqvmsjpa85pnqjcvq28r-sui-1.48.4-vendor.drv' failed with exit code 1;
last 25 log lines:
> Unpacking to /nix/store/rz03lsxwvps8c2qkr6ls2klnwda79xl2-sui-1.48.4-vendor/subprocess-0.2.9
> Unpacking to /nix/store/rz03lsxwvps8c2qkr6ls2klnwda79xl2-sui-1.48.4-vendor/subtle-2.5.0
> Unpacking to /nix/store/rz03lsxwvps8c2qkr6ls2klnwda79xl2-sui-1.48.4-vendor/subtle-ng-2.5.0
> Copying to /nix/store/rz03lsxwvps8c2qkr6ls2klnwda79xl2-sui-1.48.4-vendor/sui-graphql-client-0.0.4
> Copying to /nix/store/rz03lsxwvps8c2qkr6ls2klnwda79xl2-sui-1.48.4-vendor/sui-graphql-client-build-0.0.4
> Copying to /nix/store/rz03lsxwvps8c2qkr6ls2klnwda79xl2-sui-1.48.4-vendor/sui-graphql-client-build-0.0.4
> Traceback (most recent call last):
> File "/nix/store/7f3a269xl53xbywqpwwihipjv3iagqya-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 349, in <module>
> main()
> File "/nix/store/7f3a269xl53xbywqpwwihipjv3iagqya-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 345, in main
> subcommand_func()
> File "/nix/store/7f3a269xl53xbywqpwwihipjv3iagqya-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 337, in <lambda>
> "create-vendor": lambda: create_vendor(vendor_staging_dir=Path(sys.argv[2]), out_dir=Path(sys.argv[3]))
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/nix/store/7f3a269xl53xbywqpwwihipjv3iagqya-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 294, in create_vendor
> copy_and_patch_git_crate_subtree(git_tree, pkg["name"], crate_out_dir)
> File "/nix/store/7f3a269xl53xbywqpwwihipjv3iagqya-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 233, in copy_and_patch_git_crate_subtree
> shutil.copytree(crate_tree, crate_out_dir, ignore=ignore_func)
> File "/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/shutil.py", line 600, in copytree
> return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/shutil.py", line 498, in _copytree
> os.makedirs(dst, exist_ok=dirs_exist_ok)
> File "<frozen os>", line 225, in makedirs
> FileExistsError: [Errno 17] File exists: '/nix/store/rz03lsxwvps8c2qkr6ls2klnwda79xl2-sui-1.48.4-vendor/sui-graphql-client-build-0.0.4'
For full logs, run:
nix log /nix/store/n6dpns7b3d3whqvmsjpa85pnqjcvq28r-sui-1.48.4-vendor.drv
sui-graphql-client-build
is being copied twice, which causes the build to fail. Why is that so disruptive? Copying a thing twice to the very same location should be an idempotent action, IMHO.
Anyway, I’m checking the Cargo.toml
file of the project and see this:
sui-graphql-client = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "7d485ababecf7282dc7d772316ccdb07b9b24753" }
sui-graphql-client-build = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "7d485ababecf7282dc7d772316ccdb07b9b24753" }
is basically the same code down to sharing the same hash, but the intention is… two different modules? I don’t really know enough Rust to figure out if this is fine or not; however, nix complains.
What are my options? I don’t know enough nix to sort this out for myself.