Downstream types that want to use `lib.types.defaultTypeMerge` must include
`wrapped` even though it is deprecated or the internal
`wrappedDeprecationMessage`. This is caused by accessing the
`wrapped` attr in `lib.types.defaultTypeMerge`. The logic should first check
if the attr exists and then if it does check if it is null.
The identifier is not versioned, as the version there is an artifact of
an incorrect interpretation of the documentation, other variants are now
deprecated.
If an attrset option was given a definition like:
{ system = lib.mkIf true false; }
Before this change, we get the non-explanatory error message:
error: expected a set but found a Boolean: true
With the stack trace having nothing to do with the module involved.
After this change, we get the better:
error: In module `[...]', you're trying to define a value of type `bool' [...]
Which names the actual module involved.
Nixpkgs does not contain an entry in lib.licenses for every SPDX license,
so it is expected that a valid SPDX id would yield no proper result from
getLicenseFromSpdxId. Hence, we should set spdxId in the default value.
Users that think their SPDX ID may be invalid should rather use
getLicenseFromSpdxIdOr.
`qemuArch` returned "aarch64" for both LE and BE, causing binfmt to
register `qemu-aarch64` for `aarch64_be` binaries. QEMU ships separate
`qemu-aarch64` and `qemu-aarch64_be` binaries, so the wrong interpreter
was used, failing with "Invalid ELF image for this architecture".
Since QEMU distinguishes endianness in the binary name, this adds the
"_be" suffix via `isBigEndian`, which is similar to the approach MIPS
uses a few lines below.
- concrete types start with uppercase: Int, String, Bool, Derivation,
etc.
- type variables start with lowercase: a, b, etc.
- list:
- use `[x]` for homogeneous lists instead of `List x` or `[ x ]`
- use `List` for heterogeneous lists (not that common in `lib`)
- attr:
- use `AttrSet` for a generic attribute set type
- use `{ key1 :: Type1; key2 :: Type2; ... }` for adding signatures
for known attribute names and types
- use `{ key1 = value1; key2 = value2; ... }` for adding attributes
with known literals
- end with an ellipsis (`...`) if the set can contain unknown
attributes
- use `{ [String] :: x }` if all the attributes has the same type `x`
- prefer `Any` over `a` if the latter is not reused
Make rustcTargetSpec the primary entrypoint for setting a custom target,
and wire up all the other stuff so they are hopefully as working and as
broken as before.
In particular, to specify a custom target, the user now just specifies
rust.rustcTargetSpec. rust.platform and rust.cargoShortTarget are
populated from rust.rustcTargetSpec now. In addition, rust.rustcTarget
defaults to rust.cargoShortTarget. (rust.rustcTarget and
rust.cargoShortTarget really should always be the same, but I think we
can deal with that later).
This allows the user to more easily control the basename of
rust.rustcTargetSpec by passing e.g.
"${./rust}/mips64el_mips3-unknown-linux-gnuabi64.json", which allows
cc-rs and in turn std to work.