Skip to content

Commit a5da382

Browse files
committed
Revert "[package outputs] generate buildInputs for package-outputs in flake (#1721)"
This reverts commit a09dbdc.
1 parent 0ad98e8 commit a5da382

File tree

6 files changed

+3
-101
lines changed

6 files changed

+3
-101
lines changed

internal/devpkg/narinfo_cache.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ func (p *Package) IsInBinaryCache() (bool, error) {
2727
if p.PatchGlibc {
2828
return false, nil
2929
}
30-
// Packages with non-default outputs are not to be taken from the binary cache.
31-
if len(p.Outputs) > 0 {
32-
return false, nil
33-
}
3430
if eligible, err := p.isEligibleForBinaryCache(); err != nil {
3531
return false, err
3632
} else if !eligible {

internal/devpkg/package.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ type Package struct {
7878
// example: github:nixos/nixpkgs/5233fd2ba76a3accb5aaa999c00509a11fd0793c#hello
7979
Raw string
8080

81-
// Outputs is a list of outputs to build from the package's derivation.
82-
// If empty, the default output is used.
83-
Outputs []string
84-
8581
// PatchGlibc applies a function to the package's derivation that
8682
// patches any ELF binaries to use the latest version of nixpkgs#glibc.
8783
PatchGlibc bool
@@ -117,7 +113,6 @@ func PackagesFromConfig(config *devconfig.Config, l lock.Locker) []*Package {
117113
pkg := newPackage(cfgPkg.VersionedName(), cfgPkg.IsEnabledOnPlatform(), l)
118114
pkg.DisablePlugin = cfgPkg.DisablePlugin
119115
pkg.PatchGlibc = cfgPkg.PatchGlibc && nix.SystemIsLinux()
120-
pkg.Outputs = cfgPkg.Outputs
121116
result = append(result, pkg)
122117
}
123118
return result
@@ -131,7 +126,6 @@ func PackageFromStringWithOptions(raw string, locker lock.Locker, opts devopt.Ad
131126
pkg := PackageFromStringWithDefaults(raw, locker)
132127
pkg.DisablePlugin = opts.DisablePlugin
133128
pkg.PatchGlibc = opts.PatchGlibc
134-
pkg.Outputs = opts.Outputs
135129
return pkg
136130
}
137131

internal/shellgen/flake_input.go

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package shellgen
22

33
import (
44
"context"
5-
"errors"
65
"runtime/trace"
76
"slices"
87
"strings"
@@ -51,54 +50,9 @@ func (f *flakeInput) PkgImportName() string {
5150
return f.Name + "-pkgs"
5251
}
5352

54-
type SymlinkJoin struct {
55-
Name string
56-
Paths []string
57-
}
58-
59-
// BuildInputsForSymlinkJoin returns a list of SymlinkJoin objects that can be used
60-
// as the buildInput. Used for packages that have non-default outputs that need to
61-
// be combined into a single buildInput.
62-
func (f *flakeInput) BuildInputsForSymlinkJoin() ([]*SymlinkJoin, error) {
63-
joins := []*SymlinkJoin{}
64-
for _, pkg := range f.Packages {
65-
// skip packages that have no non-default outputs
66-
if len(pkg.Outputs) == 0 {
67-
continue
68-
}
69-
70-
attributePath, err := pkg.FullPackageAttributePath()
71-
if err != nil {
72-
return nil, err
73-
}
74-
75-
if pkg.PatchGlibc {
76-
return nil, errors.New("patch_glibc is not yet supported for packages with non-default outputs")
77-
}
78-
joins = append(joins, &SymlinkJoin{
79-
Name: pkg.String() + "-combined",
80-
Paths: lo.Map(pkg.Outputs, func(output string, _ int) string {
81-
if !f.IsNixpkgs() {
82-
return f.Name + "." + attributePath + "." + output
83-
}
84-
parts := strings.Split(attributePath, ".")
85-
return f.PkgImportName() + "." + strings.Join(parts[2:], ".") + "." + output
86-
}),
87-
})
88-
}
89-
return joins, nil
90-
}
91-
9253
func (f *flakeInput) BuildInputs() ([]string, error) {
9354
var err error
94-
95-
// Filter out packages that have non-default outputs
96-
// These are handled in BuildInputsForSymlinkJoin
97-
packages := lo.Filter(f.Packages, func(pkg *devpkg.Package, _ int) bool {
98-
return len(pkg.Outputs) == 0
99-
})
100-
101-
attributePaths := lo.Map(packages, func(pkg *devpkg.Package, _ int) string {
55+
attributePaths := lo.Map(f.Packages, func(pkg *devpkg.Package, _ int) string {
10256
attributePath, attributePathErr := pkg.FullPackageAttributePath()
10357
if attributePathErr != nil {
10458
err = attributePathErr

internal/shellgen/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var tmplFS embed.FS
3030
// devbox.PrintEnv, which is the core function from which devbox shell/run/direnv
3131
// functionality is derived.
3232
func GenerateForPrintEnv(ctx context.Context, devbox devboxer) error {
33-
defer trace.StartRegion(ctx, "GenerateForPrintEnv").End()
33+
defer trace.StartRegion(ctx, "generateShellFiles").End()
3434

3535
plan, err := newFlakePlan(ctx, devbox)
3636
if err != nil {

internal/shellgen/tmpl/flake_remove_nixpkgs.nix.tmpl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,7 @@
4646
})
4747
{{- end }}
4848
{{- end }}
49-
{{- range $_, $flakeInput := .FlakeInputs }}
50-
{{- range .BuildInputsForSymlinkJoin }}
51-
(pkgs.symlinkJoin {
52-
name = "{{.Name}}";
53-
paths = [
54-
{{- range .Paths }}
55-
{{.}}
56-
{{- end }}
57-
];
58-
})
59-
{{- end }}
49+
{{- range .FlakeInputs }}
6050
{{- range .BuildInputs }}
6151
{{.}}
6252
{{- end }}

testscripts/add/add_outputs.test.txt

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)