pihole-ftl: Download macvendor.db in setup service

As done in the update script https://github.com/pi-hole/pi-hole/blob/cef7fd4b02c9ae4314e7478c0d542379bfce7f65/automated install/basic-install.sh#L1791-L1792

averyv 155cdfb0 113e3681

+12 -1
+4 -1
nixos/modules/services/networking/pihole-ftl-setup-script.nix
··· 15 comment = list.description; 16 }; 17 payloads = map makePayload cfg.lists; 18 in 19 '' 20 # Can't use -u (unset) because api.sh uses API_URL before it is set ··· 22 pihole="${lib.getExe pihole}" 23 jq="${lib.getExe pkgs.jq}" 24 25 # If the database doesn't exist, it needs to be created with gravity.sh 26 - if [ ! -f '${cfg.stateDirectory}'/gravity.db ]; then 27 $pihole -g 28 # Send SIGRTMIN to FTL, which makes it reload the database, opening the newly created one 29 ${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN $(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name})
··· 15 comment = list.description; 16 }; 17 payloads = map makePayload cfg.lists; 18 + macvendorURL = lib.strings.escapeShellArg cfg.macvendorURL; 19 in 20 '' 21 # Can't use -u (unset) because api.sh uses API_URL before it is set ··· 23 pihole="${lib.getExe pihole}" 24 jq="${lib.getExe pkgs.jq}" 25 26 + ${lib.getExe pkgs.curl} --retry 3 --retry-delay 5 "${macvendorURL}" -o "${cfg.settings.files.macvendor}" || echo "Failed to download MAC database from ${macvendorURL}" 27 + 28 # If the database doesn't exist, it needs to be created with gravity.sh 29 + if [ ! -f '${cfg.settings.files.gravity}' ]; then 30 $pihole -g 31 # Send SIGRTMIN to FTL, which makes it reload the database, opening the newly created one 32 ${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN $(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name})
+8
nixos/modules/services/networking/pihole-ftl.nix
··· 118 ''; 119 }; 120 121 pihole = mkOption { 122 type = types.package; 123 default = piholeScript;
··· 118 ''; 119 }; 120 121 + macvendorURL = mkOption { 122 + type = types.str; 123 + default = "https://ftl.pi-hole.net/macvendor.db"; 124 + description = '' 125 + URL from which to download the macvendor.db file. 126 + ''; 127 + }; 128 + 129 pihole = mkOption { 130 type = types.package; 131 default = piholeScript;