MCPcopy Index your code
hub / github.com/jetify-com/devbox / Info

Method Info

nix/nix.go:133–156  ·  view source on GitHub ↗

Info returns Nix version information. It caches the result after the first call, which means it won't reflect any configuration changes to Nix. Create a new Nix instance to retrieve uncached information.

()

Source from the content-addressed store, hash-verified

131// call, which means it won't reflect any configuration changes to Nix. Create a
132// new Nix instance to retrieve uncached information.
133func (n *Nix) Info() (Info, error) {
134 // Create the command first, which will catch any errors finding the Nix
135 // executable outside of the once. This allows us to retry after
136 // installing Nix.
137 cmd := n.Command("--version", "--debug")
138 if cmd.err != nil {
139 return Info{}, cmd.err
140 }
141
142 n.infoOnce.Do(func() {
143 out, err := cmd.Output(context.Background())
144 if err != nil {
145 var exitErr *exec.ExitError
146 if errors.As(err, &exitErr) && len(exitErr.Stderr) != 0 {
147 n.infoErr = redact.Errorf("nix command: %s: %q: %v", redact.Safe(cmd), exitErr.Stderr, err)
148 return
149 }
150 n.infoErr = redact.Errorf("nix command: %s: %v", redact.Safe(cmd), err)
151 return
152 }
153 n.info, n.infoErr = parseInfo(out)
154 })
155 return n.info, n.infoErr
156}
157
158// All major Nix versions supported by Devbox.
159const (

Callers 3

SystemMethod · 0.95
VersionMethod · 0.95
AtLeastFunction · 0.45

Calls 6

CommandMethod · 0.95
ErrorfFunction · 0.92
SafeFunction · 0.92
parseInfoFunction · 0.85
DoMethod · 0.45
OutputMethod · 0.45

Tested by

no test coverage detected