all repos — searchix @ 698881aa577d2c209f162db9263fab17ced3643f

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: use attribute instead of name for packages
Alan Pearce alan@alanpearce.eu
Fri, 17 May 2024 22:59:57 +0200
commit

698881aa577d2c209f162db9263fab17ced3643f

parent

f10543d0aff0e203dd57287dc2b736c686e69102

M frontend/templates/blocks/packages.gotmplfrontend/templates/blocks/packages.gotmpl
@@ -5,9 +5,9 @@ <details id="{{ .Name }}">         <summary>
           <h3>
             {{- if .Broken }}
-              <del>{{ .Name }}</del>
+              <del>{{ .Attribute }}</del>
             {{- else }}
-              {{ .Name }}
+              {{ .Attribute }}
             {{- end }}
           </h3>
         </summary>
M internal/importer/package.gointernal/importer/package.go
@@ -228,6 +228,7 @@ } 
 			results <- &nix.Package{
 				Name:            i.pkg.Name,
+				Attribute:       kv.Key,
 				Source:          i.source.Key,
 				PackageSet:      pkgSet,
 				Version:         i.pkg.Version,
M internal/index/indexer.gointernal/index/indexer.go
@@ -104,7 +104,7 @@ optionMapping.AddSubDocumentMapping("Example", nixValueMapping) 
 	packageMapping := bleve.NewDocumentStaticMapping()
 
-	packageMapping.AddFieldMappingsAt("Name", keywordFieldMapping)
+	packageMapping.AddFieldMappingsAt("Attribute", keywordFieldMapping)
 	packageMapping.AddFieldMappingsAt("Source", keywordFieldMapping)
 	packageMapping.AddFieldMappingsAt("Description", textFieldMapping)
 	packageMapping.AddFieldMappingsAt("MainProgram", keywordFieldMapping)
M internal/nix/package.gointernal/nix/package.go
@@ -2,6 +2,7 @@ package nix 
 type Package struct {
 	Name            string
+	Attribute       string
 	Source          string
 	Broken          bool
 	Definition      string