From 8853e0fafa877c6123f47434827bed69fe190c73 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 6 Nov 2024 01:13:50 +0100 Subject: [PATCH] Add a script for installing `nginx` --- lib/modules/software.nix | 4 +++- scripts/Arch/Software/nginx/main.fish | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 scripts/Arch/Software/nginx/main.fish diff --git a/lib/modules/software.nix b/lib/modules/software.nix index 7923de7a..2f94dc98 100644 --- a/lib/modules/software.nix +++ b/lib/modules/software.nix @@ -12,7 +12,7 @@ let optionalAttrs = lib.attrsets.optionalAttrs; cfg = config; - inherit (cfg.software) coding desktopExperience essential gaming socialMedia; + inherit (cfg.software) coding desktopExperience essential gaming server socialMedia; mkPrograms = programs: builtins.foldl' ( programs: name: programs // { @@ -118,6 +118,8 @@ "pyenv" ])) // (optionalAttrs gaming (mkPrograms [ "lutris" + ])) // (optionalAttrs server (mkPrograms [ + "nginx" ])); # Essentials diff --git a/scripts/Arch/Software/nginx/main.fish b/scripts/Arch/Software/nginx/main.fish new file mode 100755 index 00000000..0dba2248 --- /dev/null +++ b/scripts/Arch/Software/nginx/main.fish @@ -0,0 +1,23 @@ +#!/bin/env fish +begin + set -l dir (status dirname) + source "$dir/../../lib/software.fish" + inherit "$dir/../../../Common/Software/aliae/main.fish" + + function installSW + yayinst nginx + end + + function configureSW + set -l file "/etc/nginx/nginx.conf" + set -l config "include /etc/nginx/conf.d/*.conf;" + + if not grep --fixed-strings "$config" "$file" >/dev/null + sudo sed -i "$file" -e "/^http {/,/^}/{ /^}/{" -e "i\\" -e "" -e "i \ $config" -e "} }" + end + + sudo systemctl enable --now nginx + end + + runInstaller $argv +end