all repos — dns @ fefa2050080cc5b29630a1b9de631e90e3875e1c

DNS records for my domains, managed via dnscontrol

autogenerate type declarations via nix derivation

Alin
commit

fefa2050080cc5b29630a1b9de631e90e3875e1c

parent

6ccf1415e3741af21a32319af1db73ca424cd9b1

1 file changed, 20 insertions(+), 0 deletions(-)

changed files
M shell.nixshell.nix
@@ -1,9 +1,29 @@
{ pkgs ? (import <nixpkgs> { }), + lib ? pkgs.lib, }: +let + types = pkgs.runCommand "dnscontrol-types" { + runtimeInputs = [ pkgs.dnscontrol ]; + } "${lib.getExe pkgs.dnscontrol} write-types -o $out"; + update-types = '' + f="types-dnscontrol.d.ts" + if [[ -e "$f" && ! -L "$f" ]] + then + echo "warn: file $f already exists, not updating. Remove to enable automatic updates." >&2 + elif [[ ! ( -L "$f" && "$(readlink -f "$f")" == "${types}" ) ]] + then + ln -sf "${types}" "$f" + fi + ''; +in pkgs.mkShellNoCC { packages = with pkgs; [ dnscontrol prettier + + # fallback for using lorri (shellHook doesn't work as expected) + (writeShellScriptBin "update-types" update-types) ]; + shellHook = update-types; }