From: Bobbe Date: Tue, 24 Mar 2026 14:59:11 +0000 (+0100) Subject: Use runCommandLocal instead of mkDerivation, pipe instead of cat X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=f924014d99dbe12db3972fe0f82fdf95d86f0c6b;p=stevenblack-hosts.git Use runCommandLocal instead of mkDerivation, pipe instead of cat --- diff --git a/unbound.nix b/unbound.nix index 72551f221..1e9aa3d70 100644 --- a/unbound.nix +++ b/unbound.nix @@ -1,19 +1,13 @@ { - stdenvNoCC, + runCommandLocal, }: -stdenvNoCC.mkDerivation { - name = "stevenblack-hosts-unbound"; - src = ./.; - - installPhase = - let - toUnboundConf = ''awk 'NF == 2 && $1 == "0.0.0.0" && $2 != "0.0.0.0" { printf "local-zone: \"%s\" always_nxdomain\n", $2 }'\''; - in - '' - mkdir $out - cat $src/hosts | ${toUnboundConf} > $out/hosts - for file in alternates/*/hosts; do - cat $file | ${toUnboundConf} > $out/$(basename $(dirname $file)) - done - ''; -} +let + toUnboundConf = ''awk 'NF == 2 && $1 == "0.0.0.0" && $2 != "0.0.0.0" { printf "local-zone: \"%s\" always_nxdomain\n", $2 }'\''; +in +runCommandLocal "stevenblack-hosts-unbound" { src = ./.; } '' + mkdir $out + ${toUnboundConf} < $src/hosts > $out/hosts + for file in alternates/*/hosts; do + ${toUnboundConf} < $file > $out/$(basename $(dirname $file)) + done +''