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

feature nix: add option useAttrPath to use packages attribute path #787

Merged

Conversation

nohzafk
Copy link
Contributor

@nohzafk nohzafk commented Jan 1, 2024

Add an option useAttrPath to install packages with nix-env -iA

Name conversion

If package name doesn't start with nixpkgs., nixpkgs. will be added as prefix to pacakge name automatically.

Compatibility

useAttrPath use false as default value, which won't break existing usage and remains compatibility.

Precision and Reliability

Using nix-env -iA ensures the installation of the exact package specified by its attribute path. This precision eliminates any ambiguity that might arise from nix-env --install, which can install unintended packages if multiple matches are found for a given name or description.

Consistency with NixOS Package Search

The attribute paths used with nix-env -iA directly correspond to those listed on the NixOS package search site(https://search.nixos.org/packages). This consistency simplifies the process of finding and installing packages as per official documentation and resources.

@nohzafk nohzafk requested a review from a team as a code owner January 1, 2024 13:49
@nohzafk
Copy link
Contributor Author

nohzafk commented Jan 1, 2024

@microsoft-github-policy-service agree

@eljog
Copy link
Member

eljog commented Jan 4, 2024

Thank you for the contribution. This sounds like a great addition.
I have approved for the workflow runs.

@nohzafk
Copy link
Contributor Author

nohzafk commented Jan 9, 2024

@eljog hello~ just ping to see how was the result, still waiting for one approving review to be merge 😃
i just rebase it on the latest main brach, just your approval to run the workflow again~

@nohzafk nohzafk force-pushed the nix-env-option-attr-path branch from ba85e37 to da7abcc Compare January 9, 2024 14:38
Copy link
Member

@samruddhikhandale samruddhikhandale left a comment

Choose a reason for hiding this comment

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

Thank you for adding this super cool Feature option, appreciate it ✨

Left some minor comments, otherwise looks great!

src/nix/devcontainer-feature.json Show resolved Hide resolved
src/nix/devcontainer-feature.json Outdated Show resolved Hide resolved
src/nix/install.sh Outdated Show resolved Hide resolved
@nohzafk
Copy link
Contributor Author

nohzafk commented Jan 18, 2024

@samruddhikhandale all fixed, thanks.

eljog
eljog previously approved these changes Jan 18, 2024
Copy link
Member

@eljog eljog left a comment

Choose a reason for hiding this comment

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

@nohzafk
Copy link
Contributor Author

nohzafk commented Jan 18, 2024

sorry, forget to update the opiton name to useAttributePath in test. updated.

Copy link
Member

@samruddhikhandale samruddhikhandale left a comment

Choose a reason for hiding this comment

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

🚢 Thanks!

@samruddhikhandale samruddhikhandale merged commit 2b2a5f6 into devcontainers:main Jan 18, 2024
11 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.

3 participants