Accessibility: kaldi fails to build NixOS 25.05

Kaldi is used for speech recognition. But at the moment in NixOS 25.05 this fails to build the follow error (see below). But the summor is that I am encountering a build error due to a mismatch in how std::unique_ptr is being assigned in the Kaldi codebase. Specifically in fst.h when used with the newer C++ standard (GCC 14.2.1 and C++20/23).

isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr;

This is trying to assign a raw pointer (fst::SymbolTable*) to a std::unique_ptr<fst::SymbolTable>, which is not allowed directly. unique_ptr cannot be assigned from a raw pointer without explicitly wrapping it.

The fix, if I recall correctly (I don’t code often, so excuse me if I am wrong).

isymbols_ = impl.isymbols_ ? std::unique_ptr<fst::SymbolTable>(impl.isymbols_->Copy()) : nullptr;
osymbols_ = impl.osymbols_ ? std::unique_ptr<fst::SymbolTable>(impl.osymbols_->Copy()) : nullptr;

This ensures that std::unique_ptr takes ownership of the dynamically allocated object returned by Copy().

The full error is below. Feel free to tell me if I am missing something. My skillset is I know enough to know that I don’t know enough, while also knowing when I think about code long enough, I get a headache. lol But I do hope this is useful.

The error:

CMake Warning (dev) at CMakeLists.txt:43 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/bin/python (found version "3.12.10")
-- Running gen_cmake_skeleton.py
/build/source/cmake/gen_cmake_skeleton.py:235: SyntaxWarning: invalid escape sequence '\s'
  libs = re.findall("[^\s\\\\=]+", libs)
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Could not find nvcc, please set CUDAToolkit_ROOT.
CMake Warning (dev) at CMakeLists.txt:189 (find_package):
  Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
  --help-policy CMP0146" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) 
-- KALDI_VERSION set to "5.5"
-- Configuring done (1.5s)
copying path '/nix/store/831imiy4g9v6g3pk23hqchx1j11j0jkd-python3.12-torch-2.6.0-dev' from 'https://cache.nixos.org'...
-- Generating done (1.8s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_POLICY_DEFAULT_CMP0025


-- Build files have been written to: /build/source/build
cmake: enabled parallel building
cmake: enabled parallel installing
Running phase: buildPhase
build flags: -j16 SHELL=/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/bash
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/fst-types.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/symbol-table.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/mapped-file.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/util.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/compat.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/flags.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/fst.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/properties.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/symbol-table-ops.cc.o
[  0%] Building CXX object _deps/openfst-build/src/lib/CMakeFiles/fst.dir/weight.cc.o
copying path '/nix/store/41p71bqd8iazgd38p0h061x1nx27nvdc-python3.12-whisper-20240930-unstable-2025-01-04' from 'https://cache.nixos.org'...
In file included from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/symbol-table-ops.h:12,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/lib/symbol-table-ops.cc:5:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h: In member function 'fst::internal::FstImpl<Arc>& fst::internal::FstImpl<Arc>::operator=(const fst::internal::FstImpl<Arc>&)':
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:655:59: error: no match for 'operator=' (operand types are 'std::unique_ptr<fst::SymbolTable>' and 'fst::SymbolTable*')
  655 |     isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
In file included from /nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/memory:78,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:16:
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note: candidate: 'template<class _Up, class _Ep> typename std::enable_if<std::__and_<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::__uniq_ptr_impl<_Tp, _Dp>::pointer>, std::__not_<std::is_array<_Up> > >, std::is_assignable<_T2&, _U2&&> >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Ep = _Up; _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  425 |         operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
      |         ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note:   template argument deduction/substitution failed:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:655:59: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'fst::SymbolTable*'
  655 |     isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:19: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                   ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:29: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::unique_ptr<fst::SymbolTable>&&'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                             ^~~~~~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:7: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>; std::nullptr_t = std::nullptr_t]'
  435 |       operator=(nullptr_t) noexcept
      |       ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:17: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::nullptr_t'
  435 |       operator=(nullptr_t) noexcept
      |                 ^~~~~~~~~
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:656:59: error: no match for 'operator=' (operand types are 'std::unique_ptr<fst::SymbolTable>' and 'fst::SymbolTable*')
  656 |     osymbols_ = impl.osymbols_ ? impl.osymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note: candidate: 'template<class _Up, class _Ep> typename std::enable_if<std::__and_<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::__uniq_ptr_impl<_Tp, _Dp>::pointer>, std::__not_<std::is_array<_Up> > >, std::is_assignable<_T2&, _U2&&> >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Ep = _Up; _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  425 |         operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
      |         ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note:   template argument deduction/substitution failed:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:656:59: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'fst::SymbolTable*'
  656 |     osymbols_ = impl.osymbols_ ? impl.osymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:19: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                   ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:29: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::unique_ptr<fst::SymbolTable>&&'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                             ^~~~~~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:7: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>; std::nullptr_t = std::nullptr_t]'
  435 |       operator=(nullptr_t) noexcept
      |       ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:17: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::nullptr_t'
  435 |       operator=(nullptr_t) noexcept
      |                 ^~~~~~~~~
In file included from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/lib/fst.cc:6:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h: In member function 'fst::internal::FstImpl<Arc>& fst::internal::FstImpl<Arc>::operator=(const fst::internal::FstImpl<Arc>&)':
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:655:59: error: no match for 'operator=' (operand types are 'std::unique_ptr<fst::SymbolTable>' and 'fst::SymbolTable*')
  655 |     isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
In file included from /nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/memory:78,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:16:
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note: candidate: 'template<class _Up, class _Ep> typename std::enable_if<std::__and_<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::__uniq_ptr_impl<_Tp, _Dp>::pointer>, std::__not_<std::is_array<_Up> > >, std::is_assignable<_T2&, _U2&&> >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Ep = _Up; _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  425 |         operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
      |         ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note:   template argument deduction/substitution failed:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:655:59: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'fst::SymbolTable*'
  655 |     isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:19: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                   ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:29: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::unique_ptr<fst::SymbolTable>&&'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                             ^~~~~~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:7: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>; std::nullptr_t = std::nullptr_t]'
  435 |       operator=(nullptr_t) noexcept
      |       ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:17: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::nullptr_t'
  435 |       operator=(nullptr_t) noexcept
      |                 ^~~~~~~~~
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:656:59: error: no match for 'operator=' (operand types are 'std::unique_ptr<fst::SymbolTable>' and 'fst::SymbolTable*')
  656 |     osymbols_ = impl.osymbols_ ? impl.osymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note: candidate: 'template<class _Up, class _Ep> typename std::enable_if<std::__and_<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::__uniq_ptr_impl<_Tp, _Dp>::pointer>, std::__not_<std::is_array<_Up> > >, std::is_assignable<_T2&, _U2&&> >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Ep = _Up; _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  425 |         operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
      |         ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note:   template argument deduction/substitution failed:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:656:59: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'fst::SymbolTable*'
  656 |     osymbols_ = impl.osymbols_ ? impl.osymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:19: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                   ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:29: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::unique_ptr<fst::SymbolTable>&&'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                             ^~~~~~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:7: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>; std::nullptr_t = std::nullptr_t]'
  435 |       operator=(nullptr_t) noexcept
      |       ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:17: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::nullptr_t'
  435 |       operator=(nullptr_t) noexcept
      |                 ^~~~~~~~~
In file included from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/expanded-fst.h:17,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/mutable-fst.h:21,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/vector-fst.h:16,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/cache.h:17,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/compact-fst.h:19,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/lib/fst-types.cc:4:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h: In member function 'fst::internal::FstImpl<Arc>& fst::internal::FstImpl<Arc>::operator=(const fst::internal::FstImpl<Arc>&)':
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:655:59: error: no match for 'operator=' (operand types are 'std::unique_ptr<fst::SymbolTable>' and 'fst::SymbolTable*')
  655 |     isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
In file included from /nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/memory:78,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/compact-fst.h:12:
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note: candidate: 'template<class _Up, class _Ep> typename std::enable_if<std::__and_<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::__uniq_ptr_impl<_Tp, _Dp>::pointer>, std::__not_<std::is_array<_Up> > >, std::is_assignable<_T2&, _U2&&> >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Ep = _Up; _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  425 |         operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
      |         ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note:   template argument deduction/substitution failed:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:655:59: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'fst::SymbolTable*'
  655 |     isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:19: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                   ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:29: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::unique_ptr<fst::SymbolTable>&&'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                             ^~~~~~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:7: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>; std::nullptr_t = std::nullptr_t]'
  435 |       operator=(nullptr_t) noexcept
      |       ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:17: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::nullptr_t'
  435 |       operator=(nullptr_t) noexcept
      |                 ^~~~~~~~~
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:656:59: error: no match for 'operator=' (operand types are 'std::unique_ptr<fst::SymbolTable>' and 'fst::SymbolTable*')
  656 |     osymbols_ = impl.osymbols_ ? impl.osymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note: candidate: 'template<class _Up, class _Ep> typename std::enable_if<std::__and_<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::__uniq_ptr_impl<_Tp, _Dp>::pointer>, std::__not_<std::is_array<_Up> > >, std::is_assignable<_T2&, _U2&&> >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Ep = _Up; _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  425 |         operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
      |         ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:425:9: note:   template argument deduction/substitution failed:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/fst.h:656:59: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'fst::SymbolTable*'
  656 |     osymbols_ = impl.osymbols_ ? impl.osymbols_->Copy() : nullptr;
      |                                                           ^~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:19: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>]'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                   ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:409:29: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::unique_ptr<fst::SymbolTable>&&'
  409 |       unique_ptr& operator=(unique_ptr&&) = default;
      |                             ^~~~~~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:7: note: candidate: 'std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = fst::SymbolTable; _Dp = std::default_delete<fst::SymbolTable>; std::nullptr_t = std::nullptr_t]'
  435 |       operator=(nullptr_t) noexcept
      |       ^~~~~~~~
/nix/store/9ds850ifd4jwcccpp3v14818kk74ldf2-gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/unique_ptr.h:435:17: note:   no known conversion for argument 1 from 'fst::SymbolTable*' to 'std::nullptr_t'
  435 |       operator=(nullptr_t) noexcept
      |                 ^~~~~~~~~
make[2]: *** [_deps/openfst-build/src/lib/CMakeFiles/fst.dir/build.make:177: _deps/openfst-build/src/lib/CMakeFiles/fst.dir/symbol-table-ops.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/accumulator.h:20,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/label-reachable.h:16,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/lookahead-matcher.h:20,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/matcher-fst.h:14,
                 from /nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/lib/fst.cc:12:
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/replace.h: In member function 'bool fst::internal::ReplaceFstImpl<Arc, StateTable, CacheStore>::ComputeArc(const StateTuple&, const Arc&, Arc*, uint32)':
/nix/store/xb8h6kfjbqclshgxq5ikh9maavxn3z1g-source/src/include/fst/replace.h:804:32: warning: expected 'template' keyword before dependent template name []
  804 |     if (arc.olabel == 0 || arc.olabel < *nonterminal_set_.begin() ||
      |                                ^~~~~~
      |                                template
make[2]: *** [_deps/openfst-build/src/lib/CMakeFiles/fst.dir/build.make:121: _deps/openfst-build/src/lib/CMakeFiles/fst.dir/fst.cc.o] Error 1
make[2]: *** [_deps/openfst-build/src/lib/CMakeFiles/fst.dir/build.make:107: _deps/openfst-build/src/lib/CMakeFiles/fst.dir/fst-types.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2957: _deps/openfst-build/src/lib/CMakeFiles/fst.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
error: builder for '/nix/store/k0p9sqh4rrxs5s5cw7bax9fp2fq9bwz6-kaldi-0-unstable-2024-11-29.drv' failed with exit code 2
error: 1 dependencies of derivation '/nix/store/psdsjafafbc58k926hylj4ypd02ljmkj-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/b0sl47xa42dqkndrdgklaxx9ihb67cvf-nixos-system-tempest-25.05beta802025.cd2812de55cf.drv' failed to build

I’m facing the same error:

I have published a pull request with a workarround (downgrading gcc).
Let’s see if we can create a patch for openfst.

Downgrading gcc would likely have issues elsewhere.

I may look for an alternative to Kaldi. It seems that build issues are well documented on Kaldi upstream.