`strings.trim` returns a copy of the string with all leading and trailing
whitespace removed.
`strings.trimWith` does the same thing, but calling code can decide
whether to trim the start and/or end of the string.
- Bring up to date
- Give meaning to the metavariables
- Use italics for metavariables (just like the Nix manual)
- Don't abbreviate
- No hard feelings, Val.
The old stdenv didn't work, and was also impure. The new one works, and
is pure. Presently, the bootstrap tools are cross compiled into one small
nar and one large tar, which is then unpacked, patched, and split into
smaller derivations. Efforts were made to make the boot process as short
as possible - there are only two clangs built, and as many packages are
propagated between stages as possible while leaving the bootstrap tools
out of the final stdenv's closure.
This is a follow-up to https://github.com/NixOS/nixpkgs/pull/325380 where @emilazy discovered that we have some typos in field names.
This refactoring wraps the implicit lib.licenses schema up in a factory function to ensure consistency.
While a more proper type checker like the one we use for meta checks would be better I didn't want to depend on that in more places.
In fact, we might want to make meta type checks more strict on the license field.
Previously we would fallback to using `kernel` as the `os` which would
result in using the wrong `os` value (`none`) when actually we want
`unknown`. This seems to be a special case for wasm32-unknown-unknown
and wasm64-unknown-unknown so I extended the if statement to support it.
All builtins should be in mirrored in lib, for consistency, as well
as control to let the Nixpkgs pin effect *subtle* improvements in
behavior (such as the foldl' accumulator strictness).
Benefits:
- some lookups happened in the hot path, and will now be slightly faster,
with only a variable lookup and no attribute selection
- it's now harder to accidentally use args.lib aka specialArgs.lib, which
has happened
- shorter
The practical use for this should be very limited because I don't
think anyone should change `lib`, let alone change `lib.functionArgs`,
but, but it would be even stranger to rely on `args.lib` (or really
`specialArgs.lib` for what's clearly a behavior of the current
`evalModules`, which uses its own ambient lib for basically everything.
The shadowing of `lib` by `args.lib` here seems to be a small mistake,
which is easy to make.
Add lib.meta.getLicenseFromSpdxIdOr as a variant of
lib.meta.getLicenseFromSpdxId that explicitly state the default
(fallback) value if there's no license matching the given SPDX ID.
Add a library function to parse and validate an IPv6 address from a
string. It can parse the first two versions of an IPv6 address according
to https://datatracker.ietf.org/doc/html/rfc4291#section-2.2. The third
form "x❌x❌x:x.d.d.d.d" is not yet implemented. Optionally parser can accept prefix length (128 is default).
Add shell script network.sh to test IPv6 parser functionality.
* doc: migrate lib.filesystem to doc-comment format
* defintion list fixes lib/filesystem.nix
Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>
---------
Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>