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

Function EnsureValidPlatform

internal/nix/nix.go:147–163  ·  view source on GitHub ↗

EnsureValidPlatform returns an error if the platform is not supported by nix. https://nixos.org/manual/nix/stable/installation/supported-platforms.html

(platforms ...string)

Source from the content-addressed store, hash-verified

145// EnsureValidPlatform returns an error if the platform is not supported by nix.
146// https://nixos.org/manual/nix/stable/installation/supported-platforms.html
147func EnsureValidPlatform(platforms ...string) error {
148 ensureValid := func(platform string) error {
149 for _, p := range nixPlatforms {
150 if p == platform {
151 return nil
152 }
153 }
154 return usererr.New("Unsupported platform: %s. Valid platforms are: %v", platform, nixPlatforms)
155 }
156
157 for _, p := range platforms {
158 if err := ensureValid(p); err != nil {
159 return err
160 }
161 }
162 return nil
163}
164
165// Warning: be careful using the bins in default/bin, they won't always match bins
166// produced by the flakes.nix. Use devbox.NixBins() instead.

Callers 2

AddPlatformsMethod · 0.92
ExcludePlatformsMethod · 0.92

Calls 1

NewFunction · 0.92

Tested by

no test coverage detected