Devbox does not pull *-dev outputs into build environment (headers missing)

オープン
#2,761 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go

調査の方向性

The report identifies package handling in Devbox environments but names no source files or tests. Start by tracing how packages such as libyaml are turned into shell build inputs, then compare that behavior with the described nix-shell semantics. Done means the reproduction with devbox add libyaml gcc makes yaml.h available without manually adding libyaml.dev; add or run relevant tests if you locate them.

索引モデルが issue の本文から書いたものです。

説明

bug looks hard p2 processed triage
What happened?

When using nix-shell / nix develop, adding a library package implicitly makes its headers available via the dev output (through normal buildInputs semantics).

Devbox does not do this. As a result, headers are missing unless the user manually adds <package>.dev.

This breaks common C/C++ expectations and makes Devbox environments subtly incomplete compared to standard Nix shells.


Expected result

yaml.h should be available automatically, as it is in nix-shell / nix develop when adding libyaml.


Actual result

Compilation fails because headers are missing:

main.c:1:10: fatal error: yaml.h: No such file or directory

Workaround

Manually add the dev output:

devbox add libyaml.dev

After this, compilation succeeds.


Why this is a problem
  • In nixpkgs, headers live in the dev output by design.
  • nix-shell users reasonably expect headers to be present when a library is added.
  • Devbox requires users to know about and manually add output-specific derivations, which defeats the abstraction Devbox aims to provide.
  • This is especially painful for newcomers unfamiliar with outputs = [ "out" "dev" ].

Suggested fix

Devbox should automatically include the dev output for library packages (or at least for packages commonly used as build dependencies), matching nix-shell / mkShell behavior.

At minimum, this behavior should be documented very clearly.


Steps to reproduce
  1. Initialize devbox:

    devbox init
    
  2. Add packages:

    devbox add libyaml gcc
    
  3. Create a test file:

    echo '#include <yaml.h>
    void main(){}' > main.c
    
  4. Enter shell:

    devbox shell
    
  5. Compile:

    gcc main.c
    

Command
devbox add libyaml

devbox.json

Without workaround

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

With workaround (devbox add libyaml.dev)

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

Devbox version
0.16.0

Nix version
nix (Nix) 2.31.2+2

What system does this bug occur on?

Linux (x86_64)


Debug logs

No response

主要言語
Go
スター
12.4k
フォーク
358
平均マージ
17時間 12分
マージ済み PR(30日)
31

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

jetify-com/devbox のほかの issue

jetify-com/devbox の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。