summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-11-04 03:26:19 +0100
committerMel <einebeere@gmail.com>2024-11-04 03:26:19 +0100
commit9a52eff1c92d63ea7309a4b0768f572973b5a6e6 (patch)
treefe565a90381c7716ba093b4ba11b432f8b0494eb /modules
parent2fc26761a1e93e6212845ebd005eab71da704d6e (diff)
downloadnetwork-9a52eff1c92d63ea7309a4b0768f572973b5a6e6.tar.zst
network-9a52eff1c92d63ea7309a4b0768f572973b5a6e6.zip
Add basic renard server config
Signed-off-by: Mel <einebeere@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r--modules/common.nix21
-rw-r--r--modules/www.nix31
2 files changed, 50 insertions, 2 deletions
diff --git a/modules/common.nix b/modules/common.nix
index f035db5..2f2b141 100644
--- a/modules/common.nix
+++ b/modules/common.nix
@@ -1,4 +1,4 @@
-{ me, config, lib, pkgs, ... }:
+{ me, util, config, lib, pkgs, ... }:
 
 {
   imports = [
@@ -9,8 +9,25 @@
   ];
 
   boot.kernelPackages = pkgs.linuxPackages_latest;
+ 
+  
+  users.motd = ''
+
+/^  /^
+\ ' ' 7   < Hi, I'm ${util.titleCase me}
+/    \
+
+  '';
 
-  networking.hostName = me;
+  networking = {
+    hostName = me;
+  
+    firewall = {
+      enable = true;
+      allowedTCPPorts = [ 80 443 ];
+      trustedInterfaces = [ "tailscale0" ];
+    };
+  };
 
   services.envfs.enable = true;
   virtualisation.libvirtd.enable = true;
diff --git a/modules/www.nix b/modules/www.nix
new file mode 100644
index 0000000..1df69cf
--- /dev/null
+++ b/modules/www.nix
@@ -0,0 +1,31 @@
+{ me, ... }:
+
+let 
+  rnrdUrl =
+    if me == "renard"
+      then "rnrd.eu"
+      else "${me}.rnrd.eu";
+in
+{
+  security.acme = {
+    acceptTerms = true;
+    defaults.email = "einebeere@gmail.com";
+  };
+
+  services.nginx = {
+    enable = true;
+    recommendedGzipSettings = true;
+    recommendedOptimisation = true;
+    recommendedProxySettings = true;
+    recommendedTlsSettings = true;
+  
+    virtualHosts = {
+      default = { default = true; };
+      ${rnrdUrl} = {
+        root = "/var/www/html";
+        forceSSL = true;
+        enableACME = true;
+      };
+    };
+  };
+}