From 10cd7fbbec8b26fa8f75b170e24c54a904f58eb6 Mon Sep 17 00:00:00 2001 From: Winter Date: Sun, 10 Aug 2025 02:55:09 -0400 Subject: [PATCH] nix: add script to do the lexgen dance h/t https://github.com/bluesky-social/indigo/issues/931#issuecomment-2635675099 for the inspiration Signed-off-by: Winter --- flake.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/flake.nix b/flake.nix index bb199838..174f19bc 100644 --- a/flake.nix +++ b/flake.nix @@ -207,6 +207,31 @@ ${gomod2nix.legacyPackages.${system}.gomod2nix}/bin/gomod2nix generate --outdir ./nix ''); }; + lexgen = { + type = "app"; + program = + (pkgs.writeShellApplication { + name = "lexgen"; + text = '' + if ! command -v lexgen > /dev/null; then + echo "error: must be executed from devshell" + exit 1 + fi + + rootDir=$(jj --ignore-working-copy root || git rev-parse --show-toplevel) || (echo "error: can't find repo root?"; exit 1) + cd "$rootDir" + + rm api/tangled/* + lexgen --build-file lexicon-build-config.json lexicons + sed -i.bak 's/\tutil/\/\/\tutil/' api/tangled/* + ${pkgs.gotools}/bin/goimports -w api/tangled/* + go run cmd/gen.go + lexgen --build-file lexicon-build-config.json lexicons + rm api/tangled/*.bak + ''; + }) + + /bin/lexgen; + }; }); nixosModules.appview = { -- 2.51.2