From 57f70f3ae05a2d61743dad4db618d5bf8d9657fc Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Thu, 11 Apr 2024 08:47:46 +0200 Subject: [PATCH] TASK: Add shell.nix for local testing --- shell.nix | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 shell.nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..e54c762 --- /dev/null +++ b/shell.nix @@ -0,0 +1,65 @@ +{ pkgs ? import { } }: + +let + php = pkgs.php82.buildEnv { + extensions = { enabled, all }: enabled ++ (with all; [ + xdebug + ]); + + extraConfig = '' + xdebug.mode = debug + memory_limit = 4G + ''; + }; + inherit(pkgs.php82Packages) composer; + + projectInstall = pkgs.writeShellApplication { + name = "project-install"; + runtimeInputs = [ + php + composer + ]; + text = '' + rm -rf .Build/ vendor/ composer.lock + composer update --prefer-dist --no-progress --working-dir="$PROJECT_ROOT" + ''; + }; + + projectCgl = pkgs.writeShellApplication { + name = "project-cgl"; + + runtimeInputs = [ + php + ]; + + text = '' + PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --dry-run --diff + ''; + }; + + projectCglFix = pkgs.writeShellApplication { + name = "project-cgl-fix"; + + runtimeInputs = [ + php + ]; + + text = '' + PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix + ''; + }; + +in pkgs.mkShell { + name = "TYPO3 Extension Responsive Images"; + buildInputs = [ + php + composer + projectInstall + projectCgl + projectCglFix + ]; + + shellHook = '' + export PROJECT_ROOT="$(pwd)" + ''; +}