all repos — searchix @ 37deedc9b1da92571548c920721984d545269eb4

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

refactor: move Source/Repository types to config package

Alan Pearce
commit

37deedc9b1da92571548c920721984d545269eb4

parent

f700a3284ecc88bb2af1df5f0c8d242290a549cc

1 file changed, 9 insertions(+), 10 deletions(-)

changed files
M internal/config/config.gointernal/config/config.go
@@ -6,7 +6,6 @@ "log/slog"
"maps" "net/url" "os" - "searchix/internal/importer" "time" "github.com/pelletier/go-toml/v2"
@@ -32,7 +31,7 @@ DataPath string `toml:"data-path"`
CSP CSP `toml:"content-security-policy"` ExtraBodyHTML template.HTML `toml:"extra-body-html"` Headers map[string]string - Sources map[string]*importer.Source + Sources map[string]*Source } var defaultConfig = Config{
@@ -43,12 +42,12 @@ },
Headers: map[string]string{ "x-content-type-options": "nosniff", }, - Sources: map[string]*importer.Source{ + Sources: map[string]*Source{ "nixos": { Name: "NixOS", Key: "nixos", Enable: true, - Type: importer.Channel, + Type: Channel, Channel: "nixpkgs", URL: "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz", ImportPath: "nixos/release.nix",
@@ -56,7 +55,7 @@ Attribute: "options",
OutputPath: "share/doc/nixos/options.json", FetchTimeout: 5 * time.Minute, ImportTimeout: 15 * time.Minute, - Repo: importer.Repository{ + Repo: Repository{ Type: "github", Owner: "NixOS", Repo: "nixpkgs",
@@ -66,7 +65,7 @@ "darwin": {
Name: "Darwin", Key: "darwin", Enable: false, - Type: importer.Channel, + Type: Channel, Channel: "darwin", URL: "https://github.com/LnL7/nix-darwin/archive/master.tar.gz", ImportPath: "release.nix",
@@ -74,7 +73,7 @@ Attribute: "options",
OutputPath: "share/doc/darwin/options.json", FetchTimeout: 5 * time.Minute, ImportTimeout: 15 * time.Minute, - Repo: importer.Repository{ + Repo: Repository{ Type: "github", Owner: "LnL7", Repo: "nix-darwin",
@@ -86,13 +85,13 @@ Key: "home-manager",
Enable: false, Channel: "home-manager", URL: "https://github.com/nix-community/home-manager/archive/master.tar.gz", - Type: importer.Channel, + Type: Channel, ImportPath: "default.nix", Attribute: "docs.json", OutputPath: "share/doc/home-manager/options.json", FetchTimeout: 5 * time.Minute, ImportTimeout: 15 * time.Minute, - Repo: importer.Repository{ + Repo: Repository{ Type: "github", Owner: "nix-community", Repo: "home-manager",
@@ -123,7 +122,7 @@ return nil, errors.Wrap(err, "config error")
} } - maps.DeleteFunc(config.Sources, func(_ string, v *importer.Source) bool { + maps.DeleteFunc(config.Sources, func(_ string, v *Source) bool { return !v.Enable })