Skip to content

devenv build returns stale rust output #2886

Description

@Toxaris

Describe the bug

devenv build fails to rebuild a config.languages.rust.import derivation when source files change.

To reproduce

Set up a minimal devenv+rust project in an empty directory:

mkdir repro
cd repro
devenv init
echo '{ config, ...}: { languages.rust.enable = true; outputs.repro = config.languages.rust.import ./. {}; }' > devenv.nix
devenv inputs add crate2nix github:nix-community/crate2nix --follows nixpkgs
devenv shell cargo init

At this point, we have a working project that we can compile both inside and outside the devenv shell:

devenv shell cargo run # compiles and prints 'Hello, world!'
$(devenv build | jq -r '.["outputs.repro"]')/bin/repro # compiles and prints 'Hello, world!'

Now change the source file and try again:

sed -i 's/Hello/Goodbye/' src/main.rs
devenv shell cargo run # recompiles and prints 'Goodbye, world!' (good)
$(devenv build | jq -r '.["outputs.repro"]')/bin/repro # prints 'Hello, world!' (bad)

I expect that after changing the source file, devenv build recompiles to pick up the changes.

Version

$ devenv version
devenv 2.1.2 (x86_64-linux)

My devenv is managed by home-manager which is running on NixOS-WSL.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions