This commit is contained in:
2025-09-18 09:23:08 -06:00
parent 4150af64bb
commit b2103a7359
5 changed files with 118 additions and 1 deletions

54
flake.nix Normal file
View File

@@ -0,0 +1,54 @@
{
description = "GlowTrack: reproducible devShell and app build outputs";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
# Developer shell with Node.js LTS, pnpm, git, jq
devShells.default = pkgs.mkShell {
packages = builtins.attrValues {
inherit (pkgs) nodejs_20 pnpm git jq;
};
# Tip: uncomment Playwright bits below once tests are wired (T007)
# packages = builtins.attrValues { inherit (pkgs) nodejs_20 pnpm git jq playwright-driver playwright-browsers; };
# shellHook = ''
# export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-browsers}
# '';
};
# Package: static site output from apps/web
# This derivation copies a prebuilt site (build/ or dist/) from apps/web if present.
# It does not run networked installs, keeping the build pure. The actual build
# step is performed via pnpm in the dev shell (see T005/T030 for CI wiring).
packages.app = pkgs.stdenvNoCC.mkDerivation {
pname = "glowtrack-app";
version = "0.0.0";
src = ./.;
buildPhase = "true";
installPhase = ''
mkdir -p "$out"
if [ -d apps/web/build ]; then
cp -r apps/web/build/* "$out/"
elif [ -d apps/web/dist ]; then
cp -r apps/web/dist/* "$out/"
else
echo "No prebuilt app output detected. After scaffolding (T005), run 'pnpm -C apps/web build' to populate build/ or dist/." > "$out/README.txt"
fi
'';
};
# Make `.#default` point to the app package for convenience
packages.default = self.packages.${system}.app;
}
);
}