Improve struct and field comments and incorporate into json schema (#4252)

* improve struct and field comments and incorporate into json schema

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* address review feedback

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2025-10-03 17:01:56 +00:00
committed by GitHub
parent b96d3d20af
commit a77d24e379
57 changed files with 4241 additions and 1676 deletions
+14 -12
View File
@@ -6,43 +6,45 @@ import (
"github.com/scylladb/go-set/strset"
)
// NixStoreEntry represents a package in the Nix store (/nix/store) with its derivation information and metadata.
type NixStoreEntry struct {
// Path is the store path for this output
// Path is full store path for this output (e.g. /nix/store/abc123...-package-1.0)
Path string `mapstructure:"path" json:"path,omitempty"`
// Output allows for optionally specifying the specific nix package output this package represents (for packages that support multiple outputs).
// Note: the default output for a package is an empty string, so will not be present in the output.
// Output is the specific output name for multi-output packages (empty string for default "out" output, can be "bin", "dev", "doc", etc.)
Output string `mapstructure:"output" json:"output,omitempty"`
// OutputHash is the prefix of the nix store basename path
// OutputHash is hash prefix of the store path basename (first part before the dash)
OutputHash string `mapstructure:"outputHash" json:"outputHash"`
// Derivation is any information about the derivation file that was used to build this package
// Derivation is information about the .drv file that describes how this package was built
Derivation NixDerivation `mapstructure:"derivation" json:"derivation,omitempty"`
// Files is a listing a files that are under the nix/store path for this package
// Files are the list of files under the nix/store path for this package
Files []string `mapstructure:"files" json:"files,omitempty"`
}
// NixDerivation represents a Nix .drv file that describes how to build a package including inputs, outputs, and build instructions.
type NixDerivation struct {
// Path is the path to the derivation file
// Path is path to the .drv file in Nix store
Path string `mapstructure:"path" json:"path,omitempty"`
// System is the nix system string that this derivation was built for
// System is target system string indicating where derivation can be built (e.g. "x86_64-linux", "aarch64-darwin"). Must match current system for local builds.
System string `mapstructure:"system" json:"system,omitempty"`
// InputDerivations is a list of derivation paths that were used to build this package
// InputDerivations are the list of other derivations that were inputs to this build (dependencies)
InputDerivations []NixDerivationReference `mapstructure:"inputDerivations" json:"inputDerivations,omitempty"`
// InputSources is a list of source paths that were used to build this package
// InputSources are the list of source file paths that were inputs to this build
InputSources []string `mapstructure:"inputSources" json:"inputSources,omitempty"`
}
// NixDerivationReference represents a reference to another derivation used as a build input or runtime dependency.
type NixDerivationReference struct {
// Path is the path to the derivation file
// Path is path to the referenced .drv file
Path string `mapstructure:"path" json:"path,omitempty"`
// Outputs is a list of output names that were used to build this package
// Outputs are which outputs of the referenced derivation were used (e.g. ["out"], ["bin", "dev"])
Outputs []string `mapstructure:"outputs" json:"outputs,omitempty"`
}