Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --print-all-depedencies to nixci build subcommand #60

Merged
merged 20 commits into from
May 5, 2024

Conversation

shivaraj-bh
Copy link
Contributor

@shivaraj-bh shivaraj-bh commented May 3, 2024

resolves #59

Uses nix-store --query --requisites --include-outputs <drv-path> to print all the build and runtime dependencies of a given derivation path.

Try it out:

nix run github:shivaraj-bh/nixci/print-all-deps -- build github:srid/haskell-template --print-all-dependencies

Uses `nix-store --query --requisites --include-outputs <drv-path>` to print all the build and runtime dependencies of a given derivation path
@shivaraj-bh
Copy link
Contributor Author

@srid I am not sure how to add integration-test for —print-all-dependencies because there will system specific dependencies. To add to that, even the most basic packages like gnutar or gnused have about 700 dependencies on macOS.

src/nix/all_deps.rs Outdated Show resolved Hide resolved
src/nix/all_deps.rs Outdated Show resolved Hide resolved
Copy link
Owner

@srid srid left a comment

Choose a reason for hiding this comment

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

Can you move the struct from juspay/nix-rs#6 to nix_store.rs? Let's give nix_store.rs some time before it can be upstreamed to nix-rs.

I am not sure how to add integration-test for —print-all-dependencies because there will system specific dependencies. To add to that, even the most basic packages like gnutar or gnused have about 700 dependencies on macOS.

Perhaps you can pick some stable transitive dependency and check for its inclusion? Rather than compare the whole list.

src/nix/all_deps.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/nix/all_deps.rs Outdated Show resolved Hide resolved
src/nix/all_deps.rs Outdated Show resolved Hide resolved
src/nix/all_deps.rs Outdated Show resolved Hide resolved
@shivaraj-bh shivaraj-bh marked this pull request as ready for review May 4, 2024 07:36
Comment on lines 82 to 84
async fn nix_store_query_deriver(&self, out_path: PathBuf) -> Result<PathBuf> {
let mut cmd = self.command();
cmd.args(["--query", "--deriver", &out_path.to_string_lossy().as_ref()]);
Copy link
Owner

Choose a reason for hiding this comment

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

Note: this command can fail silently with unknown-deriver:

❯ nix-store --query --deriver /nix/store/50rs0cwcp2878l3hvymwnq6v7cyyw1l3-haskell-template
/nix/store/myd60l138syblrhwckpwxh259cn2s6ms-haskell-template.drv

srid on appreciate.intern nixci on  print-all-deps [!] is 📦 v0.4.0 via 🦀 v1.74.0 via ❄️  impure (nixci-env)
❯ nix-store --query --deriver /nix/store/myd60l138syblrhwckpwxh259cn2s6ms-haskell-template.drv
unknown-deriver

srid on appreciate.intern nixci on  print-all-deps [!] is 📦 v0.4.0 via 🦀 v1.74.0 via ❄️  impure (nixci-env)
❯ echo $?
0

Copy link
Owner

@srid srid left a comment

Choose a reason for hiding this comment

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

Great, thanks!

I refactored a few things; check the commit log.

I might have to refactor some surrounding code (unchanged in this PR) as well; but will do that in another commit/PR.

@srid srid merged commit 4109ce9 into srid:master May 5, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an option to print all dependencies of outputs
2 participants