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" = {
enableACME = true;
forceSSL = true;
locations."/".root = "${self.legacyPackages.${config.nixpkgs.hostPlatform.system}.web.override { withBackendUrl = "api.clan-war.net";}}/";
};
"api.clan-war.net" = {
forceSSL = true;

View file

@ -2,6 +2,8 @@
stdenv,
lib,
pnpm,
nodejs,
withBackendUrl ? ""
}:
stdenv.mkDerivation (finalAttrs: {
@ -12,10 +14,32 @@ stdenv.mkDerivation (finalAttrs: {
pnpmDeps = pnpm.fetchDeps {
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 = [ ];

View file

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