divnix / std

A DevOps framework for the SDLC with the power of Nix and Flakes. Good for keeping deadlines!
https://std.divnix.com
377 stars 41 forks source link

STD Overriding PRJ_ROOT #365

Closed keidrych closed 6 months ago

keidrych commented 6 months ago

Project structure follows

/.config/
/.envrc
/nix/<cells>/devshells.nix
/projectA/.envrc
/projectB/.envrc

Direnv is enabled & when you switch to projectA or any other directory containing .envrc the respective DevShell would be loaded

numtide/prj-spec scans for .config to identify a PRJ_ROOT https://github.com/numtide/prj-spec/blob/main/contrib/direnv#L5

What is happening is direnv correctly displays PRJ_ROOT when switching shell, however when STD starts via use envreload //<cell>/devshells/default PRJ_ROOT is overridden from the actual PRJ_ROOT to that of the directory you are currently in.

All other PRJ_* values are still correct

keidrych commented 6 months ago

Located the source of the issue: https://github.com/numtide/devshell/blob/44ddedcbcfc2d52a76b64fb6122f209881bd3e1e/modules/devshell.nix#L60

DevShell is ultimately the culprit in this case will move discussion over