diff --git a/pkgs/by-name/du/dust/package.nix b/pkgs/by-name/du/dust/package.nix index 720bfee00efd..bbcfa8fd96be 100644 --- a/pkgs/by-name/du/dust/package.nix +++ b/pkgs/by-name/du/dust/package.nix @@ -3,9 +3,11 @@ fetchFromGitHub, rustPlatform, installShellFiles, + versionCheckHook, + nix-update-script, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { # Originally, this package was under the attribute `du-dust`, since `dust` was taken. # Since then, `dust` has been freed up, allowing this package to take that attribute. # However in order for tools like `nix-env` to detect package updates, keep `du-dust` for pname. @@ -15,7 +17,7 @@ rustPlatform.buildRustPackage rec { src = fetchFromGitHub { owner = "bootandy"; repo = "dust"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-MmlCTF7tZBBOCnyhUjTatDjajFMGd+Nk2kYyxjzZc04="; # Remove unicode file names which leads to different checksums on HFS+ # vs. other filesystems because of unicode normalisation. @@ -29,18 +31,38 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - doCheck = false; + checkFlags = [ + # disable tests that depend on the unicode files we removed above + "--skip=test_show_files_by_type" + ]; + + preCheck = '' + # These tests depend on the disk format of the build host. + rm tests/test_exact_output.rs + rm tests/tests_symlinks.rs + ''; postInstall = '' installManPage man-page/dust.1 installShellCompletion completions/dust.{bash,fish} --zsh completions/_dust ''; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = "${placeholder "out"}/bin/dust"; + versionCheckProgramArg = "--version"; + doInstallCheck = true; + + passthru.updateScript = nix-update-script { }; + meta = { description = "du + rust = dust. Like du but more intuitive"; homepage = "https://github.com/bootandy/dust"; + changelog = "https://github.com/bootandy/dust/releases/tag/v${finalAttrs.version}"; license = lib.licenses.asl20; - maintainers = with lib.maintainers; [ aaronjheng ]; + maintainers = with lib.maintainers; [ + aaronjheng + defelo + ]; mainProgram = "dust"; }; -} +})