infra: add web page

This commit is contained in:
jopejoe1 2024-07-11 14:10:10 +02:00
parent 31b3f57970
commit 10287025aa
3 changed files with 30 additions and 2 deletions

View file

@ -1,4 +1,6 @@
{ {
self,
config,
... ...
}: }:
@ -13,6 +15,7 @@
"clan-war.net" = { "clan-war.net" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".root = "${self.legacyPackages.${config.nixpkgs.hostPlatform.system}.web.override { withBackendUrl = "api.clan-war.net";}}/";
}; };
"api.clan-war.net" = { "api.clan-war.net" = {
forceSSL = true; forceSSL = true;

View file

@ -2,6 +2,8 @@
stdenv, stdenv,
lib, lib,
pnpm, pnpm,
nodejs,
withBackendUrl ? ""
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -12,10 +14,32 @@ stdenv.mkDerivation (finalAttrs: {
pnpmDeps = pnpm.fetchDeps { pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src; inherit (finalAttrs) pname version src;
hash = "sha256-dTXWbUDjmlIlMZ/sIFaInTRmVdWpyzJA4oadJAzUivs="; hash = "sha256-sDeAAvBsYnZchMBCKFN3XODC65Y5mThLwO3//UqcDgI=";
}; };
nativeBuildInputs = [ pnpm.configHook ]; nativeBuildInputs = [
nodejs
pnpm.configHook
];
env.VITE_BACKEND_URL = withBackendUrl;
buildPhase = ''
runHook preBuild
pnpm buildNoCheck
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r dist/* $out
runHook postInstall
'';
buildInputs = [ ]; buildInputs = [ ];

View file

@ -4,6 +4,7 @@
"scripts": { "scripts": {
"dev": "vite --host", "dev": "vite --host",
"build": "vue-tsc --noEmit && vite build", "build": "vue-tsc --noEmit && vite build",
"buildNoCheck": "vite build",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {