Skip to content

nix develop --command doesn't work with a flakeref #13408

Open
@colemickens

Description

@colemickens

Describe the bug

It seems that -c is accepted, but effectively ignored, if the user passes a flakeref at the same time.

Let me show via 3 cases:

Case: -c works with my devShells.x86_64-linux.default (git is coming from the shell):

╭ slynux  ~/code/nixcfg cole-nixcfg-devenv-env 240ms
╰🡒  nix develop --ignore-env -c git --version
warning: Git tree '/home/cole/code/nixcfg' is dirty
git version 2.49.0

Case: it works as expected when I manually enter the devShell, the run a command:

╭ slynux  ~/code/nixcfg shell-ci-env
╰🡒  nix develop .#devenv

╭ slynux  ~/code/nixcfg cole-nixcfg-devenv-env
╰🡒  cargo
Rust's package manager

Case: -c does not work when I use a flakeref to a different devShell:


╭ slynux  ~/code/nixcfg shell-ci-env 2min 37sec 383ms
╰🡒  nix develop .#devenv -c cargo

╭ slynux  ~/code/nixcfg cole-nixcfg-devenv-env 823ms
╰🡒

As you can see, it:

  1. does not run my command
  2. drops me into the develop environment

Expected behavior

That nix develop -c works similarly with and without a flakeref specified

Metadata

I repro'd this with: 2.29, 2.20.9, 2.24, I'm not sure it has ever worked.

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions