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
···1515 comment = list.description;
1616 };
1717 payloads = map makePayload cfg.lists;
1818+ macvendorURL = lib.strings.escapeShellArg cfg.macvendorURL;
1819in
1920''
2021 # Can't use -u (unset) because api.sh uses API_URL before it is set
···2223 pihole="${lib.getExe pihole}"
2324 jq="${lib.getExe pkgs.jq}"
24252626+ ${lib.getExe pkgs.curl} --retry 3 --retry-delay 5 "${macvendorURL}" -o "${cfg.settings.files.macvendor}" || echo "Failed to download MAC database from ${macvendorURL}"
2727+2528 # If the database doesn't exist, it needs to be created with gravity.sh
2626- if [ ! -f '${cfg.stateDirectory}'/gravity.db ]; then
2929+ if [ ! -f '${cfg.settings.files.gravity}' ]; then
2730 $pihole -g
2831 # Send SIGRTMIN to FTL, which makes it reload the database, opening the newly created one
2932 ${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
···118118 '';
119119 };
120120121121+ macvendorURL = mkOption {
122122+ type = types.str;
123123+ default = "https://ftl.pi-hole.net/macvendor.db";
124124+ description = ''
125125+ URL from which to download the macvendor.db file.
126126+ '';
127127+ };
128128+121129 pihole = mkOption {
122130 type = types.package;
123131 default = piholeScript;