Compare commits
2
Commits
35aa44a59d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4c8f89018 | ||
|
|
47cd18e8c6 |
+15
-18
@@ -34,33 +34,23 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
# ---- Frontend: Svelte static assets built with node/npm. ----
|
# ---- Frontend: Svelte static assets built with node/npm. ----
|
||||||
filehostFrontend = pkgs.stdenv.mkDerivation {
|
filehostFrontend = pkgs.buildNpmPackage {
|
||||||
pname = "filehost-frontend";
|
pname = "filehost-frontend";
|
||||||
version = "1.0.0";
|
version = "1.0.0";
|
||||||
|
|
||||||
src = cfg.src;
|
# Build from the frontend/ subdirectory (contains package.json + lock).
|
||||||
|
src = "${cfg.src}/frontend";
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
# Hash of the npm dependency fetch (generated from frontend/package-lock.json).
|
||||||
# `nodejs` ships `npm`/`npx` in its own bin/ (Node 24 bundles npm).
|
npmDepsHash = "sha256-ec2rDPuTIGOMdx7oHq+At1Fez6WFCVnFaYydzVF+5Ws=";
|
||||||
nodejs
|
|
||||||
];
|
|
||||||
|
|
||||||
# `npm install` needs writable dirs that default to the source; redirect
|
# The default npm build script is `build` (vite build).
|
||||||
# caches so the build stays sandbox-friendly.
|
npmBuildScript = "build";
|
||||||
npm_config_cache = "/tmp/npm-cache";
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
cd frontend
|
|
||||||
npm install --no-audit --no-fund
|
|
||||||
npm run build
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir -p $out/share/filehost
|
mkdir -p $out/share/filehost
|
||||||
cp -r frontend/dist $out/share/filehost/dist
|
cp -r dist $out/share/filehost/dist
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@@ -210,6 +200,13 @@ in
|
|||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
# The service runs as root but the checkout is owned by another user;
|
||||||
|
# allow git to operate on it without a persistent global config.
|
||||||
|
export GIT_CONFIG_COUNT=1
|
||||||
|
export GIT_CONFIG_KEY_0=safe.directory
|
||||||
|
export GIT_CONFIG_VALUE_0="${cfg.workingDir}"
|
||||||
|
|
||||||
if [ ! -d "${cfg.workingDir}/.git" ]; then
|
if [ ! -d "${cfg.workingDir}/.git" ]; then
|
||||||
git clone ${cfg.repoUrl} ${cfg.workingDir}
|
git clone ${cfg.repoUrl} ${cfg.workingDir}
|
||||||
else
|
else
|
||||||
|
|||||||
Generated
+2378
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user