cachix / devenv

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

Devcontainer not working for devenv development #171

Closed shyim closed 1 year ago

shyim commented 1 year ago

Describe the bug

@shyim ➜ /workspaces/devenv (main) $ ./result/bin/devenv shell
Building shell ...
warning: Git tree '/workspaces/devenv' is dirty
error: suspicious ownership or permission on '/nix/store/rbi9ibwrwa6mrv8a08q2kjgq7issgwvm-devcontainer.json' for output 'out'; rejecting this build output
error: 1 dependencies of derivation '/nix/store/2d2x8py0nvnq4r2n6dn6x8hanm29bha2-devenv-env.drv' failed to build
@shyim ➜ /workspaces/devenv (main) $ ls -la /nix/store/rbi9ibwrwa6mrv8a08q2kjgq7issgwvm-devcontainer.json
-rw-r--rw- 1 nixbld1 nixbld 74 Dec  2 11:58 /nix/store/rbi9ibwrwa6mrv8a08q2kjgq7issgwvm-devcontainer.json

Deleting that file and opening the shell does not help its broken again

To Reproduce

nix build
./result/bin/devenv shell

Version

main branch (89cd0f7d6122cbe1f351e8f6fccc7fc638690e9f)

domenkozar commented 1 year ago

I see the issue, I'll look into it.

domenkozar commented 1 year ago

Also need to install https://github.com/direnv/direnv-vscode

kkharji commented 1 year ago

Same issue, just devcontainer.enable = true then opened it for testing.

edit: Removing .devcontainer.json fixed it

jonasb commented 1 year ago

I get the same issue when using the devcontainer created by devcontainer.enable = true in my own repo as well. So it seems to not only be when working on devenv itself.

devenv: 0.4

domenkozar commented 1 year ago

I'll fix this one soon, I have an idea how to get it done.

domenkozar commented 1 year ago

Need to check what they do in https://github.com/zombiezen/codespaces-nix

thedavidmeister commented 1 year ago

deleting .devcontainer.json did not work for me, it simply meant that the default codespaces without devenv was used so i couldn't enter a devenv shell

between this issue and https://github.com/cachix/devenv/issues/267 i'm locked out of using devenv atm 😞

domenkozar commented 1 year ago

I'll look into this one tomorrow

thedavidmeister commented 1 year ago

@domenkozar any luck/progress/workaround for this one?

domenkozar commented 1 year ago

https://github.com/cachix/devenv/pull/482 should fix it and I pushed the newest image.

Can you try using devcontainer on the repo that didn't work before?

thedavidmeister commented 1 year ago

@domenkozar this bug does seem to be fixed, sadly cargo seems to be blowing resource limits on codespaces, even on a machine that would cost me $50-100 a month

any chance we could get it compiling on mac? https://github.com/cachix/devenv/issues/267

shyim commented 1 year ago

do you have an example repo? sounds strange

thedavidmeister commented 1 year ago

@shyim it's not that strange that rust uses a ton of memory, storage and cpu to compile

this was enough to get a sigkill during compilation (usually means resource usage on CI)

cargo install --git https://github.com/foundry-rs/foundry foundry-cli anvil chisel --bins --locked

an 8 core codespace is $0.72 an hour and still sigkills (but that can just be because rust throws more jobs based on CPU than it has memory to handle, so scaling up resources can do nothing to fix these issues without extra config)