devenv icon indicating copy to clipboard operation
devenv copied to clipboard

Add mechanism to allow processes in composed imports to run with their relative working directory

Open AndrewIngram opened this issue 2 years ago • 7 comments

At present, any process defined in an imported subproject (such as frontend or backend in the following example) will be run with the cwd (current working directory) of this parent devenv. Some mechanism to allow them to easily run in isolation (from their own directories) or as part of the greater devenv could be valuable.

inputs:
  nixpkgs:
    url: github:NixOS/nixpkgs/nixpkgs-unstable
  devenv:
    url: github:cachix/devenv
imports:
- ./frontend
- ./backend

AndrewIngram avatar Jan 20 '23 17:01 AndrewIngram

Currently we have env.DEVENV_ROOT, but ideally we'd also have env.DEVENV_PARENT_DIR (needs a better name) to reflect this.

domenkozar avatar Jan 22 '23 16:01 domenkozar

Does flake-root solve this?

MrFoxPro avatar Jul 01 '23 19:07 MrFoxPro

No.

domenkozar avatar Jul 02 '23 14:07 domenkozar

As usual, process-compose solves this, at least partially.

You can explicitly specify the processes.${process-name}.process-compose.working_dir attribute to change the CWD. This can be done in the "parent" devenv, which already has an idea where that might be.

You still have to do it for all CWD-dependent processes by hand, so it's not optimal.

@domenkozar one more reason to make process-compose the default when the python 1.0 version comes out 🤞

thenonameguy avatar Feb 15 '24 09:02 thenonameguy

Can you show an example?

domenkozar avatar Feb 16 '24 09:02 domenkozar

See: https://github.com/schemamap/schemamap/pull/10 See commits 2-4.

thenonameguy avatar Feb 16 '24 11:02 thenonameguy

Alright 1.0 ships with process-compose as the default so hopefully we can make this happen.

domenkozar avatar Mar 25 '24 23:03 domenkozar