summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--hosts/server1/configuration.nix1
-rw-r--r--modules/by-name/re/redlib/module.nix36
-rw-r--r--system/services/default.nix1
-rw-r--r--system/services/libreddit/default.nix26
4 files changed, 37 insertions, 27 deletions
diff --git a/hosts/server1/configuration.nix b/hosts/server1/configuration.nix
index 0bbead5..0bbb993 100644
--- a/hosts/server1/configuration.nix
+++ b/hosts/server1/configuration.nix
@@ -13,6 +13,7 @@
     nix-sync.enable = true;
     openssh.enable = true;
     peertube.enable = true;
+    redlib.enable = true;
   };
 
   boot.tmp.cleanOnBoot = true;
diff --git a/modules/by-name/re/redlib/module.nix b/modules/by-name/re/redlib/module.nix
new file mode 100644
index 0000000..393a8b9
--- /dev/null
+++ b/modules/by-name/re/redlib/module.nix
@@ -0,0 +1,36 @@
+{
+  config,
+  pkgsUnstable,
+  lib,
+  ...
+}: let
+  domain = "libreddit.vhack.eu";
+
+  cfg = config.vhack.redlib;
+in {
+  options.vhack.redlib = {
+    enable = lib.mkEnableOption ''
+      the redlib reddit frontend
+    '';
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.redlib = {
+      enable = true;
+      package = pkgsUnstable.redlib;
+      port = 8080;
+      address = "127.0.0.1";
+      openFirewall = false;
+    };
+
+    services.nginx = {
+      enable = true;
+      virtualHosts.${domain} = {
+        locations."/".proxyPass = "http://127.0.0.1:${toString config.services.redlib.port}";
+
+        enableACME = lib.mkDefault true;
+        forceSSL = lib.mkDefault true;
+      };
+    };
+  };
+}
diff --git a/system/services/default.nix b/system/services/default.nix
index 52ad177..b8b617e 100644
--- a/system/services/default.nix
+++ b/system/services/default.nix
@@ -3,7 +3,6 @@
     ./fail2ban
     ./invidious
     ./invidious-router
-    ./libreddit
     ./mail
     ./mastodon
     ./matrix
diff --git a/system/services/libreddit/default.nix b/system/services/libreddit/default.nix
deleted file mode 100644
index f7cc5f8..0000000
--- a/system/services/libreddit/default.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-  config,
-  pkgsUnstable,
-  lib,
-  ...
-}: let
-  domain = "libreddit.vhack.eu";
-in {
-  services.libreddit = {
-    enable = true;
-    package = pkgsUnstable.redlib;
-    port = 8080;
-    address = "127.0.0.1";
-    openFirewall = false;
-  };
-
-  services.nginx = {
-    enable = true;
-    virtualHosts.${domain} = {
-      locations."/".proxyPass = "http://127.0.0.1:${toString config.services.libreddit.port}";
-
-      enableACME = lib.mkDefault true;
-      forceSSL = lib.mkDefault true;
-    };
-  };
-}