all repos — searchix @ 0f5508013d776f8806a87957f80e74c7f74c72eb

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

feat(config): print durations and URLs with human values

Alan Pearce
commit

0f5508013d776f8806a87957f80e74c7f74c72eb

parent

d0c2de9e762fb476b5cb53bb5129bf8af8cb9b45

1 file changed, 16 insertions(+), 8 deletions(-)

changed files
M internal/config/config.gointernal/config/config.go
@@ -21,6 +21,10 @@ type URL struct {
*url.URL } +func (u *URL) MarshalText() ([]byte, error) { + return []byte(u.URL.String()), nil +} + func (u *URL) UnmarshalText(text []byte) (err error) { u.URL, err = url.Parse(string(text))
@@ -33,6 +37,10 @@ }
type Duration struct { time.Duration +} + +func (d *Duration) MarshalText() ([]byte, error) { + return []byte(d.Duration.String()), nil } func (d *Duration) UnmarshalText(text []byte) (err error) {
@@ -122,8 +130,8 @@ URL: "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz",
ImportPath: "nixos/release.nix", Attribute: "options", OutputPath: "share/doc/nixos", - FetchTimeout: 5 * time.Minute, - ImportTimeout: 15 * time.Minute, + FetchTimeout: Duration{5 * time.Minute}, + ImportTimeout: Duration{15 * time.Minute}, Repo: nixpkgs, }, "darwin": {
@@ -137,8 +145,8 @@ URL: "https://github.com/LnL7/nix-darwin/archive/master.tar.gz",
ImportPath: "release.nix", Attribute: "options", OutputPath: "share/doc/darwin", - FetchTimeout: 5 * time.Minute, - ImportTimeout: 15 * time.Minute, + FetchTimeout: Duration{5 * time.Minute}, + ImportTimeout: Duration{15 * time.Minute}, Repo: Repository{ Type: "github", Owner: "LnL7",
@@ -156,8 +164,8 @@ Fetcher: Channel,
ImportPath: "default.nix", Attribute: "docs.json", OutputPath: "share/doc/home-manager", - FetchTimeout: 5 * time.Minute, - ImportTimeout: 15 * time.Minute, + FetchTimeout: Duration{5 * time.Minute}, + ImportTimeout: Duration{15 * time.Minute}, Repo: Repository{ Type: "github", Owner: "nix-community",
@@ -172,8 +180,8 @@ Importer: Packages,
Fetcher: ChannelNixpkgs, Channel: "nixos-unstable", OutputPath: "packages.json.br", - FetchTimeout: 5 * time.Minute, - ImportTimeout: 15 * time.Minute, + FetchTimeout: Duration{5 * time.Minute}, + ImportTimeout: Duration{15 * time.Minute}, Repo: nixpkgs, }, },