diff --git a/pkgs/by-name/dp/dprint/package.nix b/pkgs/by-name/dp/dprint/package.nix index 1b3cb8f91e2e..05543ec1217c 100644 --- a/pkgs/by-name/dp/dprint/package.nix +++ b/pkgs/by-name/dp/dprint/package.nix @@ -1,7 +1,7 @@ { lib, stdenv, - fetchCrate, + fetchFromGitHub, rustPlatform, installShellFiles, testers, @@ -13,21 +13,30 @@ rustPlatform.buildRustPackage rec { pname = "dprint"; version = "0.47.6"; - src = fetchCrate { - inherit pname version; - hash = "sha256-7tGzSFp7Dnu27L65mqFd7hzeFFDfe1xJ6cMul3hGyJs="; + # Prefer repository rather than crate here + # - They have Cargo.lock in the repository + # - They have WASM files in the repository which will be used in checkPhase + src = fetchFromGitHub { + owner = "dprint"; + repo = "dprint"; + rev = "refs/tags/${version}"; + hash = "sha256-zyiBFZbetKx0H47MAU4JGauAmthcuEdJMl93M6MobD8="; }; - cargoHash = "sha256-y3tV3X7YMOUGBn2hCmxsUUc9QQleKEioTIw7SGoBvSQ="; - - # Tests fail because they expect a test WASM plugin. Tests already run for - # every commit upstream on GitHub Actions - doCheck = false; + cargoHash = "sha256-XuzxoJgJJl4Blw1lDnCG3faEqL9U40MhZEb9LYjiaSs="; nativeBuildInputs = lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ installShellFiles ]; + checkFlags = [ + # Require creating directory and network access + "--skip=plugins::cache_fs_locks::test" + "--skip=utils::lax_single_process_fs_flag::test" + # Require cargo is running + "--skip=utils::process::test" + ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' export DPRINT_CACHE_DIR="$(mktemp -d)" installShellCompletion --cmd dprint \