pihole: 6.1 -> 6.1.4

averyv 83d3cc8a f76ef0df

+2 -2
nixos/modules/services/networking/pihole-ftl-setup-script.nix
···
${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN $(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name})
fi
-
source ${pihole}/usr/share/pihole/advanced/Scripts/api.sh
-
source ${pihole}/usr/share/pihole/advanced/Scripts/utils.sh
+
source ${pihole}/share/pihole/advanced/Scripts/api.sh
+
source ${pihole}/share/pihole/advanced/Scripts/utils.sh
any_failed=0
+8 -8
pkgs/by-name/pi/pihole/0001-Remove-sudo.patch
···
-
From a2b3aa45d6e073272608506b1d27e4f43f2b0032 Mon Sep 17 00:00:00 2001
-
From: williamvds <william@williamvds.me>
-
Date: Sun, 6 Apr 2025 23:00:41 +0100
-
Subject: [PATCH 1/3] Remove sudo
+
From 833856bd77dc6ea77557ab0659c1459bee393653 Mon Sep 17 00:00:00 2001
+
From: averyv <avery@averyv.me>
+
Date: Sat, 6 Sep 2025 17:51:48 +0100
+
Subject: [PATCH 1/2] Remove sudo
Rely on polkit and sensible permissions
---
···
1 file changed, 8 deletions(-)
diff --git a/pihole b/pihole
-
index 1d5093c..6afc48a 100755
+
index 7b5e3eb..b00617e 100755
--- a/pihole
+++ b/pihole
@@ -570,14 +570,6 @@ if [[ -z ${USER} ]]; then
USER=$(whoami)
fi
-
-# Check if the current user is neither root nor pihole and if the command
+
-# Check if the current user is not root and if the command
-# requires root. If so, exit with an error message.
-
-if [[ $EUID -ne 0 && ${USER} != "pihole" && need_root -eq 1 ]];then
+
-if [[ $EUID -ne 0 && need_root -eq 1 ]];then
- echo -e " ${CROSS} The Pi-hole command requires root privileges, try:"
- echo -e " ${COL_GREEN}sudo pihole $*${COL_NC}"
- exit 1
···
case "${1}" in
"allow" | "allowlist" ) listFunc "$@";;
--
-
2.48.1
+
2.50.1
+6 -6
pkgs/by-name/pi/pihole/0002-Remove-unsupported-commands.patch
···
-
From ab0650484cdd89afb5b60a0a046509ec5ae14375 Mon Sep 17 00:00:00 2001
-
From: williamvds <william@williamvds.me>
-
Date: Sun, 6 Apr 2025 23:01:30 +0100
-
Subject: [PATCH 2/3] Remove unsupported commands
+
From d72475d713a8eecd1476bc5bb4acfb0448d5abad Mon Sep 17 00:00:00 2001
+
From: averyv <avery@averyv.me>
+
Date: Sat, 6 Sep 2025 18:04:11 +0100
+
Subject: [PATCH 2/2] Remove unsupported commands
Remove some unsupported maintenance commands, particularly the ones which
reinstall, update, and uninstall pihole. This is managed by NixOS, after all.
···
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/pihole b/pihole
-
index 6afc48a..cce7c97 100755
+
index b00617e..a3c2e20 100755
--- a/pihole
+++ b/pihole
@@ -92,6 +92,7 @@ debugFunc() {
···
helpFunc() {
--
-
2.48.1
+
2.50.1
-52
pkgs/by-name/pi/pihole/0003-Fix-redefinition-of-readonly-variable-utilsfile.patch
···
-
From cca2f6437e3ba09019b8fcb1986b4558d7c6db4e Mon Sep 17 00:00:00 2001
-
From: williamvds <william@williamvds.me>
-
Date: Sat, 31 May 2025 13:43:42 +0100
-
Subject: [PATCH 3/3] Fix redefinition of readonly variable utilsfile
-
-
---
-
advanced/Scripts/api.sh | 2 +-
-
pihole | 10 +++-------
-
2 files changed, 4 insertions(+), 8 deletions(-)
-
-
diff --git a/advanced/Scripts/api.sh b/advanced/Scripts/api.sh
-
index 613a8d8..8720043 100755
-
--- a/advanced/Scripts/api.sh
-
+++ b/advanced/Scripts/api.sh
-
@@ -19,7 +19,7 @@
-
-
TestAPIAvailability() {
-
-
- local chaos_api_list authResponse authStatus authData apiAvailable DNSport
-
+ local chaos_api_list authResponse authStatus authData apiAvailable DNSport utilsfile
-
-
# as we are running locally, we can get the port value from FTL directly
-
readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
-
diff --git a/pihole b/pihole
-
index cce7c97..d63d064 100755
-
--- a/pihole
-
+++ b/pihole
-
@@ -16,18 +16,14 @@ readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
-
# error due to modifying a readonly variable.
-
PI_HOLE_BIN_DIR="/usr/local/bin"
-
-
-readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
-
# shellcheck source=./advanced/Scripts/COL_TABLE
-
-source "${colfile}"
-
+source "${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
-
-
-readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
-
# shellcheck source=./advanced/Scripts/utils.sh
-
-source "${utilsfile}"
-
+source "${PI_HOLE_SCRIPT_DIR}/utils.sh"
-
-
-# Source api functions
-
-readonly apifile="${PI_HOLE_SCRIPT_DIR}/api.sh"
-
# shellcheck source=./advanced/Scripts/api.sh
-
-source "${apifile}"
-
+source "${PI_HOLE_SCRIPT_DIR}/api.sh"
-
-
versionsfile="/etc/pihole/versions"
-
if [ -f "${versionsfile}" ]; then
-
--
-
2.48.1
-
+16 -16
pkgs/by-name/pi/pihole/package.nix
···
(resholve.mkDerivation rec {
pname = "pihole";
-
version = "6.1";
+
version = "6.1.4";
src = fetchFromGitHub {
owner = "pi-hole";
repo = "pi-hole";
tag = "v${version}";
-
hash = "sha256-aEnv8Lhb5vf0yDyuriVTaUY1wcdVmTdqoK+KDHvT/Lw=";
+
hash = "sha256-2B2GUJKt4jHEjQLBx96FRuHpnLCTzE4UPDaeQvnDONc=";
};
patches = [
···
./0001-Remove-sudo.patch
# Disable unsupported subcommands, particularly those for imperatively installing/upgrading Pi-hole
./0002-Remove-unsupported-commands.patch
-
# Fix a readonly variable error caused by defining a shadowing local variable
-
./0003-Fix-redefinition-of-readonly-variable-utilsfile.patch
];
nativeBuildInputs = [
···
installPhase = ''
runHook preInstall
-
readonly scriptsDir=$out/usr/share/pihole
+
readonly scriptsDir=$out/share/pihole
install -Dm 555 -t $out/bin pihole
install -Dm 555 -t $scriptsDir/advanced/Scripts gravity.sh
···
solutions.default =
let
out = builtins.placeholder "out";
-
scriptsDir = "${out}/usr/share/pihole/advanced/Scripts";
+
scriptsDir = "${out}/share/pihole/advanced/Scripts";
in
{
scripts =
let
-
relativeScripts = "usr/share/pihole/advanced/Scripts";
+
relativeScripts = "share/pihole/advanced/Scripts";
in
[
"bin/pihole"
···
inputs = [
# TODO: see if these inputs can help resholving
"bin"
-
"usr/share/pihole/advanced/Scripts"
+
"share/pihole/advanced/Scripts"
bash
coreutils
···
};
fix = {
"$PI_HOLE_BIN_DIR" = [ "${out}/bin" ];
-
"$PI_HOLE_FILES_DIR" = [ "${out}/usr/share/pihole" ];
+
"$PI_HOLE_FILES_DIR" = [ "${out}/share/pihole" ];
"$PI_HOLE_INSTALL_DIR" = [ scriptsDir ];
-
"$PI_HOLE_LOCAL_REPO" = [ "${out}/usr/share/pihole" ];
+
"$PI_HOLE_LOCAL_REPO" = [ "${out}/share/pihole" ];
"$PI_HOLE_SCRIPT_DIR" = [ scriptsDir ];
"$colfile" = [ "${scriptsDir}/COL_TABLE" ];
"$coltable" = [ "${scriptsDir}/COL_TABLE" ];
"$PIHOLE_COLTABLE_FILE" = [ "${scriptsDir}/COL_TABLE" ];
"$utilsfile" = [ "${scriptsDir}/utils.sh" ];
"$apifile" = [ "${scriptsDir}/api.sh" ];
-
"$piholeGitDir" = [ "${out}/usr/share/pihole" ];
+
"$piholeGitDir" = [ "${out}/share/pihole" ];
"$PIHOLE_COMMAND" = [ "pihole" ];
};
keep = {
···
"$setupVars" # Global config file
"$PIHOLE_SETUP_VARS_FILE"
"$versionsfile" # configuration file, doesn't exist on NixOS
-
"${out}/usr/share/pihole/automated install/basic-install.sh"
+
"${out}/share/pihole/automated install/basic-install.sh"
"${scriptsDir}/COL_TABLE"
"${scriptsDir}/database_migration/gravity-db.sh"
"${scriptsDir}/gravity.sh"
···
# both quoted and escaped. Resholve apparently requires matching the
# literal path, so we need to provide a version with and without the
# backslash.
-
"'${out}/usr/share/pihole/automated\\ install/basic-install.sh'" = true;
-
"'${out}/usr/share/pihole/automated install/basic-install.sh'" = true;
+
"'${out}/share/pihole/automated\\ install/basic-install.sh'" = true;
+
"'${out}/share/pihole/automated install/basic-install.sh'" = true;
"/etc/.pihole" = true; # Patched with an override
"/etc/os-release" = true;
···
meta = {
description = "Black hole for Internet advertisements";
+
homepage = "https://pi-hole.net";
+
changelog = "https://github.com/pi-hole/pi-hole/releases/tag/v${version}";
license = lib.licenses.eupl12;
maintainers = with lib.maintainers; [ averyvigolo ];
platforms = lib.platforms.linux;
···
};
passthru = {
-
stateDir = stateDir;
+
inherit stateDir;
};
}).overrideAttrs
(old: {
# Resholve can't fix the hardcoded absolute paths, so substitute them before resholving
preFixup = ''
-
scriptsDir=$out/usr/share/pihole
+
scriptsDir=$out/share/pihole
substituteInPlace $out/bin/pihole $scriptsDir/advanced/Scripts/*.sh \
--replace-quiet /etc/.pihole $scriptsDir \