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

View File

@ -1,48 +1,68 @@
{ {
lib, lib,
fetchzip, fetchFromGitHub,
fetchYarnDeps,
nodejs,
yarn,
yarnBuildHook,
yarnConfigHook,
nixosTests, nixosTests,
php, php,
stdenv,
writeText,
}: }:
stdenv.mkDerivation rec { php.buildComposerProject2 (finalAttrs: {
pname = "engelsystem"; pname = "engelsystem";
version = "3.6.0"; version = "3.6.0";
src = fetchzip { src = fetchFromGitHub {
url = "https://github.com/engelsystem/engelsystem/releases/download/v${version}/engelsystem-v${version}.zip"; owner = "engelsystem";
hash = "sha256-AZVW04bcSlESSRmtfvP2oz15xvZLlGEz/X9rX7PuRGg="; repo = "engelsystem";
tag = "v${finalAttrs.version}";
hash = "sha256-Pi+nowImUvENx2c4gsku1KkFb3pLM84oT8WevI6ImQg=";
}; };
buildInputs = [ php ]; inherit php;
installPhase = '' vendorHash = "sha256-0Mv48mB/pTQtYd2do6wTdhD/c2zwbU1gTYsdU7rELPY=";
runHook preInstall composoerNoDev = true;
composerStrictValidation = false;
# prepare yarnOfflineCache = fetchYarnDeps {
rm -r ./storage/ 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 /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 postInstall = ''
mkdir -p $out/bin mkdir $out/bin
cp -r . $out/share/engelsystem ln -s $out/share/php/engelsystem/bin/migrate $out/bin/migrate
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
''; '';
passthru.tests = nixosTests.engelsystem; passthru.tests = nixosTests.engelsystem;
meta = { 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"; 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"; homepage = "https://engelsystem.de";
license = lib.licenses.gpl2Only; license = lib.licenses.gpl2Only;
@ -50,4 +70,4 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers; [ ]; maintainers = with lib.maintainers; [ ];
platforms = lib.platforms.all; platforms = lib.platforms.all;
}; };
} })