CI / typecheck + tests (push) Canceled after 0s
CI / build + deploy (Nix) — api (push) Canceled after 0s
CI / build + deploy (Nix) — mcp (push) Canceled after 0s
CI / build + deploy (Nix) — worker (push) Canceled after 0s
CI / build + deploy (web) (push) Canceled after 0s
The heredoc-based script writer in web.nix was indenting content inside a nix '' string, which caused bash to prepend whitespace before the #!/usr/bin/env bash shebang. The kernel rejected this as 'Exec format error' (203/EXEC), preventing systemd from starting mcpedia-web.service. Fix: use writeShellScriptBin instead of a raw heredoc. This ensures the shebang starts at column 0 and uses the nix-resolved bash path.
37 lines
903 B
Nix
37 lines
903 B
Nix
# ─── Web: packages pre-built .next into a Nix store path ───
|
|
# Next.js 16/Turbopack has a Bun incompatibility in the Nix sandbox,
|
|
# so .next is built in CI via `bun run build` and packaged here.
|
|
{ pkgs
|
|
, stdenv
|
|
, writeShellScriptBin
|
|
, bun
|
|
, webNextDir
|
|
, ...
|
|
}:
|
|
|
|
let
|
|
mcpedia-web-script = writeShellScriptBin "mcpedia-web" ''
|
|
#!${pkgs.bash}/bin/bash
|
|
export NODE_ENV=production
|
|
export PORT=4016
|
|
cd /home/code/mcpedia/apps/web
|
|
rm -f .next
|
|
ln -s "${webNextDir}" .next
|
|
exec "${bun}/bin/bun" x next start -p 4016
|
|
'';
|
|
in
|
|
stdenv.mkDerivation {
|
|
pname = "mcpedia-web";
|
|
version = "1.0.0";
|
|
src = webNextDir;
|
|
dontUnpack = true;
|
|
buildPhase = "";
|
|
installPhase = ''
|
|
mkdir -p $out/share/mcpedia-web/.next
|
|
cp -r "${webNextDir}/." $out/share/mcpedia-web/.next/
|
|
|
|
mkdir -p $out/bin
|
|
cp ${mcpedia-web-script}/bin/mcpedia-web $out/bin/mcpedia-web
|
|
'';
|
|
}
|