szip is unfree, that's why using it was disabled by default. Also, if
cmake was called with `-DHDF5_ENABLE_SZIP_SUPPORT=ON`, we got the
messages:
-- Could NOT find libaec (missing: libaec_DIR)
CMake Warning at CMakeFilters.cmake:221 (message):
SZIP support in HDF5 was enabled but not found
Meaning the library szip was no longer in use by this library since an
earlier release.
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
Short:
- fix incorrect cmake flag `"-DDHDF5_ENABLE_THREADSAFE:BOOL=ON"` -> `"-DHDF5_ENABLE_THREADSAFE:BOOL=ON"`.
- disable unsupported c++ api in hdf5-threadsafe.
Breaking:
Note: this bug means that historically nixpkgs was building hdf5-threadsafe without threadsafety enabled, but with c++ support.
C++ and threadsafe are unsupported, so this fix is a slight breaking change if downstream users were relying on hdf5-threadsafe exposing the c++ api.
If we instead want to expose both c++ and threadsafe, we would need "-DALLOW_UNSUPPORTED=ON", but then we are exposing a combination not supported or tested by upstream.
Related:
typo introduced in cbd4d659e3
in the transition to cmake `"--enable-threadsafe"` was changed to `"-DDHDF5_ENABLE_THREADSAFE:BOOL=ON"`.
Note the double `D`, the correct syntax is `-DFLAG_NAME=VALUE`.
C++ was enabled by default in 9046690c73
Longer:
```
$ nix build .#legacyPackages.aarch64-darwin.hdf5-threadsafe
$ nix log $(nix eval --raw .#legacyPackages.aarch64-darwin.hdf5-threadsafe.drvPath)
[...]
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_EXPORT_NO_PACKAGE_REGISTRY
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_DOCDIR
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_INFODIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_LIBEXECDIR
CMAKE_INSTALL_LOCALEDIR
CMAKE_INSTALL_MANDIR
CMAKE_INSTALL_SBINDIR
CMAKE_POLICY_DEFAULT_CMP0025
DHDF5_ENABLE_THREADSAFE
[...]
```
```
$ git grep -ni 'DHDF5_ENABLE_THREADSAFE'
pkgs/tools/misc/hdf5/default.nix:93: "-DDHDF5_ENABLE_THREADSAFE:BOOL=ON"
```
We can see the correct version of this flag in the hdf5 repo
```
$ git grep -ni 'HDF5_ENABLE_THREADSAFE'
.github/workflows/arm-main-cmake.yml:94: -DHDF5_ENABLE_THREADSAFE:BOOL=ON \
[...]
CMakeBuildOptions.cmake:59:option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF)
[...]
```
after this fix we can again inspect the cmake output, and we no longer see a warning for this unsupported variable
```
$ nix build .#legacyPackages.aarch64-darwin.hdf5-threadsafe
$ nix log $(nix eval --raw .#legacyPackages.aarch64-darwin.hdf5-threadsafe.drvPath)
[...]
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_EXPORT_NO_PACKAGE_REGISTRY
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_DOCDIR
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_INFODIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_LIBEXECDIR
CMAKE_INSTALL_LOCALEDIR
CMAKE_INSTALL_MANDIR
CMAKE_INSTALL_SBINDIR
CMAKE_POLICY_DEFAULT_CMP0025
[...]
```
if we try to compile with both cppSupport and threadsafe we receive
```
> CMake Error at CMakeLists.txt:959 (message):
> **** C++ and thread-safety options are not supported, override with ALLOW_UNSUPPORTED option ****
```
Testing:
Builds clean on aarch64-darwin and x86_64-linux.
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
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"
```
* Only build static libs by default when stdenv.hostPlatform.isStatic
* Add separate -bin output
* Move h5hlcc/c++ dev binaries to -dev output
* Default to building with C++ support to cut down
on duplicated hdf5/hdf5-cpp in downstream closures