Convert a platform string of two or three(-ish) components to Platform.
For this, the following logic is utilized:
If the string has one dash, the form
cpu-osis assumed whereosmay only have a single component. Thevendorpart is ignored.Otherwise
cpu-vendor-osis assumed whereosmay have any number of components separated by dashes to accomodate its two componentkernel-systemform.
Note: This behavior is different from nixpkgs' lib.systems.elaborate:
Because we have no knowledge of the legal contents of the different parts,
we only decide how to parse it based on what form the string has. This can
give different results compared to autoconf or nixpkgs. It will also never
reject an invalid platform string that has a valid form.
parsePlatformLenient "x86_64-unknown-linux"Just (Platform X86_64 Linux)parsePlatformLenient "x86_64-pc-linux-gnu"Just (Platform X86_64 Linux)parsePlatformLenient "x86_64-linux"Just (Platform X86_64 Linux)
Note also that this conversion sometimes looses information nixpkgs would retain:
parsePlatformLenient "powerpc64-unknown-linux"Just (Platform PPC64 Linux)parsePlatformLenient "powerpc64le-unknown-linux"Just (Platform PPC64 Linux)