Skip to content

Instantly share code, notes, and snippets.

@kauhat
Created December 24, 2021 21:47
Show Gist options
  • Save kauhat/f66a1e6569212e5fcd159040bd117b12 to your computer and use it in GitHub Desktop.
Save kauhat/f66a1e6569212e5fcd159040bd117b12 to your computer and use it in GitHub Desktop.
Laravel Nix workspace
{ pkgs ? import <nixpkgs> { } }:
let
# Provide a script to start the Docker service.
daemonServiceScript =
pkgs.writeScript "check-daemon-service" ''
#!${pkgs.runtimeShell}
echo "Checking Docker service..."
if service docker status 2>&1 | grep -q "is not running"; then
echo "Service not running."
echo "Starting Docker..."
wsl.exe -d "''${WSL_DISTRO_NAME}" -u root -e /usr/sbin/service docker start >/dev/null 2>&1
fi
'';
in
pkgs.mkShell {
buildInputs = [
pkgs.php80
pkgs.docker-compose
pkgs.php80Packages.composer
pkgs.php80Packages.php-cs-fixer
pkgs.php80Packages.phpstan
];
shellHook = ''
${daemonServiceScript}
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
# alias artisan="./vendor/bin/sail artisan"
# alias composer="./vendor/bin/sail composer"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment