mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-25 17:55:21 +00:00
nixos/adguardhome: Fix protection_disabled_until value; nixos/adguardhome: Use lib.recursiveUpdate (#483921)
This commit is contained in:
@@ -20,8 +20,7 @@ let
|
||||
|
||||
settings =
|
||||
if (cfg.settings != null) then
|
||||
cfg.settings
|
||||
// (
|
||||
lib.recursiveUpdate cfg.settings (
|
||||
if cfg.settings.schema_version < 23 then
|
||||
{
|
||||
bind_host = cfg.host;
|
||||
@@ -192,8 +191,9 @@ in
|
||||
# Note: --check-config has the side effect of modifying the file at rest!
|
||||
${lib.getExe cfg.package} -c "$STATE_DIRECTORY/AdGuardHome.yaml" --check-config
|
||||
|
||||
# Writing directly to AdGuardHome.yaml results in empty file
|
||||
${lib.getExe pkgs.yaml-merge} "$STATE_DIRECTORY/AdGuardHome.yaml" "${configFile}" > "$STATE_DIRECTORY/AdGuardHome.yaml.tmp"
|
||||
# sed operation needed to fix protection_disabled_until value changed by yaml-merge
|
||||
${lib.getExe pkgs.yaml-merge} "$STATE_DIRECTORY/AdGuardHome.yaml" "${configFile}" \
|
||||
| sed -E "s/(protection_disabled_until: [0-9]{4}-[0-9]{2}-[0-9]{2}) /\1T/" > "$STATE_DIRECTORY/AdGuardHome.yaml.tmp"
|
||||
mv "$STATE_DIRECTORY/AdGuardHome.yaml.tmp" "$STATE_DIRECTORY/AdGuardHome.yaml"
|
||||
else
|
||||
${installFresh}
|
||||
|
||||
Reference in New Issue
Block a user