jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
7.83k stars 187 forks source link

error: path '/home' is a symlink for PHP package #2160

Open quazar-omega opened 2 weeks ago

quazar-omega commented 2 weeks ago

What happened?

I was trying to set up PHP, it installs correctly, but if I try to enter the shell it breaks, because it can't resolve my home that is a symlink to /var/home, it's set up this way since I'm using Fedora Kinoite.

Incriminated lines in the generated flake:

      extensions = builtins.concatLists(builtins.filter (x: x != null) [
        (builtins.match "^php.*Extensions\.([^@]*).*$" "path:/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake")
        (builtins.match "^php.*Extensions\.([^@]*).*$" "path:/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake#composer")
        (builtins.match "^php.*Extensions\.([^@]*).*$" "php@latest")
      ]);

Possibly related issue: https://github.com/DeterminateSystems/nix-installer/issues/912 (it's the installer that I used, though I never faced the mentioned issue, probably because I installed it one month after that issue was reported, so the fix might have already landed when I did)

Steps to reproduce

  1. Have the system home directory be a symbolic link, e.g. on Fedora Atomic
  2. Run devbox init
  3. Run devbox add php
  4. Run devbox shell
  5. Can't enter the shell because the expression evaluation fails

Command

shell

devbox.json

{
  "$schema":  "https://raw.githubusercontent.com/jetify-com/devbox/0.11.0/.schema/devbox.schema.json",
  "packages": ["php@latest"],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.11.0

Nix version

nix (Nix) 2.21.2

What system does this bug occur on?

Linux (x86-64)

Debug logs

2024/06/18 22:57:39 findProjectDir: path is 
2024/06/18 22:57:39 finding devbox config in dir: /home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling
2024/06/18 22:57:39 findProjectDir: path is 
2024/06/18 22:57:39 finding devbox config in dir: /home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling
2024/06/18 22:57:39 nix --version --debug output:
nix (Nix) 2.21.2
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/amusing-dove/.config/nix/nix.conf:/home/amusing-dove/.config/kdedefaults/nix/nix.conf:/etc/xdg/nix/nix.conf:/usr/share/kde-settings/kde-profile/default/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/00dc6iygj63mjcmixki1vwg7m1jbdi9p-nix-2.21.2/share
2024/06/18 22:57:39 findProjectDir: path is 
2024/06/18 22:57:39 finding devbox config in dir: /home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling
Info: Ensuring packages are installed.
2024/06/18 22:57:39 Creating files for package "php@latest" create files
2024/06/18 22:57:39 Creating file "/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/process-compose.yaml" from contentPath: "php/process-compose.yaml"
2024/06/18 22:57:39 Creating file "/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake/flake.nix" from contentPath: "php/flake.nix"
Warning: Outputs for path:/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake are not in lockfile. Fetching store paths from nix, this may take a while
2024/06/18 22:57:39 Running cmd /nix/var/nix/profiles/default/bin/nix path-info path:/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake --json --impure --extra-experimental-features ca-derivations --option experimental-features nix-command flakes fetch-closure

Error: error installing package path:/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake
source: nix path-info exit code: 1, output: error (ignored): error: end of string reached
error:
       … while fetching the input 'path:/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake'

       error: path '/home' is a symlink
, err: exit status 1

2024/06/18 22:57:39 Command stderr: error (ignored): error: end of string reached
error:
       … while fetching the input 'path:/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake'

       error: path '/home' is a symlink

2024/06/18 22:57:39 
ExecutionID:3a841b640c76441eadf0093b005976be
nix path-info exit code: 1, output: error (ignored): error: end of string reached
error:
       … while fetching the input 'path:/home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling/.devbox/virtenv/php/flake'

       error: path '/home' is a symlink
, err: exit status 1
go.jetpack.io/devbox/internal/nix.StorePathsFromInstallable
        go.jetpack.io/devbox/internal/nix/store.go:41
go.jetpack.io/devbox/internal/devpkg.(*Package).GetStorePaths
        go.jetpack.io/devbox/internal/devpkg/package.go:758
go.jetpack.io/devbox/internal/devbox.(*Devbox).packagesToInstallInStore
        go.jetpack.io/devbox/internal/devbox/packages.go:575
go.jetpack.io/devbox/internal/devbox.(*Devbox).installNixPackagesToStore
        go.jetpack.io/devbox/internal/devbox/packages.go:448
go.jetpack.io/devbox/internal/devbox.(*Devbox).installPackages
        go.jetpack.io/devbox/internal/devbox/packages.go:404
go.jetpack.io/devbox/internal/devbox.(*Devbox).ensureStateIsUpToDate
        go.jetpack.io/devbox/internal/devbox/packages.go:271
go.jetpack.io/devbox/internal/devbox.(*Devbox).ensureStateIsUpToDateAndComputeEnv
        go.jetpack.io/devbox/internal/devbox/devbox.go:1015
go.jetpack.io/devbox/internal/devbox.(*Devbox).Shell
        go.jetpack.io/devbox/internal/devbox/devbox.go:207
go.jetpack.io/devbox/internal/boxcli.runShellCmd
        go.jetpack.io/devbox/internal/boxcli/shell.go:83
go.jetpack.io/devbox/internal/boxcli.shellCmd.func1
        go.jetpack.io/devbox/internal/boxcli/shell.go:36
github.com/spf13/cobra.(*Command).execute
        github.com/spf13/cobra@v1.8.0/command.go:983
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/cobra@v1.8.0/command.go:1115
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/cobra@v1.8.0/command.go:1039
go.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute
        go.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:61
go.jetpack.io/devbox/internal/boxcli.Execute
        go.jetpack.io/devbox/internal/boxcli/root.go:113
go.jetpack.io/devbox/internal/boxcli.Main
        go.jetpack.io/devbox/internal/boxcli/root.go:136
main.main
        go.jetpack.io/devbox/cmd/devbox/main.go:11
runtime.main
        runtime/proc.go:271
runtime.goexit
        runtime/asm_amd64.s:1695
2024/06/18 22:57:39 findProjectDir: path is 
2024/06/18 22:57:39 finding devbox config in dir: /home/amusing-dove/Documenti/Develop/Languages/PHP/array-mangling