index-debuginfo: support building with Nix >= 2.19

This commit is contained in:
Pierre Bourdon 2024-02-21 00:26:10 +01:00
parent c09f3125d5
commit 50daba62af
Signed by untrusted user: delroth
GPG key ID: 6FB80DCD84DA0F1C
2 changed files with 10 additions and 2 deletions

View file

@ -17,14 +17,17 @@
sqlite sqlite
]; ];
buildCommand = '' buildCommand = let
nixHasSignalsHh = nixpkgs.lib.strings.versionAtLeast nix.version "2.19";
in ''
mkdir -p $out/bin mkdir -p $out/bin
g++ -Os -g ${./index-debuginfo.cc} -Wall -std=c++14 -o $out/bin/index-debuginfo -I . \ g++ -Os -g ${./index-debuginfo.cc} -Wall -std=c++14 -o $out/bin/index-debuginfo -I . \
$(pkg-config --cflags nix-main) \ $(pkg-config --cflags nix-main) \
$(pkg-config --libs nix-main) \ $(pkg-config --libs nix-main) \
$(pkg-config --libs nix-store) \ $(pkg-config --libs nix-store) \
-lsqlite3 -lsqlite3 \
${nixpkgs.lib.optionalString nixHasSignalsHh "-DHAS_SIGNALS_HH"}
''; '';
}; };

View file

@ -8,6 +8,11 @@
#include "thread-pool.hh" #include "thread-pool.hh"
#include "nar-info.hh" #include "nar-info.hh"
// https://github.com/NixOS/nix/commit/ac89bb064aeea85a62b82a6daf0ecca7190a28b7
#ifdef HAS_SIGNALS_HH
#include "signals.hh"
#endif
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
// cache.nixos.org/debuginfo/<build-id> // cache.nixos.org/debuginfo/<build-id>