-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fromFlakeRoot
option, start processes in $FLAKE_ROOT
by default.
#29
Conversation
fromFlakeRoot
option, start processes in $FLAKE_ROOT by default.
fromFlakeRoot
option, start processes in $FLAKE_ROOT by default.fromFlakeRoot
option, start processes in $FLAKE_ROOT
by default.
Maybe warn if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for #25 (which I didn't entirely understand)?
The problem with this PR is that it will work in some cases (eg: devShell), but not in other cases (eg: nix run
). Unless you disable auto wiring (#27), don't add packages.*
and say "My process-compose configuration is meant to work only in the devShell"
Could you state the real-world use case where you need this? Let me think about the problem first, before getting to the solution. |
no, it's not for #25. let
cwd = "./deno/web";
in
process-compose."dev:web-deno".settings.processes.web = {
command = "exec deno run -A --node-modules-dir npm:vite";
working_dir = cwd;
}; in root imports = with inputs; [
flake-root.flakeModule
devenv.flakeModule
treefmt-nix.flakeModule
process-compose-flake.flakeModule
./deno/api/api-deno.nix
./deno/web/web-deno.nix
./node/web/web-node.nix
]; |
I'm not sure, but maybe in case of |
So it is a devShell only process? One way to solve this is to use it in combination with https://github.com/Platonic-Systems/mission-control which does support FLAKE_ROOT (unless Is this solution sufficient? |
You can run |
Not sure, I took process-compose especially to run multiple commands in parallel.
Yeah, if you mean that running package that is produced by |
It does. Here's a simple example https://github.com/srid/ema-template/blob/master/flake.nix Line 55 defines the process-compose group. process-compose.run = {
tui = false;
settings.processes = {
haskell.command = "ghcid";
tailwind.command = "${lib.getExe pkgs.haskellPackages.tailwind} -w -o ./static/tailwind.css './src/**/*.hs'";
};
}; Then line 82 uses it from mission-control, run = {
description = "Run the dev server (ghcid + tailwind)";
exec = config.process-compose.run.outputs.package;
}; That last part provides Let me think about this. Meanwhile, your PR can be improved to directly use the package as well, cf. https://github.com/srid/proc-flake/blob/676b5af467e52c06aa8a9165edb3345c6dbbabde/flake-module.nix#L53-L54
Is your |
Yep, so mission-control could be used together with process-compose. Nice! @srid thanks, I opened here: |
Nushell supports this: |
I mean, how it's supposed to work outside of devshell anyway? Does process-compose use |
I can do this: ${if !lib.inPureEvalMode && config.fromFlakeRoot then "[[ -n $FLAKE_ROOT ]] && cd \"$FLAKE_ROOT\"" else "echo 'Warning: $FLAKE_ROOT' is not defined, script will start agains you current CWD" } This should work if |
Now there is strange thing: process-compose."dev:web-node".settings = {
processes.web = {
command = "ls; echo $PWD; echo $(pwd)";
working_dir = "./node/web";
};
};
$PWD now is always same as $FLAKE_ROOT |
Closing per this ^ |
No description provided.