refactor(ops/dns): use drvTargets for meta.targets population

Since we have a dedicated util for this, we may as well use it
to reduce code duplication.

Change-Id: Ie52647be8c786d0b6a4dceb2fa6778b94625fafc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2604
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
sterni 2021-03-15 23:02:07 +01:00
parent 5d8490d2fc
commit c32e8424be

View file

@ -1,15 +1,16 @@
# Performs simple (local-only) validity checks on DNS zones. # Performs simple (local-only) validity checks on DNS zones.
{ pkgs, ... }: { depot, pkgs, ... }:
let let
inherit (depot.nix.utils)
drvTargets
;
checkZone = zone: file: pkgs.runCommandNoCC "${zone}-check" {} '' checkZone = zone: file: pkgs.runCommandNoCC "${zone}-check" {} ''
${pkgs.bind}/bin/named-checkzone -i local ${zone} ${file} | tee $out ${pkgs.bind}/bin/named-checkzone -i local ${zone} ${file} | tee $out
''; '';
zones = { in drvTargets {
tvl-fyi = checkZone "tvl.fyi" ./tvl.fyi.zone; tvl-fyi = checkZone "tvl.fyi" ./tvl.fyi.zone;
tvl-su = checkZone "tvl.su" ./tvl.su.zone; tvl-su = checkZone "tvl.su" ./tvl.su.zone;
};
in zones // {
meta.targets = builtins.attrNames zones;
} }