2024-12-11 19:50:19 +01:00
|
|
|
{pkgs ? import <nixpkgs> { }}:
|
2023-02-16 08:33:59 +01:00
|
|
|
|
|
|
|
let
|
2024-12-11 19:50:19 +01:00
|
|
|
php = pkgs.php84.buildEnv {
|
2024-03-05 19:39:12 +01:00
|
|
|
extensions = { enabled, all }: enabled ++ (with all; [
|
|
|
|
xdebug
|
|
|
|
]);
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
xdebug.mode = debug
|
|
|
|
memory_limit = 4G
|
|
|
|
'';
|
|
|
|
};
|
2024-12-11 19:50:19 +01:00
|
|
|
inherit (php.packages) composer;
|
2024-03-05 19:39:12 +01:00
|
|
|
|
2023-02-16 08:33:59 +01:00
|
|
|
projectInstall = pkgs.writeShellApplication {
|
|
|
|
name = "project-install";
|
|
|
|
runtimeInputs = [
|
2024-03-05 19:39:12 +01:00
|
|
|
php
|
|
|
|
composer
|
2023-02-16 09:57:36 +01:00
|
|
|
projectTest
|
2023-02-16 08:33:59 +01:00
|
|
|
];
|
|
|
|
text = ''
|
2024-12-11 19:50:19 +01:00
|
|
|
composer install
|
2023-02-16 09:57:36 +01:00
|
|
|
project-test
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
projectTest = pkgs.writeShellApplication {
|
|
|
|
name = "project-test";
|
|
|
|
runtimeInputs = [
|
2024-03-05 19:39:12 +01:00
|
|
|
php
|
2023-02-16 09:57:36 +01:00
|
|
|
];
|
|
|
|
text = ''
|
2024-12-11 19:50:19 +01:00
|
|
|
export PHP_CS_FIXER_IGNORE_ENV=1
|
2023-02-16 09:57:36 +01:00
|
|
|
./vendor/bin/phpunit
|
|
|
|
./vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes
|
2023-02-16 08:33:59 +01:00
|
|
|
'';
|
|
|
|
};
|
2023-02-23 14:28:13 +01:00
|
|
|
projectRun = pkgs.writeShellApplication {
|
|
|
|
name = "project-run";
|
|
|
|
runtimeInputs = [
|
2024-03-05 19:39:12 +01:00
|
|
|
php
|
2023-02-23 14:28:13 +01:00
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
php -S 127.0.0.1:8080 -t public
|
|
|
|
'';
|
|
|
|
};
|
2023-02-16 08:33:59 +01:00
|
|
|
projectDeploy = pkgs.writeShellApplication {
|
|
|
|
name = "project-deploy";
|
|
|
|
runtimeInputs = [
|
|
|
|
pkgs.git
|
|
|
|
pkgs.rsync
|
|
|
|
# Missing ssh
|
2024-03-05 19:39:12 +01:00
|
|
|
php
|
|
|
|
composer
|
2023-02-16 08:33:59 +01:00
|
|
|
projectInstall
|
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
echo "Clean file system"
|
|
|
|
git clean -dfx
|
|
|
|
|
|
|
|
echo "Install project"
|
|
|
|
project-install
|
|
|
|
|
|
|
|
echo "Install project for production"
|
|
|
|
composer install --no-dev --optimize-autoloader
|
|
|
|
|
|
|
|
echo "Sync project to production"
|
|
|
|
rsync \
|
|
|
|
-vaz \
|
|
|
|
--copy-dirlinks \
|
|
|
|
--delete \
|
|
|
|
--exclude vendor/**/.git \
|
|
|
|
src vendor public \
|
|
|
|
daniel-siepmann.de:webs/fediverse-feed-wrappers/htdocs/
|
|
|
|
|
|
|
|
echo "Clean file system"
|
|
|
|
git clean -dfx
|
|
|
|
|
|
|
|
echo "Install project"
|
|
|
|
project-install
|
|
|
|
'';
|
|
|
|
};
|
2024-03-05 19:04:12 +01:00
|
|
|
in pkgs.mkShellNoCC {
|
2023-02-16 08:33:59 +01:00
|
|
|
name = "Fediverse-Feed-Wrappers";
|
|
|
|
buildInputs = [
|
2024-03-05 19:39:12 +01:00
|
|
|
php
|
|
|
|
composer
|
2023-02-16 08:33:59 +01:00
|
|
|
projectInstall
|
2023-02-16 09:57:36 +01:00
|
|
|
projectTest
|
2023-02-23 14:28:13 +01:00
|
|
|
projectRun
|
2023-02-16 08:33:59 +01:00
|
|
|
projectDeploy
|
|
|
|
];
|
|
|
|
}
|