cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
3.47k stars 252 forks source link

devenv up -d (detach) argument does not work #1159

Open noverby opened 1 week ago

noverby commented 1 week ago

According to https://devenv.sh/services, devenv up support detaching with the -d argument, but the argument does nothing, and it is not documented either with --help, that it is an available option.

domenkozar commented 1 week ago

Are you using flakes?

❯ devenv up --help
Start processes in the foreground. https://devenv.sh/processes/

Usage: devenv up [OPTIONS] [PROCESS]

Arguments:
  [PROCESS]  Start a specific process.

Options:
  -d, --detach  Start processes in the background.
  -h, --help    Print help
noverby commented 1 week ago

Yes, using inputs:

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    git-hooks = {
      url = "github:cachix/git-hooks.nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    devenv = {
      url = "github:cachix/devenv";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.pre-commit-hooks.follows = "git-hooks";
    };
  };

I'm getting the output:

❯ devenv up --help
{"level":"warn","error":"open /home/noverby/.config/process-compose/settings.yaml: no such file or directory","time":"2024-04-22T11:17:29+02:00","message":"Error reading settings file /home/noverby/.config/process-compose/settings.yaml"}
Run all the process compose processes.
If one or more process names are passed as arguments,
will start them and their dependencies only

Usage:
  process-compose up [PROCESS...] [flags]

Flags:
  -f, --config stringArray      path to config files to load (env: PC_CONFIG_FILES)
  -h, --help                    help for up
  -d, --hide-disabled           hide disabled processes
  -n, --namespace stringArray   run only specified namespaces (default all)
      --no-deps                 don't start dependent processes
  -r, --ref-rate int            TUI refresh rate in seconds (default 1)
  -R, --reverse                 sort in reverse order
  -S, --sort string             sort column name. legal values (case insensitive): [AGE, EXIT, HEALTH, NAME, NAMESPACE, PID, RESTARTS, STATUS] (default "NAME")
      --theme string            select process compose theme (default "Default")
  -t, --tui                     enable TUI (-t=false) (env: PC_DISABLE_TUI) (default true)

Global Flags:
      --keep-tui             keep TUI running even after all processes exit
  -L, --log-file string      Specify the log file path (env: PC_LOG_FILE) (default "/tmp/nix-shell.o1NNhj/process-compose-noverby.log")
noverby commented 1 week ago

Oh, just noticed that we are using the workaround provided by https://github.com/cachix/devenv/issues/756, so that is probably why it doesn't support --detach:

packages.devenv-up = {stdenv}: self.devShells.${stdenv.system}.default.config.procfileScript;
domenkozar commented 1 week ago

Yeah if you'd like to use -d you have to use devenv cli.

noverby commented 1 day ago

For ref: process-compose issue to add support for --detach argument: https://github.com/F1bonacc1/process-compose/issues/169