github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/pkg/nix_store_metadata.go (about)

     1  package pkg
     2  
     3  import (
     4  	"sort"
     5  
     6  	"github.com/scylladb/go-set/strset"
     7  )
     8  
     9  type NixStoreMetadata struct {
    10  	// OutputHash is the prefix of the nix store basename path
    11  	OutputHash string `mapstructure:"outputHash" json:"outputHash"`
    12  
    13  	// Output allows for optionally specifying the specific nix package output this package represents (for packages that support multiple outputs).
    14  	// Note: the default output for a package is an empty string, so will not be present in the output.
    15  	Output string `mapstructure:"output" json:"output,omitempty"`
    16  
    17  	// Files is a listing a files that are under the nix/store path for this package
    18  	Files []string `mapstructure:"files" json:"files"`
    19  }
    20  
    21  func (m NixStoreMetadata) OwnedFiles() (result []string) {
    22  	result = strset.New(m.Files...).List()
    23  	sort.Strings(result)
    24  	return
    25  }