Skip to content

tinymist: remove unused deps#396283

Merged
GaetanLepage merged 1 commit intoNixOS:masterfrom
ddogfoodd:deps-tinymist
Apr 5, 2025
Merged

tinymist: remove unused deps#396283
GaetanLepage merged 1 commit intoNixOS:masterfrom
ddogfoodd:deps-tinymist

Conversation

@ddogfoodd
Copy link
Contributor

Trying out https://github.com/LordGrimmauld/nix-check-deps I removed presumably unused deps.
Still builds and works fine as far as my testing goes.
Reviewing and testing would be appreciated.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 5, 2025
Copy link
Contributor

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I wonder though, can this tool tell if we include a dependency so that the one eventually vendored in the package itself is not used?
In this case, would the dependency be tagged as "unused"?

cc @LordGrimmauld

@GaetanLepage GaetanLepage requested a review from drupol April 5, 2025 10:40
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not ! If that still works, let's do it !

@GaetanLepage
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 396283


x86_64-linux

✅ 2 packages built:
  • tinymist
  • vscode-extensions.myriad-dreamin.tinymist

aarch64-linux

✅ 2 packages built:
  • tinymist
  • vscode-extensions.myriad-dreamin.tinymist

x86_64-darwin

✅ 2 packages built:
  • tinymist
  • vscode-extensions.myriad-dreamin.tinymist

aarch64-darwin

✅ 2 packages built:
  • tinymist
  • vscode-extensions.myriad-dreamin.tinymist

@GaetanLepage GaetanLepage merged commit 36a7451 into NixOS:master Apr 5, 2025
24 of 27 checks passed
@LordGrimmauld
Copy link
Contributor

Thanks!

I wonder though, can this tool tell if we include a dependency so that the one eventually vendored in the package itself is not used? In this case, would the dependency be tagged as "unused"?

cc @LordGrimmauld

My tool does yield false-positives! Not all flagged dependencies are actually unused. Vendored blobs (copied instead of symlinked), runtime deps that are expected to be in the $PATH (e.g. capnp for pycapnp), or some edge cases in statical linking.

Please ALWAYS check against upstream code, and ideally check why the dependency was first included in nix. The packages probably build when removing the flagged deps, but it is not entirely guaranteed, care needs to be taken.

@GaetanLepage
Copy link
Contributor

Thanks!
I wonder though, can this tool tell if we include a dependency so that the one eventually vendored in the package itself is not used? In this case, would the dependency be tagged as "unused"?
cc @LordGrimmauld

My tool does yield false-positives! Not all flagged dependencies are actually unused. Vendored blobs (copied instead of symlinked), runtime deps that are expected to be in the $PATH (e.g. capnp for pycapnp), or some edge cases in statical linking.

Please ALWAYS check against upstream code, and ideally check why the dependency was first included in nix. The packages probably build when removing the flagged deps, but it is not entirely guaranteed, care needs to be taken.

Understood, thanks for the clarification. In this case, tinymist seems to still build and run fine.

@ddogfoodd ddogfoodd deleted the deps-tinymist branch April 5, 2025 11:59
@ddogfoodd
Copy link
Contributor Author

Yes I know there might be false-positives. I just thought I'd give it a try and see if it still works. Only briefly have I skimmed through the upstream code though.

Looking at why deps were added to a nix package is a good call, I should have done that as well!

Thanks @LordGrimmauld !

@LordGrimmauld
Copy link
Contributor

I am happy people are excited about cleanup work, this was my intention - but only as long as nothing breaks. Good tools are not an excuse for cheaping out on due diligence. But thanks for giving my tool a spin and understanding the limitations, have fun hunting dead code :)

@LordGrimmauld
Copy link
Contributor

For future reference, i have added a checklist to my tool describing reasonable steps to ensure nothing breaks: https://github.com/LordGrimmauld/nix-check-deps?tab=readme-ov-file#guidelines-when-contributing-cleanup-work-to-nixpkgs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants