The indentation stripping semantics of strings are fairly bad and have a
few gotchas where the resulting string has not the intended indentation.
This commit fixes most if not all such instances in Nixpkgs.
I tried to strive a balance between keeping the diff small and
reformatting/refactoring the code to look better. In general,
reformatting should be left to Nixfmt.
Note that this causes a lot of rebuilds by design. All changes need to
be thoroughly vetted and reviewed for correctness. There is no automatic
way to prove correctness.
List of files to fix generated by running
https://gerrit.lix.systems/c/lix/+/2092 on Nixpkgs and looking at the
warnings.
In preparation for the deprecation of `stdenv.isX`.
These shorthands are not conducive to cross-compilation because they
hide the platforms.
Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way
One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059
There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.
```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper
this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
Changelog:
0.49.1:
* Ban Unstable Variables
0.50.0:
* Fix crash with exhaustive match on Generics.
* Fix parameter names not being checked in all circumstances.
* Fix compiler crash to HeapToStack compiler pass.
* Strengthen the ordering for some atomic operations.
* Allow override of return types for FFI functions.
* Don't allow FFI calls in default methods or behaviours.
* Fix MacOS version mismatch warnings when linking pony programs.
* Fix calculation of "is prime" for numbers > 1321.
* Prevent non-opaque structs from being used as behaviour parameters.
* Update to LLVM 12.0.1.
* Added FileMode.u32.
* Changes to Promises Library.
* Remove zlib from libponyc as a dependency.
* Fix compile-time crash related to Pony-specific Optimizations.
* Update FilePath constructors to allow a non-partial way to create a FilePath.
Updated googlebenchmark dependency to 1.5.4
Updated googletest to 1.10.0
Replaced a fetchurl call with a fetchFromGitHub call.
* Don't allow PONYPATH to override standard library (PR #3780)
* Fix bug where Flags.remove could set flags in addition to unsetting them (PR #3777)
* Allow Flags instances to be created with a set bit encoding (PR #3778)
* Fix "iftype" expressions not being usable in lambdas or object literals (PR #3763)
* Fix code generation for variadic FFI functions on arm64 (PR #3768)
* Fix NullablePointer type constraint check being omitted in FFI declarations
* Change to Steed's model of subtyping
* Fix memory corruption with Array.chop and String.chop
* Improve error message for match on structs
* RFC 68: Mandatory FFI declarations
* Change return type of String.add to String iso^
* Improve error message on destructuring of non-tuple types
* Use built-in offset argument to cpointer
* Add IsPrime checker to math package
* Fix compiler crash related to type parameter references
* Fix literal inference through partial function
* Fix partial FFI declarations ignoring partial annotation
* Fix symbol table patching for overriding default methods
* Fix tuple related compiler segfaults
* Create a standalone libponyc on Linux