Skip to content

nix run -f does not accept subcommand arguments #14698

@roberth

Description

@roberth

Describe the bug

# setup, specifics don't matter
$ echo 'derivation { name = "hi"; system = "foo"; }' >open-docs.nix

$ nix run -f open-docs.nix -- subpath.html
error: attribute 'subpath' in selection path 'subpath.html' not found

It's treating the argument as an attribute path. YIKES

Steps To Reproduce

Yes ^

Expected behavior

At the very least, treat arguments as exec arguments.

$ nix run -f open-docs.nix -- subpath.html
opening /nix/store/.../subpath.html

Probably the -- should have significant meaning in this case (besides allowing -foo syntax)

$ nix run -f open-docs.nix greeter -- --subject traveler  # note the attribute, greeter
hello, traveler

Metadata

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnew-cliRelating to the "nix" command

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions