This commit is contained in:
@@ -15,6 +15,7 @@ let
|
||||
comment = list.description;
|
||||
};
|
||||
payloads = map makePayload cfg.lists;
|
||||
macvendorURL = lib.strings.escapeShellArg cfg.macvendorURL;
|
||||
in
|
||||
''
|
||||
# Can't use -u (unset) because api.sh uses API_URL before it is set
|
||||
@@ -22,8 +23,10 @@ in
|
||||
pihole="${lib.getExe pihole}"
|
||||
jq="${lib.getExe pkgs.jq}"
|
||||
|
||||
${lib.getExe pkgs.curl} --retry 3 --retry-delay 5 "${macvendorURL}" -o "${cfg.settings.files.macvendor}" || echo "Failed to download MAC database from ${macvendorURL}"
|
||||
|
||||
# If the database doesn't exist, it needs to be created with gravity.sh
|
||||
if [ ! -f '${cfg.stateDirectory}'/gravity.db ]; then
|
||||
if [ ! -f '${cfg.settings.files.gravity}' ]; then
|
||||
$pihole -g
|
||||
# Send SIGRTMIN to FTL, which makes it reload the database, opening the newly created one
|
||||
${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN $(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name})
|
||||
|
||||
@@ -118,6 +118,14 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
macvendorURL = mkOption {
|
||||
type = types.str;
|
||||
default = "https://ftl.pi-hole.net/macvendor.db";
|
||||
description = ''
|
||||
URL from which to download the macvendor.db file.
|
||||
'';
|
||||
};
|
||||
|
||||
pihole = mkOption {
|
||||
type = types.package;
|
||||
default = piholeScript;
|
||||
@@ -260,7 +268,7 @@ in
|
||||
files = {
|
||||
database = "${cfg.stateDirectory}/pihole-FTL.db";
|
||||
gravity = "${cfg.stateDirectory}/gravity.db";
|
||||
macvendor = "${cfg.stateDirectory}/gravity.db";
|
||||
macvendor = "${cfg.stateDirectory}/macvendor.db";
|
||||
log.ftl = "${cfg.logDirectory}/FTL.log";
|
||||
log.dnsmasq = "${cfg.logDirectory}/pihole.log";
|
||||
log.webserver = "${cfg.logDirectory}/webserver.log";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
nixosTests,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
gmp,
|
||||
@@ -12,7 +13,6 @@
|
||||
readline,
|
||||
xxd,
|
||||
iproute2,
|
||||
...
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
@@ -78,6 +78,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
'';
|
||||
|
||||
passthru.settingsTemplate = ./pihole.toml;
|
||||
passthru.tests = nixosTests.pihole-ftl;
|
||||
|
||||
meta = {
|
||||
description = "Pi-hole FTL engine";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
nixosTests,
|
||||
fetchFromGitHub,
|
||||
pihole,
|
||||
pihole-ftl,
|
||||
@@ -36,6 +37,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.tests = nixosTests.pihole-ftl;
|
||||
|
||||
meta = {
|
||||
description = "Pi-hole web dashboard displaying stats and more";
|
||||
homepage = "https://github.com/pi-hole/web";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
lib,
|
||||
nixosTests,
|
||||
fetchFromGitHub,
|
||||
makeBinaryWrapper,
|
||||
installShellFiles,
|
||||
@@ -238,6 +239,8 @@
|
||||
mainProgram = "pihole";
|
||||
};
|
||||
|
||||
passthru.tests = nixosTests.pihole-ftl;
|
||||
|
||||
passthru = {
|
||||
inherit stateDir;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user