{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; outputs = {nixpkgs, ...} @ inputs: let lib = nixpkgs.lib; supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; forEachSupportedSystem = f: lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs {inherit system;}; }); in { devShells = forEachSupportedSystem ({pkgs}: { default = pkgs.mkShell { packages = with pkgs; [ gleam beamMinimal28Packages.erlang beamMinimal28Packages.rebar3 jq ]; }; }); apps = forEachSupportedSystem ({pkgs}: let cdInto = service: '' rootDir=$(jj --ignore-working-copy root || git rev-parse --show-toplevel) || (echo "error: can't find repo root?"; exit 1) cd "$rootDir/${service}" ''; runtimeInputs = with pkgs; [ jujutsu gleam beamMinimal28Packages.erlang beamMinimal28Packages.rebar3 ]; in { # TODO: make default app run both frontend and backend frontend = { type = "app"; program = "${(pkgs.writeShellApplication { inherit runtimeInputs; name = "run-frontend"; text = '' ${cdInto "frontend"} # TODO: dev server proxy thing ${pkgs.gleam}/bin/gleam run -m lustre/dev start ''; })}/bin/run-frontend"; }; backend = { type = "app"; program = "${(pkgs.writeShellApplication { inherit runtimeInputs; name = "run-backend"; text = '' ${cdInto "backend"} ${pkgs.gleam}/bin/gleam run ''; })}/bin/run-backend"; }; lexgen = { type = "app"; program = "${(pkgs.writeShellApplication { inherit runtimeInputs; name = "run-lexgen"; text = '' ${cdInto "shared"} ${pkgs.gleam}/bin/gleam run -m alicia/lexgen -- --dir=${./lexicons} ''; })}/bin/run-lexgen"; }; test = { type = "app"; program = "${(pkgs.writeShellApplication { inherit runtimeInputs; name = "run-tests"; text = '' ${cdInto "alicia/identity"} ${pkgs.gleam}/bin/gleam test ${cdInto ""} ''; })}/bin/run-tests"; }; }); }; }