Open nick-kadutskyi opened 2 weeks ago
I reverted to devenv version 1.0.3
and that seems to have fixed it for me.
I can successfully run devenv up
inside a direnv
shell, but it fails when run from a shell created with nix develop --impure
. Not sure what the issue is yet.
We need to remove this line from the template: packages.devenv-up = self'.devShells.default.config.procfileScript;
.
This fixes the error, but I then run into the same issue as the regular flake.
The socket isssue is macos-specific.
Our runtime dir is: DEVENV_RUNTIME=/tmp/devenv-8e7ea8e
The tmp dir in nix develop --impure
shell is: TMP=/tmp/nix-shell.uRu0AU
process-compose is looking for the socket in: /tmp/nix-shell.uRu0AU/devenv-8e7ea8e/pc.sock
I believe what's happening is that devenv never creates the /tmp/nix-shell.uRu0AU/devenv-8e7ea8e
directory.
Before nix develop
takes over the shell, the runtime dir is set to /tmp/devenv-<hash>
and created.
After nix develop
, nix sets TMPDIR
to /tmp/nix-shell.<hash>
, which then changes the runtime dir to /tmp/nix-shell.<hash>/devenv-<hash>
. This dir is never created.
The reason this doesn't happen on NixOS is because XDG_RUNTIME_DIR
is set by default, which takes precedence over TMPDIR
in devenv.
And direnv
's nix integration unsets TMPDIR
, which is why it also works.
@domenkozar, see https://github.com/cachix/devenv/issues/1153#issuecomment-2068078326. There's 2 ways to fix this:
mkdir
in the procfileScript
to create the new runtime dir. Could be problematic if anything is put into the original runtime dir on shell creation and is required later on.DEVENV_RUNTIME
env var and modify the devenv.runtime
default. One issue here is that devenv.tmpdir
gets updated to /tmp/nix-shell.<hash>
, but nothing seems to be using this.Alternatively, maybe we can create the runtime dir in a script passed to nix develop
? Would this work?
Describe the bug Running
devenv up
innix develop --impure
shell fails in flake config based on default flake template:When I use
flake-parts
flake template it fails in a different way. I get the same error when I rundevenv up
on fresh template or if I add some process (processes.run.exec="hello"
) indevenv.shells.default
:To reproduce For default flake template:
mkdir devenvsh-test && cd $_
nix flake init --template github:cachix/devenv
nix develop --impure
devenv up
FTL start UDS http server on /tmp/nix-shell.kxqGNh/devenv-76311b3/pc.sock failed error="listen unix /tmp/nix-shell.kxqGNh/devenv-76311b3/pc.sock: bind: no such file or directory"
errorOr for
flake-parts
template:mkdir devenvsh-test && cd $_
nix flake init --template github:cachix/devenv#flake-parts
nix develop --impure
devenv up
error: attribute 'config' missing
error.Version