nix.dev
nix.dev copied to clipboard
Teach pure interfaces by default
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 :+1: to issues you find important.