diff --git a/home/dot_local/bin/post-installx/executable_post-nginx.sh b/home/dot_local/bin/post-installx/executable_post-nginx.sh index 38b62033..42d45fe3 100644 --- a/home/dot_local/bin/post-installx/executable_post-nginx.sh +++ b/home/dot_local/bin/post-installx/executable_post-nginx.sh @@ -13,12 +13,30 @@ if command -v nginx > /dev/null; then if [ -d Applications ] && [ -d /System ]; then + ### macOS logg info 'Skipping installation of NGINX Amplify because macOS is not supported' + NGINX_CONFIG_DIR=/usr/local/etc/nginx else + ### Linux + NGINX_CONFIG_DIR=/etc/nginx logg info 'Downloading the NGINX Amplify installer script' TMP="$(mktemp)" curl -sSL https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh > "$TMP" logg info 'Running the NGINX Amplify setup script' API_KEY="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NGINX_AMPLIFY_API_KEY")) }}{{- includeTemplate "secrets/NGINX_AMPLIFY_API_KEY" | decrypt | trim -}}{{ else }}{{- env "NGINX_AMPLIFY_API_KEY" -}}{{ end }}" sh "$TMP" fi + logg info "Ensuring $NGINX_CONFIG_DIR is present" && sudo mkdir -p "$NGINX_CONFIG_DIR" + logg info "Copying configuration files from $HOME/.local/etc/nginx to $NGINX_CONFIG_DIR" + sudo rsync -av "$HOME/.local/etc/nginx" "$NGINX_CONFIG_DIR" + if [ -d /Applications ] && [ -d /System ]; then + ### macOS + if [ -d "${HOMEBREW_PREFIX:-/opt/homebrew}/etc/nginx" ] && [ ! -L "${HOMEBREW_PREFIX:-/opt/homebrew}/etc/nginx" ]; then + logg info "Removing directory at ${HOMEBREW_PREFIX:-/opt/homebrew}/etc/nginx" + sudo rm -rf "{HOMEBREW_PREFIX:-/opt/homebrew}/etc/nginx" + logg info "Symlinking /usr/local/etc/nginx to ${HOMEBREW_PREFIX:-/opt/homebrew}/etc/nginx" + ln -s /usr/local/etc/nginx "${HOMEBREW_PREFIX:-/opt/homebrew}/etc/nginx" + else + logg info "Skipping symlinking of /usr/local/etc/nginx to ${HOMEBREW_PREFIX:-/opt/homebrew}/etc/nginx because directory symlink already appears to be there" + fi + fi fi diff --git a/software.yml b/software.yml index 68398d82..542d60ff 100644 --- a/software.yml +++ b/software.yml @@ -7259,6 +7259,8 @@ softwarePackages: _desc: It also generates sites-enabled proxies using YML configurations. Easter eggs included. [Nginx](https://www.nginx.com/), stylized as NGINX, nginx or NginX, is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004. Nginx is free and open-source software, released under the terms of the 2-clause BSD license. _docs: https://nginx.org/en/docs/ _github: https://github.com/nginx/nginx + _groups: + - www-data _home: https://nginx.org/ _name: NGINX _ports: @@ -7269,7 +7271,6 @@ softwarePackages: _service: nginx _serviceEnabled: true _short: "nginx is a popular open-source web server known for its high performance, stability, and scalability. " - _todo: Check out /opt/homebrew/etc/nginx/nginx.conf / nginx/servers ansible: professormanhattan.nginx apt: nginx brew: nginx