devenv icon indicating copy to clipboard operation
devenv copied to clipboard

Allow recursively finding the devenv.nix in the parent folders inside a monorepo

Open onnimonni opened this issue 4 months ago • 3 comments

Hey!

It would be beneficial to be able to start the postgresql server when I'm inside a subfolder in a monorepo:

$ devenv processes up
Error:   × File devenv.nix does not exist. To get started, run:
  │
  │     $ devenv init
  │

$ ls -lah ../../devenv*
.rw-r--r-- 2.8k onnimonni 20 Oct 10:39 ../../devenv.lock
.rw-r--r-- 3.6k onnimonni 21 Oct 09:08 ../../devenv.nix
.rw-r--r--  201 onnimonni 20 Oct 10:38 ../../devenv.yaml

Currently I need to go back to the root folder everytime to run this.

Or would there be another way to achieve this?

onnimonni avatar Oct 21 '25 06:10 onnimonni

Maybe we could crawl up and ask to run it from parent(s) folder. I guess that's better than what we have now. WDYT?

domenkozar avatar Oct 22 '25 16:10 domenkozar

Yeah that would be perfect ☺️

onnimonni avatar Oct 23 '25 03:10 onnimonni

A possible way to do this is to add a script alias to run devenv in the project root:

    scripts = {
      devenv = {
        description = "Alias of devenv command, ran in the project root";
        exec = ''
          cd "''${DEVENV_ROOT}"
          devenv "''${@}"
        '';
      };
  };

landure avatar Oct 28 '25 12:10 landure