From 50daba62af2b7bb90281757570be1c8cf9ded0c6 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Wed, 21 Feb 2024 00:26:10 +0100 Subject: [PATCH] index-debuginfo: support building with Nix >= 2.19 --- flake.nix | 7 +++++-- index-debuginfo.cc | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index f1f9a71..6f76f26 100644 --- a/flake.nix +++ b/flake.nix @@ -17,14 +17,17 @@ sqlite ]; - buildCommand = '' + buildCommand = let + nixHasSignalsHh = nixpkgs.lib.strings.versionAtLeast nix.version "2.19"; + in '' mkdir -p $out/bin g++ -Os -g ${./index-debuginfo.cc} -Wall -std=c++14 -o $out/bin/index-debuginfo -I . \ $(pkg-config --cflags nix-main) \ $(pkg-config --libs nix-main) \ $(pkg-config --libs nix-store) \ - -lsqlite3 + -lsqlite3 \ + ${nixpkgs.lib.optionalString nixHasSignalsHh "-DHAS_SIGNALS_HH"} ''; }; diff --git a/index-debuginfo.cc b/index-debuginfo.cc index 8dd7dba..e320ccb 100644 --- a/index-debuginfo.cc +++ b/index-debuginfo.cc @@ -8,6 +8,11 @@ #include "thread-pool.hh" #include "nar-info.hh" +// https://github.com/NixOS/nix/commit/ac89bb064aeea85a62b82a6daf0ecca7190a28b7 +#ifdef HAS_SIGNALS_HH +#include "signals.hh" +#endif + #include // cache.nixos.org/debuginfo/