Daniel Siepmann
787be4ed2c
Allows to manually test the project by opening urls in browser or calling via curl, etc.
87 lines
1.8 KiB
Nix
87 lines
1.8 KiB
Nix
{ pkgs ? import <nixpkgs> { } }:
|
|
|
|
let
|
|
projectInstall = pkgs.writeShellApplication {
|
|
name = "project-install";
|
|
runtimeInputs = [
|
|
pkgs.php82
|
|
pkgs.php82Packages.composer
|
|
projectTest
|
|
];
|
|
text = ''
|
|
composer install --working-dir="$PROJECT_ROOT"
|
|
project-test
|
|
'';
|
|
};
|
|
projectTest = pkgs.writeShellApplication {
|
|
name = "project-test";
|
|
runtimeInputs = [
|
|
pkgs.php82
|
|
];
|
|
text = ''
|
|
./vendor/bin/phpunit
|
|
./vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes
|
|
'';
|
|
};
|
|
projectRun = pkgs.writeShellApplication {
|
|
name = "project-run";
|
|
runtimeInputs = [
|
|
pkgs.php82
|
|
];
|
|
text = ''
|
|
php -S 127.0.0.1:8080 -t public
|
|
'';
|
|
};
|
|
projectDeploy = pkgs.writeShellApplication {
|
|
name = "project-deploy";
|
|
runtimeInputs = [
|
|
pkgs.git
|
|
pkgs.rsync
|
|
# Missing ssh
|
|
pkgs.php82
|
|
pkgs.php82Packages.composer
|
|
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
|
|
'';
|
|
};
|
|
in pkgs.mkShell {
|
|
name = "Fediverse-Feed-Wrappers";
|
|
buildInputs = [
|
|
pkgs.php82
|
|
pkgs.php82Packages.composer
|
|
projectInstall
|
|
projectTest
|
|
projectRun
|
|
projectDeploy
|
|
];
|
|
|
|
shellHook = ''
|
|
export PROJECT_ROOT="$(pwd)"
|
|
export PATH="$(pwd)/:$PATH"
|
|
export PHP_CS_FIXER_IGNORE_ENV=1
|
|
'';
|
|
}
|