1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +02:00

fix phpunit

This commit is contained in:
Robin Appelman 2025-06-10 16:05:43 +02:00
commit 7985255d9d
7 changed files with 85 additions and 16 deletions

View file

@ -3,6 +3,10 @@
NGINX_CONFIG="$1" NGINX_CONFIG="$1"
FPM_CONFIG="$2" FPM_CONFIG="$2"
shadow-setup
chmod +sx /sbin/sudo
echo "nginx: $NGINX_CONFIG" echo "nginx: $NGINX_CONFIG"
echo "fpm: $FPM_CONFIG" echo "fpm: $FPM_CONFIG"
@ -15,14 +19,6 @@ tail --follow --retry /var/log/nginx/*.log &
HAZE_UID=${HAZE_UID:-1000} HAZE_UID=${HAZE_UID:-1000}
HAZE_GID=${HAZE_GID:-1000} HAZE_GID=${HAZE_GID:-1000}
# undo the fakeNss symlink
mv /etc/passwd /etc/passwd.bak
cp /etc/passwd.bak /etc/passwd
mv /etc/group /etc/group.bak
cp /etc/group.bak /etc/group
if [ "$(getent group "$HAZE_GID")" ]; then if [ "$(getent group "$HAZE_GID")" ]; then
groupadd haze groupadd haze
EXTRA_GROUP=" -G haze" EXTRA_GROUP=" -G haze"

View file

@ -103,5 +103,4 @@ else
redis-server --protected-mode no & redis-server --protected-mode no &
fi fi
echo "starting nginx"
bootstrap-nginx "$@" bootstrap-nginx "$@"

View file

@ -1,8 +1,10 @@
{runCommand}: {runCommand}:
runCommand "configs" {} '' runCommand "configs" {} ''
mkdir -p $out/etc mkdir -p $out/etc
mkdir -p $out/etc/sudoers.d
mkdir -p $out/conf mkdir -p $out/conf
cp ${./configs/cron.conf} $out/etc/oc-cron.conf cp ${./configs/cron.conf} $out/etc/oc-cron.conf
cp ${./configs/nginx-app.conf} $out/conf/nginx-app.conf cp ${./configs/nginx-app.conf} $out/conf/nginx-app.conf
cp ${./configs/sudoers} $out/etc/sudoers.d/haze
cp -r ${./configs/nc} $out/etc/nc cp -r ${./configs/nc} $out/etc/nc
'' ''

View file

@ -1 +1 @@
haze ALL=(ALL) NOPASSWD: ALL haze ALL=(ALL) NOPASSWD: ALL

View file

@ -24,12 +24,15 @@
minio-client, minio-client,
neovim, neovim,
helix, helix,
sudo,
su,
which,
debug ? false, debug ? false,
writeShellApplication, writeShellApplication,
}: let }: let
inherit (lib) readFile getExe; inherit (lib) readFile getExe concatStringsSep splitString take;
phpVersion = lib.concatStringsSep "." (lib.take 2 (lib.splitString "." php.version)); phpVersion = concatStringsSep "." (take 2 (splitString "." php.version));
phpEnv = callPackage ./php.nix {inherit debug php;}; phpEnv = callPackage ./php.nix {inherit debug php;};
bootstrap-nginx = writeShellApplication { bootstrap-nginx = writeShellApplication {
@ -41,6 +44,10 @@
runtimeInputs = [getent]; runtimeInputs = [getent];
text = readFile ./bootstrap.sh; text = readFile ./bootstrap.sh;
}; };
shadowSetupScript = writeShellApplication {
name = "shadow-setup";
text = dockerTools.shadowSetup;
};
tmpDir = runCommand "tmp-dir" {} '' tmpDir = runCommand "tmp-dir" {} ''
mkdir -p $out/tmp mkdir -p $out/tmp
@ -56,6 +63,7 @@
''; '';
configs = callPackage ./configs.nix {}; configs = callPackage ./configs.nix {};
scripts = callPackage ./scripts.nix {}; scripts = callPackage ./scripts.nix {};
phpunit = callPackage ./phpunit.nix {php = phpEnv;};
redis-certificates = runCommand "scripts" {} '' redis-certificates = runCommand "scripts" {} ''
mkdir -p $out mkdir -p $out
cp -r ${../../redis-certificates} $out/redis-certificates cp -r ${../../redis-certificates} $out/redis-certificates
@ -68,7 +76,6 @@
copyToRoot = [ copyToRoot = [
dockerTools.caCertificates dockerTools.caCertificates
dockerTools.usrBinEnv dockerTools.usrBinEnv
dockerTools.fakeNss
bash bash
blackfire blackfire
nginx nginx
@ -80,6 +87,9 @@
procps procps
gnugrep gnugrep
minio-client minio-client
sudo
su
which
# samba # samba
wget wget
curl curl
@ -96,6 +106,7 @@
copyToRoot = [ copyToRoot = [
phpEnv phpEnv
phpEnv.packages.composer phpEnv.packages.composer
phpunit
]; ];
}; };
in in
@ -111,6 +122,7 @@ in
configs configs
scripts scripts
redis-certificates redis-certificates
shadowSetupScript
]; ];
fakeRootCommands = '' fakeRootCommands = ''
chmod 1777 tmp chmod 1777 tmp

63
nix/image/phpunit.nix Normal file
View file

@ -0,0 +1,63 @@
{
lib,
fetchFromGitHub,
nix-update-script,
php,
phpunit,
testers,
versionCheckHook,
}: let
inherit (lib) concatStringsSep splitString take;
phpVersion = concatStringsSep "." (take 2 (splitString "." php.version));
versions = {
"8.1" = {
version = "10.5.46";
hash = "sha256-DtQ6CR4RAGKpZcJA9WZ5ud5ztIBTr8MeVTIhFwbGHYc=";
vendorHash = "sha256-fNv9pWFwYTyw3KEGtmbKNzXFsiDE6oZjRCWhypa/k0A=";
};
"8.2" = {
version = "11.5.22";
hash = "sha256-oXoh/2G0bqPPyvVoQUUdUz8XGyNtRJE3taUFGu2UIsc=";
vendorHash = "sha256-9gLTJe2ft90qGr/d8/Zc/ua7EWyNZ16wPEZRe9sKZf0=";
};
"8.3" = {
version = "12.2.1";
hash = "sha256-D5WI1kv05L8X3Gfw/MCxGdIcqWyWJg68GL9I24z/zIY=";
vendorHash = "sha256-H+XMRMvbUz/WCUdPRmL8nSCqa5YE3Qb1+goEQjjDK70=";
};
"8.4" = {
version = "12.2.1";
hash = "sha256-D5WI1kv05L8X3Gfw/MCxGdIcqWyWJg68GL9I24z/zIY=";
vendorHash = "sha256-H+XMRMvbUz/WCUdPRmL8nSCqa5YE3Qb1+goEQjjDK70=";
};
};
in php.buildComposerProject2 (finalAttrs: {
pname = "phpunit";
inherit (versions.${phpVersion}) version vendorHash;
src = fetchFromGitHub {
owner = "sebastianbergmann";
repo = "phpunit";
tag = finalAttrs.version;
inherit (versions.${phpVersion}) hash;
};
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion { package = phpunit; };
};
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
meta = {
changelog = "https://github.com/sebastianbergmann/phpunit/blob/${finalAttrs.version}/ChangeLog-${lib.versions.majorMinor finalAttrs.version}.md";
description = "PHP Unit Testing framework";
homepage = "https://phpunit.de";
license = lib.licenses.bsd3;
mainProgram = "phpunit";
maintainers = with lib.maintainers; [ onny ];
teams = [ lib.teams.php ];
};
})

View file

@ -1,3 +0,0 @@
#!/bin/sh
/usr/local/bin/php -d memory_limit=512M /usr/local/bin/phpunit.phar $@