pihole-ftl: cleanup

(cherry picked from commit cd869b7f02)
This commit is contained in:
Yiyu Zhou
2026-02-28 16:29:42 -08:00
committed by github-actions[bot]
parent 7c13ab6767
commit 65e4d8a2ce

View File

@@ -1,16 +1,18 @@
{
lib,
stdenv,
nixosTests,
fetchFromGitHub,
cmake,
fetchFromGitHub,
gmp,
lib,
libidn2,
libunistring,
mbedtls,
ncurses,
nettle,
nix-update-script,
nixosTests,
readline,
stdenv,
versionCheckHook,
xxd,
}:
@@ -46,14 +48,15 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
substituteInPlace src/version.c.in \
--replace-quiet "@GIT_VERSION@" "v${finalAttrs.version}" \
--replace-quiet "@GIT_DATE@" "1970-01-01" \
--replace-quiet "@GIT_BRANCH@" "master" \
--replace-quiet "@GIT_TAG@" "v${finalAttrs.version}" \
--replace-quiet "@GIT_HASH@" "builtfromreleasetarball"
--replace-fail "@GIT_VERSION@" "v${finalAttrs.version}" \
--replace-fail "@GIT_DATE@" "1970-01-01" \
--replace-fail "@GIT_BRANCH@" "master" \
--replace-fail "@GIT_TAG@" "v${finalAttrs.version}" \
--replace-fail "@GIT_HASH@" "builtfromreleasetarball"
# Remove hard-coded absolute path to the pihole script, rely on it being provided by $PATH
# Use execvp instead of execv so PATH is followed
# Remove hard-coded absolute path to the pihole script, rely on it
# being provided by $PATH. Use execvp instead of execv so PATH is
# followed.
substituteInPlace src/api/action.c \
--replace-fail "/usr/local/bin/pihole" "pihole" \
--replace-fail "execv" "execvp"
@@ -62,17 +65,20 @@ stdenv.mkDerivation (finalAttrs: {
installPhase = ''
runHook preInstall
install -Dm 555 -t $out/bin pihole-FTL
install -D pihole-FTL $out/bin/${finalAttrs.meta.mainProgram}
runHook postInstall
'';
passthru = {
settingsTemplate = ./pihole.toml;
tests = nixosTests.pihole-ftl;
updateScript = nix-update-script { };
};
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
meta = {
description = "Pi-hole FTL engine";
homepage = "https://github.com/pi-hole/FTL";