MCPcopy Index your code
hub / github.com/jetify-com/devbox / BuildInputs

Method BuildInputs

internal/shellgen/flake_input.go:97–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95}
96
97func (f *flakeInput) BuildInputs() ([]string, error) {
98 var err error
99
100 // Skip packages that will be handled in BuildInputsForSymlinkJoin
101 packages := []*devpkg.Package{}
102 for _, pkg := range f.Packages {
103 if needs, err := needsSymlinkJoin(pkg); err != nil {
104 return nil, err
105 } else if !needs {
106 packages = append(packages, pkg)
107 }
108 }
109
110 attributePaths := lo.Map(packages, func(pkg *devpkg.Package, _ int) string {
111 attributePath, attributePathErr := pkg.FullPackageAttributePath()
112 if attributePathErr != nil {
113 err = attributePathErr
114 }
115 if pkg.Patch {
116 // When the package comes from the glibc flake, the
117 // "legacyPackages" portion of the attribute path
118 // becomes just "packages" (matching the standard flake
119 // output schema).
120 return strings.Replace(attributePath, "legacyPackages", "packages", 1)
121 }
122 return attributePath
123 })
124 if err != nil {
125 return nil, err
126 }
127 if !f.Ref.IsNixpkgs() {
128 return lo.Map(attributePaths, func(pkg string, _ int) string {
129 return f.Name + "." + pkg
130 }), nil
131 }
132 return lo.Map(attributePaths, func(pkg string, _ int) string {
133 parts := strings.Split(pkg, ".")
134 // Ugh, not sure if this is reliable?
135 return f.PkgImportName() + "." + strings.Join(parts[2:], ".")
136 }), nil
137}
138
139// flakeInputs returns a list of flake inputs for the top level flake.nix
140// created by devbox. We map packages to the correct flake and attribute path

Callers

nothing calls this directly

Calls 4

PkgImportNameMethod · 0.95
needsSymlinkJoinFunction · 0.85
IsNixpkgsMethod · 0.80

Tested by

no test coverage detected