cachix / devenv

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

`devenv up` stuck #1525

Open MarceColl opened 2 days ago

MarceColl commented 2 days ago

Describe the bug When I run devenv up in a brand new arch linux machine it gets stuck and never finishes at the Building shell stage. The same devenv.nix works in a separate arch linux machine, also up-to-date.

To reproduce Devenv files: https://gist.github.com/MarceColl/bf5f924cb23b16f2efab99ac5775f451

[seikaku@seikaku seikaku]$ uname -a
Linux seikaku 6.6.52-1-lts #1 SMP PREEMPT_DYNAMIC Wed, 18 Sep 2024 19:02:04 +0000 x86_64 GNU/Linux

I also need --max-jobs=4 in this case for some reason.

[seikaku@seikaku seikaku]$ devenv up --max-jobs=4
• Building processes ...
• Using Cachix: devenv
these 3 derivations will be built:
  /nix/store/q37ckd0zi65qfzkzvzs38akxhbijl3ki-devenv-profile.drv
  /nix/store/8l7v5p81gsfb3zlf27r4sadnabr19nw9-process-compose.yaml.drv
  /nix/store/7zd2ysl9i2fgxrk9gk2drs2v159kxh21-devenv-up.drv
building '/nix/store/q37ckd0zi65qfzkzvzs38akxhbijl3ki-devenv-profile.drv'
created 833 symlinks in user environment
building '/nix/store/8l7v5p81gsfb3zlf27r4sadnabr19nw9-process-compose.yaml.drv'
building '/nix/store/7zd2ysl9i2fgxrk9gk2drs2v159kxh21-devenv-up.drv'
✔ Building processes in 6.1s.
• Starting processes ...
• Building shell ...
building '/nix/store/vjzm8xxzjg7x0y6xkfykndyiqlgxywmy-devenv-shell-env.drv'

User seikaku is part of nixbld.

[seikaku@seikaku seikaku]$ groups
wheel nixbld seikaku

Version

devenv 1.3.0 (x86_64-linux)
sandydoo commented 2 days ago

Does devenv shell work? Also, run it with the --verbose flag to see the nix command it gets stuck on.

MarceColl commented 2 days ago

Sorry, I'm super sleep deprived, I wanted to send this part as well, it gets stuck on

devenv readFile: '«github:cachix/devenv/ef61728d91ad5eb91f86cdbcc16070602e7afa16»/src/modules/latest-version'

Both devenv shell and devenv up get stuck in the same place.

domenkozar commented 2 days ago

I also need --max-jobs=4 in this case for some reason.

Does this mean it only reproduces with 4?

MarceColl commented 2 days ago

It always happens, but if I try it without setting --max-jobs it complains that it cannot build before it even reaches that point.

[seikaku@seikaku seikaku]$ devenv up       
• Building processes ...
• Using Cachix: devenv
these 2 derivations will be built:
  /nix/store/g083qjcf324snh6xx08wfj0gsdjj5qn8-process-compose.yaml.drv
  /nix/store/0iy6yfgp4w2k91dajppgsbic1pchir2h-devenv-up.drv
error:
       error:
                           Unable to start any build;
                           either increase '--max-jobs' or enable remote builds.

                           For more information run 'man nix.conf' and search for '/machines'.
✔ Building processes in 5.3s.
Error:   × Failed to run command `/nix/store/kqn8clfzc13gnqbav7l13r9w7xick9lr-nix-2.24-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 0 --option
  │ eval-cache false --option extra-substituters https://devenv.cachix.org --option extra-trusted-public-keys devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw= build --no-link --print-out-paths .#procfileScript -vv --log-format
  │ internal-json`
  ╰─▶ Nix command failed: exit status: 1
sandydoo commented 1 day ago

The max-jobs issue is a bug on our end. We'll push a fix for it.

In verbose mode, before the Nix output and the line that hangs, there should be a really long Nix command. That's the command it's running. Try running copy-pasting that and running it separately. It might have a hint for us.

MarceColl commented 1 day ago

Sure, the command previous to the failure is

Running command: /nix/store/kqn8clfzc13gnqbav7l13r9w7xick9lr-nix-2.24-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 4 --option eval-cache false eval --json .#devenv.processes
domenkozar commented 1 day ago

Pushed a fix for max_jobs in https://github.com/cachix/devenv/commit/dc7ebaf872306526ea6dcbb2122acca792680701

domenkozar commented 1 day ago

Sure, the command previous to the failure is

Running command: /nix/store/kqn8clfzc13gnqbav7l13r9w7xick9lr-nix-2.24-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 4 --option eval-cache false eval --json .#devenv.processes

Does it work if you run it manually?

MarceColl commented 1 day ago

Looks like it:

$ /nix/store/kqn8clfzc13gnqbav7l13r9w7xick9lr-nix-2.24-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 4 --option eval-cache false eval --json .#devenv.processes
{"postgres":{"exec":"exec /nix/store/wc19qmf9xsry7z9nlcpp9mrwgblcypmj-start-postgres/bin/start-postgres","process-compose":{"availability":{"restart":"on_failure"},"readiness_probe":{"exec":{"command":"/nix/store/b2629mw4kzz7av7m1w9y9g3l103wg2ll-postgresql-15.6/bin/pg_isready -d template1"},"failure_threshold":5,"initial_delay_seconds":2,"period_seconds":10,"success_threshold":1,"timeout_seconds":4},"shutdown":{"signal":2}}}}
[seikaku@seikaku seikaku]$ echo $?
0
sandydoo commented 1 day ago

Are there more in there? Is there one with the command develop in it?

MarceColl commented 1 day ago

Nope, no nix call with develop in it

domenkozar commented 1 day ago

@MarceColl What command hangs if you do devenv --verbose shell? Can you run it manually?

MarceColl commented 1 day ago
[seikaku@seikaku seikaku]$ devenv -v shell 2>&1 | grep command
• Running command: /nix/store/kqn8clfzc13gnqbav7l13r9w7xick9lr-nix-2.24-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 0 --option eval-cache false eval --json .#devenv.cachix
• Running command: /nix/store/kqn8clfzc13gnqbav7l13r9w7xick9lr-nix-2.24-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 0 --option eval-cache false store ping --json
• Running command: /nix/store/kqn8clfzc13gnqbav7l13r9w7xick9lr-nix-2.24-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 0 --option eval-cache false --option extra-substituters https://devenv.cachix.org --option extra-trusted-public-keys devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw= print-dev-env --profile /home/seikaku/seikaku/.devenv/gc/shell
domenkozar commented 1 day ago

@MarceColl if you run the last command manually, does it complete?

domenkozar commented 1 day ago

@MarceColl please book a slot at https://calendly.com/domenkozar and we'll dive into this 1:1