Skip to content

Inconsistent behavior of "--" in nix run #13994

@rszyma

Description

@rszyma

Describe the bug

Currently these 2 commands are equivalent:

  1. nix run nixpkgs#eza -- arg1 arg2
  2. nix run -- nixpkgs#eza arg1 arg2

In the 2nd case - when trying to skip installable (to use the default .#.) and supplying args to the nested command after -- - nix run expects the first argument after the -- to be an "installable". The problem is that it's inconsistent compared to when installable is provided before --.

Steps To Reproduce

  1. Run nix run -- arg1 arg2.

Expected behavior

It should run app/package at .#., just like nix run does. Everything else after -- should be passed to the command. But the arg1 is not passed as arg, but an installable.

Metadata

nix-env (Nix) 2.31.1

Additional context

May be resolved / made irrelevant by implementing #6933 (comment), provided that we decide to completely remove -- from nix run - see the comment #6933 (comment).

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnew-cliRelating to the "nix" command

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions