mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-26 02:05:02 +00:00
`attrListWith` re-emits every flag as an `lib.mkOrder` definition, so `argv` and `flags` share one ordering space. Unadorned flags arrived at `lib.modules.defaultOrderPriority`, the same priority as unadorned `argv`, and only landed after `argv` because the declaring module's `config` happened to be collected last. Give flags that carry no ordering property of their own a priority of 1250, between `lib.modules.defaultOrderPriority` and `lib.mkAfter`. Plain flags now provably follow plain `argv`, `lib.mkAfter` on `argv` still places trailing positional arguments after the flags, and an explicit `lib.mkOrder` on a flag is honoured verbatim, which is what interleaving a sub-command among flags needs. Also render path flag values through `pathOrStr`. `lib.cli.toCommandLine` formats values with `lib.generators.mkValueStringDefault`, which has no case for paths and aborts; coercing first yields the store path, matching `argv`. Assisted-by: Claude:claude-opus-5