Skip to content

Conversation

@s3igo
Copy link
Contributor

@s3igo s3igo commented Apr 19, 2025

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.

@NixOSInfra NixOSInfra added the 12.first-time contribution This PR is the author's first one; please be gentle! label Apr 19, 2025
@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 19, 2025
@nix-owners nix-owners bot requested a review from kalbasit April 19, 2025 05:12
@acid-bong
Copy link
Contributor

Nixpkgs manual has an example of using cross env when it's possible: https://nixos.org/manual/nixpkgs/unstable/#installshellfiles-installshellcompletion-exampleusage-guarded. Maybe use that?

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.

Hello!

Welcome to the Nix project and thanks for the PR.

I added a minor comment.

Regarding the rest, I will check later if a more up to date way is available for the completions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this and use writableTmpDirAsHomeHook

@s3igo
Copy link
Contributor Author

s3igo commented Apr 19, 2025

Nixpkgs manual has an example of using cross env when it's possible: https://nixos.org/manual/nixpkgs/unstable/#installshellfiles-installshellcompletion-exampleusage-guarded. Maybe use that?

Is it suggesting that using lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) as a guard is not idiomatic? I implemented it this way because similar approaches were taken in packages like Starship and Zellij.

@drupol

This comment was marked as resolved.

@s3igo s3igo force-pushed the pet-shell-completions branch from 1479720 to 6021a59 Compare April 19, 2025 08:36
@s3igo
Copy link
Contributor Author

s3igo commented Apr 19, 2025

Nixpkgs manual has an example of using cross env when it's possible: https://nixos.org/manual/nixpkgs/unstable/#installshellfiles-installshellcompletion-exampleusage-guarded. Maybe use that?

Yes, this is precisely what I was looking for. When using this, there's no need to have a condition (lib.optionalString). If you could implement that preferred solution, it would be great.

As I'm still learning Nix, I'm confused about why this approach eliminates the need for lib.optionalString.
Could you please provide guidance on the implementation approach?

@drupol
Copy link
Contributor

drupol commented Apr 19, 2025

Nixpkgs manual has an example of using cross env when it's possible: https://nixos.org/manual/nixpkgs/unstable/#installshellfiles-installshellcompletion-exampleusage-guarded. Maybe use that?

Yes, this is precisely what I was looking for. When using this, there's no need to have a condition (lib.optionalString). If you could implement that preferred solution, it would be great.

As I'm still learning Nix, I'm confused about why this approach eliminates the need for lib.optionalString. Could you please provide guidance on the implementation approach?

Please ignore my last comment, I have been too quick reviewing this and my comment is wrong. What you did is fine and I'm going to merge it after my local nixpkgs-review is done.

@drupol
Copy link
Contributor

drupol commented Apr 19, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 399954


x86_64-linux

✅ 1 package built:
  • pet

@drupol drupol merged commit 919cb29 into NixOS:master Apr 19, 2025
23 of 27 checks passed
@drupol
Copy link
Contributor

drupol commented Apr 19, 2025

Thank you ! Keep PRs coming :)

@s3igo s3igo deleted the pet-shell-completions branch April 20, 2025 03:01
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-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants