EnsureValidPlatform returns an error if the platform is not supported by nix. https://nixos.org/manual/nix/stable/installation/supported-platforms.html
(platforms ...string)
| 145 | // EnsureValidPlatform returns an error if the platform is not supported by nix. |
| 146 | // https://nixos.org/manual/nix/stable/installation/supported-platforms.html |
| 147 | func 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. |
no test coverage detected