Skip to content

Rename dependency attributes #28327

@Ericson2314

Description

@Ericson2314

nativeBuildInputs, buildInputs, propagatedNativeBuildInputs, and propagatedBuildInputs are horrible names:

  • Word order + capitalization impedes easy grepping
  • native is vague wrt cross compilation
  • build time vs run time usage is unclear
  • both the host platform and target platform of dependencies can be varied, so in fact there is 2 axis of "native" vs "foreignness"

In #26805 I do add 4 more sorts of dependencies giving us:

Current name @Ericson2314's Ideal name Host is Target is
depsBuildBuild depsBuildBuild build platform build platform
nativeBuildInputs depsBuildHost build platform host platform
depsBuildTarget depsBuildTarget build platform target platform
depsHostHost depsHostHost host platform host platform
buildInputs depsHostTarget host platform target platform
depsTargetTarget depsTargetTarget target platform target platform

A disadvantages of these names, per the comments below, is for the vast majority of deps the target platform is irrelevant---my names are unintuitive and noisy in this case.

N.B. I'd love to structure things purely when the deps are needed---run time or build time---which is a pretty understandable concept even for those who have never heard of cross compiling. But this just isn't correct (yet). Firstly, it isn't enough granularity---see when dependent's host = depender's build, there's 3 possible target platforms. Worse, host=host dependencies may be used in all possible ways: only at build-time (static linking), only at run-time (dynamic loading of plugin library), or both (linking and headers).


A completely different approach would be rely more on language-specific builders: For C, let people think in terms of headers (and pkg-config files, etc) and libraries (dynamic or static), and then C-specific infrastructure would take care of everything behind the scenes regarding propagation and multiple outputs. I should probably elaborate this approach more fully in the another issue or RFC.

Split out from #4855

CC @dezgeg @edolstra

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancementAdd something new or improve an existing system.1.severity: significantNovel ideas, large API changes, notable refactorings, issues with RFC potential, etc.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: cross-compilationBuilding packages on a different platform than they will be used on9.needs: documentationThis needs to be documented well.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions