From 39a39e763d6a7e6b587b97dfa309f3ddae97797c Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 17 Jun 2024 22:43:19 +0000 Subject: [PATCH] trust-dns: hack to substitute ANATIVE before anything else --- modules/services/trust-dns/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/services/trust-dns/default.nix b/modules/services/trust-dns/default.nix index 01b8e885..97794da0 100644 --- a/modules/services/trust-dns/default.nix +++ b/modules/services/trust-dns/default.nix @@ -96,7 +96,13 @@ let } // extraConfig ); configPath = "/var/lib/trust-dns/${flavor}-config.toml"; - sedArgs = lib.mapAttrsToList (key: value: ''-e "s/${key}/${value}/g"'') substitutions; + sedArgs = builtins.map (key: ''-e "s/${key}/${substitutions."${key}"}/g"'') ( + # HACK: %ANATIVE% often expands to one of the other subtitutions (e.g. %AWAN%) + # so we must expand it *first*. + lib.sortOn + (k: if k == "%ANATIVE%" then 0 else 1) + (builtins.attrNames substitutions) + ); subs = lib.concatStringsSep " " sedArgs; in { description = "trust-dns Domain Name Server (serving ${flavor})";