Skip to content

Commit fca5809

Browse files
committed
clean up
1 parent 39e3a24 commit fca5809

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

internal/devpkg/package_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ func (l *lockfile) LegacyNixpkgsPath(pkg string) string {
119119
)
120120
}
121121

122+
func (l *lockfile) Source(pkg string) string {
123+
return ""
124+
}
125+
122126
func (l *lockfile) Resolve(pkg string) (*lock.Package, error) {
123127
switch {
124128
case strings.Contains(pkg, "path:"):

internal/lock/lockfile.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818

1919
const lockFileVersion = "1"
2020
const (
21-
NixpkgSource string = "nixpkg"
22-
DevboxSearchSource = "devbox-search"
21+
nixpkgSource string = "nixpkg"
22+
devboxSearchSource string = "devbox-search"
2323
)
2424

2525
// Lightly inspired by package-lock.json
@@ -104,7 +104,7 @@ func (l *File) Resolve(pkg string) (*Package, error) {
104104
// whatever hash is in the devbox.json
105105
locked = &Package{
106106
Resolved: l.LegacyNixpkgsPath(pkg),
107-
Source: NixpkgSource,
107+
Source: nixpkgSource,
108108
}
109109
}
110110
l.Packages[pkg] = locked
@@ -118,20 +118,6 @@ func (l *File) ForceResolve(pkg string) (*Package, error) {
118118
return l.Resolve(pkg)
119119
}
120120

121-
func (l *File) ResolveToCurrentNixpkgCommitHash(pkg string) error {
122-
name, version, found := strings.Cut(pkg, "@")
123-
if found && version != "latest" {
124-
return errors.New(
125-
"only allowed version is @latest. Otherwise we can't guarantee the " +
126-
"version will resolve")
127-
}
128-
l.Packages[pkg] = &Package{
129-
Resolved: l.LegacyNixpkgsPath(name),
130-
Source: NixpkgSource,
131-
}
132-
return nil
133-
}
134-
135121
func (l *File) Save() error {
136122
return cuecfg.WriteFile(lockFilePath(l.devboxProject), l)
137123
}

internal/lock/resolve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (l *File) FetchResolvedPackage(pkg string) (*Package, error) {
5757
packageInfo.AttrPaths[0],
5858
),
5959
Version: packageInfo.Version,
60-
Source: DevboxSearchSource,
60+
Source: devboxSearchSource,
6161
Systems: sysInfos,
6262
}, nil
6363
}

0 commit comments

Comments
 (0)