Fix compilation against older Nix versions (tested with 2.13.6)

dblsaiko
Nov 27, 2023, 6:25 PM
7YS2X7JJVAFT7QFDASQR4ZVUAAFYF4OLK5XLY3JJ2URSXI34ZOTAC

Dependencies

Change contents

  • edit in src/fetcher.cpp at line 27
    [2.709]
    [2.709]
    #if NIX_VERSION >= 0x021600
  • edit in src/fetcher.cpp at line 29
    [2.749]
    [2.749]
    #endif
  • edit in src/fetcher.cpp at line 40
    [2.956]
    [2.956]
    #if NIX_VERSION < 0x021800
    [[nodiscard]] std::optional<Input> inputFromURL(const ParsedURL &url) const override
    #else
  • edit in src/fetcher.cpp at line 44
    [2.1063]
    [2.1063]
    #endif
  • edit in CMakeLists.txt at line 22
    [2.14335]
    [2.14335]
    string(REPLACE "." ";" VERSION_LIST ${Nix_VERSION})
    list(GET VERSION_LIST 0 Nix_MAJOR_VERSION)
    list(GET VERSION_LIST 1 Nix_MINOR_VERSION)
    list(GET VERSION_LIST 2 Nix_PATCH_VERSION)
    target_compile_definitions(PkgConfig::Nix
    INTERFACE
    "NIX_MAJOR_VERSION=(${Nix_MAJOR_VERSION})"
    "NIX_MINOR_VERSION=(${Nix_MINOR_VERSION})"
    "NIX_PATCH_VERSION=(${Nix_PATCH_VERSION})"
    "NIX_VERSION=(((0x${Nix_MAJOR_VERSION})<<16) | ((0x${Nix_MINOR_VERSION})<<8) | (0x${Nix_PATCH_VERSION}))")