BuildInputsForSymlinkJoin returns a list of SymlinkJoin objects that can be used as the buildInput. Used for packages that have non-default outputs that need to be combined into a single buildInput.
()
| 46 | // as the buildInput. Used for packages that have non-default outputs that need to |
| 47 | // be combined into a single buildInput. |
| 48 | func (f *flakeInput) BuildInputsForSymlinkJoin() ([]*SymlinkJoin, error) { |
| 49 | joins := []*SymlinkJoin{} |
| 50 | for _, pkg := range f.Packages { |
| 51 | |
| 52 | // Skip packages that don't need a symlink join. |
| 53 | if needs, err := needsSymlinkJoin(pkg); err != nil { |
| 54 | return nil, err |
| 55 | } else if !needs { |
| 56 | continue |
| 57 | } |
| 58 | |
| 59 | // Skip packages that are already in the binary cache. These will be directly |
| 60 | // included in the buildInputs using `builtins.fetchClosure` of their store paths. |
| 61 | inCache, err := pkg.IsInBinaryCache() |
| 62 | if err != nil { |
| 63 | return nil, err |
| 64 | } |
| 65 | if inCache { |
| 66 | continue |
| 67 | } |
| 68 | |
| 69 | attributePath, err := pkg.FullPackageAttributePath() |
| 70 | if err != nil { |
| 71 | return nil, err |
| 72 | } |
| 73 | |
| 74 | if pkg.Patch { |
| 75 | return nil, errors.New("patch_glibc is not yet supported for packages with non-default outputs") |
| 76 | } |
| 77 | |
| 78 | outputNames, err := pkg.GetOutputNames() |
| 79 | if err != nil { |
| 80 | return nil, err |
| 81 | } |
| 82 | |
| 83 | joins = append(joins, &SymlinkJoin{ |
| 84 | Name: pkg.String() + "-combined", |
| 85 | Paths: lo.Map(outputNames, func(outputName string, _ int) string { |
| 86 | if !f.Ref.IsNixpkgs() { |
| 87 | return f.Name + "." + attributePath + "." + outputName |
| 88 | } |
| 89 | parts := strings.Split(attributePath, ".") |
| 90 | return f.PkgImportName() + "." + strings.Join(parts[2:], ".") + "." + outputName |
| 91 | }), |
| 92 | }) |
| 93 | } |
| 94 | return joins, nil |
| 95 | } |
| 96 | |
| 97 | func (f *flakeInput) BuildInputs() ([]string, error) { |
| 98 | var err error |
nothing calls this directly
no test coverage detected