diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c99e2d3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1758070117, + "narHash": "sha256-uLwwHFCZnT1c3N3biVe/0hCkag2GSrf9+M56+Okf+WY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e9b7f2ff62b35f711568b1f0866243c7c302028d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..68bcb67 --- /dev/null +++ b/flake.nix @@ -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; + } + ); +} diff --git a/result b/result new file mode 120000 index 0000000..7edb235 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/a7d43vv7g79mi2da7b977vqy0cqnaa45-glowtrack-app-0.0.0 \ No newline at end of file diff --git a/specs/001-glowtrack-a-mood/tasks.md b/specs/001-glowtrack-a-mood/tasks.md index 9a7d606..46e78c9 100644 --- a/specs/001-glowtrack-a-mood/tasks.md +++ b/specs/001-glowtrack-a-mood/tasks.md @@ -25,7 +25,7 @@ Paths below are absolute to this repo. - Add placeholder README.md in each new folder. - Dependencies: none -- [ ] T002 Initialize Nix flake (devShell + build outputs) +- [X] T002 Initialize Nix flake (devShell + build outputs) - Create /home/jawz/Development/Projects/GlowTrack/flake.nix providing: - devShell with: nodejs (LTS 20+), pnpm, git, playwright browsers (via optional separate task), jq - packages.app building static site from /apps/web (pnpm build)