/
package.go
51 lines (43 loc) · 1.42 KB
/
package.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2023 Jetpack Technologies Inc and contributors. All rights reserved.
// Use of this source code is governed by the license in the LICENSE file.
package lock
const (
nixpkgSource string = "nixpkg"
devboxSearchSource string = "devbox-search"
)
type Package struct {
AllowInsecure bool `json:"allow_insecure,omitempty"`
LastModified string `json:"last_modified,omitempty"`
PluginVersion string `json:"plugin_version,omitempty"`
Resolved string `json:"resolved,omitempty"`
Source string `json:"source,omitempty"`
Version string `json:"version,omitempty"`
// Systems is keyed by the system name
Systems map[string]*SystemInfo `json:"systems,omitempty"`
// NOTE: if you add more fields, please update SyncLockfiles
}
type SystemInfo struct {
// StorePath is the input-addressed path for the nix package in /nix/store
// It is the cache key in the Binary Cache Store (cache.nixos.org)
// It is of the form /nix/store/<hash>-<name>-<version>
// <name> may be different from the canonicalName so we store the full store path.
StorePath string `json:"store_path,omitempty"`
}
func (p *Package) GetSource() string {
if p == nil {
return ""
}
return p.Source
}
func (p *Package) IsAllowInsecure() bool {
if p == nil {
return false
}
return p.AllowInsecure
}
func (i *SystemInfo) Equals(other *SystemInfo) bool {
if i == nil || other == nil {
return i == other
}
return *i == *other
}