omarchy/bin/omarchy-install-dev-env
Brosseau Valentin 4b6e8962ca
Better PHP dev-env init (#624)
* Extract logic to avoid adding composer in the path multiple times and add Symfony

* Add missing usage

* Use the official script to install Symfony installer

* Use AUR package

* Move PHP and Composer install in function to avoid duplication.

* Add explicit usage for symfony-cli

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
2025-08-10 20:45:47 +02:00

96 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
if [[ -z "$1" ]]; then
echo "Usage: omarchy-instal-dev-env <ruby|node|bun|go|laravel|symfony|python|elixir|rust|java|ocaml|dotnet>" >&2
exit 1
fi
install_php() {
yay -Sy php composer --noconfirm
if [[ ":$PATH:" != *":$HOME/.config/composer/vendor/bin:"* ]]; then
echo 'export PATH="$HOME/.config/composer/vendor/bin:$PATH"' >> "$HOME/.bashrc"
source "$HOME/.bashrc"
echo "Added Composer global bin directory to PATH."
else
echo "Composer global bin directory already in PATH."
fi
}
case "$1" in
ruby)
echo -e "Installing Ruby on Rails...\n"
mise use --global ruby@latest
mise settings add idiomatic_version_file_enable_tools ruby
mise x ruby -- gem install rails --no-document
;;
node)
echo -e "Installing Node.js...\n"
mise use --global node@lts
;;
bun)
echo -e "Installing Bun...\n"
mise use -g bun@latest
;;
deno)
echo -e "Installing Deno...\n"
mise use -g deno@latest
;;
go)
echo -e "Installing Go...\n"
mise use --global go@latest
;;
laravel)
echo -e "Installing PHP and Laravel...\n"
install_php
composer global require laravel/installer
echo "PHP, Composer, and Laravel have been installed successfully."
echo "You can now run: laravel new myproject"
;;
symfony)
echo -e "Installing PHP and Symfony...\n"
install_php
yay -S symfony-cli --noconfirm
echo "PHP, Composer, and Symfony CLI have been installed successfully."
echo "If you are building a traditional web application:"
echo "symfony new --webapp my_project"
echo "If you are building a microservice, console application or API:"
echo "symfony new my_project"
;;
python)
echo -e "Installing Python...\n"
mise use --global python@latest
echo -e "\nInstalling uv...\n"
wget -qO- https://astral.sh/uv/install.sh | sh
;;
elixir)
echo -e "Installing Elixir...\n"
mise use --global erlang@latest
mise use --global elixir@latest
mise x elixir -- mix local.hex --force
;;
rust)
echo -e "Installing Rust...\n"
bash -c "$(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs)" -- -y
;;
java)
echo -e "Installing Java...\n"
mise use --global java@latest
;;
zig)
echo -e "Installing Zig...\n"
mise use --global zig@latest
;;
ocaml)
echo -e "Installing OCaml...\n"
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
opam init --yes
eval "$(opam env)"
opam install ocaml-lsp-server odoc ocamlformat utop --yes
;;
dotnet)
echo -e "Installing .NET...\n"
mise use --global dotnet@latest
;;
esac