engelsystem: unvendor composer and yarn dependencies

This commit is contained in:
Martin Weinelt 2025-06-22 23:56:49 +02:00
parent b1a53f6033
commit 8dfb4412a7
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 47 additions and 27 deletions

View File

@ -134,7 +134,7 @@ in
enable = true;
virtualHosts."${cfg.domain}".locations = {
"/" = {
root = "${cfg.package}/share/engelsystem/public";
root = "${cfg.package}/share/php/engelsystem/public";
extraConfig = ''
index index.php;
try_files $uri $uri/ /index.php?$args;
@ -142,7 +142,7 @@ in
'';
};
"~ \\.php$" = {
root = "${cfg.package}/share/engelsystem/public";
root = "${cfg.package}/share/php/engelsystem/public";
extraConfig = ''
fastcgi_pass unix:${config.services.phpfpm.pools.engelsystem.socket};
fastcgi_index index.php;

View File

@ -1,48 +1,68 @@
{
lib,
fetchzip,
fetchFromGitHub,
fetchYarnDeps,
nodejs,
yarn,
yarnBuildHook,
yarnConfigHook,
nixosTests,
php,
stdenv,
writeText,
}:
stdenv.mkDerivation rec {
php.buildComposerProject2 (finalAttrs: {
pname = "engelsystem";
version = "3.6.0";
src = fetchzip {
url = "https://github.com/engelsystem/engelsystem/releases/download/v${version}/engelsystem-v${version}.zip";
hash = "sha256-AZVW04bcSlESSRmtfvP2oz15xvZLlGEz/X9rX7PuRGg=";
src = fetchFromGitHub {
owner = "engelsystem";
repo = "engelsystem";
tag = "v${finalAttrs.version}";
hash = "sha256-Pi+nowImUvENx2c4gsku1KkFb3pLM84oT8WevI6ImQg=";
};
buildInputs = [ php ];
inherit php;
installPhase = ''
runHook preInstall
vendorHash = "sha256-0Mv48mB/pTQtYd2do6wTdhD/c2zwbU1gTYsdU7rELPY=";
composoerNoDev = true;
composerStrictValidation = false;
# prepare
rm -r ./storage/
yarnOfflineCache = fetchYarnDeps {
pname = "${finalAttrs.pname}-yarn-deps";
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-nyCLM9OF2qwlW+VK38kiRMo6jMlupNFG+91N3Fb/WLY=";
};
strictDeps = true;
nativeBuildInputs = [
nodejs
yarn
yarnConfigHook
];
preBuild = ''
yarn build
'';
preInstall = ''
rm -rf node_modules
# link config and storage into FHS locations
ln -sf /etc/engelsystem/config.php ./config/config.php
ln -sf /var/lib/engelsystem/storage/ ./storage
rm -rf storage
ln -snf /var/lib/engelsystem/storage/ ./storage
'';
mkdir -p $out/share/engelsystem
mkdir -p $out/bin
cp -r . $out/share/engelsystem
echo $(command -v php)
# The patchShebangAuto function always used the php without extensions, so path the shebang manually
sed -i -e "1 s|.*|#\!${lib.getExe php}|" "$out/share/engelsystem/bin/migrate"
ln -s "$out/share/engelsystem/bin/migrate" "$out/bin/migrate"
runHook postInstall
postInstall = ''
mkdir $out/bin
ln -s $out/share/php/engelsystem/bin/migrate $out/bin/migrate
'';
passthru.tests = nixosTests.engelsystem;
meta = {
changelog = "https://github.com/engelsystem/engelsystem/releases/tag/v${version}";
changelog = "https://github.com/engelsystem/engelsystem/releases/tag/v${finalAttrs.version}";
description = "Coordinate your volunteers in teams, assign them to work shifts or let them decide for themselves when and where they want to help with what";
homepage = "https://engelsystem.de";
license = lib.licenses.gpl2Only;
@ -50,4 +70,4 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers; [ ];
platforms = lib.platforms.all;
};
}
})