diff options
author | Alan Pearce | 2024-05-12 21:29:56 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-12 21:34:57 +0200 |
commit | fe79b4509dd580542fa28186673826df603677bb (patch) | |
tree | df338a6e8d4a66855879ff4f2b6fe49aec251146 | |
parent | 2e56008ef28109f0895b5918e2d0caeb16a08d8a (diff) | |
download | searchix-fe79b4509dd580542fa28186673826df603677bb.tar.lz searchix-fe79b4509dd580542fa28186673826df603677bb.tar.zst searchix-fe79b4509dd580542fa28186673826df603677bb.zip |
feat: enable using channel URLs if unable to resolve via NIX_PATH
-rw-r--r-- | internal/config/config.go | 5 | ||||
-rw-r--r-- | internal/importer/channel.go | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 55f5efa..9880b3a 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -48,6 +48,7 @@ var defaultConfig = Config{ Enable: true, Type: importer.Channel, Channel: "nixpkgs", + URL: "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz", ImportPath: "nixos/release.nix", Attribute: "options", OutputPath: "share/doc/nixos/options.json", @@ -64,7 +65,8 @@ var defaultConfig = Config{ Key: "darwin", Enable: false, Type: importer.Channel, - Channel: "nix-darwin", + Channel: "darwin", + URL: "https://github.com/LnL7/nix-darwin/archive/master.tar.gz", ImportPath: "release.nix", Attribute: "options", OutputPath: "share/doc/darwin/options.json", @@ -81,6 +83,7 @@ var defaultConfig = Config{ Key: "home-manager", Enable: false, Channel: "home-manager", + URL: "https://github.com/nix-community/home-manager/archive/master.tar.gz", Type: importer.Channel, ImportPath: "default.nix", Attribute: "docs.json", diff --git a/internal/importer/channel.go b/internal/importer/channel.go index 97f0a27..70aa9de 100644 --- a/internal/importer/channel.go +++ b/internal/importer/channel.go @@ -45,6 +45,10 @@ func (i *ChannelImporter) FetchIfNeeded(parent context.Context) (bool, error) { dest, } + if i.Source.URL != "" { + args = append(args, "-I", fmt.Sprintf("%s=%s", i.Source.Channel, i.Source.URL)) + } + i.Logger.Debug("nix-build command", "args", args) cmd := exec.CommandContext(ctx, "nix-build", args...) out, err := cmd.Output() |