commit e9c531858bc46b80786daf4bd8b13fe739fe9a69
parent 947dea140d0a51c73baaf12f263a39a7f06782b2
Author: mtmn <miro@haravara.org>
Date: Mon, 13 Apr 2026 04:12:29 +0200
chore: readd redlib
Diffstat:
3 files changed, 11 insertions(+), 41 deletions(-)
diff --git a/flake.nix b/flake.nix
@@ -176,6 +176,7 @@
"scorpus"
"napkins"
"listenbrainz-mpd"
+ "redlib"
]
importService
// {
diff --git a/hosts/nixaran/configuration.nix b/hosts/nixaran/configuration.nix
Binary files differ.
diff --git a/modules/services/redlib.nix b/modules/services/redlib.nix
@@ -1,26 +1,9 @@
{
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";
@@ -32,36 +15,22 @@ 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 {
- 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.redlib = {
+ enable = true;
+ port = 7828;
+ address = "127.0.0.1";
};
services.caddy.virtualHosts."${cfg.domain}".extraConfig = ''
- reverse_proxy ${cfg.address}:${toString cfg.port}
+ ${lib.optionalString (cfg.authLabel != null) "import ${
+ if cfg.authLabel == "default"
+ then "auth"
+ else "auth_${cfg.authLabel}"
+ }"}
+ reverse_proxy 127.0.0.1:7828
'';
};
}