about summary refs log tree commit diff
path: root/users/wpcarro/nixos/modules
diff options
context:
space:
mode:
Diffstat (limited to 'users/wpcarro/nixos/modules')
-rw-r--r--users/wpcarro/nixos/modules/.skip-subtree1
-rw-r--r--users/wpcarro/nixos/modules/nginx.nix45
-rw-r--r--users/wpcarro/nixos/modules/www/billandhiscomputer.com.nix11
-rw-r--r--users/wpcarro/nixos/modules/www/wpcarro.dev.nix10
4 files changed, 67 insertions, 0 deletions
diff --git a/users/wpcarro/nixos/modules/.skip-subtree b/users/wpcarro/nixos/modules/.skip-subtree
new file mode 100644
index 000000000000..09520f8c831f
--- /dev/null
+++ b/users/wpcarro/nixos/modules/.skip-subtree
@@ -0,0 +1 @@
+NixOS modules are not readTree compatible.
diff --git a/users/wpcarro/nixos/modules/nginx.nix b/users/wpcarro/nixos/modules/nginx.nix
new file mode 100644
index 000000000000..e6cc6b0febab
--- /dev/null
+++ b/users/wpcarro/nixos/modules/nginx.nix
@@ -0,0 +1,45 @@
+# Common configuration for Nginx.
+{ pkgs, ... }:
+
+{
+  config = {
+    security.acme = {
+      acceptTerms = true;
+      defaults.email = "wpcarro@gmail.com";
+    };
+
+    services.nginx = {
+      enable = true;
+      enableReload = true;
+
+      recommendedTlsSettings = true;
+      recommendedGzipSettings = true;
+
+      # Log errors to journald (i.e. /dev/log) with debug verbosity.
+      logError = "syslog:server=unix:/dev/log debug";
+
+      # for journaldriver
+      commonHttpConfig = ''
+        log_format json_combined escape=json
+        '{'
+            '"remote_addr":"$remote_addr",'
+            '"method":"$request_method",'
+            '"host":"$host",'
+            '"uri":"$request_uri",'
+            '"status":$status,'
+            '"request_size":$request_length,'
+            '"response_size":$body_bytes_sent,'
+            '"response_time":$request_time,'
+            '"referrer":"$http_referer",'
+            '"user_agent":"$http_user_agent"'
+        '}';
+
+        access_log syslog:server=unix:/dev/log,nohostname json_combined;
+      '';
+
+      appendHttpConfig = ''
+        add_header Permissions-Policy "interest-cohort=()";
+      '';
+    };
+  };
+}
diff --git a/users/wpcarro/nixos/modules/www/billandhiscomputer.com.nix b/users/wpcarro/nixos/modules/www/billandhiscomputer.com.nix
new file mode 100644
index 000000000000..ec4e5d7302fc
--- /dev/null
+++ b/users/wpcarro/nixos/modules/www/billandhiscomputer.com.nix
@@ -0,0 +1,11 @@
+{ pkgs, depot, ... }:
+
+{
+  config = {
+    services.nginx.virtualHosts."billandhiscomputer.com" = {
+      enableACME = true;
+      forceSSL = true;
+      root = depot.users.wpcarro.website.root;
+    };
+  };
+}
diff --git a/users/wpcarro/nixos/modules/www/wpcarro.dev.nix b/users/wpcarro/nixos/modules/www/wpcarro.dev.nix
new file mode 100644
index 000000000000..7c4af627edfd
--- /dev/null
+++ b/users/wpcarro/nixos/modules/www/wpcarro.dev.nix
@@ -0,0 +1,10 @@
+{ pkgs, ... }:
+
+{
+  config = {
+    services.nginx.virtualHosts."wpcarro.dev" = {
+      enableACME = true;
+      forceSSL = true;
+    };
+  };
+}