diff --git a/doc/using/configuration.chapter.md b/doc/using/configuration.chapter.md index 5934726c068b..c54124fbe7a6 100644 --- a/doc/using/configuration.chapter.md +++ b/doc/using/configuration.chapter.md @@ -31,6 +31,22 @@ Unfree software is not tested or built in Nixpkgs continuous integration, and th Most unfree licenses prohibit either executing or distributing the software. ::: +The `NIXPKGS_CONFIG` environment variable can override the configuration file location. +Nixpkgs resolves the config in this order: + +1. `$NIXPKGS_CONFIG`, if set and the file exists. +2. `~/.config/nixpkgs/config.nix`, if it exists. +3. `~/.nixpkgs/config.nix` (legacy), if it exists. +4. Empty configuration. + +On NixOS, `NIXPKGS_CONFIG` points to `/etc/nix/nixpkgs-config.nix` system-wide. +Drop a file there to apply configuration to `nix-env`, `nix-shell`, and other user-level commands. +NixOS does not create this file. +The [`nixpkgs.config`](https://nixos.org/manual/nixos/stable/options#opt-nixpkgs.config) option does not affect `nix-env`, `nix-shell`, or other user-level commands. + +This lookup applies to non-flake usage like channels and ``. +Flakes ignore it; pass `config` directly when importing `nixpkgs`. + ## Installing broken packages {#sec-allow-broken} There are several ways to try compiling a package which has been marked as broken.