commit dbc71566a7720c2f09bdee41a3a8021e08c13745
parent d9daf82c791eaff25a08c7ab5ce1c0be32a98ce8
Author: mtmn <miro@haravara.org>
Date: Sat, 11 Apr 2026 01:36:43 +0200
fix: redlib broke
Diffstat:
2 files changed, 41 insertions(+), 11 deletions(-)
diff --git a/modules/services/redlib.nix b/modules/services/redlib.nix
@@ -1,9 +1,26 @@
{
config,
lib,
+ pkgs,
...
}: let
cfg = config.services.haravara.redlib;
+ redlib-package = pkgs.stdenv.mkDerivation rec {
+ pname = "redlib";
+ version = "0.36.0";
+ src = builtins.fetchurl {
+ url = "https://github.com/Silvenga/redlib/releases/download/v${version}/redlib-x86_64-unknown-linux-gnu.tar.gz";
+ sha256 = "dd652c806de2b604c105e6e8c1a960102b3387228b6afc04cc90f6ab7324d588";
+ };
+ unpackPhase = ''
+ tar -xzf $src
+ '';
+ installPhase = ''
+ mkdir -p $out/bin
+ cp redlib $out/bin/
+ chmod +x $out/bin/redlib
+ '';
+ };
in {
options.services.haravara.redlib = {
enable = lib.mkEnableOption "Redlib Reddit Frontend";
@@ -15,22 +32,36 @@ in {
default = null;
description = "The auth snippet to import";
};
+ port = lib.mkOption {
+ type = lib.types.port;
+ default = 7828;
+ description = "Port to bind to";
+ };
+ address = lib.mkOption {
+ type = lib.types.str;
+ default = "127.0.0.1";
+ description = "Address to bind to";
+ };
};
config = lib.mkIf cfg.enable {
- services.redlib = {
- enable = true;
- port = 7828;
- address = "127.0.0.1";
+ systemd.services.redlib = {
+ description = "Redlib Reddit Frontend";
+ after = ["network.target"];
+ wantedBy = ["multi-user.target"];
+ serviceConfig = {
+ ExecStart = "${redlib-package}/bin/redlib";
+ Restart = "always";
+ DynamicUser = true;
+ };
+ environment = {
+ REDLIB_PORT = toString cfg.port;
+ REDLIB_ADDRESS = cfg.address;
+ };
};
services.caddy.virtualHosts."${cfg.domain}".extraConfig = ''
- ${lib.optionalString (cfg.authLabel != null) "import ${
- if cfg.authLabel == "default"
- then "auth"
- else "auth_${cfg.authLabel}"
- }"}
- reverse_proxy 127.0.0.1:7828
+ reverse_proxy ${cfg.address}:${toString cfg.port}
'';
};
}
diff --git a/modules/services/storage-box.nix b/modules/services/storage-box.nix
@@ -102,7 +102,6 @@ in {
"seal"
"nofail"
"x-systemd.automount"
- "x-systemd.device-timeout=10"
"noauto"
];
};