Teach pure interfaces by default
Nobody has claimed this yet.
- Dominant language
- Nix
- Stars
- 4k
- Forks
- 339
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 7
Description
Observations
We're currently showing patterns like
pkgs = import nixpkgs { config = {}; overlays = []; system = builtins.currentSystem; };
as a defensive measure against historical, impure interfaces that may mess with your expression if you happened to follow the ancient documentation on configuring Nixpkgs.
Problem
Dismantling the Nixpkgs manual is a big chunk of work, and in any case that wouldn't remove the convenient-looking but foot-gunny impure interface which is used absolutely everywhere.
Approaches
Until https://github.com/NixOS/nixpkgs/issues/339635 is settled, we can only show the ugly but technically correct
pkgs = import "${nixpkgs}/pkgs/top-level" { localSystem.system = builtins.currentSystem; };
and may eventually please today's new users with a future release that makes the interface less verbose.
This would require replacing all instances where we use it, and updating the relevant best practices section.
Willing to help?
As always.
Priorities
Add 👍 to issues you find important.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the nix.dev repository for instances of the impure Nixpkgs import pattern shown in the issue, then locate the relevant best-practices section. Replace the documented examples with the technically correct interface described here and update that guidance; done means the old pattern is no longer presented in the affected documentation.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100