NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
11.45k stars 1.44k forks source link

Settings aliases are not supported as flags, while their "real" names are #10989

Open cole-h opened 2 days ago

cole-h commented 2 days ago

Describe the bug

It is possible to specify nix.conf options on the command line with --<option name> <option value if necessary> (as opposed to --option <option name> <option value if necessary>). However, this does not appear to extend to aliases.

When running nix eval --expr '{}' --build-cores 0, the --build-cores flag is unrecognized. However, passing it as an --option allows it to work.

Steps To Reproduce

  1. Install Nix 2.23.1
  2. Run nix eval --expr '{}' --build-cores 0
  3. See error that build-cores is not recognized (despite there being an alias to it from cores)
  4. Try again with --cores 0 and see it succeed

This is reproducible for all settings with aliases.

Expected behavior

Aliases of nix.conf settings should work when passed as a flag, without needing to resort to --option <setting alias name> <value>

nix-env --version output

Reproduced on nix-env (Nix) 2.21.2, nix-env (Nix) 2.23.1, and nix-env (Nix) 2.24.0pre20240617_daf1b6b

Additional context

Priorities

Add :+1: to issues you find important.