feat: add Nix flake for reproducible builds and deployment
- Add flake.nix with packages for all 5 apps (landing, gacha, backoffice, dimentorin, hackathon) - Add NixOS modules for deployment (systemd service for Next.js, nginx for Vite apps) - Add mkHackathonWithEnv function for build-time environment variables - Add development shell with Node.js 22, npm, bun 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
f77967a092
commit
5be9ec1edf
@@ -0,0 +1,50 @@
|
||||
# Next.js Landing App Package
|
||||
{ pkgs, src, npmDepsHash }:
|
||||
|
||||
pkgs.buildNpmPackage {
|
||||
pname = "imphnen-landing";
|
||||
version = "0.0.1";
|
||||
inherit src npmDepsHash;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
nodejs_22
|
||||
nodePackages.npm
|
||||
python3 # Required for node-gyp (sharp, etc.)
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
export NX_DAEMON=false
|
||||
export HOME=$TMPDIR
|
||||
npm run landing:build
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin $out/share/landing
|
||||
|
||||
# Copy standalone server
|
||||
cp -r dist/apps/landing/.next/standalone/* $out/share/landing/
|
||||
|
||||
# Copy public assets
|
||||
mkdir -p $out/share/landing/apps/landing/public
|
||||
cp -r dist/apps/landing/public/* $out/share/landing/apps/landing/public/ || true
|
||||
|
||||
# Copy static files
|
||||
mkdir -p $out/share/landing/dist/apps/landing/.next/static
|
||||
cp -r dist/apps/landing/.next/static/* $out/share/landing/dist/apps/landing/.next/static/
|
||||
|
||||
# Create wrapper script
|
||||
cat > $out/bin/imphnen-landing <<EOF
|
||||
#!/usr/bin/env bash
|
||||
cd $out/share/landing
|
||||
exec ${pkgs.nodejs_22}/bin/node apps/landing/server.js "\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/imphnen-landing
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontNpmBuild = true;
|
||||
}
|
||||
Reference in New Issue
Block a user