jetify-com / devbox

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

[Bug]: Nix threw`SSL connect error (35)` on all `devbox` commands on macOS #1034

Open michaellzc opened 1 year ago

michaellzc commented 1 year ago

Current Behavior (bug)

Summary: Whenever Nix made network requests, it failed with SSL connect error (35) in the error message

Reproduce:

Follow the Get Started guide to install devbox.

curl -fsSL https://get.jetpack.io/devbox | bash
$ devbox add go_1_19                 

warning: error: unable to download 'https://github.com/NixOS/nixpkgs/archive/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62.tar.gz': SSL connect error (35); retrying in 269 ms
warning: error: unable to download 'https://github.com/NixOS/nixpkgs/archive/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62.tar.gz': SSL connect error (35); retrying in 519 ms
warning: error: unable to download 'https://github.com/NixOS/nixpkgs/archive/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62.tar.gz': SSL connect error (35); retrying in 1175 ms
error: download of 'https://github.com/NixOS/nixpkgs/archive/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62.tar.gz' was interrupted
$ DEVBOX_DEBUG=1 devbox shell

onfig.go:125: findProjectDir: path is
config.go:166: finding devbox.json in dir: /Users/michael/<redacted>
[DEBUG] 2023/05/19 21:03:51 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:51: Debug mode enabled.
[DEBUG] 2023/05/19 21:03:51 go.jetpack.io/devbox/internal/impl/config.go:125: findProjectDir: path is
[DEBUG] 2023/05/19 21:03:51 go.jetpack.io/devbox/internal/impl/config.go:166: finding devbox.json in dir: /Users/michael/<redacted>
Reinitialized existing Git repository in /Users/michael/<redacted>/.devbox/gen/flake/.git/
[DEBUG] 2023/05/19 21:03:51 go.jetpack.io/devbox/internal/impl/devbox.go:925: failed to clean up script file .hooks.sh, error = remove /Users/michael/<redacted>/.devbox/gen/scripts/.hooks.sh.sh: no such file or directory
Ensuring packages are installed.
[DEBUG] 2023/05/19 21:03:52 go.jetpack.io/devbox/internal/impl/devbox.go:748: current environment PATH is: <redacted>
[DEBUG] 2023/05/19 21:03:52 go.jetpack.io/devbox/internal/nix/nix.go:68: Running print-dev-env cmd: /usr/local/bin/nix print-dev-env /Users/michael/<redacted>/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json
Error: Command: /usr/local/bin/nix print-dev-env /Users/michael/<redacted>/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json: exit status 1

[DEBUG] 2023/05/19 21:03:57 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:72: Command stderr: path '/Users/michael/<redacted>/.devbox/gen/flake/flake.nix' does not contain a 'flake.nix', searching up
warning: Git tree '/Users/michael/<redacted>/.devbox/gen/flake' is dirty
warning: error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': SSL connect error (35); retrying in 286 ms
warning: error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': SSL connect error (35); retrying in 600 ms
warning: error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': SSL connect error (35); retrying in 1009 ms
warning: error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': SSL connect error (35); retrying in 2440 ms
error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': SSL connect error (35)
(use '--show-trace' to show detailed location information)

[DEBUG] 2023/05/19 21:03:57 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:74:
ExecutionID:40f2f1aa1225442bb07f35c3338e45f0
exit status 1
Command: /usr/local/bin/nix print-dev-env /Users/michael/<redacted>/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json
go.jetpack.io/devbox/internal/nix.(*Nix).PrintDevEnv
        go.jetpack.io/devbox/internal/nix/nix.go:71
go.jetpack.io/devbox/internal/impl.(*Devbox).computeNixEnv
        go.jetpack.io/devbox/internal/impl/devbox.go:760
go.jetpack.io/devbox/internal/impl.(*Devbox).ensurePackagesAreInstalled
        go.jetpack.io/devbox/internal/impl/packages.go:190
go.jetpack.io/devbox/internal/impl.(*Devbox).Shell
        go.jetpack.io/devbox/internal/impl/devbox.go:211
go.jetpack.io/devbox/internal/boxcli.runShellCmd
        go.jetpack.io/devbox/internal/boxcli/shell.go:67
go.jetpack.io/devbox/internal/boxcli.shellCmd.func1
        go.jetpack.io/devbox/internal/boxcli/shell.go:33
github.com/spf13/cobra.(*Command).execute
        github.com/spf13/cobra@v1.6.1/command.go:916
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/cobra@v1.6.1/command.go:1044
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/cobra@v1.6.1/command.go:968
go.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute
        go.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:57
go.jetpack.io/devbox/internal/boxcli.Execute
        go.jetpack.io/devbox/internal/boxcli/root.go:95
go.jetpack.io/devbox/internal/boxcli.Main
        go.jetpack.io/devbox/internal/boxcli/root.go:108
main.main
        ./main.go:11
runtime.main
        runtime/proc.go:250
runtime.goexit
        runtime/asm_arm64.s:1172
[DEBUG] 2023/05/19 21:03:57 go.jetpack.io/devbox/internal/impl/config.go:125: findProjectDir: path is
[DEBUG] 2023/05/19 21:03:57 go.jetpack.io/devbox/internal/impl/config.go:166: finding devbox.json in dir: /Users/michael/<redacted>
[DEBUG] 2023/05/19 21:03:57 go.jetpack.io/devbox/internal/impl/config.go:125: findProjectDir: path is
[DEBUG] 2023/05/19 21:03:57 go.jetpack.io/devbox/internal/impl/config.go:166: finding devbox.json in dir: /Users/michael/<redacted>

Expected Behavior (fix)

it works

Additional context

maybe related with https://github.com/jetpack-io/devbox/issues/177 ?

OS: macOS 13.3.1 Network: I can confirm there's no proxy running on the compute, also everything else works just fine but devbox.

$ devbox version -v

Version:     0.5.2
Platform:    darwin_arm64
Commit:      8f579b2c45c730742cbf9b7c400f247abf902775
Commit Time: 2023-05-18T16:18:52Z
Go Version:  go1.20.4
Launcher:    0.2.0

devbox.json

nothing new but the default stuff from devbox init

mohsenari commented 1 year ago

@michaellzc thanks for reporting this. I tried reproducing the steps but it succeeds for me. What do you see when you run curl https://api.github.com/repos/numtide/flake-utils/commits/HEAD in your terminal?

gcurtis commented 1 year ago

Nix also relies on its own certificate bundle that gets set with NIX_SSL_CERT_FILE.

Could you try running echo $NIX_SSL_CERT_FILE both in and out of a Devbox shell? If it's set, does the path it's set to exist?

michaellzc commented 1 year ago

curl https://api.github.com/repos/numtide/flake-utils/commits/HEAD

Like I mentioned in the issue, everything outside of devbox/nix is fine. curl-ing stuff works just fine and TLS is good as well.

michaellzc commented 1 year ago

Nix also relies on its own certificate bundle that gets set with NIX_SSL_CERT_FILE.

Could you try running echo $NIX_SSL_CERT_FILE both in and out of a Devbox shell? If it's set, does the path it's set to exist?

please see the attached output of DEVBOX_DEBUG=1 devbox shell in the issue description, I can't even launch devbox shell 😅

PorcoRosso85 commented 1 year ago

Hi, can I join? same problem, I seem to be in .

by the way, I don't configure anything about SSL.

I wrote down both

  1. ....devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json: exit status 1

2 . result of curl https://api.github.com/repos/numtide/flake-utils/commits/HEAD

3 . echo $NIX_SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt

...

[DEBUG] 2023/05/30 08:47:59 go.jetpack.io/devbox/internal/nix/search.go:103: running command: /nix/var/nix/profiles/default/bin/nix search --json github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#legacyPackages.x86_64-linux.python310 --extra-experimental-features ca-derivations --option experimental-features nix-command flakes
[DEBUG] 2023/05/30 08:47:59 go.jetpack.io/devbox/internal/impl/devbox.go:748: current environment PATH is: /mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/home/ub01/.vscode-server/bin/b3e4e68a0bc097f0ae7907b217c1119af9e03435/bin/remote-cli:/mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.nix-profile/bin:/mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.local/bin:/home/ub01/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Users/admin.DESKTOP-1PF4AT3/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/admin.DESKTOP-1PF4AT3/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:~/.local/bin:~/.local/bin
[DEBUG] 2023/05/30 08:47:59 go.jetpack.io/devbox/internal/nix/nix.go:68: Running print-dev-env cmd: /nix/var/nix/profiles/default/bin/nix print-dev-env /mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json
Error: Command: /nix/var/nix/profiles/default/bin/nix print-dev-env /mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json: exit status 1

[DEBUG] 2023/05/30 08:48:00 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:72: Command stderr: path '/mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.devbox/gen/flake/flake.nix' does not contain a 'flake.nix', searching up
warning: Git tree '/mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.devbox/gen/flake' is dirty
warning: updating lock file '/mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.devbox/gen/flake/flake.lock':
• Added input 'flake-utils':
    'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11)
• Added input 'flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Added input 'nixpkgs':
    'github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62' (2023-01-27)
• Added input 'nixpkgs-f80ac8':
    'github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62' (2023-01-27)
The following paths are ignored by one of your .gitignore files:
flake.lock
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"
error:
       … while updating the lock file of flake 'git+file:///mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.devbox/gen/flake'

       error: program 'git' failed with exit code 1

[DEBUG] 2023/05/30 08:48:00 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:74: 
ExecutionID:9eacab7bc1f14b69bb18cbb74c363883
exit status 1
Command: /nix/var/nix/profiles/default/bin/nix print-dev-env /mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json
go.jetpack.io/devbox/internal/nix.(*Nix).PrintDevEnv
        go.jetpack.io/devbox/internal/nix/nix.go:71
go.jetpack.io/devbox/internal/impl.(*Devbox).computeNixEnv
        go.jetpack.io/devbox/internal/impl/devbox.go:760
go.jetpack.io/devbox/internal/impl.(*Devbox).ensurePackagesAreInstalled
        go.jetpack.io/devbox/internal/impl/packages.go:190
go.jetpack.io/devbox/internal/impl.(*Devbox).Shell
        go.jetpack.io/devbox/internal/impl/devbox.go:211
go.jetpack.io/devbox/internal/boxcli.runShellCmd
        go.jetpack.io/devbox/internal/boxcli/shell.go:67
go.jetpack.io/devbox/internal/boxcli.shellCmd.func1
        go.jetpack.io/devbox/internal/boxcli/shell.go:33
github.com/spf13/cobra.(*Command).execute
        github.com/spf13/cobra@v1.6.1/command.go:916
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/cobra@v1.6.1/command.go:1044
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/cobra@v1.6.1/command.go:968
go.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute
        go.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:57
go.jetpack.io/devbox/internal/boxcli.Execute
        go.jetpack.io/devbox/internal/boxcli/root.go:95
go.jetpack.io/devbox/internal/boxcli.Main
        go.jetpack.io/devbox/internal/boxcli/root.go:108
main.main
        ./main.go:11
runtime.main
        runtime/proc.go:250
runtime.goexit
        runtime/asm_amd64.s:1598
[DEBUG] 2023/05/30 08:48:00 go.jetpack.io/devbox/internal/impl/config.go:125: findProjectDir: path is 
[DEBUG] 2023/05/30 08:48:00 go.jetpack.io/devbox/internal/impl/config.go:166: finding devbox.json in dir: /mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev
[DEBUG] 2023/05/30 08:48:00 go.jetpack.io/devbox/internal/impl/config.go:125: findProjectDir: path is 
[DEBUG] 2023/05/30 08:48:00 go.jetpack.io/devbox/internal/impl/config.go:166: finding devbox.json in dir: /mnt/c/Users/admin.DESKTOP-1PF4AT3/Documents/Dev

ub01@DESKTOP-1PF4AT3:~$ curl https://api.github.com/repos/numtide/flake-utils/commits/HEAD
{
  "sha": "cfacdce06f30d2b68473a46042957675eebb3401",
  "node_id": "C_kwDODzELM9oAKGNmYWNkY2UwNmYzMGQyYjY4NDczYTQ2MDQyOTU3Njc1ZWViYjM0MDE",
  "commit": {
    "author": {
      "name": "zimbatm",
      "email": "zimbatm@zimbatm.com",
      "date": "2023-04-11T08:47:17Z"
    },
    "committer": {
      "name": "zimbatm",
      "email": "zimbatm@zimbatm.com",
      "date": "2023-04-11T08:47:17Z"
    },
    "message": "REAMDE: document the systems pattern a bit more",
    "tree": {
      "sha": "7c850ea8c0be096e2106de27abac0ab2f77f9096",
      "url": "https://api.github.com/repos/numtide/flake-utils/git/trees/7c850ea8c0be096e2106de27abac0ab2f77f9096"
    },
    "url": "https://api.github.com/repos/numtide/flake-utils/git/commits/cfacdce06f30d2b68473a46042957675eebb3401",
    "comment_count": 0,
    "verification": {
      "verified": true,
      "reason": "valid",
      "signature": "-----BEGIN PGP SIGNATURE-----\n\niQEzBAABCgAdFiEEJgNTuZP4zhZ1LvSMcbr21AwdY9cFAmQ1HpUACgkQcbr21Awd\nY9e+ywf/c3euW7lkchGNoFFF3b6PiuhIepprQk3IMoabMSTU/upxVseZ+ttn6FsL\npS3lwmKiC326K1pWFkw+Mi6P2aNeMkkZ7sNX+1SczgSr08cA1hEK9wET0gVlxVtS\nYd/GpDI5sulQpmqFVmZq9U5nhrpTR8JcYS91zA9ByAwf0OEd4DEkUo6/FN0gjyQy\nz4bkdgReq2tr/IgEAx/rbJP2faMnAuJVttKxMCV9stQqu7spUgtWevu/3KrCP6gJ\nwuE2xVZsNQDOW9YaUZxSc2OdcBqsoOzZmec21x8u7XE6whvV0vT6IdhYJytsxxgG\nGHFzPkzLi2PjEAXlh5ZoqNCxd2Kpzw==\n=ari0\n-----END PGP SIGNATURE-----",
      "payload": "tree 7c850ea8c0be096e2106de27abac0ab2f77f9096\nparent 033b9f258ca96a10e543d4442071f614dc3f8412\nauthor zimbatm <zimbatm@zimbatm.com> 1681202837 +0200\ncommitter zimbatm <zimbatm@zimbatm.com> 1681202837 +0200\n\nREAMDE: document the systems pattern a bit more\n"
    }
  },
  "url": "https://api.github.com/repos/numtide/flake-utils/commits/cfacdce06f30d2b68473a46042957675eebb3401",
  "html_url": "https://github.com/numtide/flake-utils/commit/cfacdce06f30d2b68473a46042957675eebb3401",
  "comments_url": "https://api.github.com/repos/numtide/flake-utils/commits/cfacdce06f30d2b68473a46042957675eebb3401/comments",
  "author": {
    "login": "zimbatm",
    "id": 3248,
    "node_id": "MDQ6VXNlcjMyNDg=",
    "avatar_url": "https://avatars.githubusercontent.com/u/3248?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/zimbatm",
    "html_url": "https://github.com/zimbatm",
    "followers_url": "https://api.github.com/users/zimbatm/followers",
    "following_url": "https://api.github.com/users/zimbatm/following{/other_user}",
    "gists_url": "https://api.github.com/users/zimbatm/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/zimbatm/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/zimbatm/subscriptions",
    "organizations_url": "https://api.github.com/users/zimbatm/orgs",
    "repos_url": "https://api.github.com/users/zimbatm/repos",
    "events_url": "https://api.github.com/users/zimbatm/events{/privacy}",
    "received_events_url": "https://api.github.com/users/zimbatm/received_events",
    "type": "User",
    "site_admin": false
  },
  "committer": {
    "login": "zimbatm",
    "id": 3248,
    "node_id": "MDQ6VXNlcjMyNDg=",
    "avatar_url": "https://avatars.githubusercontent.com/u/3248?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/zimbatm",
    "html_url": "https://github.com/zimbatm",
    "followers_url": "https://api.github.com/users/zimbatm/followers",
    "following_url": "https://api.github.com/users/zimbatm/following{/other_user}",
    "gists_url": "https://api.github.com/users/zimbatm/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/zimbatm/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/zimbatm/subscriptions",
    "organizations_url": "https://api.github.com/users/zimbatm/orgs",
    "repos_url": "https://api.github.com/users/zimbatm/repos",
    "events_url": "https://api.github.com/users/zimbatm/events{/privacy}",
    "received_events_url": "https://api.github.com/users/zimbatm/received_events",
    "type": "User",
    "site_admin": false
  },
  "parents": [
    {
      "sha": "033b9f258ca96a10e543d4442071f614dc3f8412",
      "url": "https://api.github.com/repos/numtide/flake-utils/commits/033b9f258ca96a10e543d4442071f614dc3f8412",
      "html_url": "https://github.com/numtide/flake-utils/commit/033b9f258ca96a10e543d4442071f614dc3f8412"
    }
  ],
  "stats": {
    "total": 30,
    "additions": 27,
    "deletions": 3
  },
  "files": [
    {
      "sha": "425a3c09a4a9daea809c71bb001e1edead0672cd",
      "filename": "README.md",
      "status": "modified",
      "additions": 27,
      "deletions": 3,
      "changes": 30,
      "blob_url": "https://github.com/numtide/flake-utils/blob/cfacdce06f30d2b68473a46042957675eebb3401/README.md",
      "raw_url": "https://github.com/numtide/flake-utils/raw/cfacdce06f30d2b68473a46042957675eebb3401/README.md",
      "contents_url": "https://api.github.com/repos/numtide/flake-utils/contents/README.md?ref=cfacdce06f30d2b68473a46042957675eebb3401",
      "patch": "@@ -30,11 +30,35 @@ Eg: instead of typing `\"x86_64-linux\"`, use `system.x86_64-linux`.\n \n A list of all systems defined in nixpkgs. For a smaller list see `defaultSystems`.\n \n-### `defaultSystems :: [<system>]` (deprecated)\n+### `defaultSystems :: [<system>]`\n \n-The list of systems passed to the flake-utils `systems` input.\n+The list of systems to use in `eachDefaultSystem` and `simpleFlake`.\n \n-Use this pattern to pass different systems to your flake: <https://github.com/nix-systems/nix-systems>.\n+The default values are `[\"x86_64-linux\" \"aarch64-linux\" \"x86_64-darwin\" \"aarch64-darwin\"]`.\n+\n+It's possible to override and control that list by changing the `systems` input of this flake.\n+\n+Eg (in your `flake.nix`):\n+\n+```nix\n+{\n+  # 1. Defined a \"systems\" inputs that maps to only [\"x86_64-linux\"]\n+  inputs.systems.url = \"github:nix-systems/x86_64-linux\";\n+\n+  inputs.flake-utils.src = \"github:numtide/flake-utils\";\n+  # 2. Override the flake-utils default to your version\n+  inputs.flake-utils.inputs.systems.follows = \"systems\";\n+\n+  outputs = { self, flake-utils, ... }:\n+    # Now eachDefaultSystem is only using [\"x86_64-linux\"], but this list can also\n+    # further be changed by users of your flake.\n+    flake-utils.lib.eachDefaultSystem (system: {\n+      # ...\n+    });\n+}\n+```\n+\n+For more details in this pattern, see: <https://github.com/nix-systems/nix-systems>.\n \n ### `eachSystem :: [<system>] -> (<system> -> attrs)`\n "
    }
  ]
}

ub01@DESKTOP-1PF4AT3:~$ echo $NIX_SSL_CERT_FILE
/etc/ssl/certs/ca-certificates.crt

version: 0.5.2 ( maybe latest )

I've already tried nix-collect-garbage -d. But nothing changed.

PorcoRosso85 commented 1 year ago

I've solved. Maybe any conflicts was by .gitignore at root dir of devbox init I try start devbox shell after removing .gitignore, then shell started.

before

*
!.gitignore
!.devbox
!flake.nix

@mohsenari @gcurtis

If you know, let us know what should not be added to .gitignore. ( in my case, I want to ignore all files and dirs in $HOME = at root dir of devbox init ) Thanks.

mohsenari commented 1 year ago

@michaellzc can you confirm removing .gitignore, or changing some line in it, makes a difference? This seems like a nix SSL cert issue because based on the debug log, when we run nix print-dev-env command, it fails to fetch files from github. I would also suggest getting a backup of $NIX_SSL_CERT_FILE and then unset $NIX_SSL_CERT_FILE and try again to see if that makes a difference. Another suggestion would be re-installing nix.

MisterBianco commented 1 year ago

I am having this issue on my m1 macbook pro.


Running DEVBOX_DEBUG=1 devbox install against a empty project with a devbox.json file in it generates the following report:

dir.go:22: findProjectDir: path is 
dir.go:66: finding devbox.json in dir: /Users/jdingman/Develop/test
dir.go:22: findProjectDir: path is 
dir.go:66: finding devbox.json in dir: /Users/jdingman/Develop/test
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:51: Debug mode enabled.
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/dir.go:22: findProjectDir: path is 
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/dir.go:66: finding devbox.json in dir: /Users/jdingman/Develop/test
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/devbox.go:918: failed to clean up script file .hooks.sh, error = remove /Users/jdingman/Develop/test/.devbox/gen/scripts/.hooks.sh.sh: no such file or directory
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/devbox.go:918: failed to clean up script file test.sh, error = remove /Users/jdingman/Develop/test/.devbox/gen/scripts/test.sh.sh: no such file or directory
Ensuring packages are installed.
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/devbox.go:735: current environment PATH is: /Users/jdingman/.pyenv/plugins/pyenv-virtualenv/shims:/Users/jdingman/.pyenv/shims:/Users/jdingman/.pyenv/bin:/Users/jdingman/.cargo/bin:/Users/jdingman/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/jdingman/.goenv/versions/1.20.5/bin:/Users/jdingman/.cargo/bin:/Users/jdingman/.goenv/bin:/Applications/kitty.app/Contents/MacOS:/Users/jdingman/.goenv/shims:/Users/jdingman/go/1.20.5/bin
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/nix/nix.go:68: Running print-dev-env cmd: /nix/var/nix/profiles/default/bin/nix print-dev-env /Users/jdingman/Develop/test/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json
Error: Command: /nix/var/nix/profiles/default/bin/nix print-dev-env /Users/jdingman/Develop/test/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json: exit status 1

[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:72: Command stderr: path '/Users/jdingman/Develop/test/.devbox/gen/flake/flake.nix' does not contain a 'flake.nix', searching up
error: unable to download 'https://cache.nixos.org/fhx92d9w0i0nwqbdgsxgapj47g5vp2hh.narinfo': Problem with the SSL CA cert (path? access rights?) (77)

[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:74: 
ExecutionID:faa8349c66bb48bab0f5c832ac2be9f8
exit status 1
Command: /nix/var/nix/profiles/default/bin/nix print-dev-env /Users/jdingman/Develop/test/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json
go.jetpack.io/devbox/internal/nix.(*Nix).PrintDevEnv
    go.jetpack.io/devbox/internal/nix/nix.go:71
go.jetpack.io/devbox/internal/impl.(*Devbox).computeNixEnv
    go.jetpack.io/devbox/internal/impl/devbox.go:747
go.jetpack.io/devbox/internal/impl.(*Devbox).ensurePackagesAreInstalled
    go.jetpack.io/devbox/internal/impl/packages.go:190
go.jetpack.io/devbox/internal/impl.(*Devbox).PrintEnv
    go.jetpack.io/devbox/internal/impl/devbox.go:289
go.jetpack.io/devbox/internal/impl.(*Devbox).Install
    go.jetpack.io/devbox/internal/impl/devbox.go:269
go.jetpack.io/devbox/internal/boxcli.installCmdFunc
    go.jetpack.io/devbox/internal/boxcli/install.go:37
go.jetpack.io/devbox/internal/boxcli.installCmd.func1
    go.jetpack.io/devbox/internal/boxcli/install.go:22
github.com/spf13/cobra.(*Command).execute
    github.com/spf13/cobra@v1.6.1/command.go:916
github.com/spf13/cobra.(*Command).ExecuteC
    github.com/spf13/cobra@v1.6.1/command.go:1044
github.com/spf13/cobra.(*Command).Execute
    github.com/spf13/cobra@v1.6.1/command.go:968
go.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute
    go.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:57
go.jetpack.io/devbox/internal/boxcli.Execute
    go.jetpack.io/devbox/internal/boxcli/root.go:96
go.jetpack.io/devbox/internal/boxcli.Main
    go.jetpack.io/devbox/internal/boxcli/root.go:109
main.main
    ./main.go:11
runtime.main
    runtime/proc.go:250
runtime.goexit
    runtime/asm_arm64.s:1172
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/dir.go:22: findProjectDir: path is 
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/dir.go:66: finding devbox.json in dir: /Users/jdingman/Develop/test
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/dir.go:22: findProjectDir: path is 
[DEBUG] 2023/06/19 13:44:25 go.jetpack.io/devbox/internal/impl/dir.go:66: finding devbox.json in dir: /Users/jdingman/Develop/test

nix was installed via devbox and the only modification I made to any nix file was the /etc/nix/nix.conf file which I added the flakes and nix-command experimental features flag to.

If there is anything else I can try just let me know.


The report of not finding a flake.nix file is likely due to this line that specifies the full path. Not that it matters but changing this to just specifying the dir would avoid the warning of not finding a flake.nix file possibly avoiding some confusion.

michaellzc commented 1 year ago

@mohsenari sorry for the late reply!

@michaellzc can you confirm removing .gitignore, or changing some line in it, makes a difference? This seems like a nix SSL cert issue because based on the debug log, when we run nix print-dev-env command, it fails to fetch files from github.

removing .gitignore doesn't help, and I also tested the exact step in an empty git repo. Neither helps, and still seeing the exact error.

I would also suggest getting a backup of $NIX_SSL_CERT_FILE and then unset $NIX_SSL_CERT_FILE and try again to see if that makes a difference. Another suggestion would be re-installing nix.

I'm on macOS using fish (no nix whatsoever), hence $NIX_SSL_CERT_FILE is never set in my shell. I double check and confirm it is in fact empty.

I have another "cleaner" M1 MacBook. I will give this a try and see if I still experience the same problem.

psucodervn commented 2 months ago

Hi, I'm facing the same issue. Does anyone have solution or workaround for that?